Demuxer modularization

Demuxer selection by name with -demuxer command (bakward compatible)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16176 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rtognimp 2005-08-05 19:57:47 +00:00
parent adfe956dc3
commit cd68e1618b
42 changed files with 1425 additions and 1329 deletions

View File

@ -785,10 +785,12 @@ Plays a Matroska file in Japanese.
.PD 1
.
.TP
.B \-audio-demuxer <number> (\-audiofile only)
.B \-audio-demuxer <name> (\-audiofile only)
Force audio demuxer type for \-audiofile.
Give the demuxer ID as defined in libmpdemux/\:demuxer.h.
\-audio-demuxer 17 forces MP3.
Give the demuxer name as printed by \-audio-demuxer help.
For backward compatibility it also accepts the demuxer ID as defined in
libmpdemux/\:demuxer.h.
\-audio-demuxer audio or \-audio-demuxer 17 forces MP3.
.
.TP
.B \-audiofile <filename>
@ -921,10 +923,12 @@ When used with MEncoder, this is not guaranteed to work correctly
with \-ovc copy.
.
.TP
.B \-demuxer <number>
.B \-demuxer <name>
Force demuxer type.
Give the demuxer ID as defined in libmpdemux/\:demuxer.h.
\-demuxer 17 forces MP3.
Give the demuxer name as printed by \-demuxer help.
For backward compatibility it also accepts the demuxer ID as defined in
libmpdemux/\:demuxer.h.
\-demuxer audio or \-demuxer 17 forces MP3.
.
.TP
.B \-dumpaudio (MPlayer only)
@ -1579,9 +1583,11 @@ intensity of the color.
255 means white and 0 black.
.
.TP
.B \-sub-demuxer <number> (\-subfile only) (BETA CODE)
.B \-sub-demuxer <name> (\-subfile only) (BETA CODE)
Force subtitle demuxer type for \-subfile.
Give the demuxer ID as defined in subreader.h.
Give the demuxer name as printed by \-sub-demuxer help.
For backward compatibility it also accepts the demuxer ID as defined in
libmpdemux/\:demuxer.h.
.
.TP
.B \-sub-fuzziness <mode>

View File

@ -113,9 +113,9 @@
{ "audiofile", &audio_stream, CONF_TYPE_STRING, 0, 0, 0, NULL },
{ "audiofile-cache", &audio_stream_cache, CONF_TYPE_INT, CONF_RANGE, 50, 65536, NULL},
{ "subfile", &sub_stream, CONF_TYPE_STRING, 0, 0, 0, NULL },
{ "demuxer", &demuxer_type, CONF_TYPE_INT, CONF_RANGE, 1, DEMUXER_TYPE_MAX, NULL },
{ "audio-demuxer", &audio_demuxer_type, CONF_TYPE_INT, CONF_RANGE, 1, DEMUXER_TYPE_MAX, NULL },
{ "sub-demuxer", &sub_demuxer_type, CONF_TYPE_INT, CONF_RANGE, 1, DEMUXER_TYPE_MAX, NULL },
{ "demuxer", &demuxer_name, CONF_TYPE_STRING, 0, 0, 0, NULL },
{ "audio-demuxer", &audio_demuxer_name, CONF_TYPE_STRING, 0, 0, 0, NULL },
{ "sub-demuxer", &sub_demuxer_name, CONF_TYPE_STRING, 0, 0, 0, NULL },
{ "extbased", &extension_parsing, CONF_TYPE_FLAG, 0, 0, 1, NULL },
{ "noextbased", &extension_parsing, CONF_TYPE_FLAG, 0, 1, 0, NULL },

View File

@ -135,7 +135,7 @@ int asf_check_header(demuxer_t *demuxer){
mp_msg(MSGT_HEADER,MSGL_V,"ASF_check: invalid subchunks_no %d\n",(int) asfh.cno);
return 0; // invalid header???
}
return 1;
return DEMUXER_TYPE_ASF;
}
extern void print_wave_header(WAVEFORMATEX *h);

View File

@ -64,7 +64,7 @@ static int demux_aac_init(demuxer_t *demuxer)
return 1;
}
void demux_close_aac(demuxer_t *demuxer)
static void demux_close_aac(demuxer_t *demuxer)
{
aac_priv_t *priv = (aac_priv_t *) demuxer->priv;
@ -79,8 +79,8 @@ void demux_close_aac(demuxer_t *demuxer)
return;
}
/// returns 1 if it finds 8 ADTS frames in 32768 bytes, 0 otherwise
int demux_aac_probe(demuxer_t *demuxer)
/// returns DEMUXER_TYPE_AAC if it finds 8 ADTS frames in 32768 bytes, 0 otherwise
static int demux_aac_probe(demuxer_t *demuxer)
{
int cnt = 0, c, len, srate, num;
off_t init, probed;
@ -122,14 +122,14 @@ int demux_aac_probe(demuxer_t *demuxer)
goto fail;
mp_msg(MSGT_DEMUX, MSGL_V, "demux_aac_probe, INIT: %llu, PROBED: %llu, cnt: %d\n", init, probed, cnt);
return 1;
return DEMUXER_TYPE_AAC;
fail:
mp_msg(MSGT_DEMUX, MSGL_V, "demux_aac_probe, failed to detect an AAC stream\n");
return 0;
}
int demux_aac_open(demuxer_t *demuxer)
static demuxer_t* demux_aac_open(demuxer_t *demuxer)
{
sh_audio_t *sh;
@ -140,10 +140,10 @@ int demux_aac_open(demuxer_t *demuxer)
demuxer->filepos = stream_tell(demuxer->stream);
return 1;
return demuxer;
}
int demux_aac_fill_buffer(demuxer_t *demuxer)
static int demux_aac_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
aac_priv_t *priv = (aac_priv_t *) demuxer->priv;
demux_packet_t *dp;
@ -209,7 +209,7 @@ int demux_aac_fill_buffer(demuxer_t *demuxer)
//This is an almost verbatim copy of high_res_mp3_seek(), from demux_audio.c
void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
static void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
aac_priv_t *priv = (aac_priv_t *) demuxer->priv;
demux_stream_t *d_audio=demuxer->audio;
@ -251,3 +251,19 @@ void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
resync_audio_stream(sh_audio);
}
demuxer_desc_t demuxer_desc_aac = {
"AAC demuxer",
"aac",
"AAC",
"Nico Sabbi",
"Raw AAC files ",
DEMUXER_TYPE_AAC,
0, // unsafe autodetect
demux_aac_probe,
demux_aac_fill_buffer,
demux_aac_open,
demux_close_aac,
demux_aac_seek,
NULL
};

View File

