comparison libmpdemux/demuxer.c @ 12164:77ff303c0eaa

demux_lavf
author michael
date Sun, 11 Apr 2004 14:26:04 +0000
parents c43d654a1f45
children da8e39bfe121
comparison
equal deleted inserted replaced
12163:012b55951076 12164:77ff303c0eaa
137 extern void demux_close_lmlm4(demuxer_t* demuxer); 137 extern void demux_close_lmlm4(demuxer_t* demuxer);
138 extern void demux_close_ts(demuxer_t* demuxer); 138 extern void demux_close_ts(demuxer_t* demuxer);
139 extern void demux_close_mkv(demuxer_t* demuxer); 139 extern void demux_close_mkv(demuxer_t* demuxer);
140 extern void demux_close_ra(demuxer_t* demuxer); 140 extern void demux_close_ra(demuxer_t* demuxer);
141 extern void demux_close_ty(demuxer_t* demuxer); 141 extern void demux_close_ty(demuxer_t* demuxer);
142 extern void demux_close_lavf(demuxer_t* demuxer);
142 143
143 144
144 #ifdef USE_TV 145 #ifdef USE_TV
145 #include "tv.h" 146 #include "tv.h"
146 extern int tv_param_on; 147 extern int tv_param_on;
221 case DEMUXER_TYPE_MPEG_TS: 222 case DEMUXER_TYPE_MPEG_TS:
222 case DEMUXER_TYPE_MPEG4_IN_TS: 223 case DEMUXER_TYPE_MPEG4_IN_TS:
223 demux_close_ts(demuxer); break; 224 demux_close_ts(demuxer); break;
224 case DEMUXER_TYPE_REALAUDIO: 225 case DEMUXER_TYPE_REALAUDIO:
225 demux_close_ra(demuxer); break; 226 demux_close_ra(demuxer); break;
226 227 #ifdef USE_LIBAVFORMAT
228 case DEMUXER_TYPE_LAVF:
229 demux_close_lavf(demuxer); break;
230 #endif
227 } 231 }
228 // free streams: 232 // free streams:
229 for(i=0;i<256;i++){ 233 for(i=0;i<256;i++){
230 if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]); 234 if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]);
231 if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]); 235 if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]);
311 extern int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds); 315 extern int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds);
312 extern int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds); 316 extern int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds);
313 extern int demux_smjpeg_fill_buffer(demuxer_t* demux); 317 extern int demux_smjpeg_fill_buffer(demuxer_t* demux);
314 extern int demux_lmlm4_fill_buffer(demuxer_t* demux); 318 extern int demux_lmlm4_fill_buffer(demuxer_t* demux);
315 extern int demux_mkv_fill_buffer(demuxer_t *d); 319 extern int demux_mkv_fill_buffer(demuxer_t *d);
320 extern int demux_lavf_fill_buffer(demuxer_t *d);
316 321
317 int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){ 322 int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
318 // Note: parameter 'ds' can be NULL! 323 // Note: parameter 'ds' can be NULL!
319 // printf("demux->type=%d\n",demux->type); 324 // printf("demux->type=%d\n",demux->type);
320 switch(demux->type){ 325 switch(demux->type){
367 case DEMUXER_TYPE_LMLM4: return demux_lmlm4_fill_buffer(demux); 372 case DEMUXER_TYPE_LMLM4: return demux_lmlm4_fill_buffer(demux);
368 case DEMUXER_TYPE_MPEG_TS: 373 case DEMUXER_TYPE_MPEG_TS:
369 case DEMUXER_TYPE_MPEG4_IN_TS: 374 case DEMUXER_TYPE_MPEG4_IN_TS:
370 return demux_ts_fill_buffer(demux); 375 return demux_ts_fill_buffer(demux);
371 case DEMUXER_TYPE_REALAUDIO: return demux_ra_fill_buffer(demux); 376 case DEMUXER_TYPE_REALAUDIO: return demux_ra_fill_buffer(demux);
377 #ifdef USE_LIBAVFORMAT
378 case DEMUXER_TYPE_LAVF: return demux_lavf_fill_buffer(demux);
379 #endif
372 } 380 }
373 return 0; 381 return 0;
374 } 382 }
375 383
376 // return value: 384 // return value:
610 extern int ra_check_file(demuxer_t *demuxer); 618 extern int ra_check_file(demuxer_t *demuxer);
611 extern int demux_open_ra(demuxer_t* demuxer); 619 extern int demux_open_ra(demuxer_t* demuxer);
612 #ifdef HAVE_MATROSKA 620 #ifdef HAVE_MATROSKA
613 extern int demux_mkv_open(demuxer_t *demuxer); 621 extern int demux_mkv_open(demuxer_t *demuxer);
614 #endif 622 #endif
623 extern int lavf_check_file(demuxer_t *demuxer);
624 extern int demux_open_lavf(demuxer_t* demuxer);
615 625
616 extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer); 626 extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer);
617 627
618 int extension_parsing=1; // 0=off 1=mixed (used only for unstable formats) 628 int extension_parsing=1; // 0=off 1=mixed (used only for unstable formats)
619 629
1076 } 1086 }
1077 //=============== Try to open as a RTP stream: =========== 1087 //=============== Try to open as a RTP stream: ===========
1078 if(file_format==DEMUXER_TYPE_RTP) { 1088 if(file_format==DEMUXER_TYPE_RTP) {
1079 demuxer=new_demuxer(stream,DEMUXER_TYPE_RTP,audio_id,video_id,dvdsub_id); 1089 demuxer=new_demuxer(stream,DEMUXER_TYPE_RTP,audio_id,video_id,dvdsub_id);
1080 } 1090 }
1091 //=============== Try to open with LAVF: =================
1092 #ifdef USE_LIBAVFORMAT
1093 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_LAVF){
1094 demuxer=new_demuxer(stream,DEMUXER_TYPE_LAVF,audio_id,video_id,dvdsub_id);
1095 if(lavf_check_file(demuxer)){
1096 mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"libavformat"); //FIXME print format
1097 file_format=DEMUXER_TYPE_LAVF;
1098 } else {
1099 free_demuxer(demuxer);
1100 demuxer = NULL;
1101 }
1102 }
1103 #endif
1081 //=============== Unknown, exiting... =========================== 1104 //=============== Unknown, exiting... ===========================
1082 if(file_format==DEMUXER_TYPE_UNKNOWN || demuxer == NULL){ 1105 if(file_format==DEMUXER_TYPE_UNKNOWN || demuxer == NULL){
1083 //mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); // will be done by mplayer.c after fallback to playlist-parsing 1106 //mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); // will be done by mplayer.c after fallback to playlist-parsing
1084 return NULL; 1107 return NULL;
1085 } 1108 }
1309 } 1332 }
1310 case DEMUXER_TYPE_REALAUDIO: { 1333 case DEMUXER_TYPE_REALAUDIO: {
1311 if (!demux_open_ra(demuxer)) return NULL; 1334 if (!demux_open_ra(demuxer)) return NULL;
1312 break; 1335 break;
1313 } 1336 }
1337 #ifdef USE_LIBAVFORMAT
1338 case DEMUXER_TYPE_LAVF: {
1339 if (!demux_open_lavf(demuxer)) return NULL;
1340 break;
1341 }
1342 #endif
1314 } // switch(file_format) 1343 } // switch(file_format)
1315 pts_from_bps=0; // !!! 1344 pts_from_bps=0; // !!!
1316 return demuxer; 1345 return demuxer;
1317 } 1346 }
1318 1347
1395 int demux_seek_nuv(demuxer_t *demuxer,float rel_seek_secs,int flags); 1424 int demux_seek_nuv(demuxer_t *demuxer,float rel_seek_secs,int flags);
1396 void demux_seek_mov(demuxer_t *demuxer,float pts,int flags); 1425 void demux_seek_mov(demuxer_t *demuxer,float pts,int flags);
1397 int demux_seek_real(demuxer_t *demuxer,float rel_seek_secs,int flags); 1426 int demux_seek_real(demuxer_t *demuxer,float rel_seek_secs,int flags);
1398 int demux_seek_pva(demuxer_t *demuxer,float rel_seek_secs,int flags); 1427 int demux_seek_pva(demuxer_t *demuxer,float rel_seek_secs,int flags);
1399 int demux_seek_ts(demuxer_t *demuxer,float rel_seek_secs,int flags); 1428 int demux_seek_ts(demuxer_t *demuxer,float rel_seek_secs,int flags);
1429 int demux_seek_lavf(demuxer_t *demuxer,float rel_seek_secs,int flags);
1400 1430
1401 #ifdef HAVE_LIBDV095 1431 #ifdef HAVE_LIBDV095
1402 int demux_seek_rawdv(demuxer_t *demuxer, float pts, int flags); 1432 int demux_seek_rawdv(demuxer_t *demuxer, float pts, int flags);
1403 #endif 1433 #endif
1404 1434
1506 demux_mkv_seek(demuxer,rel_seek_secs,flags); break; 1536 demux_mkv_seek(demuxer,rel_seek_secs,flags); break;
1507 #endif 1537 #endif
1508 case DEMUXER_TYPE_MPEG_TS: 1538 case DEMUXER_TYPE_MPEG_TS:
1509 case DEMUXER_TYPE_MPEG4_IN_TS: 1539 case DEMUXER_TYPE_MPEG4_IN_TS:
1510 demux_seek_ts(demuxer,rel_seek_secs,flags); break; 1540 demux_seek_ts(demuxer,rel_seek_secs,flags); break;
1541 #ifdef USE_LIBAVFORMAT
1542 case DEMUXER_TYPE_LAVF:
1543 demux_seek_lavf(demuxer,rel_seek_secs,flags); break;
1544 #endif
1511 1545
1512 } // switch(demuxer->file_format) 1546 } // switch(demuxer->file_format)
1513 1547
1514 return 1; 1548 return 1;
1515 } 1549 }
1571 extern int demux_xmms_control(demuxer_t *demuxer, int cmd, void *arg); 1605 extern int demux_xmms_control(demuxer_t *demuxer, int cmd, void *arg);
1572 extern int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg); 1606 extern int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg);
1573 extern int demux_audio_control(demuxer_t *demuxer, int cmd, void *arg); 1607 extern int demux_audio_control(demuxer_t *demuxer, int cmd, void *arg);
1574 extern int demux_ogg_control(demuxer_t *demuxer, int cmd, void *arg); 1608 extern int demux_ogg_control(demuxer_t *demuxer, int cmd, void *arg);
1575 extern int demux_real_control(demuxer_t *demuxer, int cmd, void *arg); 1609 extern int demux_real_control(demuxer_t *demuxer, int cmd, void *arg);
1610 extern int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg);
1576 1611
1577 int demux_control(demuxer_t *demuxer, int cmd, void *arg) { 1612 int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
1578 switch(demuxer->type) { 1613 switch(demuxer->type) {
1579 case DEMUXER_TYPE_MPEG_TY: 1614 case DEMUXER_TYPE_MPEG_TY:
1580 return demux_ty_control(demuxer,cmd,arg); 1615 return demux_ty_control(demuxer,cmd,arg);
1604 case DEMUXER_TYPE_MATROSKA: 1639 case DEMUXER_TYPE_MATROSKA:
1605 return demux_mkv_control(demuxer,cmd,arg); 1640 return demux_mkv_control(demuxer,cmd,arg);
1606 #endif 1641 #endif
1607 case DEMUXER_TYPE_REAL: 1642 case DEMUXER_TYPE_REAL:
1608 return demux_real_control(demuxer, cmd, arg); 1643 return demux_real_control(demuxer, cmd, arg);
1644 #ifdef USE_LIBAVFORMAT
1645 case DEMUXER_TYPE_LAVF:
1646 return demux_lavf_control(demuxer, cmd, arg);
1647 #endif
1609 1648
1610 default: 1649 default:
1611 return DEMUXER_CTRL_NOTIMPL; 1650 return DEMUXER_CTRL_NOTIMPL;
1612 } 1651 }
1613 } 1652 }