Mercurial > mplayer.hg
changeset 16310:fb95057e370e
support MPEG in GXF container with extension-based detection.
author | reimar |
---|---|
date | Fri, 26 Aug 2005 17:40:02 +0000 |
parents | aa7829aa8428 |
children | 26401de08141 |
files | libmpdemux/demux_mpg.c libmpdemux/demuxer.c libmpdemux/demuxer.h libmpdemux/extension.c libmpdemux/video.c |
diffstat | 5 files changed, 60 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mpg.c Thu Aug 25 21:46:32 2005 +0000 +++ b/libmpdemux/demux_mpg.c Fri Aug 26 17:40:02 2005 +0000 @@ -506,6 +506,36 @@ return 1; } +static int demux_mpg_gxf_fill_buffer(demuxer_t *demux, demux_stream_t *ds) { + demux_packet_t *pack; + uint32_t state = (uint32_t)demux->priv; + int pos = 0; + int discard = 0; + unsigned char *buf; + if (demux->stream->eof) + return 0; + demux->filepos = stream_tell(demux->stream); + pack = new_demux_packet(STREAM_BUFFER_SIZE); + buf = pack->buffer; + while (pos < STREAM_BUFFER_SIZE) { + register int c = stream_read_char(demux->stream); + if (c < 0) { // EOF + resize_demux_packet(pack, pos); + break; + } + state = state << 8 | c; + if (state == 0x1bc || state == 0x1bf) + discard = 1; + else if (state == 0x100) + discard = 0; + if (!discard) + buf[pos++] = c; + } + ds_add_packet(ds, pack); + demux->priv = (void *)state; + return 1; +} + int demux_mpg_fill_buffer(demuxer_t *demux, demux_stream_t *ds){ unsigned int head=0; int skipped=0; @@ -789,6 +819,13 @@ return demuxer; } +static demuxer_t *demux_mpg_gxf_open(demuxer_t *demuxer) { + demuxer->audio->sh = NULL; + demuxer->video->sh = new_sh_video(demuxer,0); + ((sh_video_t *)demuxer->video->sh)->ds = demuxer->video; + demuxer->priv = (void *) 0xffffffff; + return demuxer; +} static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer) { @@ -844,6 +881,22 @@ }; +demuxer_desc_t demuxer_desc_mpeg_gxf = { + "MPEG ES in GXF demuxer", + "mpeggxf", + "MPEG-ES in GXF", + "Reimar Döffinger", + "Mpeg", + DEMUXER_TYPE_MPEG_GXF, + 0, // hack autodetection + NULL, + demux_mpg_gxf_fill_buffer, + demux_mpg_gxf_open, + NULL, + NULL, + NULL +}; + demuxer_desc_t demuxer_desc_mpeg_es = { "MPEG ES demuxer", "mpeges",
--- a/libmpdemux/demuxer.c Thu Aug 25 21:46:32 2005 +0000 +++ b/libmpdemux/demuxer.c Fri Aug 26 17:40:02 2005 +0000 @@ -51,6 +51,7 @@ extern demuxer_desc_t demuxer_desc_mpeg_ps; extern demuxer_desc_t demuxer_desc_mpeg_pes; extern demuxer_desc_t demuxer_desc_mpeg_es; +extern demuxer_desc_t demuxer_desc_mpeg_gxf; extern demuxer_desc_t demuxer_desc_mpeg4_es; extern demuxer_desc_t demuxer_desc_h264_es; extern demuxer_desc_t demuxer_desc_rawdv; @@ -100,6 +101,7 @@ &demuxer_desc_mpeg_ps, &demuxer_desc_mpeg_pes, &demuxer_desc_mpeg_es, + &demuxer_desc_mpeg_gxf, &demuxer_desc_mpeg4_es, &demuxer_desc_h264_es, #ifdef HAVE_LIBDV095
--- a/libmpdemux/demuxer.h Thu Aug 25 21:46:32 2005 +0000 +++ b/libmpdemux/demuxer.h Fri Aug 26 17:40:02 2005 +0000 @@ -49,11 +49,12 @@ #define DEMUXER_TYPE_AAC 39 #define DEMUXER_TYPE_MPC 40 #define DEMUXER_TYPE_MPEG_PES 41 +#define DEMUXER_TYPE_MPEG_GXF 42 // 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 41 +#define DEMUXER_TYPE_MAX 42 #define DEMUXER_TYPE_DEMUXERS (1<<16) // A virtual demuxer type for the network code
--- a/libmpdemux/extension.c Thu Aug 25 21:46:32 2005 +0000 +++ b/libmpdemux/extension.c Fri Aug 26 17:40:02 2005 +0000 @@ -20,6 +20,7 @@ // { "mpe", DEMUXER_TYPE_MPEG_PS }, { "vob", DEMUXER_TYPE_MPEG_PS }, { "m2v", DEMUXER_TYPE_MPEG_PS }, + { "gxf", DEMUXER_TYPE_MPEG_GXF }, { "avi", DEMUXER_TYPE_AVI }, { "mp4", DEMUXER_TYPE_MOV }, { "mov", DEMUXER_TYPE_MOV },
--- a/libmpdemux/video.c Thu Aug 25 21:46:32 2005 +0000 +++ b/libmpdemux/video.c Fri Aug 26 17:40:02 2005 +0000 @@ -46,6 +46,7 @@ if((d_video->demuxer->file_format == DEMUXER_TYPE_PVA) || (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES) || + (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_GXF) || (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS && ((! sh_video->format) || (sh_video->format==0x10000001) || (sh_video->format==0x10000002))) || (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TY) || (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS && ((sh_video->format==0x10000001) || (sh_video->format==0x10000002))) @@ -403,6 +404,7 @@ *start=NULL; if(demuxer->file_format==DEMUXER_TYPE_MPEG_ES || + demuxer->file_format==DEMUXER_TYPE_MPEG_GXF || (demuxer->file_format==DEMUXER_TYPE_MPEG_PS && ((! sh_video->format) || (sh_video->format==0x10000001) || (sh_video->format==0x10000002))) || demuxer->file_format==DEMUXER_TYPE_PVA || ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && ((sh_video->format==0x10000001) || (sh_video->format==0x10000002)))