@ -38,6 +38,8 @@ extern int asf_scrambling_b;
extern int asf_packetsize;
extern double asf_packetrate;
extern int asf_movielength;
extern int asf_check_header(demuxer_t *demuxer);
extern int read_asf_header(demuxer_t *demuxer);
// based on asf file-format doc by Eugene [http://divx.euro.ru]
@ -140,7 +142,7 @@ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,in
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_asf_fill_buffer(demuxer_t *demux){
static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
demux->filepos=stream_tell(demux->stream);
// Brodcast stream have movi_start==movi_end
@ -360,7 +362,7 @@ int demux_asf_fill_buffer(demuxer_t *demux){
extern void resync_audio_stream(sh_audio_t *sh_audio);
extern void skip_audio_frame(sh_audio_t *sh_audio);
void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=d_audio->sh;
@ -412,7 +414,7 @@ void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
}
int demux_asf_control(demuxer_t *demuxer,int cmd, void *arg){
static int demux_asf_control(demuxer_t *demuxer,int cmd, void *arg){
/* demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=d_audio->sh;
@ -430,3 +432,58 @@ int demux_asf_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
}
static demuxer_t* demux_open_asf(demuxer_t* demuxer)
{
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
//---- ASF header:
read_asf_header(demuxer);
stream_reset(demuxer->stream);
stream_seek(demuxer->stream,demuxer->movi_start);
// demuxer->idx_pos=0;
// demuxer->endpos=avi_header.movi_end;
if(demuxer->video->id != -2) {
if(!ds_fill_buffer(demuxer->video)){
mp_msg(MSGT_DEMUXER,MSGL_WARN,"ASF: " MSGTR_MissingVideoStream);
demuxer->video->sh=NULL;
//printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
} else {
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
//sh_video->i_bps=10*asf_packetsize; // FIXME!
}
}
if(demuxer->audio->id!=-2){
mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_ASFSearchingForAudioStream,demuxer->audio->id);
if(!ds_fill_buffer(demuxer->audio)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"ASF: " MSGTR_MissingAudioStream);
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
sh_audio->format=sh_audio->wf->wFormatTag;
}
}
return demuxer;
}
demuxer_desc_t demuxer_desc_asf = {
"ASF demuxer",
"asv",
"ASF",
"A'rpi",
"ASF, WMV, WMA",
DEMUXER_TYPE_ASF,
1, // safe autodetect
asf_check_header,
demux_asf_fill_buffer,
demux_open_asf,
NULL, //demux_close_asf,
demux_seek_asf,
demux_asf_control
};

View File

@ -131,7 +131,7 @@ static mp3_hdr_t *add_mp3_hdr(mp3_hdr_t **list, off_t st_pos,
return NULL;
}
int demux_audio_open(demuxer_t* demuxer) {
static int demux_audio_open(demuxer_t* demuxer) {
stream_t *s;
sh_audio_t* sh_audio;
uint8_t hdr[HDR_SIZE];
@ -383,11 +383,11 @@ int demux_audio_open(demuxer_t* demuxer) {
mp_msg(MSGT_DEMUX,MSGL_V,"demux_audio: audio data 0x%X - 0x%X \n",(int)demuxer->movi_start,(int)demuxer->movi_end);
return 1;
return DEMUXER_TYPE_AUDIO;
}
int demux_audio_fill_buffer(demux_stream_t *ds) {
static int demux_audio_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) {
int l;
demux_packet_t* dp;
sh_audio_t* sh_audio;
@ -471,7 +471,7 @@ static void high_res_mp3_seek(demuxer_t *demuxer,float time) {
}
}
void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
sh_audio_t* sh_audio;
stream_t* s;
int base,pos;
@ -527,7 +527,7 @@ void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
}
void demux_close_audio(demuxer_t* demuxer) {
static void demux_close_audio(demuxer_t* demuxer) {
da_priv_t* priv = demuxer->priv;
if(!priv)
@ -535,7 +535,7 @@ void demux_close_audio(demuxer_t* demuxer) {
free(priv);
}
int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){
static int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){
sh_audio_t *sh_audio=demuxer->audio->sh;
int audio_length = demuxer->movi_end / sh_audio->i_bps;
da_priv_t* priv = demuxer->priv;
@ -556,3 +556,20 @@ int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
}
demuxer_desc_t demuxer_desc_audio = {
"Audio demuxer",
"audio",
"Audio file",
"?",
"Audio only files",
DEMUXER_TYPE_AUDIO,
0, // unsafe autodetect
demux_audio_open,
demux_audio_fill_buffer,
NULL,
demux_close_audio,
demux_audio_seek,
demux_audio_control
};

View File

@ -14,6 +14,9 @@
#include "aviheader.h"
extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer);
extern int demux_ogg_open(demuxer_t* demuxer);
// PTS: 0=interleaved 1=BPS-based
int pts_from_bps=1;
@ -173,7 +176,7 @@ static int demux_avi_read_packet(demuxer_t *demux,demux_stream_t *ds,unsigned in
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_avi_fill_buffer(demuxer_t *demux){
static int demux_avi_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
avi_priv_t *priv=demux->priv;
unsigned int id=0;
unsigned int len;
@ -430,7 +433,7 @@ int force_ni=0; // force non-interleaved AVI parsing
void read_avi_header(demuxer_t *demuxer,int index_mode);
demuxer_t* demux_open_avi(demuxer_t* demuxer){
static demuxer_t* demux_open_avi(demuxer_t* demuxer){
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=NULL;
@ -856,3 +859,70 @@ int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
}
static int avi_check_file(demuxer_t *demuxer)
{
int id=stream_read_dword_le(demuxer->stream); // "RIFF"
if((id==mmioFOURCC('R','I','F','F')) || (id==mmioFOURCC('O','N','2',' '))) {
stream_read_dword_le(demuxer->stream); //filesize
id=stream_read_dword_le(demuxer->stream); // "AVI "
if(id==formtypeAVI)
return DEMUXER_TYPE_AVI;
if(id==mmioFOURCC('O','N','2','f')){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"ON2 AVI format");
return DEMUXER_TYPE_AVI;
}
}
return 0;
}
static demuxer_t* demux_open_hack_avi(demuxer_t *demuxer)
{
sh_audio_t* sh_a;
demuxer = (demuxer_t*) demux_open_avi(demuxer);
if(!demuxer) return NULL; // failed to open
sh_a = (sh_audio_t*)demuxer->audio->sh;
if(demuxer->audio->id != -2 && sh_a) {
#ifdef HAVE_OGGVORBIS
// support for Ogg-in-AVI:
if(sh_a->format == 0xFFFE)
demuxer = init_avi_with_ogg(demuxer);
else if(sh_a->format == 0x674F) {
stream_t* s;
demuxer_t *od;
s = new_ds_stream(demuxer->audio);
od = new_demuxer(s,DEMUXER_TYPE_OGG,-1,-2,-2,NULL);
if(!demux_ogg_open(od)) {
mp_msg( MSGT_DEMUXER,MSGL_ERR,MSGTR_ErrorOpeningOGGDemuxer);
free_stream(s);
demuxer->audio->id = -2;
} else
demuxer = new_demuxers_demuxer(demuxer,od,demuxer);
}
#endif
}
return demuxer;
}
demuxer_desc_t demuxer_desc_avi = {
"AVI demuxer",
"avi",
"AVI",
"Arpi?",
"AVI files, including non interleaved files",
DEMUXER_TYPE_AVI,
1, // safe autodetect
avi_check_file,
demux_avi_fill_buffer,
demux_open_hack_avi,
demux_close_avi,
demux_seek_avi,
NULL
};

View File

@ -162,7 +162,7 @@ static __inline int get_mmioFOURCC(const AVS_VideoInfo *v)
}
#endif
int demux_avs_fill_buffer(demuxer_t *demuxer)
static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
AVS_VideoFrame *curr_frame;
demux_packet_t *dp = NULL;
@ -219,7 +219,7 @@ int demux_avs_fill_buffer(demuxer_t *demuxer)
return 1;
}
int demux_open_avs(demuxer_t* demuxer)
static demuxer_t* demux_open_avs(demuxer_t* demuxer)
{
sh_video_t *sh_video = NULL;
#ifdef ENABLE_AUDIO
@ -236,14 +236,14 @@ int demux_open_avs(demuxer_t* demuxer)
if(!AVS->clip)
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
return 0;
return NULL;
}
AVS->video_info = AVS->avs_get_video_info(AVS->clip);
if (!AVS->video_info)
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
return 0;
return NULL;
}
if (!avs_is_yv12(AVS->video_info))
@ -252,7 +252,7 @@ int demux_open_avs(demuxer_t* demuxer)
if (avs_is_error(AVS->handler))
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Cannot convert input video to YV12: %s\n", avs_as_string(AVS->handler));
return 0;
return NULL;
}
AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
@ -260,14 +260,14 @@ int demux_open_avs(demuxer_t* demuxer)
if(!AVS->clip)
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
return 0;
return NULL;
}
AVS->video_info = AVS->avs_get_video_info(AVS->clip);
if (!AVS->video_info)
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
return 0;
return NULL;
}
}
@ -326,10 +326,13 @@ int demux_open_avs(demuxer_t* demuxer)
#endif
AVS->init = 1;
return found;
if (found)
return demuxer;
else
return NULL;
}
int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
{
demux_stream_t *d_video=demuxer->video;
sh_video_t *sh_video=d_video->sh;
@ -354,7 +357,7 @@ int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
}
}
void demux_close_avs(demuxer_t* demuxer)
static void demux_close_avs(demuxer_t* demuxer)
{
AVS_T *AVS = (AVS_T *) demuxer->priv;
// TODO release_clip?
@ -372,7 +375,7 @@ void demux_close_avs(demuxer_t* demuxer)
}
}
void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs,int flags)
static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs,int flags)
{
demux_stream_t *d_video=demuxer->video;
sh_video_t *sh_video=d_video->sh;
@ -394,11 +397,11 @@ void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs,int flags)
d_video->pts=AVS->frameno / sh_video->fps; // OSD
}
int avs_check_file(demuxer_t *demuxer, const char *filename)
static int avs_check_file(demuxer_t *demuxer)
{
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_check_file - attempting to open file %s\n", filename);
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_check_file - attempting to open file %s\n", demuxer->filename);
if (!filename) return 0;
if (!demuxer->filename) return 0;
/* Avoid crazy memory eating when passing an mpg stream */
if (demuxer->movi_end > MAX_AVS_SIZE)
@ -407,13 +410,30 @@ int avs_check_file(demuxer_t *demuxer, const char *filename)
return 0;
}
demuxer->priv = initAVS(filename);
demuxer->priv = initAVS(demuxer->filename);
if (demuxer->priv)
{
mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init Ok\n");
return 1;
return DEMUXER_TYPE_AVS;
}
mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init failed\n");
return 0;
}
demuxer_desc_t demuxer_desc_avs = {
"Avisynth demuxer",
"avs",
"AVS",
"Gianluigi Tiesi",
"Requires binary dll",
DEMUXER_TYPE_AVS,
0, // unsafe autodetect
avs_check_file,
demux_avs_fill_buffer,
demux_open_avs,
demux_close_avs,
demux_seek_avs,
demux_avs_control
};

View File

@ -13,6 +13,7 @@ typedef struct dd_priv {
demuxer_t* sd;
} dd_priv_t;
extern demuxer_desc_t demuxer_desc_demuxers;
demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
demuxer_t* ret;
@ -34,11 +35,13 @@ demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
ret->video = vd->video;
ret->audio = ad->audio;
ret->sub = sd->sub;
ret->desc = &demuxer_desc_demuxers;
return ret;
}
int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
dd_priv_t* priv;
priv=demux->priv;
@ -54,7 +57,7 @@ int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
return 0;
}
void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
dd_priv_t* priv;
float pos;
priv=demuxer->priv;
@ -81,7 +84,7 @@ void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
}
void demux_close_demuxers(demuxer_t* demuxer) {
static void demux_close_demuxers(demuxer_t* demuxer) {
int i;
dd_priv_t* priv = demuxer->priv;
stream_t *s;
@ -109,3 +112,19 @@ void demux_close_demuxers(demuxer_t* demuxer) {
free(demuxer);
}
demuxer_desc_t demuxer_desc_demuxers = {
"Demuxers demuxer",
"", // Not selectable
"",
"?",
"internal use only",
DEMUXER_TYPE_DEMUXERS,
0, // no autodetect
NULL,
demux_demuxers_fill_buffer,
NULL,
demux_close_demuxers,
demux_demuxers_seek,
NULL
};

View File

@ -46,7 +46,7 @@ typedef struct _film_data_t
unsigned int film_version;
} film_data_t;
void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, int flags)
static void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
film_data_t *film_data = (film_data_t *)demuxer->priv;
int new_current_chunk=(flags&1)?0:film_data->current_chunk;
@ -83,7 +83,7 @@ printf (" (flags = %X) actual new chunk = %d (syncinfo1 = %08X)\n",
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_film_fill_buffer(demuxer_t *demuxer)
static int demux_film_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
int i;
unsigned char byte_swap;
@ -206,7 +206,7 @@ int demux_film_fill_buffer(demuxer_t *demuxer)
return 1;
}
demuxer_t* demux_open_film(demuxer_t* demuxer)
static demuxer_t* demux_open_film(demuxer_t* demuxer)
{
sh_video_t *sh_video = NULL;
sh_audio_t *sh_audio = NULL;
@ -436,7 +436,7 @@ demuxer_t* demux_open_film(demuxer_t* demuxer)
return demuxer;
}
void demux_close_film(demuxer_t* demuxer) {
static void demux_close_film(demuxer_t* demuxer) {
film_data_t *film_data = demuxer->priv;
if(!film_data)
@ -446,3 +446,31 @@ void demux_close_film(demuxer_t* demuxer) {
free(film_data);
}
static int film_check_file(demuxer_t* demuxer)
{
int signature=stream_read_fourcc(demuxer->stream);
// check for the FILM file magic number
if(signature==mmioFOURCC('F', 'I', 'L', 'M'))
return DEMUXER_TYPE_FILM;
return 0;
}
demuxer_desc_t demuxer_desc_film = {
"FILM/CPK demuxer for Sega Saturn CD-ROM games",
"film",
"FILM",
"Mike Melanson",
"",
DEMUXER_TYPE_FILM,
0, // unsafe autodetect (short signature)
film_check_file,
demux_film_fill_buffer,
demux_open_film,
demux_close_film,
demux_seek_film,
NULL
};

View File

@ -22,7 +22,7 @@ typedef struct _fli_frames_t {
unsigned int *frame_size;
} fli_frames_t;
void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags){
fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
sh_video_t *sh_video = demuxer->video->sh;
int newpos=(flags&1)?0:frames->current_frame;
@ -41,7 +41,7 @@ void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags){
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_fli_fill_buffer(demuxer_t *demuxer){
static int demux_fli_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
sh_video_t *sh_video = demuxer->video->sh;
@ -67,7 +67,7 @@ int demux_fli_fill_buffer(demuxer_t *demuxer){
return 1;
}
demuxer_t* demux_open_fli(demuxer_t* demuxer){
static demuxer_t* demux_open_fli(demuxer_t* demuxer){
sh_video_t *sh_video = NULL;
fli_frames_t *frames = (fli_frames_t *)malloc(sizeof(fli_frames_t));
int frame_number;
@ -164,7 +164,7 @@ demuxer_t* demux_open_fli(demuxer_t* demuxer){
return demuxer;
}
void demux_close_fli(demuxer_t* demuxer) {
static void demux_close_fli(demuxer_t* demuxer) {
fli_frames_t *frames = demuxer->priv;
if(!frames)
@ -178,3 +178,34 @@ void demux_close_fli(demuxer_t* demuxer) {
free(frames);
}
static int fli_check_file(demuxer_t* demuxer)
{
int id;
stream_seek(demuxer->stream, 4);
id=stream_read_word_le(demuxer->stream);
// check for the FLI file magic number
if((id==0xAF11) || (id==0xAF12))
return DEMUXER_TYPE_FLI;
return 0;
}
demuxer_desc_t demuxer_desc_fli = {
"Autodesk FLIC demuxer",
"fli",
"FLI",
"Mike Melanson",
"Supports also some extensions",
DEMUXER_TYPE_FLI,
0, // unsafe autodetect (short signature)
fli_check_file,
demux_fli_fill_buffer,
demux_open_fli,
demux_close_fli,
demux_seek_fli,
NULL
};

View File

@ -31,14 +31,14 @@ int my_read_gif(GifFileType *gif, uint8_t *buf, int len) {
}
#endif
int gif_check_file(demuxer_t *demuxer)
static int gif_check_file(demuxer_t *demuxer)
{
if (stream_read_int24(demuxer->stream) == GIF_SIGNATURE)
return 1;
return DEMUXER_TYPE_GIF;
return 0;
}
int demux_gif_fill_buffer(demuxer_t *demuxer)
static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
GifFileType *gif = (GifFileType *)demuxer->priv;
sh_video_t *sh_video = (sh_video_t *)demuxer->video->sh;
@ -148,7 +148,7 @@ int demux_gif_fill_buffer(demuxer_t *demuxer)
return 1;
}
demuxer_t* demux_open_gif(demuxer_t* demuxer)
static demuxer_t* demux_open_gif(demuxer_t* demuxer)
{
sh_video_t *sh_video = NULL;
GifFileType *gif = NULL;
@ -206,7 +206,7 @@ demuxer_t* demux_open_gif(demuxer_t* demuxer)
return demuxer;
}
void demux_close_gif(demuxer_t* demuxer)
static void demux_close_gif(demuxer_t* demuxer)
{
GifFileType *gif = (GifFileType *)demuxer->priv;
@ -219,4 +219,22 @@ void demux_close_gif(demuxer_t* demuxer)
demuxer->stream->fd = 0;
demuxer->priv = NULL;
}
demuxer_desc_t demuxer_desc_gif = {
"GIF demuxer",
"gif",
"GIF",
"Joey Parrish",
"",
DEMUXER_TYPE_GIF,
0, // unsafe autodetect
gif_check_file,
demux_gif_fill_buffer,
demux_open_gif,
demux_close_gif,
NULL,
NULL
};
#endif /* HAVE_GIF */

View File

@ -101,7 +101,7 @@ static URLProtocol mp_protocol = {
mp_close,
};
int lavf_check_file(demuxer_t *demuxer){
static int lavf_check_file(demuxer_t *demuxer){
AVProbeData avpd;
uint8_t buf[PROBE_BUF_SIZE];
lavf_priv_t *priv;
@ -125,10 +125,10 @@ int lavf_check_file(demuxer_t *demuxer){
}else
mp_msg(MSGT_HEADER,MSGL_V,"LAVF_check: %s\n", priv->avif->long_name);
return 1;
return DEMUXER_TYPE_LAVF;
}
int demux_open_lavf(demuxer_t *demuxer){
static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
AVFormatContext *avfc;
AVFormatParameters ap;
lavf_priv_t *priv= demuxer->priv;
@ -152,14 +152,14 @@ int demux_open_lavf(demuxer_t *demuxer){
if(av_open_input_stream(&avfc, &priv->pb, mp_filename, priv->avif, &ap)<0){
mp_msg(MSGT_HEADER,MSGL_ERR,"LAVF_header: av_open_input_stream() failed\n");
return 0;
return NULL;
}
priv->avfc= avfc;
if(av_find_stream_info(avfc) < 0){
mp_msg(MSGT_HEADER,MSGL_ERR,"LAVF_header: av_find_stream_info() failed\n");
return 0;
return NULL;
}
if(avfc->title [0]) demux_info_add(demuxer, "name" , avfc->title );
@ -304,15 +304,15 @@ int demux_open_lavf(demuxer_t *demuxer){
if(!priv->video_streams){
if(!priv->audio_streams){
mp_msg(MSGT_HEADER,MSGL_ERR,"LAVF: no audio or video headers found - broken file?\n");
return 0;
return NULL;
}
demuxer->video->id=-2; // audio-only
} //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
return 1;
return demuxer;
}
int demux_lavf_fill_buffer(demuxer_t *demux){
static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
lavf_priv_t *priv= demux->priv;
AVPacket pkt;
demux_packet_t *dp;
@ -382,7 +382,7 @@ int demux_lavf_fill_buffer(demuxer_t *demux){
return 1;
}
void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, int flags){
static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, int flags){
lavf_priv_t *priv = demuxer->priv;
mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %d)\n", demuxer, rel_seek_secs, flags);
@ -393,7 +393,7 @@ void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, int flags){
#endif
}
int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
{
lavf_priv_t *priv = demuxer->priv;
@ -417,7 +417,7 @@ int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
}
}
void demux_close_lavf(demuxer_t *demuxer)
static void demux_close_lavf(demuxer_t *demuxer)
{
lavf_priv_t* priv = demuxer->priv;
if (priv){
@ -429,4 +429,21 @@ void demux_close_lavf(demuxer_t *demuxer)
}
}
demuxer_desc_t demuxer_desc_lavf = {
"libavformat demuxer",
"lavf",
"libavformat",
"Michael Niedermayer",
"supports many formats, requires libavformat",
DEMUXER_TYPE_LAVF,
0, // Check after other demuxer
lavf_check_file,
demux_lavf_fill_buffer,
demux_open_lavf,
demux_close_lavf,
demux_seek_lavf,
demux_lavf_control
};
#endif // USE_LIBAVFORMAT

View File

@ -158,7 +158,7 @@ static int getFrame(demuxer_t *demuxer, FrameInfo *frameInfo)
return 1;
}
int lmlm4_check_file(demuxer_t* demuxer)
static int lmlm4_check_file(demuxer_t* demuxer)
{
FrameInfo frameInfo;
unsigned int first;
@ -198,7 +198,7 @@ int lmlm4_check_file(demuxer_t* demuxer)
// stream_reset(demuxer->stream);
mp_msg(MSGT_DEMUX, MSGL_V, "LMLM4 Stream Format found\n");
return 1;
return DEMUXER_TYPE_LMLM4;
}
static int video = 0;
@ -207,7 +207,7 @@ static int frames= 0;
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_lmlm4_fill_buffer(demuxer_t *demux)
static int demux_lmlm4_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
{
FrameInfo frameInfo;
double pts;
@ -277,7 +277,9 @@ hdr:
return 1;
}
int demux_open_lmlm4(demuxer_t* demuxer){
static demuxer_t* demux_open_lmlm4(demuxer_t* demuxer){
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
#if 0
sh_video_t* sh_video;
@ -327,13 +329,43 @@ int demux_open_lmlm4(demuxer_t* demuxer){
demuxer->seekable = 0;
if(!ds_fill_buffer(demuxer->video)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"LMLM4: " MSGTR_MissingVideoStream);
demuxer->video->sh=NULL;
} else {
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
}
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"LMLM4: " MSGTR_MissingAudioStream);
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
}
}
return 1;
return demuxer;
}
void demux_close_lmlm4(demuxer_t *demuxer)
static void demux_close_lmlm4(demuxer_t *demuxer)
{
// printf("Close LMLM4 Stream\n");
return;
}
demuxer_desc_t demuxer_desc_lmlm4 = {
"LMLM4 MPEG4 Compression Card stream demuxer",
"lmlm4",
"RAW LMLM4",
"Maxim Yevtyushkin",
"",
DEMUXER_TYPE_LMLM4,
0, // unsafe autodetect
lmlm4_check_file,
demux_lmlm4_fill_buffer,
demux_open_lmlm4,
demux_close_lmlm4,
NULL,
NULL
};

View File

@ -15,7 +15,7 @@
#include "stheader.h"
#include "mf.h"
void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,int flags){
mf_t * mf = (mf_t *)demuxer->priv;
sh_video_t * sh_video = demuxer->video->sh;
int newpos = (flags & 1)?0:mf->curr_frame;
@ -30,7 +30,7 @@ void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,int flags){
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_mf_fill_buffer(demuxer_t *demuxer){
static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
mf_t * mf;
struct stat fs;
FILE * f;
@ -62,7 +62,7 @@ int demux_mf_fill_buffer(demuxer_t *demuxer){
return 1;
}
demuxer_t* demux_open_mf(demuxer_t* demuxer){
static demuxer_t* demux_open_mf(demuxer_t* demuxer){
sh_video_t *sh_video = NULL;
mf_t *mf = NULL;
@ -130,10 +130,27 @@ demuxer_t* demux_open_mf(demuxer_t* demuxer){
return demuxer;
}
void demux_close_mf(demuxer_t* demuxer) {
static void demux_close_mf(demuxer_t* demuxer) {
mf_t *mf = demuxer->priv;
if(!mf)
return;
free(mf);
}
demuxer_desc_t demuxer_desc_mf = {
"mf demuxer",
"mf",
"MF",
"?",
"multiframe?, pictures demuxer",
DEMUXER_TYPE_MF,
0, // no autodetect
NULL,
demux_mf_fill_buffer,
demux_open_mf,
demux_close_mf,
demux_seek_mf,
NULL
};

View File

@ -2067,7 +2067,7 @@ demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track)
return 0;
}
void demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags);
static void demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags);
/** \brief Given a matroska track number and type, find the id that mplayer would ask for.
* \param d The demuxer for which the subtitle id should be returned.
@ -2088,7 +2088,7 @@ static int demux_mkv_reverse_id(mkv_demuxer_t *d, int num, int type)
return -1;
}
int
static int
demux_mkv_open (demuxer_t *demuxer)
{
stream_t *s = demuxer->stream;
@ -2344,10 +2344,10 @@ demux_mkv_open (demuxer_t *demuxer)
}
}
return 1;
return DEMUXER_TYPE_MATROSKA;
}
void
static void
demux_close_mkv (demuxer_t *demuxer)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
@ -2986,8 +2986,8 @@ handle_block (demuxer_t *demuxer, uint8_t *block, uint64_t length,
return 0;
}
int
demux_mkv_fill_buffer (demuxer_t *demuxer)
static int
demux_mkv_fill_buffer (demuxer_t *demuxer, demux_stream_t *ds)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
stream_t *s = demuxer->stream;
@ -3100,7 +3100,7 @@ demux_mkv_fill_buffer (demuxer_t *demuxer)
return 0;
}
void
static void
demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
{
free_cached_dps (demuxer);
@ -3216,7 +3216,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
if (target_timecode <= mkv_d->last_pts * 1000)
clear_subtitles(demuxer, 0, 1);
demux_mkv_fill_buffer(demuxer);
demux_mkv_fill_buffer(demuxer, NULL);
if(demuxer->audio->sh != NULL)
resync_audio_stream((sh_audio_t *) demuxer->audio->sh);
@ -3262,14 +3262,14 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
if (index->timecode <= mkv_d->last_pts * 1000)
clear_subtitles(demuxer, 0, 1);
demux_mkv_fill_buffer(demuxer);
demux_mkv_fill_buffer(demuxer, NULL);
if(demuxer->audio->sh != NULL)
resync_audio_stream((sh_audio_t *) demuxer->audio->sh);
}
}
int
static int
demux_mkv_control (demuxer_t *demuxer, int cmd, void *arg)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
@ -3433,4 +3433,21 @@ demux_mkv_get_sub_lang(demuxer_t *demuxer, int track_num, char *lang,
}
}
demuxer_desc_t demuxer_desc_matroska = {
"Matroska demuxer",
"mkv",
"Matroska",
"Aurelien Jacobs",
"based on gstreamer demuxer by Ronald Bultje and demux_mkv.cpp by Moritz Bunkus",
DEMUXER_TYPE_MATROSKA,
1, // safe autodetect
demux_mkv_open,
demux_mkv_fill_buffer,
NULL,
demux_close_mkv,
demux_mkv_seek,
demux_mkv_control
};
#endif /* HAVE_MATROSKA */

View File

@ -287,7 +287,7 @@ typedef struct {
#define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d))
int mov_check_file(demuxer_t* demuxer){
static int mov_check_file(demuxer_t* demuxer){
int flags=0;
int no=0;
mov_priv_t* priv=malloc(sizeof(mov_priv_t));
@ -460,7 +460,7 @@ int mov_check_file(demuxer_t* demuxer){
if(flags==3){
// if we're over the headers, then we can stop parsing here!
demuxer->priv=priv;
return 1;
return DEMUXER_TYPE_MOV;
}
break;
case MOV_FOURCC('f','r','e','e'):
@ -485,12 +485,12 @@ skip_chunk:
if(flags==3){
demuxer->priv=priv;
return 1;
return DEMUXER_TYPE_MOV;
}
free(priv);
if ((flags==5) || (flags==7)) // reference & header sent
return 1;
return DEMUXER_TYPE_MOV;
if(flags==1)
mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: missing data (mdat) chunk! Maybe broken file...\n");
@ -500,7 +500,7 @@ skip_chunk:
return 0;
}
void demux_close_mov(demuxer_t *demuxer) {
static void demux_close_mov(demuxer_t *demuxer) {
mov_priv_t* priv = demuxer->priv;
int i;
if (!priv)
@ -1681,7 +1681,7 @@ static int lschunks_intrak(demuxer_t* demuxer, int level, unsigned int id,
return 0;
}
int mov_read_header(demuxer_t* demuxer){
static demuxer_t* mov_read_header(demuxer_t* demuxer){
mov_priv_t* priv=demuxer->priv;
int t_no;
int best_a_id=-1, best_a_len=0;
@ -1806,7 +1806,7 @@ int mov_read_header(demuxer_t* demuxer){
demuxer->stream->eof = 0;
#endif
return 1;
return demuxer;
}
/**
@ -1824,7 +1824,7 @@ static mov_track_t *stream_track(mov_priv_t *priv, demux_stream_t *ds) {
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_mov_fill_buffer(demuxer_t *demuxer,demux_stream_t* ds){
static int demux_mov_fill_buffer(demuxer_t *demuxer,demux_stream_t* ds){
mov_priv_t* priv=demuxer->priv;
mov_track_t* trak=NULL;
float pts;
@ -1956,7 +1956,7 @@ if(trak->samplesize){
return pts;
}
void demux_seek_mov(demuxer_t *demuxer,float pts,int flags){
static void demux_seek_mov(demuxer_t *demuxer,float pts,int flags){
mov_priv_t* priv=demuxer->priv;
demux_stream_t* ds;
mov_track_t* trak;
@ -1984,7 +1984,7 @@ void demux_seek_mov(demuxer_t *demuxer,float pts,int flags){
}
int demux_mov_control(demuxer_t *demuxer, int cmd, void *arg){
static int demux_mov_control(demuxer_t *demuxer, int cmd, void *arg){
mov_track_t* track;
// try the video track
@ -2015,3 +2015,19 @@ int demux_mov_control(demuxer_t *demuxer, int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
demuxer_desc_t demuxer_desc_mov = {
"Quicktime/MP4 demuxer",
"mov",
"Quicktime/MOV",
"Arpi, Al3x, Atmos, others",
"Handles Quicktime, MP4, 3GP",
DEMUXER_TYPE_MOV,
0, // slow autodetect
mov_check_file,
demux_mov_fill_buffer,
mov_read_header,
demux_close_mov,
demux_seek_mov,
demux_mov_control
};

View File

@ -46,7 +46,7 @@ static uint32_t get_bits(da_priv_t* priv, stream_t* s, int bits) {
return out & mask;
}
int demux_mpc_open(demuxer_t* demuxer) {
static int demux_mpc_open(demuxer_t* demuxer) {
stream_t *s = demuxer->stream;
sh_audio_t* sh_audio;
uint8_t hdr[HDR_SIZE];
@ -101,10 +101,10 @@ int demux_mpc_open(demuxer_t* demuxer) {
sh_audio->audio.dwScale = 32 * 36;
sh_audio->audio.dwRate = sh_audio->samplerate;
return 1;
return DEMUXER_TYPE_MPC;
}
int demux_mpc_fill_buffer(demux_stream_t *ds) {
static int demux_mpc_fill_buffer(demux_stream_t *ds, demux_stream_t *dsds) {
int l;
int bit_len;
demux_packet_t* dp;
@ -134,11 +134,11 @@ int demux_mpc_fill_buffer(demux_stream_t *ds) {
return 1;
}
void demux_mpc_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_mpc_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
// TODO
}
void demux_close_mpc(demuxer_t* demuxer) {
static void demux_close_mpc(demuxer_t* demuxer) {
da_priv_t* priv = demuxer->priv;
if(!priv)
@ -146,6 +146,23 @@ void demux_close_mpc(demuxer_t* demuxer) {
free(priv);
}
int demux_mpc_control(demuxer_t *demuxer,int cmd, void *arg){
static int demux_mpc_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
demuxer_desc_t demuxer_desc_mpc = {
"Musepack demuxer",
"mpc",
"MPC",
"Reza Jelveh, Reimar Doeffinger",
"supports v7 bitstream only",
DEMUXER_TYPE_MPC,
0, // unsafe autodetect
demux_mpc_open,
demux_mpc_fill_buffer,
NULL,
demux_close_mpc,
demux_mpc_seek,
demux_mpc_control
};

View File

@ -99,7 +99,7 @@ static int parse_psm(demuxer_t *demux, int len) {
}
/// Open an mpg physical stream
int demux_mpg_open(demuxer_t* demuxer) {
static demuxer_t* demux_mpg_open(demuxer_t* demuxer) {
stream_t *s = demuxer->stream;
off_t pos = stream_tell(s);
off_t end_seq_start = demuxer->movi_end-500000; // 500000 is a wild guess
@ -134,10 +134,10 @@ int demux_mpg_open(demuxer_t* demuxer) {
stream_seek(s,pos);
ds_fill_buffer(demuxer->video);
}
return 1;
return demuxer;
}
void demux_close_mpg(demuxer_t* demuxer) {
static void demux_close_mpg(demuxer_t* demuxer) {
mpg_demuxer_t* mpg_d = demuxer->priv;
if (mpg_d) free(mpg_d);
}
@ -418,7 +418,7 @@ static int num_h264_pps=0;
static int num_mp3audio_packets=0;
int demux_mpg_probe(demuxer_t *demuxer) {
static int demux_mpg_probe(demuxer_t *demuxer) {
int pes=1;
int tmp;
off_t tmppos;
@ -498,7 +498,7 @@ int demux_mpg_probe(demuxer_t *demuxer) {
return file_format;
}
int demux_mpg_es_fill_buffer(demuxer_t *demux){
static int demux_mpg_es_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
// Elementary video stream
if(demux->stream->eof) return 0;
demux->filepos=stream_tell(demux->stream);
@ -506,7 +506,7 @@ int demux_mpg_es_fill_buffer(demuxer_t *demux){
return 1;
}
int demux_mpg_fill_buffer(demuxer_t *demux){
int demux_mpg_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
unsigned int head=0;
int skipped=0;
int max_packs=256; // 512kbyte
@ -770,3 +770,126 @@ int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
}
static int demux_mpg_pes_probe(demuxer_t *demuxer) {
demuxer->synced = 3;
return demux_mpg_probe(demuxer);
}
static demuxer_t* demux_mpg_es_open(demuxer_t* demuxer)
{
sh_video_t *sh_video=NULL;
demuxer->audio->sh = NULL; // ES streams has no audio channel
demuxer->video->sh = new_sh_video(demuxer,0); // create dummy video stream header, id=0
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
return demuxer;
}
static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer)
{
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: " MSGTR_MissingAudioStream);
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
}
}
return demuxer;
}
demuxer_desc_t demuxer_desc_mpeg_ps = {
"MPEG PS demuxer",
"mpegps",
"MPEG-PS",
"Arpi?",
"Mpeg",
DEMUXER_TYPE_MPEG_PS,
0, // unsafe autodetect
demux_mpg_probe,
demux_mpg_fill_buffer,
demux_mpg_ps_open,
demux_close_mpg,
demux_seek_mpg,
NULL
};
demuxer_desc_t demuxer_desc_mpeg_pes = {
"MPEG PES demuxer",
"mpegpes",
"MPEG-PES",
"Arpi?",
"Mpeg",
DEMUXER_TYPE_MPEG_PES,
0, // unsafe autodetect
demux_mpg_pes_probe,
demux_mpg_fill_buffer,
NULL,
demux_close_mpg,
demux_seek_mpg,
NULL
};
demuxer_desc_t demuxer_desc_mpeg_es = {
"MPEG ES demuxer",
"mpeges",
"MPEG-ES",
"Arpi?",
"Mpeg",
DEMUXER_TYPE_MPEG_ES,
0, // hack autodetection
NULL,
demux_mpg_es_fill_buffer,
demux_mpg_es_open,
demux_close_mpg,
demux_seek_mpg,
NULL
};
demuxer_desc_t demuxer_desc_mpeg4_es = {
"MPEG4 ES demuxer",
"mpeg4es",
"MPEG-ES",
"Arpi?",
"Mpeg",
DEMUXER_TYPE_MPEG4_ES,
0, // hack autodetection
NULL,
demux_mpg_es_fill_buffer,
demux_mpg_es_open,
demux_close_mpg,
demux_seek_mpg,
NULL
};
demuxer_desc_t demuxer_desc_h264_es = {
"H.264 ES demuxer",
"h264es",
"H264-ES",
"Arpi?",
"Mpeg",
DEMUXER_TYPE_H264_ES,
0, // hack autodetection
NULL,
demux_mpg_es_fill_buffer,
demux_mpg_es_open,
demux_close_mpg,
demux_seek_mpg,
NULL
};

View File

@ -31,13 +31,13 @@ typedef struct {
/**
* Seeking still to be implemented
*/
void demux_seek_nsv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
static void demux_seek_nsv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
{
// seeking is not yet implemented
}
int demux_nsv_fill_buffer ( demuxer_t *demuxer )
static int demux_nsv_fill_buffer ( demuxer_t *demuxer, demux_stream_t *ds )
{
unsigned char hdr[17];
// for the extra data
@ -132,7 +132,7 @@ int demux_nsv_fill_buffer ( demuxer_t *demuxer )
}
demuxer_t* demux_open_nsv ( demuxer_t* demuxer )
static demuxer_t* demux_open_nsv ( demuxer_t* demuxer )
{
// last 2 bytes 17 and 18 are unknown but right after that comes the length
unsigned char hdr[17];
@ -314,7 +314,7 @@ demuxer_t* demux_open_nsv ( demuxer_t* demuxer )
return demuxer;
}
int nsv_check_file ( demuxer_t* demuxer )
static int nsv_check_file ( demuxer_t* demuxer )
{
unsigned int id;
@ -332,10 +332,10 @@ int nsv_check_file ( demuxer_t* demuxer )
stream_seek(demuxer->stream,demuxer->stream->start_pos);
return 1;
return DEMUXER_TYPE_NSV;
}
void demux_close_nsv(demuxer_t* demuxer) {
static void demux_close_nsv(demuxer_t* demuxer) {
nsv_priv_t* priv = demuxer->priv;
if(!priv)
@ -343,3 +343,20 @@ void demux_close_nsv(demuxer_t* demuxer) {
free(priv);
}
demuxer_desc_t demuxer_desc_nsv = {
"NullsoftVideo demuxer",
"nsv",
"Nullsoft Streaming Video",
"Reza Jelveh",
"nsv and nsa streaming files",
DEMUXER_TYPE_NSV,
1, // safe autodetect
nsv_check_file,
demux_nsv_fill_buffer,
demux_open_nsv,
demux_close_nsv,
demux_seek_nsv,
NULL
};

View File

@ -63,7 +63,7 @@ static int nearestBitrate(int bitrate) {
/**
* Seek to a position relative to the current position, indicated in time.
*/
void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
static void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
{
#define MAX_TIME 1000000
nuv_priv_t* priv = demuxer->priv;
@ -152,7 +152,7 @@ void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
}
int demux_nuv_fill_buffer ( demuxer_t *demuxer )
static int demux_nuv_fill_buffer ( demuxer_t *demuxer, demux_stream_t *ds )
{
struct rtframeheader rtjpeg_frameheader;
off_t orig_pos;
@ -309,7 +309,7 @@ out:
return 0;
}
demuxer_t* demux_open_nuv ( demuxer_t* demuxer )
static demuxer_t* demux_open_nuv ( demuxer_t* demuxer )
{
sh_video_t *sh_video = NULL;
sh_audio_t *sh_audio = NULL;
@ -404,7 +404,7 @@ demuxer_t* demux_open_nuv ( demuxer_t* demuxer )
return demuxer;
}
int nuv_check_file ( demuxer_t* demuxer )
static int nuv_check_file ( demuxer_t* demuxer )
{
struct nuv_signature ns;
@ -426,10 +426,10 @@ int nuv_check_file ( demuxer_t* demuxer )
/* Return to original position */
stream_seek ( demuxer->stream, orig_pos );
return 1;
return DEMUXER_TYPE_NUV;
}
void demux_close_nuv(demuxer_t* demuxer) {
static void demux_close_nuv(demuxer_t* demuxer) {
nuv_priv_t* priv = demuxer->priv;
nuv_position_t* pos;
if(!priv)
@ -441,3 +441,20 @@ void demux_close_nuv(demuxer_t* demuxer) {
}
free(priv);
}
demuxer_desc_t demuxer_desc_nuv = {
"NuppelVideo demuxer",
"nuv",
"NuppelVideo",
"Panagiotis Issaris",
"",
DEMUXER_TYPE_NUV,
1, // safe autodetect
nuv_check_file,
demux_nuv_fill_buffer,
demux_open_nuv,
demux_close_nuv,
demux_seek_nuv,
NULL
};

View File

@ -734,7 +734,7 @@ char *demux_ogg_sub_lang(demuxer_t *demuxer, int index) {
return (index < 0) ? NULL : (index >= ogg_d->n_text) ? NULL : ogg_d->text_langs[index];
}
void demux_close_ogg(demuxer_t* demuxer);
static void demux_close_ogg(demuxer_t* demuxer);
static inline unsigned int store_ughvlc(unsigned char *s, unsigned int v)
{
@ -819,6 +819,7 @@ static void fixup_vorbis_wf(sh_audio_t *sh)
/// Open an ogg physical stream
// Not static because it's used also in demuxer_avi.c
int demux_ogg_open(demuxer_t* demuxer) {
ogg_demuxer_t* ogg_d;
stream_t *s;
@ -1194,14 +1195,14 @@ int demux_ogg_open(demuxer_t* demuxer) {
if(sh_a->format == FOURCC_VORBIS)
fixup_vorbis_wf(sh_a);
return 1;
return DEMUXER_TYPE_OGG;
err_out:
return 0;
}
int demux_ogg_fill_buffer(demuxer_t *d) {
static int demux_ogg_fill_buffer(demuxer_t *d, demux_stream_t *dsds) {
ogg_demuxer_t* ogg_d;
stream_t *s;
demux_stream_t *ds;
@ -1344,7 +1345,7 @@ demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) {
// Create the ds_stream and the ogg demuxer
s = new_ds_stream(demuxer->audio);
od = new_demuxer(s,DEMUXER_TYPE_OGG,0,-2,-2);
od = new_demuxer(s,DEMUXER_TYPE_OGG,0,-2,-2,NULL);
/// Add the header packets in the ogg demuxer audio stream
// Initial header
@ -1380,7 +1381,7 @@ demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) {
extern void resync_audio_stream(sh_audio_t *sh_audio);
void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
ogg_demuxer_t* ogg_d = demuxer->priv;
ogg_sync_state* sync = &ogg_d->sync;
ogg_page* page= &ogg_d->page;
@ -1557,7 +1558,7 @@ void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
}
void demux_close_ogg(demuxer_t* demuxer) {
static void demux_close_ogg(demuxer_t* demuxer) {
ogg_demuxer_t* ogg_d = demuxer->priv;
int i;
@ -1587,7 +1588,7 @@ void demux_close_ogg(demuxer_t* demuxer) {
free(ogg_d);
}
int demux_ogg_control(demuxer_t *demuxer,int cmd, void *arg){
static int demux_ogg_control(demuxer_t *demuxer,int cmd, void *arg){
ogg_demuxer_t* ogg_d = demuxer->priv;
ogg_stream_t* os;
float rate;
@ -1617,4 +1618,22 @@ int demux_ogg_control(demuxer_t *demuxer,int cmd, void *arg){
}
}
demuxer_desc_t demuxer_desc_ogg = {
"Ogg demuxer",
"ogg",
"Ogg",
"?",
"",
DEMUXER_TYPE_OGG,
1, // safe autodetect
demux_ogg_open,
demux_ogg_fill_buffer,
NULL,
demux_close_ogg,
demux_ogg_seek,
demux_ogg_control
};
#endif

View File

@ -104,7 +104,7 @@ int pva_sync(demuxer_t * demuxer)
}
}
int pva_check_file(demuxer_t * demuxer)
static int pva_check_file(demuxer_t * demuxer)
{
uint8_t buffer[5]={0,0,0,0,0};
mp_msg(MSGT_DEMUX, MSGL_V, "Checking for PVA\n");
@ -112,7 +112,7 @@ int pva_check_file(demuxer_t * demuxer)
if(buffer[0]=='A' && buffer[1] == 'V' && buffer[4] == 0x55)
{
mp_msg(MSGT_DEMUX,MSGL_DBG2, "Success: PVA\n");
return 1;
return DEMUXER_TYPE_PVA;
}
else
{
@ -121,7 +121,7 @@ int pva_check_file(demuxer_t * demuxer)
}
}
demuxer_t * demux_open_pva (demuxer_t * demuxer)
static demuxer_t * demux_open_pva (demuxer_t * demuxer)
{
sh_video_t *sh_video = new_sh_video(demuxer,0);
sh_audio_t *sh_audio = new_sh_audio(demuxer,0);
@ -189,7 +189,7 @@ int pva_get_payload(demuxer_t * d,pva_payload_t * payload);
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_pva_fill_buffer (demuxer_t * demux)
static int demux_pva_fill_buffer (demuxer_t * demux, demux_stream_t *ds)
{
uint8_t done=0;
demux_packet_t * dp;
@ -466,7 +466,7 @@ int pva_get_payload(demuxer_t * d,pva_payload_t * payload)
return 1;
}
int demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
static int demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
{
int total_bitrate=0;
off_t dest_offset;
@ -507,7 +507,7 @@ int demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
void demux_close_pva(demuxer_t * demuxer)
static void demux_close_pva(demuxer_t * demuxer)
{
if(demuxer->priv)
{
@ -516,3 +516,19 @@ void demux_close_pva(demuxer_t * demuxer)
}
}
demuxer_desc_t demuxer_desc_pva = {
"PVA demuxer",
"pva",
"PVA",
"Matteo Giani",
"streams from DVB cards",
DEMUXER_TYPE_PVA,
0, // unsafe autodetect
pva_check_file,
demux_pva_fill_buffer,
demux_open_pva,
demux_close_pva,
demux_seek_pva,
NULL
};

View File

@ -33,7 +33,7 @@ m_option_t demux_rawaudio_opts[] = {
extern void resync_audio_stream(sh_audio_t *sh_audio);
int demux_rawaudio_open(demuxer_t* demuxer) {
static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
sh_audio_t* sh_audio;
WAVEFORMATEX* w;
@ -59,10 +59,10 @@ int demux_rawaudio_open(demuxer_t* demuxer) {
demuxer->audio->sh = sh_audio;
sh_audio->ds = demuxer->audio;
return 1;
return demuxer;
}
int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
static int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
sh_audio_t* sh_audio = demuxer->audio->sh;
int l = sh_audio->wf->nAvgBytesPerSec;
off_t spos = stream_tell(demuxer->stream);
@ -82,7 +82,7 @@ int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
return 1;
}
void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
stream_t* s = demuxer->stream;
sh_audio_t* sh_audio = demuxer->audio->sh;
off_t base,pos;
@ -99,3 +99,20 @@ void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
resync_audio_stream(sh_audio);
// printf("demux_rawaudio: streamtell=%d\n",(int)stream_tell(demuxer->stream));
}
demuxer_desc_t demuxer_desc_rawaudio = {
"Raw audio demuxer",
"rawaudio",
"rawaudio",
"?",
"",
DEMUXER_TYPE_RAWAUDIO,
0, // no autodetect
NULL,
demux_rawaudio_fill_buffer,
demux_rawaudio_open,
NULL,
demux_rawaudio_seek,
NULL
};

View File

@ -36,7 +36,7 @@ typedef struct
dv_decoder_t *decoder;
} rawdv_frames_t;
void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,int flags)
static void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,int flags)
{
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
sh_video_t *sh_video = demuxer->video->sh;
@ -59,7 +59,7 @@ void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,int flags)
frames->current_filepos=newpos*frames->frame_size;
}
int rawdv_check_file(demuxer_t *demuxer)
static int rawdv_check_file(demuxer_t *demuxer)
{
unsigned char tmp_buffer[DV_PAL_FRAME_SIZE];
int bytes_read=0;
@ -86,13 +86,16 @@ int rawdv_check_file(demuxer_t *demuxer)
&& ((td->height==576) || (td->height==480)))
result=1;
dv_decoder_free(td);
return result;
if (result)
return DEMUXER_TYPE_RAWDV;
else
return 0;
}
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_rawdv_fill_buffer(demuxer_t *demuxer)
static int demux_rawdv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
demux_packet_t* dp_video=NULL;
@ -125,7 +128,7 @@ int demux_rawdv_fill_buffer(demuxer_t *demuxer)
return 1;
}
demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
{
unsigned char dv_frame[DV_PAL_FRAME_SIZE];
sh_video_t *sh_video = NULL;
@ -216,7 +219,7 @@ demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
return demuxer;
}
void demux_close_rawdv(demuxer_t* demuxer)
static void demux_close_rawdv(demuxer_t* demuxer)
{
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
@ -225,7 +228,7 @@ void demux_close_rawdv(demuxer_t* demuxer)
free(frames);
}
int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) {
static int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) {
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
sh_video_t *sh_video=demuxer->video->sh;
@ -243,4 +246,21 @@ int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) {
}
}
demuxer_desc_t demuxer_desc_rawdv = {
"Raw DV demuxer",
"rawdv",
"RAWDV",
"Alexander Neundorf",
"",
DEMUXER_TYPE_RAWDV,
0, // unsafe autodetect
rawdv_check_file,
demux_rawdv_fill_buffer,
demux_open_rawdv,
demux_close_rawdv,
demux_seek_rawdv,
demux_rawdv_control
};
#endif

View File

@ -53,7 +53,7 @@ m_option_t demux_rawvideo_opts[] = {
};
int demux_rawvideo_open(demuxer_t* demuxer) {
static demuxer_t* demux_rawvideo_open(demuxer_t* demuxer) {
sh_video_t* sh_video;
switch(size_id){
@ -100,10 +100,10 @@ int demux_rawvideo_open(demuxer_t* demuxer) {
demuxer->video->sh = sh_video;
sh_video->ds = demuxer->video;
return 1;
return demuxer;
}
int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
static int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
sh_video_t* sh = demuxer->video->sh;
off_t pos;
if(demuxer->stream->eof) return 0;
@ -113,7 +113,7 @@ int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
return 1;
}
void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
stream_t* s = demuxer->stream;
sh_video_t* sh_video = demuxer->video->sh;
off_t pos;
@ -131,3 +131,20 @@ void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
demuxer->video->pts = pos * sh_video->frametime;
// printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream));
}
demuxer_desc_t demuxer_desc_rawvideo = {
"Raw video demuxer",
"rawvideo",
"rawvideo",
"?",
"",
DEMUXER_TYPE_RAWVIDEO,
0, // no autodetect
NULL,
demux_rawvideo_fill_buffer,
demux_rawvideo_open,
NULL,
demux_rawvideo_seek,
NULL
};

View File

@ -433,7 +433,7 @@ end:
#endif
int real_check_file(demuxer_t* demuxer)
static int real_check_file(demuxer_t* demuxer)
{
real_priv_t *priv;
int c;
@ -450,7 +450,7 @@ int real_check_file(demuxer_t* demuxer)
memset(priv, 0, sizeof(real_priv_t));
demuxer->priv = priv;
return 1;
return DEMUXER_TYPE_REAL;
}
void hexdump(char *, unsigned long);
@ -517,7 +517,7 @@ typedef struct dp_hdr_s {
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_real_fill_buffer(demuxer_t *demuxer)
static int demux_real_fill_buffer(demuxer_t *demuxer, demux_stream_t *dsds)
{
real_priv_t *priv = demuxer->priv;
demux_stream_t *ds = NULL;
@ -956,7 +956,7 @@ discard:
extern void print_wave_header(WAVEFORMATEX *h);
void demux_open_real(demuxer_t* demuxer)
static demuxer_t* demux_open_real(demuxer_t* demuxer)
{
real_priv_t* priv = demuxer->priv;
int num_of_headers;
@ -1730,9 +1730,10 @@ header_end:
sh->disp_w,sh->disp_h,sh->aspect,sh->fps);
}
return demuxer;
}
void demux_close_real(demuxer_t *demuxer)
static void demux_close_real(demuxer_t *demuxer)
{
int i;
real_priv_t* priv = demuxer->priv;
@ -1750,7 +1751,7 @@ void demux_close_real(demuxer_t *demuxer)
extern void resync_audio_stream(sh_audio_t * sh_audio);
/* please upload RV10 samples WITH INDEX CHUNK */
int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
real_priv_t *priv = demuxer->priv;
demux_stream_t *d_audio = demuxer->audio;
@ -1838,13 +1839,13 @@ int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
if (next_offset)
stream_seek(demuxer->stream, next_offset);
demux_real_fill_buffer(demuxer);
demux_real_fill_buffer(demuxer, NULL);
if (sh_audio)
resync_audio_stream(sh_audio);
return 1;
}
int demux_real_control(demuxer_t *demuxer, int cmd, void *arg)
static int demux_real_control(demuxer_t *demuxer, int cmd, void *arg)
{
real_priv_t *priv = demuxer->priv;
int lastpts = priv->v_pts ? priv->v_pts : priv->a_pts;
@ -1868,3 +1869,20 @@ int demux_real_control(demuxer_t *demuxer, int cmd, void *arg)
return DEMUXER_CTRL_NOTIMPL;
}
}
demuxer_desc_t demuxer_desc_real = {
"Realmedia demuxer",
"real",
"REAL",
"Alex Beregszasi, Florian Schneider, A'rpi, Roberto Togni",
"handles new .RMF files",
DEMUXER_TYPE_REAL,
1, // safe autodetect
real_check_file,
demux_real_fill_buffer,
demux_open_real,
demux_close_real,
demux_seek_real,
demux_real_control
};

View File

@ -40,13 +40,13 @@ typedef struct {
int ra_check_file(demuxer_t* demuxer)
static int ra_check_file(demuxer_t* demuxer)
{
unsigned int chunk_id;
chunk_id = stream_read_dword_le(demuxer->stream);
if (chunk_id == FOURCC_DOTRA)
return 1;
return DEMUXER_TYPE_REALAUDIO;
else
return 0;
}
@ -58,7 +58,7 @@ void hexdump(char *, unsigned long);
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_ra_fill_buffer(demuxer_t *demuxer)
static int demux_ra_fill_buffer(demuxer_t *demuxer, demux_stream_t *dsds)
{
ra_priv_t *ra_priv = demuxer->priv;
int len;
@ -92,7 +92,7 @@ extern void print_wave_header(WAVEFORMATEX *h);
int demux_open_ra(demuxer_t* demuxer)
static demuxer_t* demux_open_ra(demuxer_t* demuxer)
{
ra_priv_t* ra_priv = demuxer->priv;
sh_audio_t *sh;
@ -264,12 +264,12 @@ int demux_open_ra(demuxer_t* demuxer)
if(!ds_fill_buffer(demuxer->audio))
mp_msg(MSGT_DEMUXER,MSGL_INFO,"[RealAudio] No data.\n");
return 1;
return demuxer;
}
void demux_close_ra(demuxer_t *demuxer)
static void demux_close_ra(demuxer_t *demuxer)
{
ra_priv_t* ra_priv = demuxer->priv;
@ -295,3 +295,20 @@ int demux_seek_ra(demuxer_t *demuxer, float rel_seek_secs, int flags)
return stream_seek(demuxer->stream, next_offset);
}
#endif
demuxer_desc_t demuxer_desc_realaudio = {
"Realaudio demuxer",
"realaudio",
"REALAUDIO",
"Roberto Togni",
"handles old audio only .ra files",
DEMUXER_TYPE_REALAUDIO,
1, // safe autodetect
ra_check_file,
demux_ra_fill_buffer,
demux_open_ra,
demux_close_ra,
NULL,
NULL
};

View File

@ -48,11 +48,11 @@ typedef struct roq_data_t
// Check if a stream qualifies as a RoQ file based on the magic numbers
// at the start of the file:
// 84 10 FF FF FF FF xx xx
int roq_check_file(demuxer_t *demuxer)
static int roq_check_file(demuxer_t *demuxer)
{
if ((stream_read_dword(demuxer->stream) == 0x8410FFFF) &&
((stream_read_dword(demuxer->stream) & 0xFFFF0000) == 0xFFFF0000))
return 1;
return DEMUXER_TYPE_ROQ;
else
return 0;
}
@ -60,7 +60,7 @@ int roq_check_file(demuxer_t *demuxer)
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_roq_fill_buffer(demuxer_t *demuxer)
static int demux_roq_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
sh_video_t *sh_video = demuxer->video->sh;
roq_data_t *roq_data = (roq_data_t *)demuxer->priv;
@ -87,7 +87,7 @@ int demux_roq_fill_buffer(demuxer_t *demuxer)
return 1;
}
demuxer_t* demux_open_roq(demuxer_t* demuxer)
static demuxer_t* demux_open_roq(demuxer_t* demuxer)
{
sh_video_t *sh_video = NULL;
sh_audio_t *sh_audio = NULL;
@ -240,7 +240,7 @@ demuxer_t* demux_open_roq(demuxer_t* demuxer)
return demuxer;
}
void demux_close_roq(demuxer_t* demuxer) {
static void demux_close_roq(demuxer_t* demuxer) {
roq_data_t *roq_data = demuxer->priv;
if(!roq_data)
@ -248,3 +248,19 @@ void demux_close_roq(demuxer_t* demuxer) {
free(roq_data);
}
demuxer_desc_t demuxer_desc_roq = {
"RoQ demuxer",
"roq",
"ROQ",
"Mike Melanson",
"",
DEMUXER_TYPE_ROQ,
0, // unsafe autodetect
roq_check_file,
demux_roq_fill_buffer,
demux_open_roq,
demux_close_roq,
NULL,
NULL
};

View File

@ -577,3 +577,20 @@ demux_packet_t* ReadBufferQueue::getPendingBuffer() {
return dp;
}
demuxer_desc_t demuxer_desc_rtp = {
"live.com RTP demuxer",
"rtp",
"",
"Ross Finlayson",
"requires live.com library",
DEMUXER_TYPE_RTP,
0, // no autodetect
NULL,
demux_rtp_fill_buffer,
demux_open_rtp,
demux_close_rtp,
NULL,
NULL
};

View File

@ -22,7 +22,7 @@
#include "stheader.h"
#include "bswap.h"
int smjpeg_check_file(demuxer_t* demuxer){
static int smjpeg_check_file(demuxer_t* demuxer){
int orig_pos = stream_tell(demuxer->stream);
char buf[8];
int version;
@ -52,14 +52,14 @@ int smjpeg_check_file(demuxer_t* demuxer){
stream_seek(demuxer->stream, orig_pos);
return 1;
return DEMUXER_TYPE_SMJPEG;
}
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_smjpeg_fill_buffer(demuxer_t *demux)
static int demux_smjpeg_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
{
int dtype, dsize, dpts;
@ -89,7 +89,7 @@ int demux_smjpeg_fill_buffer(demuxer_t *demux)
return 1;
}
int demux_open_smjpeg(demuxer_t* demuxer){
static demuxer_t* demux_open_smjpeg(demuxer_t* demuxer){
sh_video_t* sh_video;
sh_audio_t* sh_audio;
unsigned int htype = 0, hleng;
@ -164,10 +164,27 @@ int demux_open_smjpeg(demuxer_t* demuxer){
demuxer->seekable = 0;
return 1;
return demuxer;
}
void demux_close_smjpeg(demuxer_t *demuxer)
static void demux_close_smjpeg(demuxer_t *demuxer)
{
return;
}
demuxer_desc_t demuxer_desc_smjpeg = {
"smjpeg demuxer",
"smjpeg",
"SMJPEG",
"Alex Beregszasi",
"",
DEMUXER_TYPE_SMJPEG,
1, // safe autodetect
smjpeg_check_file,
demux_smjpeg_fill_buffer,
demux_open_smjpeg,
demux_close_smjpeg,
NULL,
NULL
};

View File

@ -263,7 +263,7 @@ try_fec:
int ts_check_file(demuxer_t * demuxer)
static int ts_check_file(demuxer_t * demuxer)
{
const int buf_size = (TS_FEC_PACKET_SIZE * NUM_CONSECUTIVE_TS_PACKETS);
unsigned char buf[TS_FEC_PACKET_SIZE * NUM_CONSECUTIVE_TS_PACKETS], done = 0, *ptr;
@ -360,9 +360,9 @@ int ts_check_file(demuxer_t * demuxer)
mp_msg(MSGT_DEMUX, MSGL_V, "GOOD CC: %d, BAD CC: %d\n", good, bad);
if(good >= bad)
return size;
return size;
else
return 0;
return 0;
}
@ -827,7 +827,7 @@ static int parse_avc_sps(uint8_t *buf, int len, int *w, int *h)
return 1;
}
demuxer_t *demux_open_ts(demuxer_t * demuxer)
static demuxer_t *demux_open_ts(demuxer_t * demuxer)
{
int i;
uint8_t packet_size;
@ -984,7 +984,7 @@ demuxer_t *demux_open_ts(demuxer_t * demuxer)
return demuxer;
}
void demux_close_ts(demuxer_t * demuxer)
static void demux_close_ts(demuxer_t * demuxer)
{
uint16_t i;
ts_priv_t *priv = (ts_priv_t*) demuxer->priv;
@ -3028,7 +3028,7 @@ extern int videobuf_code_len;
extern int sync_video_packet(demux_stream_t *);
extern int skip_video_packet(demux_stream_t *);
void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, int flags)
static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
@ -3129,7 +3129,7 @@ void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, int flags)
}
int demux_ts_fill_buffer(demuxer_t * demuxer)
static int demux_ts_fill_buffer(demuxer_t * demuxer, demux_stream_t *ds)
{
ES_stream_t es;
ts_priv_t *priv = (ts_priv_t *)demuxer->priv;
@ -3138,4 +3138,24 @@ int demux_ts_fill_buffer(demuxer_t * demuxer)
}
static int ts_check_file_dmx(demuxer_t *demuxer)
{
return ts_check_file(demuxer) ? DEMUXER_TYPE_MPEG_TS : 0;
}
demuxer_desc_t demuxer_desc_mpeg_ts = {
"MPEG-TS demuxer",
"mpegts",
"TS",
"Nico Sabbi",
"",
DEMUXER_TYPE_MPEG_TS,
0, // unsafe autodetect
ts_check_file_dmx,
demux_ts_fill_buffer,
demux_open_ts,
demux_close_ts,
demux_seek_ts,
NULL
};

View File

@ -585,7 +585,7 @@ static unsigned char ty_VideoPacket[] = { 0x00, 0x00, 0x01, 0xe0 };
static unsigned char ty_MPEGAudioPacket[] = { 0x00, 0x00, 0x01, 0xc0 };
static unsigned char ty_AC3AudioPacket[] = { 0x00, 0x00, 0x01, 0xbd };
int demux_ty_fill_buffer( demuxer_t *demux )
static int demux_ty_fill_buffer( demuxer_t *demux, demux_stream_t *dsds )
{
int invalidType = 0;
int errorHeader = 0;
@ -1238,7 +1238,7 @@ int demux_ty_fill_buffer( demuxer_t *demux )
return( 1 );
}
void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, int flags )
static void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, int flags )
{
demux_stream_t *d_audio = demuxer->audio;
demux_stream_t *d_video = demuxer->video;
@ -1362,7 +1362,7 @@ int demux_ty_control( demuxer_t *demuxer,int cmd, void *arg )
}
int demux_close_ty( demuxer_t *demux )
static int demux_close_ty( demuxer_t *demux )
{
TiVoInfo *tivo = 0;
@ -1377,3 +1377,44 @@ int demux_close_ty( demuxer_t *demux )
}
static int ty_check_file(demuxer_t* demuxer)
{
return ds_fill_buffer(demuxer->video) ? DEMUXER_TYPE_MPEG_TY : 0;
}
static demuxer_t* demux_open_ty(demuxer_t* demuxer)
{
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: " MSGTR_MissingAudioStream);
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
}
}
return demuxer;
}
demuxer_desc_t demuxer_desc_mpeg_ty = {
"TiVo demuxer",
"tivo",
"TiVo",
"Christopher R. Wingert",
"Demux streams from TiVo",
DEMUXER_TYPE_MPEG_TY,
0, // unsafe autodetect
ty_check_file,
demux_ty_fill_buffer,
demux_open_ty,
demux_close_ty,
demux_seek_ty,
demux_ty_control
};

View File

@ -221,7 +221,7 @@ static void vivo_parse_text_header(demuxer_t *demux, int header_len)
free(param);
}
int vivo_check_file(demuxer_t* demuxer){
static int vivo_check_file(demuxer_t* demuxer){
int i=0;
int len;
int c;
@ -281,7 +281,7 @@ int vivo_check_file(demuxer_t* demuxer){
stream_seek(demuxer->stream, orig_pos);
return 1;
return DEMUXER_TYPE_VIVO;
}
static int audio_pos=0;
@ -290,7 +290,7 @@ static int audio_rate=0;
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_vivo_fill_buffer(demuxer_t *demux){
static int demux_vivo_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
demux_stream_t *ds=NULL;
int c;
int len=0;
@ -537,12 +537,12 @@ static int h263_decode_picture_header(unsigned char *b_ptr)
void demux_open_vivo(demuxer_t* demuxer){
static demuxer_t* demux_open_vivo(demuxer_t* demuxer){
vivo_priv_t* priv=demuxer->priv;
if(!ds_fill_buffer(demuxer->video)){
mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingVideoStreamBug);
return;
return NULL;
}
audio_pos=0;
@ -714,13 +714,13 @@ if (demuxer->audio->id >= -1){
sh->ds=demuxer->audio;
demuxer->audio->id=1;
nosound:
return;
return demuxer;
}
}
return demuxer;
}
}
void demux_close_vivo(demuxer_t *demuxer)
static void demux_close_vivo(demuxer_t *demuxer)
{
vivo_priv_t* priv=demuxer->priv;
@ -737,3 +737,20 @@ void demux_close_vivo(demuxer_t *demuxer)
}
return;
}
demuxer_desc_t demuxer_desc_vivo = {
"Vivo demuxer",
"vivo",
"VIVO",
"A'rpi, Alex Beregszasi",
"",
DEMUXER_TYPE_VIVO,
0, // unsafe autodetect
vivo_check_file,
demux_vivo_fill_buffer,
demux_open_vivo,
demux_close_vivo,
NULL,
NULL
};

View File

@ -11,18 +11,18 @@
extern void resync_audio_stream(sh_audio_t *sh_audio);
int demux_probe_vqf(demuxer_t* demuxer)
static int demux_probe_vqf(demuxer_t* demuxer)
{
char buf[KEYWORD_BYTES];
stream_t *s;
s = demuxer->stream;
if(stream_read(s,buf,KEYWORD_BYTES)!=KEYWORD_BYTES)
return 0;
if(memcmp(buf,"TWIN",KEYWORD_BYTES)==0) return 1; /*version: 97012000*/
if(memcmp(buf,"TWIN",KEYWORD_BYTES)==0) return DEMUXER_TYPE_VQF; /*version: 97012000*/
return 0;
}
demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
sh_audio_t* sh_audio;
WAVEFORMATEX* w;
stream_t *s;
@ -161,7 +161,7 @@ demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
return demuxer;
}
int demux_vqf_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
static int demux_vqf_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
sh_audio_t* sh_audio = demuxer->audio->sh;
int l = sh_audio->wf->nAvgBytesPerSec;
off_t spos = stream_tell(demuxer->stream);
@ -181,7 +181,7 @@ int demux_vqf_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
return 1;
}
void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
#if 0
stream_t* s = demuxer->stream;
sh_audio_t* sh_audio = demuxer->audio->sh;
@ -199,4 +199,21 @@ void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
#endif
}
void demux_close_vqf(demuxer_t* demuxer) {}
static void demux_close_vqf(demuxer_t* demuxer) {}
demuxer_desc_t demuxer_desc_vqf = {
"TwinVQ demuxer",
"vqf",
"VQF",
"Nick Kurshev",
"ported frm MPlayerXP",
DEMUXER_TYPE_VQF,
1, // safe autodetect
demux_probe_vqf,
demux_vqf_fill_buffer,
demux_open_vqf,
demux_close_vqf,
demux_seek_vqf,
NULL
};

View File

@ -201,7 +201,7 @@ static void cleanup_plugins(){
//extern void resync_audio_stream(sh_audio_t *sh_audio);
int demux_xmms_open(demuxer_t* demuxer) {
static int demux_xmms_open(demuxer_t* demuxer) {
InputPlugin* ip = NULL;
sh_audio_t* sh_audio;
WAVEFORMATEX* w;
@ -267,10 +267,10 @@ int demux_xmms_open(demuxer_t* demuxer) {
w->nBlockAlign = sh_audio->samplesize*sh_audio->channels;
w->cbSize = 0;
return 1;
return DEMUXER_TYPE_XMMS;
}
int demux_xmms_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
static int demux_xmms_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
sh_audio_t *sh_audio = demuxer->audio->sh;
xmms_priv_t *priv=demuxer->priv;
demux_packet_t* dp;
@ -299,7 +299,7 @@ int demux_xmms_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
return 1;
}
void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
static void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
stream_t* s = demuxer->stream;
sh_audio_t* sh_audio = demuxer->audio->sh;
xmms_priv_t *priv=demuxer->priv;
@ -321,7 +321,7 @@ void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
sh_audio->delay=pos; //priv->spos / sh_audio->wf->nAvgBytesPerSec;
}
int demux_close_xmms(demuxer_t* demuxer) {
static void demux_close_xmms(demuxer_t* demuxer) {
xmms_priv_t *priv=demuxer->priv;
xmms_playing=0;
xmms_audiopos=0; // xmp on exit waits until buffer is free enough
@ -331,10 +331,9 @@ int demux_close_xmms(demuxer_t* demuxer) {
free(priv); xmms_priv=demuxer->priv=NULL;
}
cleanup_plugins();
return 1;
}
int demux_xmms_control(demuxer_t *demuxer,int cmd, void *arg){
static int demux_xmms_control(demuxer_t *demuxer,int cmd, void *arg){
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=demuxer->audio->sh;
xmms_priv_t *priv=demuxer->priv;
@ -355,3 +354,20 @@ int demux_xmms_control(demuxer_t *demuxer,int cmd, void *arg){
return DEMUXER_CTRL_NOTIMPL;
}
}
demuxer_desc_t demuxer_desc_xmms = {
"XMMS demuxer",
"xmms",
"XMMS",
"?",
"requires XMMS plugins",
DEMUXER_TYPE_XMMS,
0, // safe autodetect
demux_xmms_open,
demux_xmms_fill_buffer,
NULL,
demux_close_xmms,
demux_xmms_seek,
demux_xmms_control
};

View File

@ -23,7 +23,7 @@ typedef struct {
int is_older;
} y4m_priv_t;
int y4m_check_file(demuxer_t* demuxer){
static int y4m_check_file(demuxer_t* demuxer){
int orig_pos = stream_tell(demuxer->stream);
char buf[10];
y4m_priv_t* priv;
@ -54,14 +54,14 @@ int y4m_check_file(demuxer_t* demuxer){
stream_seek(demuxer->stream, orig_pos);
return 1;
return DEMUXER_TYPE_Y4M;
}
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_y4m_fill_buffer(demuxer_t *demux) {
static int demux_y4m_fill_buffer(demuxer_t *demux, demux_stream_t *dsds) {
demux_stream_t *ds=demux->video;
demux_packet_t *dp;
y4m_priv_t *priv=demux->priv;
@ -117,7 +117,7 @@ int demux_y4m_fill_buffer(demuxer_t *demux) {
return 1;
}
void demux_open_y4m(demuxer_t* demuxer){
static demuxer_t* demux_open_y4m(demuxer_t* demuxer){
y4m_priv_t* priv = demuxer->priv;
y4m_ratio_t ratio;
sh_video_t* sh=new_sh_video(demuxer,0);
@ -227,9 +227,11 @@ void demux_open_y4m(demuxer_t* demuxer){
mp_msg(MSGT_DEMUX, MSGL_INFO, "YUV4MPEG2 Video stream %d size: display: %dx%d, codec: %ux%u\n",
demuxer->video->id, sh->disp_w, sh->disp_h, sh->bih->biWidth,
sh->bih->biHeight);
return demuxer;
}
int demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, int flags) {
static void demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, int flags) {
sh_video_t* sh = demuxer->video->sh;
y4m_priv_t* priv = demuxer->priv;
int rel_seek_frames = sh->fps*rel_seek_secs;
@ -254,10 +256,9 @@ int demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, int flags) {
* is disabled. */
mp_msg(MSGT_DEMUX, MSGL_WARN, "Seeking for YUV4MPEG2 not yet implemented!\n");
}
return 0;
}
void demux_close_y4m(demuxer_t *demuxer)
static void demux_close_y4m(demuxer_t *demuxer)
{
y4m_priv_t* priv = demuxer->priv;
@ -269,3 +270,20 @@ void demux_close_y4m(demuxer_t *demuxer)
free(demuxer->priv);
return;
}
demuxer_desc_t demuxer_desc_y4m = {
"YUV4MPEG2 demuxer",
"y4m",
"YUV4MPEG2",
"Rik snel",
"",
DEMUXER_TYPE_Y4M,
1, // safe autodetect
y4m_check_file,
demux_y4m_fill_buffer,
demux_open_y4m,
demux_close_y4m,
demux_seek_y4m,
NULL
};

File diff suppressed because it is too large Load Diff

View File

@ -48,11 +48,12 @@
#define DEMUXER_TYPE_AVS 38
#define DEMUXER_TYPE_AAC 39
#define DEMUXER_TYPE_MPC 40
#define DEMUXER_TYPE_MPEG_PES 41
// This should always match the higest demuxer type number.
// Unless you want to disallow users to force the demuxer to some types
#define DEMUXER_TYPE_MIN 0
#define DEMUXER_TYPE_MAX 40
#define DEMUXER_TYPE_MAX 41
#define DEMUXER_TYPE_DEMUXERS (1<<16)
// A virtual demuxer type for the network code
@ -125,11 +126,42 @@ typedef struct demuxer_info_st {
#define MAX_A_STREAMS 256
#define MAX_V_STREAMS 256
struct demuxer_st;
/**
* Demuxer description structure
*/
typedef struct demuxers_desc_st {
const char *info; ///< What is it (long name and/or description)
const char *name; ///< Demuxer name, used with -demuxer switch
const char *shortdesc; ///< Description printed at demuxer detection
const char *author; ///< Demuxer author(s)
const char *comment; ///< Comment, printed with -demuxer help
int type; ///< DEMUXER_TYPE_xxx
int safe_check; ///< If 1 detection is safe and fast, do it before file extension check
/// Check if can demux the file, return DEMUXER_TYPE_xxx on success
int (*check_file)(struct demuxer_st *demuxer); ///< Mandatory if safe_check == 1, else optional
/// Get packets from file, return 0 on eof
int (*fill_buffer)(struct demuxer_st *demuxer, demux_stream_t *ds); ///< Mandatory
/// Open the demuxer, return demuxer on success, NULL on failure
struct demuxer_st* (*open)(struct demuxer_st *demuxer); ///< Optional
/// Close the demuxer
void (*close)(struct demuxer_st *demuxer); ///< Optional
// Seek
void (*seek)(struct demuxer_st *demuxer, float rel_seek_secs, int flags); ///< Optional
// Control
int (*control)(struct demuxer_st *demuxer, int cmd, void *arg); ///< Optional
} demuxer_desc_t;
typedef struct demuxer_st {
demuxer_desc_t *desc; ///< Demuxer description structure
off_t filepos; // input stream current pos.
off_t movi_start;
off_t movi_end;
stream_t *stream;
char *filename; ///< Needed by avs_check_file
int synced; // stream synced (used by mpeg)
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
int file_format; // file format: mpeg/avi/asf
@ -203,7 +235,7 @@ inline static void free_demux_packet(demux_packet_t* dp){
}
demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id);
demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id);
demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
void free_demuxer_stream(demux_stream_t *ds);
void free_demuxer(demuxer_t *demuxer);
@ -292,3 +324,6 @@ extern int demuxer_get_percent_pos(demuxer_t *demuxer);
extern int demuxer_switch_audio(demuxer_t *demuxer, int index);
extern int demuxer_type_by_filename(char* filename);
extern void demuxer_help(void);
extern int get_demuxer_type_from_name(char *demuxer_name);

View File

@ -90,7 +90,7 @@ char *tv_channel_last_real;
*/
/* fill demux->video and demux->audio */
int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
{
tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv);
demux_packet_t* dp;
@ -454,18 +454,18 @@ done:
return 1;
}
int demux_open_tv(demuxer_t *demuxer)
static demuxer_t* demux_open_tv(demuxer_t *demuxer)
{
tvi_handle_t *tvh;
sh_video_t *sh_video;
sh_audio_t *sh_audio = NULL;
tvi_functions_t *funcs;
if(!(tvh=tv_begin())) return 0;
if (!tv_init(tvh)) return 0;
if(!(tvh=tv_begin())) return NULL;
if (!tv_init(tvh)) return NULL;
if (!open_tv(tvh)){
tv_uninit(tvh);
return 0;
return NULL;
}
funcs = tvh->functions;
demuxer->priv=tvh;
@ -591,7 +591,7 @@ no_audio:
if(!(funcs->start(tvh->priv))){
// start failed :(
tv_uninit(tvh);
return 0;
return NULL;
}
/* set color eq */
@ -600,10 +600,10 @@ no_audio:
tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation);
tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast);
return 1;
return demuxer;
}
int demux_close_tv(demuxer_t *demuxer)
static int demux_close_tv(demuxer_t *demuxer)
{
tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
return(tvh->functions->uninit(tvh->priv));
@ -853,4 +853,20 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm)
return(1);
}
demuxer_desc_t demuxer_desc_tv = {
"Tv card demuxer",
"tv",
"TV",
"Alex Beregszaszi, Charles R. Henrich",
"?",
DEMUXER_TYPE_TV,
0, // no autodetect
NULL,
demux_tv_fill_buffer,
demux_open_tv,
demux_close_tv,
NULL,
NULL
};
#endif /* USE_TV */

View File

@ -115,6 +115,9 @@ static char** audio_codec_list=NULL; // override audio codec
static char** video_codec_list=NULL; // override video codec
static char** audio_fm_list=NULL; // override audio codec family
static char** video_fm_list=NULL; // override video codec family
extern char *demuxer_name; // override demuxer
extern char *audio_demuxer_name; // override audio demuxer
extern char *sub_demuxer_name; // override sub demuxer
static int out_audio_codec=-1;
static int out_video_codec=-1;

View File

@ -249,6 +249,11 @@ char **video_codec_list=NULL; // override video codec
char **audio_fm_list=NULL; // override audio codec family
char **video_fm_list=NULL; // override video codec family
// demuxer:
extern char *demuxer_name; // override demuxer
extern char *audio_demuxer_name; // override audio demuxer
extern char *sub_demuxer_name; // override sub demuxer
// streaming:
int audio_id=-1;
int video_id=-1;
@ -1268,6 +1273,13 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
exit_player_with_rc(NULL, 0);
}
#endif
if((demuxer_name && strcmp(demuxer_name,"help")==0) ||
(audio_demuxer_name && strcmp(audio_demuxer_name,"help")==0) ||
(sub_demuxer_name && strcmp(sub_demuxer_name,"help")==0)){
demuxer_help();
mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
exit_player_with_rc(NULL, 0);
}
#ifdef USE_EDL
if (edl_check_mode() == EDL_ERROR && edl_filename)