Changeset 091aff73545a19bdb1c1706acecfc86e326e2734

Show
Ignore:
Timestamp:
08/09/03 00:48:29 (5 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1062974909 +0000
git-parent:

[fce2672fa627f847ba77f305b28f454a12f0daf2]

git-author:
Laurent Aimar <fenrir@videolan.org> 1062974909 +0000
Message:
  • all : demuxers *have to* set pf_demux_control. (demux_vaControlDefault
    is a generic handler)
  • avi, mp4 : begin to implement a specific pf_demux_control.
Files:

Legend:

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

    r4cd852f r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: a52sys.c,v 1.4 2003/08/01 00:04:28 fenrir Exp $ 
     5 * $Id: a52sys.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    2929#include <vlc/vlc.h> 
    3030#include <vlc/input.h> 
    31  
    32 #include <ninput.h> 
    3331 
    3432/***************************************************************************** 
     
    130128 
    131129    p_input->pf_demux = Demux; 
     130    p_input->pf_demux_control = demux_vaControlDefault; 
    132131 
    133132    p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); 
  • modules/demux/aac.c

    r75d4217 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: aac.c,v 1.2 2003/08/01 00:40:05 fenrir Exp $ 
     5 * $Id: aac.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    2929#include <vlc/vlc.h> 
    3030#include <vlc/input.h> 
    31  
    32 #include <ninput.h> 
    3331 
    3432/***************************************************************************** 
     
    137135 
    138136    p_input->pf_demux = Demux; 
     137    p_input->pf_demux_control = demux_vaControlDefault; 
    139138 
    140139    p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); 
  • modules/demux/asf/asf.c

    r349d96d r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002-2003 VideoLAN 
    5  * $Id: asf.c,v 1.36 2003/08/25 23:36:16 fenrir Exp $ 
     5 * $Id: asf.c,v 1.37 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    2929#include <vlc/vlc.h> 
    3030#include <vlc/input.h> 
    31 #include "ninput.h" 
    3231 
    3332#include "codecs.h"                        /* BITMAPINFOHEADER, WAVEFORMATEX */ 
     
    118117 
    119118    /* Set p_input field */ 
    120     p_input->pf_demux = Demux; 
     119    p_input->pf_demux         = Demux; 
     120    p_input->pf_demux_control = demux_vaControlDefault; 
    121121    p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); 
    122122    memset( p_sys, 0, sizeof( demux_sys_t ) ); 
  • modules/demux/asf/libasf.c

    r245a23e r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: libasf.c,v 1.17 2003/08/24 15:05:27 fenrir Exp $ 
     5 * $Id: libasf.c,v 1.18 2003/09/07 22:48:29 fenrir Exp $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    2525#include <vlc/vlc.h> 
    2626#include <vlc/input.h> 
    27 #include "ninput.h" 
    2827 
    2928#include "codecs.h"                        /* BITMAPINFOHEADER, WAVEFORMATEX */ 
  • modules/demux/au.c

    r76ae095 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001-2003 VideoLAN 
    5  * $Id: au.c,v 1.5 2003/08/22 20:32:27 fenrir Exp $ 
     5 * $Id: au.c,v 1.6 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    3131 
    3232#include <codecs.h> 
    33 #include <ninput.h> 
    3433 
    3534/***************************************************************************** 
     
    321320 
    322321        p_input->pf_demux = DemuxPCM; 
     322        p_input->pf_demux_control = demux_vaControlDefault; 
    323323    } 
    324324 
  • modules/demux/avi/avi.c

    r1eab54f r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: avi.c,v 1.59 2003/08/23 11:46:06 fenrir Exp $ 
     5 * $Id: avi.c,v 1.60 2003/09/07 22:48:29 fenrir Exp $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    2828#include <vlc/vlc.h> 
    2929#include <vlc/input.h> 
    30 #include "ninput.h" 
    3130#include "codecs.h" 
    3231 
     
    5958 * Local prototypes 
    6059 *****************************************************************************/ 
     60static int    Control         ( input_thread_t *, int, va_list ); 
    6161static int    Seek            ( input_thread_t *, mtime_t, int ); 
    6262static int    Demux_Seekable  ( input_thread_t * ); 
     
    160160    stream_Control( p_avi->s, STREAM_CAN_FASTSEEK, &p_avi->b_seekable ); 
    161161 
     162    p_input->pf_demux_control = Control; 
    162163    p_input->pf_demux = Demux_Seekable; 
    163164    /* For unseekable stream, automaticaly use Demux_UnSeekable */ 
     
    461462        msg_Warn( p_input, "broken or missing index, 'seek' will be axproximative or will have strange behavour" ); 
    462463    } 
    463  
    464464    /* fix some BeOS MediaKit generated file */ 
    465465    for( i = 0 ; i < p_avi->i_streams; i++ ) 
     
    657657        return( 0 ); 
    658658    } 
    659  
     659#if 0 
    660660    if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT ) 
    661661    { 
     
    679679        } 
    680680    } 
    681  
     681#endif 
    682682 
    683683    /* wait for the good time */ 
     
    11321132 * Returns -1 in case of error, 0 in case of EOF, 1 otherwise 
    11331133 *****************************************************************************/ 
    1134 static int    Seek   ( input_thread_t *p_input, 
    1135                           mtime_t i_date, int i_percent ) 
     1134static int Seek( input_thread_t *p_input, mtime_t i_date, int i_percent ) 
    11361135{ 
    11371136 
     
    11851184            } 
    11861185 
    1187             /* be sure that the index exit */ 
     1186            /* be sure that the index exist */ 
    11881187            if( AVI_StreamChunkSet( p_input, 
    11891188                                    i_stream, 
     
    12541253} 
    12551254 
     1255/***************************************************************************** 
     1256 * Control: 
     1257 ***************************************************************************** 
     1258 * 
     1259 *****************************************************************************/ 
     1260static int    Control( input_thread_t *p_input, int i_query, va_list args ) 
     1261{ 
     1262    demux_sys_t *p_sys = p_input->p_demux_data; 
     1263    double   f, *pf; 
     1264    int64_t i64, *pi64; 
     1265 
     1266    switch( i_query ) 
     1267    { 
     1268        case DEMUX_GET_POSITION: 
     1269            pf = (double*)va_arg( args, double * ); 
     1270            if( p_sys->i_length > 0 ) 
     1271            { 
     1272                *pf = (double)p_sys->i_time / (double)( p_sys->i_length * (mtime_t)1000000 ); 
     1273                return VLC_SUCCESS; 
     1274            } 
     1275            else if( stream_Size( p_sys->s ) > 0 ) 
     1276            { 
     1277                unsigned int i; 
     1278                int64_t i_tmp; 
     1279 
     1280                i64 = 0; 
     1281                /* search the more advanced selected es */ 
     1282                for( i = 0; i < p_sys->i_streams; i++ ) 
     1283                { 
     1284#define tk  p_sys->pp_info[i] 
     1285                    if( tk->b_activated && tk->i_idxposc < tk->i_idxnb ) 
     1286                    { 
     1287                        i_tmp = tk->p_index[tk->i_idxposc].i_pos + 
     1288                                tk->p_index[tk->i_idxposc].i_length + 8; 
     1289                        if( i_tmp > i64 ) 
     1290                        { 
     1291                            i64 = i_tmp; 
     1292                        } 
     1293                    } 
     1294#undef tk 
     1295                } 
     1296                *pf = (double)i64 / (double)stream_Size( p_sys->s ); 
     1297                return VLC_SUCCESS; 
     1298            } 
     1299            else 
     1300            { 
     1301                *pf = 0.0; 
     1302                return VLC_SUCCESS; 
     1303            } 
     1304        case DEMUX_SET_POSITION: 
     1305            if( p_sys->b_seekable ) 
     1306            { 
     1307                int i_ret; 
     1308 
     1309                f = (double)va_arg( args, double ); 
     1310                i64 = (mtime_t)(1000000.0 * p_sys->i_length * f ); 
     1311                i_ret = Seek( p_input, i64, (int)(f * 100) ); 
     1312                if( p_sys->p_sub ) 
     1313                { 
     1314                    subtitle_Seek( p_sys->p_sub, p_sys->i_time ); 
     1315                } 
     1316                return i_ret; 
     1317            } 
     1318            else 
     1319            { 
     1320                return demux_vaControlDefault( p_input, i_query, args ); 
     1321            } 
     1322        case DEMUX_GET_TIME: 
     1323            pi64 = (int64_t*)va_arg( args, int64_t * ); 
     1324            *pi64 = p_sys->i_time; 
     1325            return VLC_SUCCESS; 
     1326 
     1327        case DEMUX_SET_TIME: 
     1328            msg_Err( p_input, "FIXME DEMUX_SET_TIME to be implemented" ); 
     1329            return VLC_EGENERIC; 
     1330            /* return demux_vaControlDefault( p_input, i_query, args ); */ 
     1331 
     1332        case DEMUX_GET_LENGTH: 
     1333            pi64 = (int64_t*)va_arg( args, int64_t * ); 
     1334            *pi64 = p_sys->i_length * (mtime_t)1000000; 
     1335            return VLC_SUCCESS; 
     1336 
     1337        default: 
     1338            return demux_vaControlDefault( p_input, i_query, args ); 
     1339    } 
     1340    return VLC_EGENERIC; 
     1341} 
    12561342 
    12571343/***************************************************************************** 
  • modules/demux/avi/libavi.c

    r67f11e2 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: libavi.c,v 1.25 2003/08/30 02:03:44 fenrir Exp $ 
     5 * $Id: libavi.c,v 1.26 2003/09/07 22:48:29 fenrir Exp $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    2525#include <vlc/vlc.h> 
    2626#include <vlc/input.h> 
    27 #include "ninput.h" 
    2827#include "codecs.h"                                      /* BITMAPINFOHEADER */ 
    2928 
  • modules/demux/demuxdump.c

    rd5791c9 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: demuxdump.c,v 1.9 2003/05/15 22:27:37 massiot Exp $ 
     5 * $Id: demuxdump.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    8585    /* Set the demux function */ 
    8686    p_input->pf_demux = Demux; 
     87    p_input->pf_demux_control = demux_vaControlDefault; 
    8788 
    8889    /* Initialize access plug-in structures. */ 
  • modules/demux/flac.c

    r8692921 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: flac.c,v 1.4 2003/08/17 13:56:26 gbazin Exp $ 
     5 * $Id: flac.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> 
     
    7373 
    7474    p_input->pf_demux = Demux; 
     75    p_input->pf_demux_control = demux_vaControlDefault; 
    7576    p_input->pf_rewind = NULL; 
    7677 
  • modules/demux/mkv.cpp

    r503bdd9 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: mkv.cpp,v 1.25 2003/08/26 19:43:51 hartman Exp $ 
     5 * $Id: mkv.cpp,v 1.26 2003/09/07 22:48:29 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    3737#include <codecs.h>                        /* BITMAPINFOHEADER, WAVEFORMATEX */ 
    3838#include "iso_lang.h" 
    39 #include "ninput.h" 
    4039 
    4140#include <iostream> 
     
    301300    /* Set the demux function */ 
    302301    p_input->pf_demux = Demux; 
     302    p_input->pf_demux_control = demux_vaControlDefault; 
    303303 
    304304    /* peek the begining */ 
  • modules/demux/mp4/libmp4.c

    r186e68f r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: libmp4.c,v 1.31 2003/08/17 23:02:52 fenrir Exp $ 
     5 * $Id: libmp4.c,v 1.32 2003/09/07 22:48:29 fenrir Exp $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    520520 
    521521/***************************************************************************** 
    522  * MP4_MP4_NextBox : Go to the next box 
     522 * MP4_NextBox : Go to the next box 
    523523 ***************************************************************************** 
    524524 * if p_box == NULL, go to the next box in witch we are( at the begining ). 
     
    567567 *       you need to call MP4_GotoBox to go where you want 
    568568 *****************************************************************************/ 
    569 int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 
     569static int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 
    570570{ 
    571571    MP4_Box_t *p_box; 
     
    608608 
    609609 
    610 int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 
     610static int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 
    611611{ 
    612612    if( p_container->i_size <= (size_t)MP4_BOX_HEADERSIZE(p_container ) + 8 ) 
     
    622622} 
    623623 
    624 void MP4_FreeBox_Common( input_thread_t *p_input, MP4_Box_t *p_box ) 
     624static void MP4_FreeBox_Common( MP4_Box_t *p_box ) 
    625625{ 
    626626    /* Up to now do nothing */ 
    627627} 
    628628 
    629 int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     629static int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    630630{ 
    631631    /* XXX sometime moov is hiden in a free box */ 
     
    663663} 
    664664 
    665 int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     665static int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    666666{ 
    667667    MP4_READBOX_ENTER( MP4_Box_data_ftyp_t ); 
     
    689689} 
    690690 
    691 void MP4_FreeBox_ftyp( input_thread_t *p_input, MP4_Box_t *p_box ) 
     691static void MP4_FreeBox_ftyp( MP4_Box_t *p_box ) 
    692692{ 
    693693    FREE( p_box->data.p_ftyp->i_compatible_brands ); 
     
    695695 
    696696 
    697 int MP4_ReadBox_mvhd(  MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     697static int MP4_ReadBox_mvhd(  MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    698698{ 
    699699    unsigned int i; 
     
    767767} 
    768768 
    769 int MP4_ReadBox_tkhd(  MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     769static int MP4_ReadBox_tkhd(  MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    770770{ 
    771771    unsigned int i; 
     
    831831 
    832832 
    833 int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     833static int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    834834{ 
    835835    unsigned int i; 
     
    884884 
    885885 
    886 int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     886static int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    887887{ 
    888888    MP4_READBOX_ENTER( MP4_Box_data_hdlr_t ); 
     
    905905} 
    906906 
    907 void MP4_FreeBox_hdlr( input_thread_t *p_input, MP4_Box_t *p_box ) 
     907static void MP4_FreeBox_hdlr( MP4_Box_t *p_box ) 
    908908{ 
    909909    FREE( p_box->data.p_hdlr->psz_name ); 
    910910} 
    911911 
    912 int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     912static int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    913913{ 
    914914    unsigned int i; 
     
    934934} 
    935935 
    936 int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     936static int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    937937{ 
    938938    MP4_READBOX_ENTER( MP4_Box_data_smhd_t ); 
     
    954954 
    955955 
    956 int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     956static int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    957957{ 
    958958    MP4_READBOX_ENTER( MP4_Box_data_hmhd_t ); 
     
    978978} 
    979979 
    980 int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     980static int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    981981{ 
    982982    MP4_READBOX_ENTER( MP4_Box_data_url_t ); 
     
    994994 
    995995 
    996 void MP4_FreeBox_url( input_thread_t *p_input, MP4_Box_t *p_box ) 
     996static void MP4_FreeBox_url( MP4_Box_t *p_box ) 
    997997{ 
    998998    FREE( p_box->data.p_url->psz_location ) 
    999999} 
    10001000 
    1001 int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1001static int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    10021002{ 
    10031003    MP4_READBOX_ENTER( MP4_Box_data_urn_t ); 
     
    10151015    MP4_READBOX_EXIT( 1 ); 
    10161016} 
    1017 void MP4_FreeBox_urn( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1017static void MP4_FreeBox_urn( MP4_Box_t *p_box ) 
    10181018{ 
    10191019    FREE( p_box->data.p_urn->psz_name ); 
     
    10221022 
    10231023 
    1024 int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1024static int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    10251025{ 
    10261026    MP4_READBOX_ENTER( MP4_Box_data_dref_t ); 
     
    10421042 
    10431043 
    1044 int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1044static int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    10451045{ 
    10461046    unsigned int i; 
     
    10691069} 
    10701070 
    1071 void MP4_FreeBox_stts( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1071static void MP4_FreeBox_stts( MP4_Box_t *p_box ) 
    10721072{ 
    10731073    FREE( p_box->data.p_stts->i_sample_count ); 
     
    10751075} 
    10761076 
    1077 int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1077static int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    10781078{ 
    10791079    unsigned int i; 
     
    11031103} 
    11041104 
    1105 void MP4_FreeBox_ctts( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1105static void MP4_FreeBox_ctts( MP4_Box_t *p_box ) 
    11061106{ 
    11071107    FREE( p_box->data.p_ctts->i_sample_count ); 
     
    11241124} 
    11251125 
    1126 int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1126static int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    11271127{ 
    11281128#define es_descriptor p_box->data.p_esds->es_descriptor 
     
    12101210} 
    12111211 
    1212 void MP4_FreeBox_esds( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1212static void MP4_FreeBox_esds( MP4_Box_t *p_box ) 
    12131213{ 
    12141214    FREE( p_box->data.p_esds->es_descriptor.psz_URL ); 
     
    12201220} 
    12211221 
    1222 int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1222static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    12231223{ 
    12241224    unsigned int i; 
     
    13021302 
    13031303 
    1304 int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1304static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    13051305{ 
    13061306    unsigned int i; 
     
    13681368 
    13691369 
    1370 int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1370static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    13711371{ 
    13721372 
     
    13901390 
    13911391 
    1392 int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1392static int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    13931393{ 
    13941394    unsigned int i; 
     
    14221422} 
    14231423 
    1424 void MP4_FreeBox_stsz( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1424static void MP4_FreeBox_stsz( MP4_Box_t *p_box ) 
    14251425{ 
    14261426    FREE( p_box->data.p_stsz->i_entry_size ); 
    14271427} 
    14281428 
    1429 int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1429static int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    14301430{ 
    14311431    unsigned int i; 
     
    14591459} 
    14601460 
    1461 void MP4_FreeBox_stsc( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1461static void MP4_FreeBox_stsc( MP4_Box_t *p_box ) 
    14621462{ 
    14631463    FREE( p_box->data.p_stsc->i_first_chunk ); 
     
    14661466} 
    14671467 
    1468 int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1468static int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    14691469{ 
    14701470    unsigned int i; 
     
    15071507} 
    15081508 
    1509 void MP4_FreeBox_stco_co64( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1509static void MP4_FreeBox_stco_co64( MP4_Box_t *p_box ) 
    15101510{ 
    15111511    FREE( p_box->data.p_co64->i_chunk_offset ); 
    15121512} 
    15131513 
    1514 int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1514static int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    15151515{ 
    15161516    unsigned int i; 
     
    15411541} 
    15421542 
    1543 void MP4_FreeBox_stss( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1543static void MP4_FreeBox_stss( MP4_Box_t *p_box ) 
    15441544{ 
    15451545    FREE( p_box->data.p_stss->i_sample_number ) 
    15461546} 
    15471547 
    1548 int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1548static int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    15491549{ 
    15501550    unsigned int i; 
     
    15781578} 
    15791579 
    1580 void MP4_FreeBox_stsh( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1580static void MP4_FreeBox_stsh( MP4_Box_t *p_box ) 
    15811581{ 
    15821582    FREE( p_box->data.p_stsh->i_shadowed_sample_number ) 
     
    15851585 
    15861586 
    1587 int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1587static int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    15881588{ 
    15891589    unsigned int i; 
     
    16101610} 
    16111611 
    1612 void MP4_FreeBox_stdp( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1612static void MP4_FreeBox_stdp( MP4_Box_t *p_box ) 
    16131613{ 
    16141614    FREE( p_box->data.p_stdp->i_priority ) 
    16151615} 
    16161616 
    1617 int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1617static int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    16181618{ 
    16191619    unsigned int i; 
     
    16541654} 
    16551655 
    1656 void MP4_FreeBox_padb( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1656static void MP4_FreeBox_padb( MP4_Box_t *p_box ) 
    16571657{ 
    16581658    FREE( p_box->data.p_padb->i_reserved1 ); 
     
    16621662} 
    16631663 
    1664 int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1664static int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    16651665{ 
    16661666    unsigned int i; 
     
    17121712} 
    17131713 
    1714 void MP4_FreeBox_elst( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1714static void MP4_FreeBox_elst( MP4_Box_t *p_box ) 
    17151715{ 
    17161716    FREE( p_box->data.p_elst->i_segment_duration ); 
     
    17201720} 
    17211721 
    1722 int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1722static int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    17231723{ 
    17241724    unsigned int i_language; 
     
    17491749} 
    17501750 
    1751 void MP4_FreeBox_cprt( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1751static void MP4_FreeBox_cprt( MP4_Box_t *p_box ) 
    17521752{ 
    17531753    FREE( p_box->data.p_cprt->psz_notice ); 
     
    17551755 
    17561756 
    1757 int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1757static int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    17581758{ 
    17591759    MP4_READBOX_ENTER( MP4_Box_data_dcom_t ); 
     
    17681768} 
    17691769 
    1770 int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1770static int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    17711771{ 
    17721772    MP4_READBOX_ENTER( MP4_Box_data_cmvd_t ); 
     
    17961796    MP4_READBOX_EXIT( 1 ); 
    17971797} 
    1798 void MP4_FreeBox_cmvd( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1798static void MP4_FreeBox_cmvd( MP4_Box_t *p_box ) 
    17991799{ 
    18001800    FREE( p_box->data.p_cmvd->p_data ); 
     
    18021802 
    18031803 
    1804 int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1804static int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    18051805{ 
    18061806    MP4_Stream_t *p_stream_memory; 
     
    19381938} 
    19391939 
    1940 int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1940static int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    19411941{ 
    19421942    uint32_t i_len; 
     
    19701970    MP4_READBOX_EXIT( 1 ); 
    19711971} 
    1972 void MP4_FreeBox_rdrf( input_thread_t *p_input, MP4_Box_t *p_box ) 
     1972 
     1973static void MP4_FreeBox_rdrf( MP4_Box_t *p_box ) 
    19731974{ 
    19741975    FREE( p_box->data.p_rdrf->psz_ref ) 
     
    19761977 
    19771978 
    1978 int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1979static int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    19791980{ 
    19801981    MP4_READBOX_ENTER( MP4_Box_data_rmdr_t ); 
     
    19921993} 
    19931994 
    1994 int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     1995static int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    19951996{ 
    19961997    MP4_READBOX_ENTER( MP4_Box_data_rmqu_t ); 
     
    20062007} 
    20072008 
    2008 int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
     2009static int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 
    20092010{ 
    20102011    MP4_READBOX_ENTER( MP4_Box_data_rmvc_t ); 
     
    20352036    uint32_t i_type; 
    20362037    int  (*MP4_ReadBox_function )( MP4_Stream_t *p_stream, MP4_Box_t *p_box ); 
    2037     void (*MP4_FreeBox_function )( input_thread_t *p_input, MP4_Box_t *p_box ); 
     2038    void (*MP4_FreeBox_function )( MP4_Box_t *p_box ); 
    20382039} MP4_Box_Function [] = 
    20392040{ 
     
    23652366        else 
    23662367        { 
    2367             MP4_Box_Function[i_index].MP4_FreeBox_function( p_input, p_box ); 
     2368            MP4_Box_Function[i_index].MP4_FreeBox_function( p_box ); 
    23682369        } 
    23692370 
  • modules/demux/mp4/mp4.c

    reb505a2 r091aff7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: mp4.c,v 1.34 2003/07/23 01:13:47 gbazin Exp $ 
     5 * $Id: mp4.c,v 1.35 2003/09/07 22:48:29 fenrir Exp $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    2525 *****************************************************************************/ 
    2626#include <stdlib.h>                                      /* malloc(), free() */ 
    27 #include <string.h>                                              /* strdup() */ 
    28 #include <errno.h> 
    29 #include <sys/types.h> 
    3027 
    3128#include <vlc/vlc.h> 
     
    3734 
    3835/***************************************************************************** 
     36 * Module descriptor 
     37 *****************************************************************************/ 
     38static int  Open    ( vlc_object_t * ); 
     39static void Close     ( vlc_object_t * ); 
     40 
     41vlc_module_begin(); 
     42    set_description( _("MP4 demuxer") ); 
     43    set_capability( "demux", 242 ); 
     44    set_callbacks( Open, Close ); 
     45vlc_module_end(); 
     46 
     47 
     48/***************************************************************************** 
    3949 * Local prototypes 
    4050 *****************************************************************************/ 
    41 static int    MP4Init    ( vlc_object_t * ); 
    42 static void __MP4End     ( vlc_object_t * ); 
    43 static int    MP4Demux   ( input_thread_t * ); 
    44  
    45 static int    MP4DemuxRef( input_thread_t *p_input ) 
     51static int    Demux   ( input_thread_t * ); 
     52static int    DemuxRef( input_thread_t *p_input ) 
    4653{ 
    4754    return 0; 
    4855} 
    49  
    50 /* New input could have something like that... */ 
    51 static int   MP4Seek     ( input_thread_t *, mtime_t ); 
    52  
    53 #define MP4End(a) __MP4End(VLC_OBJECT(a)) 
    54  
    55 /***************************************************************************** 
    56  * Module descriptor 
    57  *****************************************************************************/ 
    58 vlc_module_begin(); 
    59     set_description( _("MP4 demuxer") ); 
    60     set_capability( "demux", 242 ); 
    61     set_callbacks( MP4Init, __MP4End ); 
    62 vlc_module_end(); 
     56static int   Seek     ( input_thread_t *, mtime_t ); 
     57static int   Control  ( input_thread_t *, int, va_list ); 
    6358 
    6459/***************************************************************************** 
     
    6661 *****************************************************************************/ 
    6762 
    68 static void MP4_TrackCreate ( input_thread_t *, 
    69                               track_data_mp4_t *, 
    70                               MP4_Box_t  * ); 
    71 static void MP4_TrackDestroy( input_thread_t *, 
    72                               track_data_mp4_t * ); 
    73  
    74 static int  MP4_TrackSelect ( input_thread_t *, 
    75                               track_data_mp4_t *, 
    76                               mtime_t ); 
    77 static void MP4_TrackUnselect(input_thread_t *, 
    78                               track_data_mp4_t * ); 
    79  
    80 static int  MP4_TrackSeek   ( input_thread_t *, 
    81                               track_data_mp4_t *, 
    82                               mtime_t ); 
    83  
    84 static uint64_t MP4_GetTrackPos( track_data_mp4_t * ); 
    85 static int  MP4_TrackSampleSize( track_data_mp4_t * ); 
    86 static int  MP4_TrackNextSample( input_thread_t *, 
    87                                  track_data_mp4_t * ); 
     63static void MP4_TrackCreate ( input_thread_t *, track_data_mp4_t *, MP4_Box_t  *); 
     64static void MP4_TrackDestroy( input_thread_t *, track_data_mp4_t * ); 
     65 
     66static int  MP4_TrackSelect ( input_thread_t *, track_data_mp4_t *, mtime_t ); 
     67static void MP4_TrackUnselect(input_thread_t *, track_data_mp4_t * ); 
     68 
     69static int  MP4_TrackSeek   ( input_thread_t *, track_data_mp4_t *, mtime_t ); 
     70 
     71static uint64_t MP4_GetTrackPos    ( track_data_mp4_t * ); 
     72static int      MP4_TrackSampleSize( track_data_mp4_t * ); 
     73static int      MP4_TrackNextSample( input_thread_t *, track_data_mp4_t * ); 
    8874 
    8975#define MP4_Set4BytesLE( p, dw ) \ 
     
    10187 
    10288/***************************************************************************** 
    103  * MP4Init: check file and initializes MP4 structures 
     89 * Open: check file and initializes MP4 structures 
    10490 *****************************************************************************/ 
    105 static int MP4Init( vlc_object_t * p_this ) 
     91static int Open( vlc_object_t * p_this ) 
    10692{ 
    10793    input_thread_t  *p_input = (input_thread_t *)p_this; 
     
    120106    vlc_bool_t      b_audio; 
    121107 
    122     /* I need to seek */ 
    123     if( !p_input->stream.b_seekable ) 
    124     { 
    125         msg_Warn( p_input, "MP4 plugin discarded (unseekable)" ); 
    126         return( VLC_EGENERIC ); 
    127  
    128     } 
    129     /* Initialize access plug-in structures. */ 
    130     if( p_input->i_mtu == 0 ) 
    131     { 
    132         /* Improve speed. */ 
    133         p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE ; 
    134     } 
    135  
    136     p_input->pf_demux = MP4Demux; 
    137  
    138108    /* a little test to see if it could be a mp4 */ 
    139109    if( input_Peek( p_input, &p_peek, 8 ) < 8 ) 
    140110    { 
    141111        msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" ); 
    142         return( VLC_EGENERIC ); 
    143     } 
    144  
    145  
     112        return VLC_EGENERIC; 
     113    } 
    146114    switch( VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ) ) 
    147115    { 
    148         case( FOURCC_ftyp )
    149         case( FOURCC_moov )
    150         case( FOURCC_foov )
    151         case( FOURCC_moof )
    152         case( FOURCC_mdat )
    153         case( FOURCC_udta )
    154         case( FOURCC_free )
    155         case( FOURCC_skip )
    156         case( FOURCC_wide )
     116        case FOURCC_ftyp
     117        case FOURCC_moov
     118        case FOURCC_foov
     119        case FOURCC_moof
     120        case FOURCC_mdat
     121        case FOURCC_udta
     122        case FOURCC_free
     123        case FOURCC_skip
     124        case FOURCC_wide
    157125            break; 
    158126         default: 
    159127            msg_Warn( p_input, "MP4 plugin discarded (not a valid file)" ); 
    160             return( VLC_EGENERIC ); 
    161     } 
     128            return VLC_EGENERIC; 
     129    } 
     130    /* I need to seek */ 
     131    if( !p_input->stream.b_seekable ) 
     132    { 
     133        msg_Warn( p_input, "MP4 plugin discarded (unseekable)" ); 
     134        return VLC_EGENERIC; 
     135    }