Changeset a9b240f58fa7bfb740de786bef8ae1e82a785b1b

Show
Ignore:
Timestamp:
17/11/07 09:13:58 (1 year ago)
Author:
Jean-Baptiste Kempf <jb@videolan.org>
git-committer:
Jean-Baptiste Kempf <jb@videolan.org> 1195287238 +0000
git-parent:

[be8e0b448eab950e839994c5e2871e07e4ce1a44]

git-author:
Jean-Baptiste Kempf <jb@videolan.org> 1195287238 +0000
Message:

Real Demuxer: Support for RM version 3. Tested and works \o/

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/real.c

    rd5a0120 ra9b240f  
    989989    else if( !strncmp( (char *)p_peek, ".ra\xfd", 4 ) ) 
    990990    { 
    991         int i_version = GetWBE( &p_peek[4] ); 
    992991        int i_header_size, i_flavor, i_coded_frame_size, i_subpacket_h; 
    993992        int i_frame_size, i_subpacket_size; 
    994  
     993        int i_version = GetWBE( &p_peek[4] );   /* [0..3] = '.','r','a',0xfd */ 
    995994        msg_Dbg( p_demux, "    - audio version=%d", i_version ); 
    996995 
    997         p_peek += 6; 
     996        p_peek += 6;                                          /* 4 + version */ 
    998997        es_format_Init( &fmt, AUDIO_ES, 0 ); 
    999998 
    1000999        if( i_version == 3 ) 
    10011000        { 
    1002             msg_Dbg( p_demux, "    - audio version 3 is not supported!" ); 
    1003             return VLC_EGENERIC; 
    1004         } 
     1001            int i_len; 
     1002            char *psz; 
     1003 
     1004            i_header_size = GetWBE( p_peek ); p_peek += 2;  /* Size from now */ 
     1005            p_peek += 10;                                         /* Unknown */ 
     1006 
     1007            p_peek += 4;                                        /* Data Size */ 
     1008 
     1009            /* Title */ 
     1010            i_len = *p_peek ; p_peek++; 
     1011            if( i_len > 0 ) 
     1012            { 
     1013                psz = malloc( i_len + 1 ); 
     1014                memcpy( psz, p_peek, i_len ); 
     1015                psz[i_len] = '\0'; 
     1016 
     1017                msg_Dbg( p_demux, "    - title=`%s'", psz ); 
     1018                EnsureUTF8( psz ); 
     1019                asprintf( &p_sys->psz_title, psz ); 
     1020                free( psz ); 
     1021            } 
     1022            p_peek += i_len; 
     1023 
     1024            /* Authors */ 
     1025            i_len = *p_peek ; p_peek++; 
     1026            if( i_len > 0 ) 
     1027            { 
     1028                psz = malloc( i_len + 1 ); 
     1029                memcpy( psz, p_peek, i_len ); 
     1030                psz[i_len] = '\0'; 
     1031 
     1032                msg_Dbg( p_demux, "    - artist=`%s'", psz ); 
     1033                EnsureUTF8( psz ); 
     1034                asprintf( &p_sys->psz_artist, psz ); 
     1035                free( psz ); 
     1036            } 
     1037            p_peek += i_len; 
     1038 
     1039            /* Copyright */ 
     1040            i_len = *p_peek ; p_peek++; 
     1041            if( i_len > 0 ) 
     1042            { 
     1043                psz = malloc( i_len + 1 ); 
     1044                memcpy( psz, p_peek, i_len ); 
     1045                psz[i_len] = '\0'; 
     1046 
     1047                msg_Dbg( p_demux, "    - Copyright=`%s'", psz ); 
     1048                EnsureUTF8( psz ); 
     1049                asprintf( &p_sys->psz_copyright, psz ); 
     1050                free( psz ); 
     1051            } 
     1052            p_peek += i_len; 
     1053 
     1054            /* Comment */ 
     1055            i_len = *p_peek ; p_peek++; 
     1056            if( i_len > 0 ) 
     1057            { 
     1058                psz = malloc( i_len + 1 ); 
     1059                memcpy( psz, p_peek, i_len ); 
     1060                psz[i_len] = '\0'; 
     1061 
     1062                msg_Dbg( p_demux, "    - Comment=`%s'", psz ); 
     1063                EnsureUTF8( psz ); 
     1064                asprintf( &p_sys->psz_description, psz ); 
     1065                free( psz ); 
     1066            } 
     1067            /* This might be unusefull */ 
     1068            p_peek += i_len; 
     1069 
     1070            p_peek ++;                                           /* Unknown */ 
     1071            p_peek ++;                                 /* FourCC length = 4 */ 
     1072            memcpy( (char *)&fmt.i_codec, p_peek, 4 ); p_peek += 4; 
     1073            /* Up to here :) */ 
     1074 
     1075            fmt.audio.i_channels = 1;      /* This is always the case in rm3 */ 
     1076            fmt.audio.i_rate = 8000; 
     1077 
     1078            msg_Dbg( p_demux, "    - audio codec=%4.4s channels=%d rate=%dHz", 
     1079                 (char*)&fmt.i_codec, fmt.audio.i_channels, fmt.audio.i_rate ); 
     1080        } 
     1081        else 
     1082        { 
    10051083 
    10061084        p_peek += 2;                                                /* 00 00 */ 
     
    10441122        p_peek += 3; /* ?? */ 
    10451123        if( i_version == 5 ) p_peek++; 
     1124        } 
    10461125 
    10471126        switch( fmt.i_codec ) 
     
    10841163            break; 
    10851164 
     1165        case VLC_FOURCC('l','p','c','J'): 
     1166            fmt.i_codec = VLC_FOURCC( '1','4','_','4' ); 
     1167 
    10861168        default: 
    10871169            msg_Dbg( p_demux, "    - unknown audio codec=%4.4s",