Changeset 091aff73545a19bdb1c1706acecfc86e326e2734
- Timestamp:
- 08/09/03 00:48:29 (5 years ago)
- git-parent:
- Files:
-
- modules/demux/a52sys.c (modified) (3 diffs)
- modules/demux/aac.c (modified) (3 diffs)
- modules/demux/asf/asf.c (modified) (3 diffs)
- modules/demux/asf/libasf.c (modified) (2 diffs)
- modules/demux/au.c (modified) (3 diffs)
- modules/demux/avi/avi.c (modified) (10 diffs)
- modules/demux/avi/libavi.c (modified) (2 diffs)
- modules/demux/demuxdump.c (modified) (2 diffs)
- modules/demux/flac.c (modified) (2 diffs)
- modules/demux/mkv.cpp (modified) (3 diffs)
- modules/demux/mp4/libmp4.c (modified) (52 diffs)
- modules/demux/mp4/mp4.c (modified) (17 diffs)
- modules/demux/mpeg/es.c (modified) (2 diffs)
- modules/demux/mpeg/m4v.c (modified) (2 diffs)
- modules/demux/mpeg/mpga.c (modified) (3 diffs)
- modules/demux/mpeg/ps.c (modified) (2 diffs)
- modules/demux/mpeg/ts.c (modified) (2 diffs)
- modules/demux/ogg.c (modified) (2 diffs)
- modules/demux/rawdv.c (modified) (2 diffs)
- modules/demux/wav.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/demux/a52sys.c
r4cd852f r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: a52sys.c,v 1. 4 2003/08/01 00:04:28fenrir Exp $5 * $Id: a52sys.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 29 29 #include <vlc/vlc.h> 30 30 #include <vlc/input.h> 31 32 #include <ninput.h>33 31 34 32 /***************************************************************************** … … 130 128 131 129 p_input->pf_demux = Demux; 130 p_input->pf_demux_control = demux_vaControlDefault; 132 131 133 132 p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); modules/demux/aac.c
r75d4217 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: aac.c,v 1. 2 2003/08/01 00:40:05fenrir Exp $5 * $Id: aac.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 29 29 #include <vlc/vlc.h> 30 30 #include <vlc/input.h> 31 32 #include <ninput.h>33 31 34 32 /***************************************************************************** … … 137 135 138 136 p_input->pf_demux = Demux; 137 p_input->pf_demux_control = demux_vaControlDefault; 139 138 140 139 p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); modules/demux/asf/asf.c
r349d96d r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002-2003 VideoLAN 5 * $Id: asf.c,v 1.3 6 2003/08/25 23:36:16fenrir Exp $5 * $Id: asf.c,v 1.37 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 29 29 #include <vlc/vlc.h> 30 30 #include <vlc/input.h> 31 #include "ninput.h"32 31 33 32 #include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */ … … 118 117 119 118 /* Set p_input field */ 120 p_input->pf_demux = Demux; 119 p_input->pf_demux = Demux; 120 p_input->pf_demux_control = demux_vaControlDefault; 121 121 p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) ); 122 122 memset( p_sys, 0, sizeof( demux_sys_t ) ); modules/demux/asf/libasf.c
r245a23e r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: libasf.c,v 1.1 7 2003/08/24 15:05:27fenrir Exp $5 * $Id: libasf.c,v 1.18 2003/09/07 22:48:29 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 25 25 #include <vlc/vlc.h> 26 26 #include <vlc/input.h> 27 #include "ninput.h"28 27 29 28 #include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */ modules/demux/au.c
r76ae095 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001-2003 VideoLAN 5 * $Id: au.c,v 1. 5 2003/08/22 20:32:27fenrir Exp $5 * $Id: au.c,v 1.6 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 31 31 32 32 #include <codecs.h> 33 #include <ninput.h>34 33 35 34 /***************************************************************************** … … 321 320 322 321 p_input->pf_demux = DemuxPCM; 322 p_input->pf_demux_control = demux_vaControlDefault; 323 323 } 324 324 modules/demux/avi/avi.c
r1eab54f r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: avi.c,v 1. 59 2003/08/23 11:46:06fenrir Exp $5 * $Id: avi.c,v 1.60 2003/09/07 22:48:29 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 28 28 #include <vlc/vlc.h> 29 29 #include <vlc/input.h> 30 #include "ninput.h"31 30 #include "codecs.h" 32 31 … … 59 58 * Local prototypes 60 59 *****************************************************************************/ 60 static int Control ( input_thread_t *, int, va_list ); 61 61 static int Seek ( input_thread_t *, mtime_t, int ); 62 62 static int Demux_Seekable ( input_thread_t * ); … … 160 160 stream_Control( p_avi->s, STREAM_CAN_FASTSEEK, &p_avi->b_seekable ); 161 161 162 p_input->pf_demux_control = Control; 162 163 p_input->pf_demux = Demux_Seekable; 163 164 /* For unseekable stream, automaticaly use Demux_UnSeekable */ … … 461 462 msg_Warn( p_input, "broken or missing index, 'seek' will be axproximative or will have strange behavour" ); 462 463 } 463 464 464 /* fix some BeOS MediaKit generated file */ 465 465 for( i = 0 ; i < p_avi->i_streams; i++ ) … … 657 657 return( 0 ); 658 658 } 659 659 #if 0 660 660 if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT ) 661 661 { … … 679 679 } 680 680 } 681 681 #endif 682 682 683 683 /* wait for the good time */ … … 1132 1132 * Returns -1 in case of error, 0 in case of EOF, 1 otherwise 1133 1133 *****************************************************************************/ 1134 static int Seek ( input_thread_t *p_input, 1135 mtime_t i_date, int i_percent ) 1134 static int Seek( input_thread_t *p_input, mtime_t i_date, int i_percent ) 1136 1135 { 1137 1136 … … 1185 1184 } 1186 1185 1187 /* be sure that the index exi t */1186 /* be sure that the index exist */ 1188 1187 if( AVI_StreamChunkSet( p_input, 1189 1188 i_stream, … … 1254 1253 } 1255 1254 1255 /***************************************************************************** 1256 * Control: 1257 ***************************************************************************** 1258 * 1259 *****************************************************************************/ 1260 static 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 } 1256 1342 1257 1343 /***************************************************************************** modules/demux/avi/libavi.c
r67f11e2 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: libavi.c,v 1.2 5 2003/08/30 02:03:44fenrir Exp $5 * $Id: libavi.c,v 1.26 2003/09/07 22:48:29 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 25 25 #include <vlc/vlc.h> 26 26 #include <vlc/input.h> 27 #include "ninput.h"28 27 #include "codecs.h" /* BITMAPINFOHEADER */ 29 28 modules/demux/demuxdump.c
rd5791c9 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: demuxdump.c,v 1. 9 2003/05/15 22:27:37 massiotExp $5 * $Id: demuxdump.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 85 85 /* Set the demux function */ 86 86 p_input->pf_demux = Demux; 87 p_input->pf_demux_control = demux_vaControlDefault; 87 88 88 89 /* Initialize access plug-in structures. */ modules/demux/flac.c
r8692921 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: flac.c,v 1. 4 2003/08/17 13:56:26 gbazinExp $5 * $Id: flac.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> … … 73 73 74 74 p_input->pf_demux = Demux; 75 p_input->pf_demux_control = demux_vaControlDefault; 75 76 p_input->pf_rewind = NULL; 76 77 modules/demux/mkv.cpp
r503bdd9 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: mkv.cpp,v 1.2 5 2003/08/26 19:43:51 hartmanExp $5 * $Id: mkv.cpp,v 1.26 2003/09/07 22:48:29 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 37 37 #include <codecs.h> /* BITMAPINFOHEADER, WAVEFORMATEX */ 38 38 #include "iso_lang.h" 39 #include "ninput.h"40 39 41 40 #include <iostream> … … 301 300 /* Set the demux function */ 302 301 p_input->pf_demux = Demux; 302 p_input->pf_demux_control = demux_vaControlDefault; 303 303 304 304 /* peek the begining */ modules/demux/mp4/libmp4.c
r186e68f r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: libmp4.c,v 1.3 1 2003/08/17 23:02:52fenrir Exp $5 * $Id: libmp4.c,v 1.32 2003/09/07 22:48:29 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 520 520 521 521 /***************************************************************************** 522 * MP4_ MP4_NextBox : Go to the next box522 * MP4_NextBox : Go to the next box 523 523 ***************************************************************************** 524 524 * if p_box == NULL, go to the next box in witch we are( at the begining ). … … 567 567 * you need to call MP4_GotoBox to go where you want 568 568 *****************************************************************************/ 569 int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container )569 static int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 570 570 { 571 571 MP4_Box_t *p_box; … … 608 608 609 609 610 int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container )610 static int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) 611 611 { 612 612 if( p_container->i_size <= (size_t)MP4_BOX_HEADERSIZE(p_container ) + 8 ) … … 622 622 } 623 623 624 void MP4_FreeBox_Common( input_thread_t *p_input,MP4_Box_t *p_box )624 static void MP4_FreeBox_Common( MP4_Box_t *p_box ) 625 625 { 626 626 /* Up to now do nothing */ 627 627 } 628 628 629 int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )629 static int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 630 630 { 631 631 /* XXX sometime moov is hiden in a free box */ … … 663 663 } 664 664 665 int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )665 static int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 666 666 { 667 667 MP4_READBOX_ENTER( MP4_Box_data_ftyp_t ); … … 689 689 } 690 690 691 void MP4_FreeBox_ftyp( input_thread_t *p_input,MP4_Box_t *p_box )691 static void MP4_FreeBox_ftyp( MP4_Box_t *p_box ) 692 692 { 693 693 FREE( p_box->data.p_ftyp->i_compatible_brands ); … … 695 695 696 696 697 int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )697 static int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 698 698 { 699 699 unsigned int i; … … 767 767 } 768 768 769 int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )769 static int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 770 770 { 771 771 unsigned int i; … … 831 831 832 832 833 int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )833 static int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 834 834 { 835 835 unsigned int i; … … 884 884 885 885 886 int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )886 static int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 887 887 { 888 888 MP4_READBOX_ENTER( MP4_Box_data_hdlr_t ); … … 905 905 } 906 906 907 void MP4_FreeBox_hdlr( input_thread_t *p_input,MP4_Box_t *p_box )907 static void MP4_FreeBox_hdlr( MP4_Box_t *p_box ) 908 908 { 909 909 FREE( p_box->data.p_hdlr->psz_name ); 910 910 } 911 911 912 int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )912 static int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 913 913 { 914 914 unsigned int i; … … 934 934 } 935 935 936 int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )936 static int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 937 937 { 938 938 MP4_READBOX_ENTER( MP4_Box_data_smhd_t ); … … 954 954 955 955 956 int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )956 static int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 957 957 { 958 958 MP4_READBOX_ENTER( MP4_Box_data_hmhd_t ); … … 978 978 } 979 979 980 int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box )980 static int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 981 981 { 982 982 MP4_READBOX_ENTER( MP4_Box_data_url_t ); … … 994 994 995 995 996 void MP4_FreeBox_url( input_thread_t *p_input,MP4_Box_t *p_box )996 static void MP4_FreeBox_url( MP4_Box_t *p_box ) 997 997 { 998 998 FREE( p_box->data.p_url->psz_location ) 999 999 } 1000 1000 1001 int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1001 static int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1002 1002 { 1003 1003 MP4_READBOX_ENTER( MP4_Box_data_urn_t ); … … 1015 1015 MP4_READBOX_EXIT( 1 ); 1016 1016 } 1017 void MP4_FreeBox_urn( input_thread_t *p_input,MP4_Box_t *p_box )1017 static void MP4_FreeBox_urn( MP4_Box_t *p_box ) 1018 1018 { 1019 1019 FREE( p_box->data.p_urn->psz_name ); … … 1022 1022 1023 1023 1024 int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1024 static int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1025 1025 { 1026 1026 MP4_READBOX_ENTER( MP4_Box_data_dref_t ); … … 1042 1042 1043 1043 1044 int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1044 static int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1045 1045 { 1046 1046 unsigned int i; … … 1069 1069 } 1070 1070 1071 void MP4_FreeBox_stts( input_thread_t *p_input,MP4_Box_t *p_box )1071 static void MP4_FreeBox_stts( MP4_Box_t *p_box ) 1072 1072 { 1073 1073 FREE( p_box->data.p_stts->i_sample_count ); … … 1075 1075 } 1076 1076 1077 int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1077 static int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1078 1078 { 1079 1079 unsigned int i; … … 1103 1103 } 1104 1104 1105 void MP4_FreeBox_ctts( input_thread_t *p_input,MP4_Box_t *p_box )1105 static void MP4_FreeBox_ctts( MP4_Box_t *p_box ) 1106 1106 { 1107 1107 FREE( p_box->data.p_ctts->i_sample_count ); … … 1124 1124 } 1125 1125 1126 int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1126 static int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1127 1127 { 1128 1128 #define es_descriptor p_box->data.p_esds->es_descriptor … … 1210 1210 } 1211 1211 1212 void MP4_FreeBox_esds( input_thread_t *p_input,MP4_Box_t *p_box )1212 static void MP4_FreeBox_esds( MP4_Box_t *p_box ) 1213 1213 { 1214 1214 FREE( p_box->data.p_esds->es_descriptor.psz_URL ); … … 1220 1220 } 1221 1221 1222 int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1222 static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1223 1223 { 1224 1224 unsigned int i; … … 1302 1302 1303 1303 1304 int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1304 static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1305 1305 { 1306 1306 unsigned int i; … … 1368 1368 1369 1369 1370 int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1370 static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1371 1371 { 1372 1372 … … 1390 1390 1391 1391 1392 int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1392 static int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1393 1393 { 1394 1394 unsigned int i; … … 1422 1422 } 1423 1423 1424 void MP4_FreeBox_stsz( input_thread_t *p_input,MP4_Box_t *p_box )1424 static void MP4_FreeBox_stsz( MP4_Box_t *p_box ) 1425 1425 { 1426 1426 FREE( p_box->data.p_stsz->i_entry_size ); 1427 1427 } 1428 1428 1429 int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1429 static int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1430 1430 { 1431 1431 unsigned int i; … … 1459 1459 } 1460 1460 1461 void MP4_FreeBox_stsc( input_thread_t *p_input,MP4_Box_t *p_box )1461 static void MP4_FreeBox_stsc( MP4_Box_t *p_box ) 1462 1462 { 1463 1463 FREE( p_box->data.p_stsc->i_first_chunk ); … … 1466 1466 } 1467 1467 1468 int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1468 static int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1469 1469 { 1470 1470 unsigned int i; … … 1507 1507 } 1508 1508 1509 void MP4_FreeBox_stco_co64( input_thread_t *p_input,MP4_Box_t *p_box )1509 static void MP4_FreeBox_stco_co64( MP4_Box_t *p_box ) 1510 1510 { 1511 1511 FREE( p_box->data.p_co64->i_chunk_offset ); 1512 1512 } 1513 1513 1514 int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1514 static int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1515 1515 { 1516 1516 unsigned int i; … … 1541 1541 } 1542 1542 1543 void MP4_FreeBox_stss( input_thread_t *p_input,MP4_Box_t *p_box )1543 static void MP4_FreeBox_stss( MP4_Box_t *p_box ) 1544 1544 { 1545 1545 FREE( p_box->data.p_stss->i_sample_number ) 1546 1546 } 1547 1547 1548 int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1548 static int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1549 1549 { 1550 1550 unsigned int i; … … 1578 1578 } 1579 1579 1580 void MP4_FreeBox_stsh( input_thread_t *p_input,MP4_Box_t *p_box )1580 static void MP4_FreeBox_stsh( MP4_Box_t *p_box ) 1581 1581 { 1582 1582 FREE( p_box->data.p_stsh->i_shadowed_sample_number ) … … 1585 1585 1586 1586 1587 int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1587 static int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1588 1588 { 1589 1589 unsigned int i; … … 1610 1610 } 1611 1611 1612 void MP4_FreeBox_stdp( input_thread_t *p_input,MP4_Box_t *p_box )1612 static void MP4_FreeBox_stdp( MP4_Box_t *p_box ) 1613 1613 { 1614 1614 FREE( p_box->data.p_stdp->i_priority ) 1615 1615 } 1616 1616 1617 int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1617 static int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1618 1618 { 1619 1619 unsigned int i; … … 1654 1654 } 1655 1655 1656 void MP4_FreeBox_padb( input_thread_t *p_input,MP4_Box_t *p_box )1656 static void MP4_FreeBox_padb( MP4_Box_t *p_box ) 1657 1657 { 1658 1658 FREE( p_box->data.p_padb->i_reserved1 ); … … 1662 1662 } 1663 1663 1664 int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1664 static int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1665 1665 { 1666 1666 unsigned int i; … … 1712 1712 } 1713 1713 1714 void MP4_FreeBox_elst( input_thread_t *p_input,MP4_Box_t *p_box )1714 static void MP4_FreeBox_elst( MP4_Box_t *p_box ) 1715 1715 { 1716 1716 FREE( p_box->data.p_elst->i_segment_duration ); … … 1720 1720 } 1721 1721 1722 int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1722 static int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1723 1723 { 1724 1724 unsigned int i_language; … … 1749 1749 } 1750 1750 1751 void MP4_FreeBox_cprt( input_thread_t *p_input,MP4_Box_t *p_box )1751 static void MP4_FreeBox_cprt( MP4_Box_t *p_box ) 1752 1752 { 1753 1753 FREE( p_box->data.p_cprt->psz_notice ); … … 1755 1755 1756 1756 1757 int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1757 static int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1758 1758 { 1759 1759 MP4_READBOX_ENTER( MP4_Box_data_dcom_t ); … … 1768 1768 } 1769 1769 1770 int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1770 static int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1771 1771 { 1772 1772 MP4_READBOX_ENTER( MP4_Box_data_cmvd_t ); … … 1796 1796 MP4_READBOX_EXIT( 1 ); 1797 1797 } 1798 void MP4_FreeBox_cmvd( input_thread_t *p_input,MP4_Box_t *p_box )1798 static void MP4_FreeBox_cmvd( MP4_Box_t *p_box ) 1799 1799 { 1800 1800 FREE( p_box->data.p_cmvd->p_data ); … … 1802 1802 1803 1803 1804 int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1804 static int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1805 1805 { 1806 1806 MP4_Stream_t *p_stream_memory; … … 1938 1938 } 1939 1939 1940 int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1940 static int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1941 1941 { 1942 1942 uint32_t i_len; … … 1970 1970 MP4_READBOX_EXIT( 1 ); 1971 1971 } 1972 void MP4_FreeBox_rdrf( input_thread_t *p_input, MP4_Box_t *p_box ) 1972 1973 static void MP4_FreeBox_rdrf( MP4_Box_t *p_box ) 1973 1974 { 1974 1975 FREE( p_box->data.p_rdrf->psz_ref ) … … 1976 1977 1977 1978 1978 int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1979 static int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1979 1980 { 1980 1981 MP4_READBOX_ENTER( MP4_Box_data_rmdr_t ); … … 1992 1993 } 1993 1994 1994 int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box )1995 static int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 1995 1996 { 1996 1997 MP4_READBOX_ENTER( MP4_Box_data_rmqu_t ); … … 2006 2007 } 2007 2008 2008 int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )2009 static int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) 2009 2010 { 2010 2011 MP4_READBOX_ENTER( MP4_Box_data_rmvc_t ); … … 2035 2036 uint32_t i_type; 2036 2037 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 ); 2038 2039 } MP4_Box_Function [] = 2039 2040 { … … 2365 2366 else 2366 2367 { 2367 MP4_Box_Function[i_index].MP4_FreeBox_function( p_ input, p_box );2368 MP4_Box_Function[i_index].MP4_FreeBox_function( p_box ); 2368 2369 } 2369 2370 modules/demux/mp4/mp4.c
reb505a2 r091aff7 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: mp4.c,v 1.3 4 2003/07/23 01:13:47 gbazinExp $5 * $Id: mp4.c,v 1.35 2003/09/07 22:48:29 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 25 25 *****************************************************************************/ 26 26 #include <stdlib.h> /* malloc(), free() */ 27 #include <string.h> /* strdup() */28 #include <errno.h>29 #include <sys/types.h>30 27 31 28 #include <vlc/vlc.h> … … 37 34 38 35 /***************************************************************************** 36 * Module descriptor 37 *****************************************************************************/ 38 static int Open ( vlc_object_t * ); 39 static void Close ( vlc_object_t * ); 40 41 vlc_module_begin(); 42 set_description( _("MP4 demuxer") ); 43 set_capability( "demux", 242 ); 44 set_callbacks( Open, Close ); 45 vlc_module_end(); 46 47 48 /***************************************************************************** 39 49 * Local prototypes 40 50 *****************************************************************************/ 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 ) 51 static int Demux ( input_thread_t * ); 52 static int DemuxRef( input_thread_t *p_input ) 46 53 { 47 54 return 0; 48 55 } 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(); 56 static int Seek ( input_thread_t *, mtime_t ); 57 static int Control ( input_thread_t *, int, va_list ); 63 58 64 59 /***************************************************************************** … … 66 61 *****************************************************************************/ 67 62 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 * ); 63 static void MP4_TrackCreate ( input_thread_t *, track_data_mp4_t *, MP4_Box_t *); 64 static void MP4_TrackDestroy( input_thread_t *, track_data_mp4_t * ); 65 66 static int MP4_TrackSelect ( input_thread_t *, track_data_mp4_t *, mtime_t ); 67 static void MP4_TrackUnselect(input_thread_t *, track_data_mp4_t * ); 68 69 static int MP4_TrackSeek ( input_thread_t *, track_data_mp4_t *, mtime_t ); 70 71 static uint64_t MP4_GetTrackPos ( track_data_mp4_t * ); 72 static int MP4_TrackSampleSize( track_data_mp4_t * ); 73 static int MP4_TrackNextSample( input_thread_t *, track_data_mp4_t * ); 88 74 89 75 #define MP4_Set4BytesLE( p, dw ) \ … … 101 87 102 88 /***************************************************************************** 103 * MP4Init: check file and initializes MP4 structures89 * Open: check file and initializes MP4 structures 104 90 *****************************************************************************/ 105 static int MP4Init( vlc_object_t * p_this )91 static int Open( vlc_object_t * p_this ) 106 92 { 107 93 input_thread_t *p_input = (input_thread_t *)p_this; … … 120 106 vlc_bool_t b_audio; 121 107 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 138 108 /* a little test to see if it could be a mp4 */ 139 109 if( input_Peek( p_input, &p_peek, 8 ) < 8 ) 140 110 { 141 111 msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" ); 142 return( VLC_EGENERIC ); 143 } 144 145 112 return VLC_EGENERIC; 113 } 146 114 switch( VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ) ) 147 115 { 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: 157 125 break; 158 126 default: 159 127 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 }
