comparison libmpdemux/demux_real.c @ 16175:6b86089c2edd

Demuxer modularization Demuxer selection by name with -demuxer command (bakward compatible)
author rtognimp
date Fri, 05 Aug 2005 19:57:47 +0000
parents cc02417dbf22
children 6ff303d2876b
comparison
equal deleted inserted replaced
16174:b118c000ddd2 16175:6b86089c2edd
431 return 1; 431 return 1;
432 } 432 }
433 #endif 433 #endif
434 434
435 435
436 int real_check_file(demuxer_t* demuxer) 436 static int real_check_file(demuxer_t* demuxer)
437 { 437 {
438 real_priv_t *priv; 438 real_priv_t *priv;
439 int c; 439 int c;
440 440
441 mp_msg(MSGT_DEMUX,MSGL_V,"Checking for REAL\n"); 441 mp_msg(MSGT_DEMUX,MSGL_V,"Checking for REAL\n");
448 448
449 priv = malloc(sizeof(real_priv_t)); 449 priv = malloc(sizeof(real_priv_t));
450 memset(priv, 0, sizeof(real_priv_t)); 450 memset(priv, 0, sizeof(real_priv_t));
451 demuxer->priv = priv; 451 demuxer->priv = priv;
452 452
453 return 1; 453 return DEMUXER_TYPE_REAL;
454 } 454 }
455 455
456 void hexdump(char *, unsigned long); 456 void hexdump(char *, unsigned long);
457 457
458 #define SKIP_BITS(n) buffer<<=n 458 #define SKIP_BITS(n) buffer<<=n
515 } dp_hdr_t; 515 } dp_hdr_t;
516 516
517 // return value: 517 // return value:
518 // 0 = EOF or no stream found 518 // 0 = EOF or no stream found
519 // 1 = successfully read a packet 519 // 1 = successfully read a packet
520 int demux_real_fill_buffer(demuxer_t *demuxer) 520 static int demux_real_fill_buffer(demuxer_t *demuxer, demux_stream_t *dsds)
521 { 521 {
522 real_priv_t *priv = demuxer->priv; 522 real_priv_t *priv = demuxer->priv;
523 demux_stream_t *ds = NULL; 523 demux_stream_t *ds = NULL;
524 int len; 524 int len;
525 int timestamp; 525 int timestamp;
954 }// goto loop; 954 }// goto loop;
955 } 955 }
956 956
957 extern void print_wave_header(WAVEFORMATEX *h); 957 extern void print_wave_header(WAVEFORMATEX *h);
958 958
959 void demux_open_real(demuxer_t* demuxer) 959 static demuxer_t* demux_open_real(demuxer_t* demuxer)
960 { 960 {
961 real_priv_t* priv = demuxer->priv; 961 real_priv_t* priv = demuxer->priv;
962 int num_of_headers; 962 int num_of_headers;
963 int a_streams=0; 963 int a_streams=0;
964 int v_streams=0; 964 int v_streams=0;
1728 mp_msg(MSGT_DEMUX,MSGL_V,"VIDEO: %.4s [%08X,%08X] %dx%d (aspect %4.2f) %4.2f fps\n", 1728 mp_msg(MSGT_DEMUX,MSGL_V,"VIDEO: %.4s [%08X,%08X] %dx%d (aspect %4.2f) %4.2f fps\n",
1729 &sh->format,((unsigned int*)(sh->bih+1))[1],((unsigned int*)(sh->bih+1))[0], 1729 &sh->format,((unsigned int*)(sh->bih+1))[1],((unsigned int*)(sh->bih+1))[0],
1730 sh->disp_w,sh->disp_h,sh->aspect,sh->fps); 1730 sh->disp_w,sh->disp_h,sh->aspect,sh->fps);
1731 } 1731 }
1732 1732
1733 return demuxer;
1733 } 1734 }
1734 1735
1735 void demux_close_real(demuxer_t *demuxer) 1736 static void demux_close_real(demuxer_t *demuxer)
1736 { 1737 {
1737 int i; 1738 int i;
1738 real_priv_t* priv = demuxer->priv; 1739 real_priv_t* priv = demuxer->priv;
1739 1740
1740 if (priv){ 1741 if (priv){
1748 } 1749 }
1749 1750
1750 extern void resync_audio_stream(sh_audio_t * sh_audio); 1751 extern void resync_audio_stream(sh_audio_t * sh_audio);
1751 1752
1752 /* please upload RV10 samples WITH INDEX CHUNK */ 1753 /* please upload RV10 samples WITH INDEX CHUNK */
1753 int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags) 1754 static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
1754 { 1755 {
1755 real_priv_t *priv = demuxer->priv; 1756 real_priv_t *priv = demuxer->priv;
1756 demux_stream_t *d_audio = demuxer->audio; 1757 demux_stream_t *d_audio = demuxer->audio;
1757 demux_stream_t *d_video = demuxer->video; 1758 demux_stream_t *d_video = demuxer->video;
1758 sh_audio_t *sh_audio = d_audio->sh; 1759 sh_audio_t *sh_audio = d_audio->sh;
1836 // printf("seek: pos: %d, current packets: a: %d, v: %d\n", 1837 // printf("seek: pos: %d, current packets: a: %d, v: %d\n",
1837 // next_offset, priv->current_apacket, priv->current_vpacket); 1838 // next_offset, priv->current_apacket, priv->current_vpacket);
1838 if (next_offset) 1839 if (next_offset)
1839 stream_seek(demuxer->stream, next_offset); 1840 stream_seek(demuxer->stream, next_offset);
1840 1841
1841 demux_real_fill_buffer(demuxer); 1842 demux_real_fill_buffer(demuxer, NULL);
1842 if (sh_audio) 1843 if (sh_audio)
1843 resync_audio_stream(sh_audio); 1844 resync_audio_stream(sh_audio);
1844 return 1; 1845 return 1;
1845 } 1846 }
1846 1847
1847 int demux_real_control(demuxer_t *demuxer, int cmd, void *arg) 1848 static int demux_real_control(demuxer_t *demuxer, int cmd, void *arg)
1848 { 1849 {
1849 real_priv_t *priv = demuxer->priv; 1850 real_priv_t *priv = demuxer->priv;
1850 int lastpts = priv->v_pts ? priv->v_pts : priv->a_pts; 1851 int lastpts = priv->v_pts ? priv->v_pts : priv->a_pts;
1851 1852
1852 switch (cmd) { 1853 switch (cmd) {
1866 1867
1867 default: 1868 default:
1868 return DEMUXER_CTRL_NOTIMPL; 1869 return DEMUXER_CTRL_NOTIMPL;
1869 } 1870 }
1870 } 1871 }
1872
1873
1874 demuxer_desc_t demuxer_desc_real = {
1875 "Realmedia demuxer",
1876 "real",
1877 "REAL",
1878 "Alex Beregszasi, Florian Schneider, A'rpi, Roberto Togni",
1879 "handles new .RMF files",
1880 DEMUXER_TYPE_REAL,
1881 1, // safe autodetect
1882 real_check_file,
1883 demux_real_fill_buffer,
1884 demux_open_real,
1885 demux_close_real,
1886 demux_seek_real,
1887 demux_real_control
1888 };