Changeset be3fe382c6d17eaa157d9bafd5de6731ed509721

Show
Ignore:
Timestamp:
09/18/05 16:42:02 (3 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1127054522 +0000
git-parent:

[d4b1caf1cc02ad3e5c16a88eb0adf74a142dc349]

git-author:
Gildas Bazin <gbazin@videolan.org> 1127054522 +0000
Message:

* modules/demux/real.c: cleanup + added support for cook.

Files:

Legend:

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

    rd367c2f rbe3fe38  
    8282 
    8383static int HeaderRead( demux_t *p_demux ); 
     84static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num ); 
    8485 
    8586/***************************************************************************** 
     
    197198    } 
    198199 
    199     if( stream_Read( p_demux->s, header, 12 ) < 12 ) 
    200     { 
    201         return 0; 
    202     } 
     200    if( stream_Read( p_demux->s, header, 12 ) < 12 ) return 0; 
     201 
    203202    i_size = GetWBE( &header[2] ) - 12; 
    204203    i_id   = GetWBE( &header[4] ); 
     
    228227    if( tk->fmt.i_cat == VIDEO_ES && b_selected ) 
    229228    { 
    230         uint8_t     *p = p_sys->buffer; 
     229        uint8_t *p = p_sys->buffer; 
    231230 
    232231        while( p < &p_sys->buffer[i_size - 2] ) 
     
    276275                i_seqnum = *p++; 
    277276            } 
     277 
    278278            i_copy = i_len - i_offset; 
    279279            if( i_copy > &p_sys->buffer[i_size] - p ) 
     
    294294                i_copy = i_offset; 
    295295                i_offset = i_len - i_copy; 
    296                 msg_Dbg( p_demux, "last fixing copy=%d offset=%d", i_copy, i_offset ); 
     296                msg_Dbg( p_demux, "last fixing copy=%d offset=%d", 
     297                         i_copy, i_offset ); 
    297298            } 
    298299 
     
    307308                    p_sys->i_pcr = tk->p_frame->i_dts; 
    308309 
    309                     es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_pcr ); 
     310                    es_out_Control( p_demux->out, ES_OUT_SET_PCR, 
     311                                    (int64_t)p_sys->i_pcr ); 
    310312                } 
    311313                es_out_Send( p_demux->out, tk->p_es, tk->p_frame ); 
     
    315317            } 
    316318 
    317             if( (h&0xc0) != 0x80 && (h&0xc0) != 0x00 && tk->p_frame == NULL
     319            if( (h&0xc0) != 0x80 && (h&0xc0) != 0x00 && !tk->p_frame
    318320            { 
    319321                /* no fragment */ 
     
    327329                msg_Dbg( p_demux, "new frame size=%d", i_len ); 
    328330                tk->i_frame = i_len; 
    329                 if( ( tk->p_frame = block_New( p_demux, i_len + 8 + 1000) ) == NULL
     331                if( !( tk->p_frame = block_New( p_demux, i_len + 8 + 1000) )
    330332                { 
    331333                    return -1; 
     
    343345                int i_ck = ((uint32_t*)tk->p_frame->p_buffer)[1]++; 
    344346 
    345                 msg_Dbg( p_demux, "copying new buffer n=%d offset=%d copy=%d", i_ck, i_offset, i_copy ); 
     347                msg_Dbg( p_demux, "copying new buffer n=%d offset=%d copy=%d", 
     348                         i_ck, i_offset, i_copy ); 
    346349 
    347350                ((uint32_t*)(tk->p_frame->p_buffer+i_len+8))[i_ck] = i_offset; 
    348351 
    349                 memcpy( &tk->p_frame->p_buffer[i_offset + 8], 
    350                         p, i_copy ); 
     352                memcpy( &tk->p_frame->p_buffer[i_offset + 8], p, i_copy ); 
    351353            } 
    352354 
     
    357359                break; 
    358360            } 
     361 
    359362#if 0 
    360363            if( tk->p_frame ) 
     
    376379                    { 
    377380                        p_sys->i_pcr = tk->p_frame->i_dts; 
    378                         es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_pcr ); 
     381                        es_out_Control( p_demux->out, ES_OUT_SET_PCR, 
     382                                        (int64_t)p_sys->i_pcr ); 
    379383                    } 
    380384                    es_out_Send( p_demux->out, tk->p_es, tk->p_frame ); 
     
    396400 
    397401                /* not fragmented */ 
    398                 if( ( p_frame = block_New( p_demux, i_copy + 8 + 8 ) ) == NULL
     402                if( !( p_frame = block_New( p_demux, i_copy + 8 + 8 ) )
    399403                { 
    400404                    return -1; 
     
    413417                { 
    414418                    p_sys->i_pcr = p_frame->i_dts; 
    415                     es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_pcr ); 
     419                    es_out_Control( p_demux->out, ES_OUT_SET_PCR, 
     420                                    (int64_t)p_sys->i_pcr ); 
    416421                } 
    417422                es_out_Send( p_demux->out, tk->p_es, p_frame ); 
     
    421426                /* First fragment */ 
    422427                tk->i_frame = i_len; 
    423                 if( ( tk->p_frame = block_New( p_demux, i_len + 8 + 1000) ) == NULL
     428                if( !( tk->p_frame = block_New( p_demux, i_len + 8 + 1000) )
    424429                { 
    425430                    return -1; 
     
    445450        { 
    446451            p_sys->i_pcr = i_pts; 
    447             es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_pcr ); 
     452            es_out_Control( p_demux->out, ES_OUT_SET_PCR, 
     453                            (int64_t)p_sys->i_pcr ); 
    448454        } 
    449455 
     
    591597                 (char*)&i_id, i_size, i_version ); 
    592598 
    593         if( i_size < 10 ) 
    594         { 
    595             return VLC_EGENERIC; 
    596         } 
     599        if( i_size < 10 ) return VLC_EGENERIC; 
    597600        i_skip = i_size - 10; 
    598601 
    599602        if( i_id == VLC_FOURCC('.','R','M','F') ) 
    600603        { 
    601             if( stream_Read( p_demux->s, header, 8 ) < 8 ) 
    602             { 
    603                 return VLC_EGENERIC; 
    604             } 
     604            if( stream_Read( p_demux->s, header, 8 ) < 8 ) return VLC_EGENERIC; 
    605605            msg_Dbg( p_demux, "    - file version=0x%x num headers=%d", 
    606606                     GetDWBE( &header[0] ), GetDWBE( &header[4] ) ); 
     
    612612            int i_flags; 
    613613 
    614             if( stream_Read( p_demux->s, header, 40 ) < 40 ) 
    615             { 
    616                 return VLC_EGENERIC; 
    617             } 
     614            if( stream_Read(p_demux->s, header, 40) < 40 ) return VLC_EGENERIC; 
     615 
    618616            msg_Dbg( p_demux, "    - max bitrate=%d avg bitrate=%d", 
    619                      GetDWBE( &header[0] ), GetDWBE( &header[4] ) ); 
     617                     GetDWBE(&header[0]), GetDWBE(&header[4]) ); 
    620618            msg_Dbg( p_demux, "    - max packet size=%d avg bitrate=%d", 
    621                      GetDWBE( &header[8] ), GetDWBE( &header[12] ) ); 
    622             msg_Dbg( p_demux, "    - packets count=%d", GetDWBE( &header[16] ) ); 
    623             msg_Dbg( p_demux, "    - duration=%d ms", GetDWBE( &header[20] ) ); 
    624             msg_Dbg( p_demux, "    - preroll=%d ms", GetDWBE( &header[24] ) ); 
    625             msg_Dbg( p_demux, "    - index offset=%d", GetDWBE( &header[28] ) ); 
    626             msg_Dbg( p_demux, "    - data offset=%d", GetDWBE( &header[32] ) ); 
    627             msg_Dbg( p_demux, "    - num streams=%d", GetWBE( &header[36] ) ); 
    628             i_flags = GetWBE( &header[38]); 
     619                     GetDWBE(&header[8]), GetDWBE(&header[12]) ); 
     620            msg_Dbg( p_demux, "    - packets count=%d", GetDWBE(&header[16]) ); 
     621            msg_Dbg( p_demux, "    - duration=%d ms", GetDWBE(&header[20]) ); 
     622            msg_Dbg( p_demux, "    - preroll=%d ms", GetDWBE(&header[24]) ); 
     623            msg_Dbg( p_demux, "    - index offset=%d", GetDWBE(&header[28]) ); 
     624            msg_Dbg( p_demux, "    - data offset=%d", GetDWBE(&header[32]) ); 
     625            msg_Dbg( p_demux, "    - num streams=%d", GetWBE(&header[36]) ); 
     626            i_flags = GetWBE(&header[38]); 
    629627            msg_Dbg( p_demux, "    - flags=0x%x %s%s%s", 
    630628                     i_flags, 
     
    693691        else if( i_id == VLC_FOURCC('M','D','P','R') ) 
    694692        { 
     693            /* Media properties header */ 
    695694            int  i_num; 
    696695            int  i_len; 
    697696            char *psz; 
    698697 
    699             if( stream_Read( p_demux->s, header, 30 ) < 30 ) 
    700             { 
    701                 return VLC_EGENERIC; 
    702             } 
     698            if( stream_Read(p_demux->s, header, 30) < 30 ) return VLC_EGENERIC; 
    703699            i_num = GetWBE( header ); 
    704700            msg_Dbg( p_demux, "    - id=0x%x", i_num ); 
    705             msg_Dbg( p_demux, "    - max bitrate=%d avg bitrate=%d", GetDWBE( &header[2] ), GetDWBE( &header[6] ) ); 
    706             msg_Dbg( p_demux, "    - max packet size=%d avg packet size=%d", GetDWBE( &header[10] ), GetDWBE( &header[14] )); 
    707             msg_Dbg( p_demux, "    - start time=%d", GetDWBE( &header[18] ) ); 
    708             msg_Dbg( p_demux, "    - preroll=%d", GetDWBE( &header[22] ) ); 
    709             msg_Dbg( p_demux, "    - duration=%d", GetDWBE( &header[26] )); 
     701            msg_Dbg( p_demux, "    - max bitrate=%d avg bitrate=%d", 
     702                     GetDWBE(&header[2]), GetDWBE(&header[6]) ); 
     703            msg_Dbg( p_demux, "    - max packet size=%d avg packet size=%d", 
     704                     GetDWBE(&header[10]), GetDWBE(&header[14]) ); 
     705            msg_Dbg( p_demux, "    - start time=%d", GetDWBE(&header[18]) ); 
     706            msg_Dbg( p_demux, "    - preroll=%d", GetDWBE(&header[22]) ); 
     707            msg_Dbg( p_demux, "    - duration=%d", GetDWBE(&header[26]) ); 
    710708            i_skip -= 30; 
    711  
    712709 
    713710            stream_Read( p_demux->s, header, 1 ); 
     
    740737            if( ( i_len = GetDWBE( header ) ) > 0 ) 
    741738            { 
    742                 es_format_t  fmt; 
    743                 real_track_t *tk; 
    744                 uint8_t *p_peek; 
    745  
    746                 msg_Dbg( p_demux, "    - specific data len=%d", i_len ); 
    747                 if( stream_Peek( p_demux->s, &p_peek, 34 ) >= 34 ) 
    748                 { 
    749                     if( !strncmp( (char *)&p_peek[4], "VIDO", 4 ) ) 
    750                     { 
    751                         es_format_Init( &fmt, VIDEO_ES, 
    752                                         VLC_FOURCC( p_peek[8], p_peek[9], p_peek[10], p_peek[11] ) ); 
    753                         fmt.video.i_width = GetWBE( &p_peek[12] ); 
    754                         fmt.video.i_height= GetWBE( &p_peek[14] ); 
    755  
    756                         fmt.i_extra = 8; 
    757                         fmt.p_extra = malloc( 8 ); 
    758                         ((uint32_t*)fmt.p_extra)[0] = GetDWBE( &p_peek[26] ); 
    759                         ((uint32_t*)fmt.p_extra)[1] = GetDWBE( &p_peek[30] ); 
    760  
    761                         msg_Dbg( p_demux, "    - video 0x%08x 0x%08x", 
    762                                  ((uint32_t*)fmt.p_extra)[0], 
    763                                  ((uint32_t*)fmt.p_extra)[1] ); 
    764  
    765                         if( GetDWBE( &p_peek[30] ) == 0x10003000 || 
    766                             GetDWBE( &p_peek[30] ) == 0x10003001 ) 
    767                         { 
    768                             fmt.i_codec = VLC_FOURCC( 'R','V','1','3' ); 
    769                         } 
    770  
    771                         msg_Dbg( p_demux, "    - video %4.4s %dx%d", 
    772                                  (char*)&fmt.i_codec, 
    773                                  fmt.video.i_width, fmt.video.i_height ); 
    774  
    775                         tk = malloc( sizeof( real_track_t ) ); 
    776                         tk->i_id = i_num; 
    777                         tk->fmt = fmt; 
    778                         tk->i_frame = 0; 
    779                         tk->p_frame = NULL; 
    780                         tk->p_es = es_out_Add( p_demux->out, &fmt ); 
    781  
    782                         TAB_APPEND( p_sys->i_track, p_sys->track, tk ); 
    783                     } 
    784                     else if( !strncmp( (char *)p_peek, ".ra\xfd", 4 ) ) 
    785                     { 
    786                         int     i_version = GetWBE( &p_peek[4] ); 
    787                         uint8_t *p_extra = NULL; 
    788                         msg_Dbg( p_demux, "    - audio version=%d", i_version ); 
    789  
    790                         es_format_Init( &fmt, AUDIO_ES, 0 ); 
    791                         if( i_version == 4 && stream_Peek( p_demux->s, &p_peek, 56 ) >= 56 ) 
    792                         { 
    793                             fmt.audio.i_channels = GetWBE( &p_peek[54] ); 
    794                             fmt.audio.i_rate = GetWBE( &p_peek[48] ); 
    795  
    796                             if( stream_Peek( p_demux->s, &p_peek, 57 ) >= 57 ) 
    797                             { 
    798                                 int i_extra = p_peek[56] + 1 + 4; 
    799                                 if( stream_Peek( p_demux->s, &p_peek, 57 + i_extra ) >= 57 + i_extra ) 
    800                                 { 
    801                                     memcpy( &fmt.i_codec, &p_peek[57 + p_peek[56] + 1], 4 ); 
    802                                 } 
    803                                 p_extra = &p_peek[57 + p_peek[56] + 1+ 4 + 3]; 
    804                             } 
    805                         } 
    806                         else if( i_version == 5 && stream_Peek( p_demux->s, &p_peek, 70 ) >= 70 ) 
    807                         { 
    808                             memcpy( &fmt.i_codec, &p_peek[66], 4 ); 
    809                             fmt.audio.i_channels = GetWBE( &p_peek[60] ); 
    810                             fmt.audio.i_rate = GetWBE( &p_peek[54] ); 
    811  
    812                             p_extra = &p_peek[66+4+3+1]; 
    813                         } 
    814                         msg_Dbg( p_demux, "    - audio codec=%4.4s channels=%d rate=%dHz", 
    815                                 (char*)&fmt.i_codec, 
    816                                 fmt.audio.i_channels, fmt.audio.i_rate ); 
    817  
    818                         if( fmt.i_codec == VLC_FOURCC( 'd', 'n', 'e', 't' ) ) 
    819                         { 
    820                             fmt.i_codec = VLC_FOURCC( 'a', '5', '2', ' ' ); 
    821                         } 
    822                         else if( fmt.i_codec == VLC_FOURCC( 'r', 'a', 'a', 'c' ) || 
    823                                  fmt.i_codec == VLC_FOURCC( 'r', 'a', 'c', 'p' ) ) 
    824                         { 
    825                             int i_peek = p_extra - p_peek; 
    826                             if( stream_Peek( p_demux->s, &p_peek, i_peek + 4 ) >= i_peek + 4 ) 
    827                             { 
    828                                 int i_extra = GetDWBE( &p_peek[i_peek] ); 
    829  
    830                                 if( i_extra > 1 && i_peek + 4 + i_extra <= i_len && 
    831                                     stream_Peek( p_demux->s, &p_peek, i_peek + 4 + i_extra ) >= i_peek + 4 + i_extra ) 
    832                                 { 
    833                                     fmt.i_extra = i_extra - 1; 
    834                                     fmt.p_extra = malloc ( i_extra - 1 ); 
    835                                     memcpy( fmt.p_extra, &p_peek[i_peek+4+1], i_extra - 1 ); 
    836  
    837                                     msg_Dbg( p_demux, "        - extra data=%d", i_extra ); 
    838                                     { 
    839                                         int i; 
    840                                         for( i = 0; i < fmt.i_extra; i++ ) 
    841                                         { 
    842                                             msg_Dbg( p_demux, "          data[%d] = 0x%x", i,((uint8_t*)fmt.p_extra)[i] ); 
    843                                         } 
    844                                     } 
    845                                 } 
    846                             } 
    847                             fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' ); 
    848                         } 
    849  
    850                         if( fmt.i_codec != 0 ) 
    851                         { 
    852                             tk = malloc( sizeof( real_track_t ) ); 
    853                             tk->i_id = i_num; 
    854                             tk->fmt = fmt; 
    855                             tk->i_frame = 0; 
    856                             tk->p_frame = NULL; 
    857                             tk->p_es = es_out_Add( p_demux->out, &fmt ); 
    858  
    859                             TAB_APPEND( p_sys->i_track, p_sys->track, tk ); 
    860                         } 
    861                     } 
    862                 } 
     739                ReadCodecSpecificData( p_demux, i_len, i_num ); 
    863740                stream_Read( p_demux->s, NULL, i_len ); 
    864741 
     
    890767        } 
    891768 
    892         if( i_skip < 0 ) 
    893         { 
    894             return VLC_EGENERIC; 
    895         } 
     769        if( i_skip < 0 ) return VLC_EGENERIC; 
    896770        stream_Read( p_demux->s, NULL, i_skip ); 
    897771    } 
     
    902776} 
    903777 
    904  
     778static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num ) 
     779
     780    demux_sys_t *p_sys = p_demux->p_sys; 
     781    es_format_t fmt; 
     782    real_track_t *tk; 
     783    uint8_t *p_peek; 
     784 
     785    msg_Dbg( p_demux, "    - specific data len=%d", i_len ); 
     786    if( stream_Peek(p_demux->s, &p_peek, i_len) < i_len ) return VLC_EGENERIC; 
     787 
     788    if( !strncmp( (char *)&p_peek[4], "VIDO", 4 ) ) 
     789    { 
     790        es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( p_peek[8], p_peek[9], 
     791                        p_peek[10], p_peek[11] ) ); 
     792        fmt.video.i_width = GetWBE( &p_peek[12] ); 
     793        fmt.video.i_height= GetWBE( &p_peek[14] ); 
     794 
     795        fmt.i_extra = 8; 
     796        fmt.p_extra = malloc( 8 ); 
     797        ((uint32_t*)fmt.p_extra)[0] = GetDWBE( &p_peek[26] ); 
     798        ((uint32_t*)fmt.p_extra)[1] = GetDWBE( &p_peek[30] ); 
     799 
     800        msg_Dbg( p_demux, "    - video 0x%08x 0x%08x", 
     801                 ((uint32_t*)fmt.p_extra)[0], ((uint32_t*)fmt.p_extra)[1] ); 
     802 
     803        if( GetDWBE( &p_peek[30] ) == 0x10003000 || 
     804            GetDWBE( &p_peek[30] ) == 0x10003001 ) 
     805        { 
     806            fmt.i_codec = VLC_FOURCC( 'R','V','1','3' ); 
     807        } 
     808 
     809        msg_Dbg( p_demux, "    - video %4.4s %dx%d", 
     810                 (char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height ); 
     811 
     812        tk = malloc( sizeof( real_track_t ) ); 
     813        tk->i_id = i_num; 
     814        tk->fmt = fmt; 
     815        tk->i_frame = 0; 
     816        tk->p_frame = NULL; 
     817        tk->p_es = es_out_Add( p_demux->out, &fmt ); 
     818 
     819        TAB_APPEND( p_sys->i_track, p_sys->track, tk ); 
     820    } 
     821    else if( !strncmp( (char *)p_peek, ".ra\xfd", 4 ) ) 
     822    { 
     823        int i_version = GetWBE( &p_peek[4] ); 
     824        int i_header_size, i_flavor, i_coded_frame_size, i_subpacket_h; 
     825        int i_frame_size, i_subpacket_size; 
     826 
     827        msg_Dbg( p_demux, "    - audio version=%d", i_version ); 
     828 
     829        p_peek += 6; 
     830        es_format_Init( &fmt, AUDIO_ES, 0 ); 
     831 
     832        if( i_version == 3 ) 
     833        { 
     834            msg_Dbg( p_demux, "    - audio version 3 is not supported!" ); 
     835            return VLC_EGENERIC; 
     836        } 
     837 
     838        p_peek += 2; /* 00 00 */ 
     839        p_peek += 4; /* .ra4 or .ra5 */ 
     840        p_peek += 4; /* ?? */ 
     841        p_peek += 2; /* version (4 or 5) */ 
     842        i_header_size = GetDWBE( p_peek ); p_peek += 4; /* header size */ 
     843        i_flavor = GetWBE( p_peek ); p_peek += 2; /* codec flavor */ 
     844        i_coded_frame_size = GetDWBE( p_peek ); p_peek += 4; 
     845        p_peek += 4; /* ?? */ 
     846        p_peek += 4; /* ?? */ 
     847        p_peek += 4; /* ?? */ 
     848        i_subpacket_h = GetWBE( p_peek ); p_peek += 2; 
     849        i_frame_size = GetWBE( p_peek ); p_peek += 2; 
     850        i_subpacket_size = GetWBE( p_peek ); p_peek += 2; 
     851        p_peek += 2; /* ?? */ 
     852 
     853        if( i_version == 5 ) p_peek += 6; /* 0, srate, 0 */ 
     854 
     855        fmt.audio.i_rate = GetWBE( p_peek ); p_peek += 2; 
     856        p_peek += 2; /* ?? */ 
     857        fmt.audio.i_bitspersample = GetWBE( p_peek ); p_peek += 2; 
     858        fmt.audio.i_channels = GetWBE( p_peek ); p_peek += 2; 
     859        fmt.audio.i_blockalign = i_frame_size; 
     860 
     861        if( i_version == 5 ) 
     862        { 
     863            p_peek += 4; /* genr */ 
     864            memcpy( (char *)&fmt.i_codec, p_peek, 4 ); p_peek += 4; 
     865        } 
     866        else 
     867        { 
     868            p_peek += p_peek[0] + 1; /* descr 1 */ 
     869            memcpy( (char *)&fmt.i_codec, p_peek + 1, 4 ); /* descr 2 */ 
     870            p_peek += p_peek[0] + 1; 
     871        } 
     872 
     873        msg_Dbg( p_demux, "    - audio codec=%4.4s channels=%d rate=%dHz", 
     874                 (char*)&fmt.i_codec, fmt.audio.i_channels, fmt.audio.i_rate ); 
     875 
     876        p_peek += 3; /* ?? */ 
     877        if( i_version == 5 ) p_peek++; 
     878 
     879        switch( fmt.i_codec ) 
     880        { 
     881        case VLC_FOURCC( 'd', 'n', 'e', 't' ): 
     882            fmt.i_codec = VLC_FOURCC( 'a', '5', '2', ' ' ); 
     883            break; 
     884 
     885        case VLC_FOURCC( 'r', 'a', 'a', 'c' ): 
     886        case VLC_FOURCC( 'r', 'a', 'c', 'p' ): 
     887            fmt.i_extra = GetDWBE( p_peek ); p_peek += 4; 
     888            if( fmt.i_extra > 0 ) { fmt.i_extra--; p_peek++; } 
     889            if( fmt.i_extra > 0 ) 
     890            { 
     891                fmt.p_extra = malloc( fmt.i_extra ); 
     892                memcpy( fmt.p_extra, p_peek, fmt.i_extra ); 
     893            } 
     894 
     895            fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' ); 
     896            break; 
     897 
     898        case VLC_FOURCC('c','o','o','k'): 
     899            fmt.i_extra = GetDWBE( p_peek ); p_peek += 4; 
     900            fmt.p_extra = malloc( fmt.i_extra + 10 ); 
     901 
     902            ((short*)(fmt.p_extra))[0] = i_subpacket_size; 
     903            ((short*)(fmt.p_extra))[1] = i_subpacket_h; 
     904            ((short*)(fmt.p_extra))[2] = i_flavor; 
     905            ((short*)(fmt.p_extra))[3] = i_coded_frame_size; 
     906            ((short*)(fmt.p_extra))[4] = fmt.i_extra; 
     907            if( fmt.i_extra ) memcpy( fmt.p_extra + 10, p_peek, fmt.i_extra ); 
     908            fmt.i_extra += 10; 
     909            break; 
     910 
     911        default: 
     912            msg_Dbg( p_demux, "    - unknown audio codec=%4.4s", 
     913                     (char*)&fmt.i_codec ); 
     914            break; 
     915        } 
     916 
     917        if( fmt.i_codec != 0 ) 
     918        { 
     919            msg_Dbg( p_demux, "        - extra data=%d", fmt.i_extra ); 
     920            { 
     921                int i; 
     922                for( i = 0; i < fmt.i_extra; i++ ) 
     923                { 
     924                    msg_Dbg( p_demux, "          data[%d] = 0x%x", i, 
     925                             ((uint8_t*)fmt.p_extra)[i] ); 
     926                } 
     927            } 
     928 
     929            tk = malloc( sizeof( real_track_t ) ); 
     930            tk->i_id = i_num; 
     931            tk->fmt = fmt; 
     932            tk->i_frame = 0; 
     933            tk->p_frame = NULL; 
     934            tk->p_es = es_out_Add( p_demux->out, &fmt ); 
     935 
     936            TAB_APPEND( p_sys->i_track, p_sys->track, tk ); 
     937        } 
     938    } 
     939 
     940    return VLC_SUCCESS; 
     941