mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 04:36:24 +01:00
support MPEG in GXF container with extension-based detection.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16311 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
99bd394969
commit
655334804b
@ -506,6 +506,36 @@ static int demux_mpg_es_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
|
||||
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 @@ static demuxer_t* demux_mpg_es_open(demuxer_t* demuxer)
|
||||
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_pes = {
|
||||
};
|
||||
|
||||
|
||||
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",
|
||||
|
@ -51,6 +51,7 @@ extern demuxer_desc_t demuxer_desc_lmlm4;
|
||||
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_t* demuxer_list[] = {
|
||||
&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
|
||||
|
@ -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
|
||||
|
@ -20,6 +20,7 @@ static struct {
|
||||
// { "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 },
|
||||
|
@ -46,6 +46,7 @@ enum {
|
||||
|
||||
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 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
|
||||
*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)))
|
||||
|
Loading…
Reference in New Issue
Block a user