summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_asf.c5
-rw-r--r--libmpdemux/demux_film.c3
-rw-r--r--libmpdemux/demux_lavf.c16
-rw-r--r--libmpdemux/demux_mf.c2
-rw-r--r--libmpdemux/demux_mkv.c55
-rw-r--r--libmpdemux/demux_mov.c1
-rw-r--r--libmpdemux/demux_nut.c2
-rw-r--r--libmpdemux/demux_ogg.c36
-rw-r--r--libmpdemux/demux_packet.h3
-rw-r--r--libmpdemux/demux_rawdv.c1
-rw-r--r--libmpdemux/demux_real.c6
-rw-r--r--libmpdemux/demux_realaud.c3
-rw-r--r--libmpdemux/demux_ts.c2
-rw-r--r--libmpdemux/demux_ty.c1
-rw-r--r--libmpdemux/demux_y4m.c1
-rw-r--r--libmpdemux/demuxer.c38
-rw-r--r--libmpdemux/demuxer.h4
-rw-r--r--libmpdemux/ebml_defs.c424
-rw-r--r--libmpdemux/ebml_types.h477
-rw-r--r--libmpdemux/stheader.h2
-rw-r--r--libmpdemux/video.c2
21 files changed, 77 insertions, 1007 deletions
diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c
index eb71d4ef96..68ccab07d2 100644
--- a/libmpdemux/demux_asf.c
+++ b/libmpdemux/demux_asf.c
@@ -177,7 +177,7 @@ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,in
dp->pts=time*0.0000001;
else
dp->pts=time*0.001;
- dp->flags=keyframe;
+ dp->keyframe = keyframe;
// if(ds==demux->video) printf("ASF time: %8d dur: %5d \n",time,dur);
dp->pos=demux->filepos;
ds->asf_packet=dp;
@@ -595,7 +595,8 @@ static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,float audio_de
continue;
}
}
- if(d_video->flags&1) break; // found a keyframe!
+ if (d_video->keyframe)
+ break;
if(!ds_fill_buffer(d_video)) break; // skip frame. EOF?
}
diff --git a/libmpdemux/demux_film.c b/libmpdemux/demux_film.c
index 8575d5f1e8..713c9ea26e 100644
--- a/libmpdemux/demux_film.c
+++ b/libmpdemux/demux_film.c
@@ -130,7 +130,6 @@ static int demux_film_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
return 0;
dp->pts = film_chunk.pts;
dp->pos = film_chunk.chunk_offset;
- dp->flags = 0;
// adjust the data before queuing it:
// 8-bit: signed -> unsigned
@@ -197,7 +196,7 @@ static int demux_film_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
dp->pts = film_chunk.pts;
dp->pos = film_chunk.chunk_offset;
- dp->flags = (film_chunk.syncinfo1 & 0x80000000) ? 1 : 0;
+ dp->keyframe = film_chunk.syncinfo1 & 0x80000000;
// fix the CVID chunk size
cvid_size = film_chunk.chunk_size - length_fix_bytes;
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 62cb0bad1b..1487a6db6b 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -245,8 +245,6 @@ static const char * const preferred_internal[] = {
/* lavf Matroska demuxer doesn't support ordered chapters and fails
* for more files */
"matroska",
- /* lavf gives neither pts nor dts for some video frames in .rm */
- "rm",
NULL
};
@@ -310,6 +308,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
break;
stream_type = "audio";
priv->astreams[priv->audio_streams] = i;
+ sh_audio->libav_codec_id = codec->codec_id;
wf = calloc(sizeof(*wf) + codec->extradata_size, 1);
// mp4a tag is used for all mp4 files no matter what they actually contain
if (codec->codec_tag == MKTAG('m', 'p', '4', 'a'))
@@ -387,6 +386,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
break;
stream_type = "video";
priv->vstreams[priv->video_streams] = i;
+ sh_video->libav_codec_id = codec->codec_id;
bih = calloc(sizeof(*bih) + codec->extradata_size, 1);
if (codec->codec_id == CODEC_ID_RAWVIDEO) {
@@ -398,9 +398,14 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
}
if (!codec->codec_tag)
codec->codec_tag = avcodec_pix_fmt_to_codec_tag(codec->pix_fmt);
- }
- if (!codec->codec_tag)
+ } else if (!codec->codec_tag) {
codec->codec_tag = mp_taglist_video(codec->codec_id);
+ /* 0 might mean either unset or rawvideo; if codec_id
+ * was not RAWVIDEO assume it's unset
+ */
+ if (!codec->codec_tag)
+ codec->codec_tag = -1;
+ }
bih->biSize = sizeof(*bih) + codec->extradata_size;
bih->biWidth = codec->width;
bih->biHeight = codec->height;
@@ -492,6 +497,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
break;
stream_type = "subtitle";
priv->sstreams[priv->sub_streams] = i;
+ sh_sub->libav_codec_id = codec->codec_id;
sh_sub->type = type;
if (codec->extradata_size) {
sh_sub->extradata = malloc(codec->extradata_size);
@@ -808,7 +814,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds)
av_q2d(priv->avfc->streams[id]->time_base);
}
dp->pos = demux->filepos;
- dp->flags = !!(pkt->flags & AV_PKT_FLAG_KEY);
+ dp->keyframe = pkt->flags & AV_PKT_FLAG_KEY;
// append packet to DS stream:
ds_add_packet(ds, dp);
return 1;
diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c
index 193b17bc18..7112fd4059 100644
--- a/libmpdemux/demux_mf.c
+++ b/libmpdemux/demux_mf.c
@@ -66,7 +66,7 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
if ( !fread( dp->buffer,file_size,1,f ) ) return 0;
dp->pts=mf->curr_frame / sh_video->fps;
dp->pos=mf->curr_frame;
- dp->flags=0;
+ dp->keyframe = true;
// append packet to DS stream:
ds_add_packet( demuxer->video,dp );
}
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 27bc45acc9..b0f45758d7 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -1840,7 +1840,7 @@ static int demux_mkv_read_block_lacing(uint8_t *buffer, uint64_t *size,
}
static void handle_realvideo(demuxer_t *demuxer, mkv_track_t *track,
- uint8_t *buffer, uint32_t size, int64_t block_bref)
+ uint8_t *buffer, uint32_t size, bool keyframe)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
demux_packet_t *dp;
@@ -1860,13 +1860,13 @@ static void handle_realvideo(demuxer_t *demuxer, mkv_track_t *track,
biCompression, &track->rv_kf_base,
&track->rv_kf_pts, NULL);
dp->pos = demuxer->filepos;
- dp->flags = block_bref ? 0 : 0x10;
+ dp->keyframe = keyframe;
ds_add_packet(demuxer->video, dp);
}
static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
- uint8_t *buffer, uint32_t size, int64_t block_bref)
+ uint8_t *buffer, uint32_t size, bool keyframe)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
int sps = track->sub_packet_size;
@@ -1952,7 +1952,7 @@ static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
dp->pts = (x * apk_usize % w) ? 0 :
track->audio_timestamp[x * apk_usize / w];
dp->pos = track->audio_filepos; // all equal
- dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
+ dp->keyframe = !x; // Mark first packet as keyframe
ds_add_packet(demuxer->audio, dp);
}
}
@@ -1966,14 +1966,14 @@ static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
track->ra_pts = mkv_d->last_pts;
dp->pos = demuxer->filepos;
- dp->flags = block_bref ? 0 : 0x10;
+ dp->keyframe = keyframe;
ds_add_packet(demuxer->audio, dp);
}
}
static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
- uint64_t block_duration, int64_t block_bref,
- int64_t block_fref, uint8_t simpleblock)
+ uint64_t block_duration, bool keyframe,
+ bool simpleblock)
{
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
mkv_track_t *track = NULL;
@@ -1995,6 +1995,8 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
length -= tmp + 2;
old_length = length;
flags = block[0];
+ if (simpleblock)
+ keyframe = flags & 0x80;
if (demux_mkv_read_block_lacing(block, &length, &laces, &lace_size))
return 0;
block += old_length - length;
@@ -2015,13 +2017,8 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
&& track->id == demuxer->audio->id) {
ds = demuxer->audio;
- if (mkv_d->a_skip_to_keyframe) {
- if (simpleblock) {
- if (!(flags & 0x80)) /*current frame isn't a keyframe */
- use_this_block = 0;
- } else if (block_bref != 0)
- use_this_block = 0;
- }
+ if (mkv_d->a_skip_to_keyframe)
+ use_this_block = keyframe;
if (mkv_d->v_skip_to_keyframe)
use_this_block = 0;
@@ -2043,13 +2040,8 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
else if (track->type == MATROSKA_TRACK_VIDEO
&& track->id == demuxer->video->id) {
ds = demuxer->video;
- if (mkv_d->v_skip_to_keyframe) {
- if (simpleblock) {
- if (!(flags & 0x80)) /*current frame isn't a keyframe */
- use_this_block = 0;
- } else if (block_bref != 0 || block_fref != 0)
- use_this_block = 0;
- }
+ if (mkv_d->v_skip_to_keyframe)
+ use_this_block = keyframe;
} else if (track->type == MATROSKA_TRACK_SUBTITLE
&& track->id == demuxer->sub->id) {
ds = demuxer->sub;
@@ -2069,10 +2061,10 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
for (i = 0; i < laces; i++) {
if (ds == demuxer->video && track->realmedia)
handle_realvideo(demuxer, track, block, lace_size[i],
- block_bref);
+ keyframe);
else if (ds == demuxer->audio && track->realmedia)
handle_realaudio(demuxer, track, block, lace_size[i],
- block_bref);
+ keyframe);
else {
int size = lace_size[i];
demux_packet_t *dp;
@@ -2083,8 +2075,7 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
memcpy(dp->buffer, buffer, size);
if (buffer != block)
talloc_free(buffer);
- dp->flags = (block_bref == 0
- && block_fref == 0) ? 0x10 : 0;
+ dp->keyframe = keyframe;
/* If default_duration is 0, assume no pts value is known
* for packets after the first one (rather than all pts
* values being the same) */
@@ -2122,7 +2113,7 @@ static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
while (1) {
while (mkv_d->cluster_size > 0) {
uint64_t block_duration = 0, block_length = 0;
- int64_t block_bref = 0, block_fref = 0;
+ bool keyframe = true;
uint8_t *block = NULL;
while (mkv_d->blockgroup_size > 0) {
@@ -2157,10 +2148,8 @@ static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
free(block);
return 0;
}
- if (num <= 0)
- block_bref = num;
- else
- block_fref = num;
+ if (num)
+ keyframe = false;
break;
case EBML_ID_INVALID:
@@ -2177,8 +2166,7 @@ static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
if (block) {
int res = handle_block(demuxer, block, block_length,
- block_duration, block_bref, block_fref,
- 0);
+ block_duration, keyframe, false);
free(block);
if (res < 0)
return 0;
@@ -2216,8 +2204,7 @@ static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
}
l = tmp + block_length;
res = handle_block(demuxer, block, block_length,
- block_duration, block_bref,
- block_fref, 1);
+ block_duration, false, true);
free(block);
mkv_d->cluster_size -= l + il;
if (res < 0)
diff --git a/libmpdemux/demux_mov.c b/libmpdemux/demux_mov.c
index bccf808465..96fb1a2d86 100644
--- a/libmpdemux/demux_mov.c
+++ b/libmpdemux/demux_mov.c
@@ -2195,7 +2195,6 @@ if(trak->pos==0 && trak->stream_header_len>0){
trak->stream_header = NULL;
trak->stream_header_len = 0;
dp->pts=pts;
- dp->flags=0;
dp->pos=pos; // FIXME?
ds_add_packet(ds,dp);
} else
diff --git a/libmpdemux/demux_nut.c b/libmpdemux/demux_nut.c
index efa20e0c47..e6602ef506 100644
--- a/libmpdemux/demux_nut.c
+++ b/libmpdemux/demux_nut.c
@@ -238,7 +238,7 @@ static int demux_nut_fill_buffer(demuxer_t * demuxer, demux_stream_t * dsds) {
dp->pts = pts;
dp->pos = demuxer->filepos;
- dp->flags= (pd.flags & NUT_FLAG_KEY) ? 0x10 : 0;
+ dp->keyframe = pd.flags & NUT_FLAG_KEY;
{int len = pd.len;
while ((ret = nut_read_frame(nut, &len, dp->buffer + pd.len-len)) == NUT_ERR_EAGAIN);
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c
index d38d68cb79..9eea061106 100644
--- a/libmpdemux/demux_ogg.c
+++ b/libmpdemux/demux_ogg.c
@@ -258,13 +258,13 @@ static int demux_ogg_get_page_stream(ogg_demuxer_t *ogg_d,
}
static unsigned char *demux_ogg_read_packet(ogg_stream_t *os, ogg_packet *pack,
- float *pts, int *flags,
+ float *pts, bool *keyframe,
int samplesize)
{
unsigned char *data = pack->packet;
*pts = MP_NOPTS_VALUE;
- *flags = 0;
+ *keyframe = false;
if (os->vorbis) {
if (*pack->packet & PACKET_TYPE_HEADER) {
@@ -283,7 +283,7 @@ static unsigned char *demux_ogg_read_packet(ogg_stream_t *os, ogg_packet *pack,
if (os->lastsize > 0)
pack->granulepos += os->lastsize;
} else
- *flags = 1;
+ *keyframe = true;
if (vi)
*pts = pack->granulepos / (float)vi->rate;
os->lastsize = blocksize;
@@ -306,7 +306,7 @@ static unsigned char *demux_ogg_read_packet(ogg_stream_t *os, ogg_packet *pack,
if (pack->granulepos >= 0) {
os->lastpos = pack->granulepos >> keyframe_granule_shift;
os->lastpos += pack->granulepos & iframemask;
- *flags = (pack->granulepos & iframemask) == 0;
+ *keyframe = (pack->granulepos & iframemask) == 0;
} else {
os->lastpos++;
}
@@ -332,7 +332,7 @@ static unsigned char *demux_ogg_read_packet(ogg_stream_t *os, ogg_packet *pack,
pack->granulepos = os->lastpos + (os->lastsize ? os->lastsize : 1);
// If we already have a timestamp it can be a syncpoint
if (*pack->packet & PACKET_IS_SYNCPOINT)
- *flags = 1;
+ *keyframe = true;
*pts = pack->granulepos / os->samplerate;
// Save the packet length and timestamp
os->lastsize = 0;
@@ -474,10 +474,6 @@ static int demux_ogg_add_packet(demux_stream_t *ds, ogg_stream_t *os,
int id, ogg_packet *pack)
{
demuxer_t *d = ds->demuxer;
- demux_packet_t *dp;
- unsigned char *data;
- float pts = 0;
- int flags = 0;
int samplesize = 1;
// If packet is an comment header then we try to get comments at first
@@ -520,7 +516,10 @@ static int demux_ogg_add_packet(demux_stream_t *ds, ogg_stream_t *os,
if (ds == d->audio && ((sh_audio_t*)ds->sh)->format == FOURCC_VORBIS) {
samplesize = ((sh_audio_t *)ds->sh)->samplesize;
}
- data = demux_ogg_read_packet(os, pack, &pts, &flags, samplesize);
+ bool keyframe;
+ float pts;
+ unsigned char *data;
+ data = demux_ogg_read_packet(os, pack, &pts, &keyframe, samplesize);
if (!data)
return 0;
@@ -530,14 +529,15 @@ static int demux_ogg_add_packet(demux_stream_t *ds, ogg_stream_t *os,
vo_osd_changed(OSDTYPE_SUBTITLE);
}
/// Send the packet
+ struct demux_packet *dp;
dp = new_demux_packet(pack->bytes - (data - pack->packet));
memcpy(dp->buffer, data, pack->bytes - (data - pack->packet));
dp->pts = pts;
- dp->flags = flags;
+ dp->keyframe = keyframe;
ds_add_packet(ds, dp);
mp_msg(MSGT_DEMUX, MSGL_DBG2,
- "New dp: %p ds=%p pts=%5.3f len=%d flag=%d \n",
- dp, ds, pts, dp->len, flags);
+ "New dp: %p ds=%p pts=%5.3f len=%d keyframe=%d \n",
+ dp, ds, pts, dp->len, keyframe);
return 1;
}
@@ -606,12 +606,12 @@ static void demux_ogg_scan_stream(demuxer_t *demuxer)
p = 0;
while (ogg_stream_packetout(oss, &op) == 1) {
float pts;
- int flags;
+ bool keyframe;
- demux_ogg_read_packet(os, &op, &pts, &flags, samplesize);
+ demux_ogg_read_packet(os, &op, &pts, &keyframe, samplesize);
if (op.granulepos >= 0) {
ogg_d->final_granulepos = op.granulepos;
- if (ogg_d->initial_granulepos == MP_NOPTS_VALUE && (flags & 1)) {
+ if (ogg_d->initial_granulepos == MP_NOPTS_VALUE && keyframe) {
ogg_d->initial_granulepos = op.granulepos;
if (index_mode != 2 && ogg_d->pos < demuxer->movi_end - 2 * 270000) {
//the 270000 are just a wild guess
@@ -621,7 +621,7 @@ static void demux_ogg_scan_stream(demuxer_t *demuxer)
}
}
}
- if (index_mode == 2 && (flags || (os->vorbis && op.granulepos >= 0))) {
+ if (index_mode == 2 && (keyframe || (os->vorbis && op.granulepos >= 0))) {
if (ogg_d->num_syncpoint > SIZE_MAX / sizeof(ogg_syncpoint_t) - 1)
break;
ogg_d->syncpoints = realloc_struct(ogg_d->syncpoints, (ogg_d->num_syncpoint + 1), sizeof(ogg_syncpoint_t));
@@ -1415,7 +1415,7 @@ static void demux_ogg_seek(demuxer_t *demuxer, float rel_seek_secs,
int np;
int is_gp_valid;
float pts;
- int is_keyframe;
+ bool is_keyframe;
int samplesize = 1;
ogg_int64_t granulepos_orig;
diff --git a/libmpdemux/demux_packet.h b/libmpdemux/demux_packet.h
index 30cd0010f5..d64291f4e0 100644
--- a/libmpdemux/demux_packet.h
+++ b/libmpdemux/demux_packet.h
@@ -19,6 +19,7 @@
#ifndef MPLAYER_DEMUX_PACKET_H
#define MPLAYER_DEMUX_PACKET_H
+#include <stdbool.h>
#include <sys/types.h>
// Holds one packet/frame/whatever
@@ -29,7 +30,7 @@ typedef struct demux_packet {
double stream_pts;
off_t pos; // position in index (AVI) or file (MPG)
unsigned char *buffer;
- int flags; // keyframe, etc
+ bool keyframe;
int refcount; // counter for the master packet, if 0, buffer can be free()d
struct demux_packet *master; //in clones, pointer to the master packet
struct demux_packet *next;
diff --git a/libmpdemux/demux_rawdv.c b/libmpdemux/demux_rawdv.c
index f0b081318c..1e0a27e9f4 100644
--- a/libmpdemux/demux_rawdv.c
+++ b/libmpdemux/demux_rawdv.c
@@ -124,7 +124,6 @@ static int demux_rawdv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
return 0;
dp_video->pts=frames->current_frame/sh_video->fps;
dp_video->pos=frames->current_filepos;
- dp_video->flags=0;
if (demuxer->audio && demuxer->audio->id>=-1)
{
diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c
index 687441f863..ea9c3046e0 100644
--- a/libmpdemux/demux_real.c
+++ b/libmpdemux/demux_real.c
@@ -794,7 +794,7 @@ got_audio:
if (x * apk_usize % w == 0)
dp->pts = priv->audio_timestamp[x * apk_usize / w];
dp->pos = priv->audio_filepos; // all equal
- dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
+ dp->keyframe = !x; // Mark first packet as keyframe
ds_add_packet(ds, dp);
}
}
@@ -839,7 +839,7 @@ got_audio:
dp->pts = timestamp/1000.0;
priv->a_pts=timestamp;
dp->pos = demuxer->filepos;
- dp->flags = (flags & 0x2) ? 0x10 : 0;
+ dp->keyframe = flags & 0x2;
ds_add_packet(ds, dp);
} // codec_id check, codec default case
@@ -1003,7 +1003,7 @@ got_video:
dp = new_demux_packet(sizeof(dp_hdr_t)+vpkg_length+8*(1+2*(vpkg_header&0x3F)));
// the timestamp seems to be in milliseconds
dp->pos = demuxer->filepos;
- dp->flags = (flags & 0x2) ? 0x10 : 0;
+ dp->keyframe = flags & 0x2;
ds->asf_seq = vpkg_seqnum;
dp_hdr=(dp_hdr_t*)dp->buffer;
dp_hdr->chunks=0;
diff --git a/libmpdemux/demux_realaud.c b/libmpdemux/demux_realaud.c
index ece05edf1e..d42b98a023 100644
--- a/libmpdemux/demux_realaud.c
+++ b/libmpdemux/demux_realaud.c
@@ -139,7 +139,7 @@ static int demux_ra_fill_buffer(demuxer_t *demuxer, demux_stream_t *dsds)
memcpy(dp->buffer, ra_priv->audio_buf + x * len, len);
dp->pts = x ? 0 : demuxer->filepos / ra_priv->data_size;
dp->pos = demuxer->filepos; // all equal
- dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
+ dp->keyframe = !x; // Mark first packet as keyframe
ds_add_packet(ds, dp);
}
} else {
@@ -148,7 +148,6 @@ static int demux_ra_fill_buffer(demuxer_t *demuxer, demux_stream_t *dsds)
dp->pts = demuxer->filepos / ra_priv->data_size;
dp->pos = demuxer->filepos;
- dp->flags = 0;
ds_add_packet(ds, dp);
}
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index 15c2613dc6..dbf12b7456 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -3132,7 +3132,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
}
memmove(p, es->start, es->size);
*dp_offset += es->size;
- (*dp)->flags = 0;
+ (*dp)->keyframe = 0;
(*dp)->pos = stream_tell(demuxer->stream);
(*dp)->pts = es->pts;
// subtitle packets must be returned immediately if possible
diff --git a/libmpdemux/demux_ty.c b/libmpdemux/demux_ty.c
index 7664eddc98..cc9bb8f902 100644
--- a/libmpdemux/demux_ty.c
+++ b/libmpdemux/demux_ty.c
@@ -294,7 +294,6 @@ static void demux_ty_CopyToDemuxPacket( demux_stream_t *ds,
if (pts != MP_NOPTS_VALUE)
dp->pts = pts / 90000.0;
dp->pos = pos;
- dp->flags = 0;
ds_add_packet( ds, dp );
}
diff --git a/libmpdemux/demux_y4m.c b/libmpdemux/demux_y4m.c
index d1b6749820..cf0f7cf7e6 100644
--- a/libmpdemux/demux_y4m.c
+++ b/libmpdemux/demux_y4m.c
@@ -141,7 +141,6 @@ static int demux_y4m_fill_buffer(demuxer_t *demux, demux_stream_t *dsds) {
dp->pts=(float)priv->framenum/((sh_video_t*)ds->sh)->fps;
priv->framenum++;
dp->pos=demux->filepos;
- dp->flags=0;
ds_add_packet(ds, dp);
return 1;
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index f8309b9f49..ea8c4e01f1 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -187,7 +187,7 @@ static struct demux_packet *create_packet(size_t len)
dp->duration = -1;
dp->stream_pts = MP_NOPTS_VALUE;
dp->pos = 0;
- dp->flags = 0;
+ dp->keyframe = false;
dp->refcount = 1;
dp->master = NULL;
dp->buffer = NULL;
@@ -601,14 +601,14 @@ void ds_clear_parser(demux_stream_t *ds)
}
void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len,
- double pts, off_t pos, int flags)
+ double pts, off_t pos, bool keyframe)
{
demux_packet_t *dp = new_demux_packet(len);
len = stream_read(stream, dp->buffer, len);
resize_demux_packet(dp, len);
dp->pts = pts;
dp->pos = pos;
- dp->flags = flags;
+ dp->keyframe = keyframe;
// append packet to DS stream:
ds_add_packet(ds, dp);
}
@@ -652,7 +652,7 @@ int ds_fill_buffer(demux_stream_t *ds)
ds->pts_bytes += p->len; // !!!
if (p->stream_pts != MP_NOPTS_VALUE)
demux->stream_pts = p->stream_pts;
- ds->flags = p->flags;
+ ds->keyframe = p->keyframe;
// unlink packet:
ds->bytes -= p->len;
ds->current = p;
@@ -1000,11 +1000,8 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
if (!desc)
// should only happen with obsolete -demuxer 99 numeric format
return NULL;
- demuxer = open_given_type(opts, desc, stream, force, audio_id,
- video_id, sub_id, filename, params);
- if (demuxer)
- goto dmx_open;
- return NULL;
+ return open_given_type(opts, desc, stream, force, audio_id,
+ video_id, sub_id, filename, params);
}
// Test demuxers with safe file checks
@@ -1013,7 +1010,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
demuxer = open_given_type(opts, desc, stream, false, audio_id,
video_id, sub_id, filename, params);
if (demuxer)
- goto dmx_open;
+ return demuxer;
}
}
@@ -1026,7 +1023,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
demuxer = open_given_type(opts, desc, stream, false, audio_id,
video_id, sub_id, filename, params);
if (demuxer)
- goto dmx_open;
+ return demuxer;
}
// Finally try detection for demuxers with unsafe checks
@@ -1035,28 +1032,11 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
demuxer = open_given_type(opts, desc, stream, false, audio_id,
video_id, sub_id, filename, params);
if (demuxer)
- goto dmx_open;
+ return demuxer;
}
}
return NULL;
-
- dmx_open:
-
- if (demuxer->type == DEMUXER_TYPE_PLAYLIST)
- return demuxer;
-
- struct sh_video *sh_video = demuxer->video->sh;
- if (sh_video && sh_video->bih) {
- int biComp = le2me_32(sh_video->bih->biCompression);
- mp_msg(MSGT_DEMUX, MSGL_INFO,
- "VIDEO: [%.4s] %dx%d %dbpp %5.3f fps %5.1f kbps (%4.1f kbyte/s)\n",
- (char *) &biComp, sh_video->bih->biWidth,
- sh_video->bih->biHeight, sh_video->bih->biBitCount,
- sh_video->fps, sh_video->i_bps * 0.008f,
- sh_video->i_bps / 1024.0f);
- }
- return demuxer;
}
struct demuxer *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index da751852d8..03b1fee830 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -136,7 +136,7 @@ typedef struct demux_stream {
off_t pos; // position in the input stream (file)
off_t dpos; // position in the demuxed stream
int pack_no; // serial number of packet
- int flags; // flags of current packet (keyframe etc)
+ bool keyframe; // keyframe flag of current packet
int non_interleaved; // 1 if this stream is not properly interleaved,
// so e.g. subtitle handling must do explicit reads.
//---------------
@@ -316,7 +316,7 @@ void free_demuxer(struct demuxer *demuxer);
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
void ds_read_packet(struct demux_stream *ds, struct stream *stream, int len,
- double pts, off_t pos, int flags);
+ double pts, off_t pos, bool keyframe);
int demux_fill_buffer(struct demuxer *demux, struct demux_stream *ds);
int ds_fill_buffer(struct demux_stream *ds);
diff --git a/libmpdemux/ebml_defs.c b/libmpdemux/ebml_defs.c
deleted file mode 100644
index b683312079..0000000000
--- a/libmpdemux/ebml_defs.c
+++ /dev/null
@@ -1,424 +0,0 @@
-// Generated by TOOLS/matroska.py, do not edit manually
-
-
-E("TagString", tag_string, EBML_TYPE_STR)
-
-E("TagLanguage", tag_language, EBML_TYPE_STR)
-
-E("TagName", tag_name, EBML_TYPE_STR)
-
-#define N simple_tag
-E_S("SimpleTag", 3)
-F(MATROSKA_ID_TAGNAME, tag_name, 0)
-F(MATROSKA_ID_TAGLANGUAGE, tag_language, 0)
-F(MATROSKA_ID_TAGSTRING, tag_string, 0)
-}};
-#undef N
-
-E("TargetAttachmentUID", target_attachment_uid, EBML_TYPE_UINT)
-
-E("TargetChapterUID", target_chapter_uid, EBML_TYPE_UINT)
-
-E("TargetEditionUID", target_edition_uid, EBML_TYPE_UINT)
-
-E("TargetTrackUID", target_track_uid, EBML_TYPE_UINT)
-
-E("TargetTypeValue", target_type_value, EBML_TYPE_UINT)
-
-#define N targets
-E_S("Targets", 5)
-F(MATROSKA_ID_TARGETTYPEVALUE, target_type_value, 0)
-F(MATROSKA_ID_TARGETTRACKUID, target_track_uid, 0)
-F(MATROSKA_ID_TARGETEDITIONUID, target_edition_uid, 0)
-F(MATROSKA_ID_TARGETCHAPTERUID, target_chapter_uid, 0)
-F(MATROSKA_ID_TARGETATTACHMENTUID, target_attachment_uid, 0)
-}};
-#undef N
-
-#define N tag
-E_S("Tag", 2)
-F(MATROSKA_ID_TARGETS, targets, 0)
-F(MATROSKA_ID_SIMPLETAG, simple_tag, 1)
-}};
-#undef N
-
-#define N tags
-E_S("Tags", 1)
-F(MATROSKA_ID_TAG, tag, 1)
-}};
-#undef N
-
-E("ChapCountry", chap_country, EBML_TYPE_STR)
-
-E("ChapLanguage", chap_language, EBML_TYPE_STR)
-
-E("ChapString", chap_string, EBML_TYPE_STR)
-
-#define N chapter_display
-E_S("ChapterDisplay", 3)
-F(MATROSKA_ID_CHAPSTRING, chap_string, 0)
-F(MATROSKA_ID_CHAPLANGUAGE, chap_language, 1)
-F(MATROSKA_ID_CHAPCOUNTRY, chap_country, 1)
-}};
-#undef N
-
-E("ChapterSegmentEditionUID", chapter_segment_edition_uid, EBML_TYPE_UINT)
-
-E("ChapterSegmentUID", chapter_segment_uid, EBML_TYPE_BINARY)
-
-E("ChapterFlagEnabled", chapter_flag_enabled, EBML_TYPE_UINT)
-
-E("ChapterFlagHidden", chapter_flag_hidden, EBML_TYPE_UINT)
-
-E("ChapterTimeEnd", chapter_time_end, EBML_TYPE_UINT)
-
-E("ChapterTimeStart", chapter_time_start, EBML_TYPE_UINT)
-
-E("ChapterUID", chapter_uid, EBML_TYPE_UINT)
-
-#define N chapter_atom
-E_S("ChapterAtom", 8)
-F(MATROSKA_ID_CHAPTERUID, chapter_uid, 0)
-F(MATROSKA_ID_CHAPTERTIMESTART, chapter_time_start, 0)
-F(MATROSKA_ID_CHAPTERTIMEEND, chapter_time_end, 0)
-F(MATROSKA_ID_CHAPTERFLAGHIDDEN, chapter_flag_hidden, 0)
-F(MATROSKA_ID_CHAPTERFLAGENABLED, chapter_flag_enabled, 0)
-F(MATROSKA_ID_CHAPTERSEGMENTUID, chapter_segment_uid, 0)
-F(MATROSKA_ID_CHAPTERSEGMENTEDITIONUID, chapter_segment_edition_uid, 0)
-F(MATROSKA_ID_CHAPTERDISPLAY, chapter_display, 1)
-}};
-#undef N
-
-E("EditionFlagOrdered", edition_flag_ordered, EBML_TYPE_UINT)
-
-E("EditionFlagDefault", edition_flag_default, EBML_TYPE_UINT)
-
-E("EditionFlagHidden", edition_flag_hidden, EBML_TYPE_UINT)
-
-E("EditionUID", edition_uid, EBML_TYPE_UINT)
-
-#define N edition_entry
-E_S("EditionEntry", 5)
-F(MATROSKA_ID_EDITIONUID, edition_uid, 0)
-F(MATROSKA_ID_EDITIONFLAGHIDDEN, edition_flag_hidden, 0)
-F(MATROSKA_ID_EDITIONFLAGDEFAULT, edition_flag_default, 0)
-F(MATROSKA_ID_EDITIONFLAGORDERED, edition_flag_ordered, 0)
-F(MATROSKA_ID_CHAPTERATOM, chapter_atom, 1)
-}};
-#undef N
-
-#define N chapters
-E_S("Chapters", 1)
-F(MATROSKA_ID_EDITIONENTRY, edition_entry, 1)
-}};
-#undef N
-
-E("FileUID", file_uid, EBML_TYPE_UINT)
-
-E("FileData", file_data, EBML_TYPE_BINARY)
-
-E("FileMimeType", file_mime_type, EBML_TYPE_STR)
-
-E("FileName", file_name, EBML_TYPE_STR)
-
-E("FileDescription", file_description, EBML_TYPE_STR)
-
-#define N attached_file
-E_S("AttachedFile", 5)
-F(MATROSKA_ID_FILEDESCRIPTION, file_description, 0)
-F(MATROSKA_ID_FILENAME, file_name, 0)
-F(MATROSKA_ID_FILEMIMETYPE, file_mime_type, 0)
-F(MATROSKA_ID_FILEDATA, file_data, 0)
-F(MATROSKA_ID_FILEUID, file_uid, 0)
-}};
-#undef N
-
-#define N attachments
-E_S("Attachments", 1)
-F(MATROSKA_ID_ATTACHEDFILE, attached_file, 1)
-}};
-#undef N
-
-E("CueClusterPosition", cue_cluster_position, EBML_TYPE_UINT)
-
-E("CueTrack", cue_track, EBML_TYPE_UINT)
-
-#define N cue_track_positions
-E_S("CueTrackPositions", 2)
-F(MATROSKA_ID_CUETRACK, cue_track, 0)
-F(MATROSKA_ID_CUECLUSTERPOSITION, cue_cluster_position, 0)
-}};
-#undef N
-
-E("CueTime", cue_time, EBML_TYPE_UINT)
-
-#define N cue_point
-E_S("CuePoint", 2)
-F(MATROSKA_ID_CUETIME, cue_time, 0)
-F(MATROSKA_ID_CUETRACKPOSITIONS, cue_track_positions, 1)
-}};
-#undef N
-
-#define N cues
-E_S("Cues", 1)
-F(MATROSKA_ID_CUEPOINT, cue_point, 1)
-}};
-#undef N
-
-E("ContentCompSettings", content_comp_settings, EBML_TYPE_BINARY)
-
-E("ContentCompAlgo", content_comp_algo, EBML_TYPE_UINT)
-
-#define N content_compression
-E_S("ContentCompression", 2)
-F(MATROSKA_ID_CONTENTCOMPALGO, content_comp_algo, 0)
-F(MATROSKA_ID_CONTENTCOMPSETTINGS, content_comp_settings, 0)
-}};
-#undef N
-
-E("ContentEncodingType", content_encoding_type, EBML_TYPE_UINT)
-
-E("ContentEncodingScope", content_encoding_scope, EBML_TYPE_UINT)
-
-E("ContentEncodingOrder", content_encoding_order, EBML_TYPE_UINT)
-
-#define N content_encoding
-E_S("ContentEncoding", 4)
-F(MATROSKA_ID_CONTENTENCODINGORDER, content_encoding_order, 0)
-F(MATROSKA_ID_CONTENTENCODINGSCOPE, content_encoding_scope, 0)
-F(MATROSKA_ID_CONTENTENCODINGTYPE, content_encoding_type, 0)
-F(MATROSKA_ID_CONTENTCOMPRESSION, content_compression, 0)
-}};
-#undef N
-
-#define N content_encodings
-E_S("ContentEncodings", 1)
-F(MATROSKA_ID_CONTENTENCODING, content_encoding, 1)
-}};
-#undef N
-
-E("BitDepth", bit_depth, EBML_TYPE_UINT)
-
-E("Channels", channels, EBML_TYPE_UINT)
-
-E("OutputSamplingFrequency", output_sampling_frequency, EBML_TYPE_FLOAT)
-
-E("SamplingFrequency", sampling_frequency, EBML_TYPE_FLOAT)
-
-#define N audio
-E_S("Audio", 4)
-F(MATROSKA_ID_SAMPLINGFREQUENCY, sampling_frequency, 0)
-F(MATROSKA_ID_OUTPUTSAMPLINGFREQUENCY, output_sampling_frequency, 0)
-F(MATROSKA_ID_CHANNELS, channels, 0)
-F(MATROSKA_ID_BITDEPTH, bit_depth, 0)
-}};
-#undef N
-
-E("FrameRate", frame_rate, EBML_TYPE_FLOAT)
-
-E("DisplayUnit", display_unit, EBML_TYPE_UINT)
-
-E("DisplayHeight", display_height, EBML_TYPE_UINT)
-
-E("DisplayWidth", display_width, EBML_TYPE_UINT)
-
-E("PixelHeight", pixel_height, EBML_TYPE_UINT)
-
-E("PixelWidth", pixel_width, EBML_TYPE_UINT)
-
-E("FlagInterlaced", flag_interlaced, EBML_TYPE_UINT)
-
-#define N video
-E_S("Video", 7)
-F(MATROSKA_ID_FLAGINTERLACED, flag_interlaced, 0)
-F(MATROSKA_ID_PIXELWIDTH, pixel_width, 0)
-F(MATROSKA_ID_PIXELHEIGHT, pixel_height, 0)
-F(MATROSKA_ID_DISPLAYWIDTH, display_width, 0)
-F(MATROSKA_ID_DISPLAYHEIGHT, display_height, 0)
-F(MATROSKA_ID_DISPLAYUNIT, display_unit, 0)
-F(MATROSKA_ID_FRAMERATE, frame_rate, 0)
-}};
-#undef N
-
-E("CodecDecodeAll", codec_decode_all, EBML_TYPE_UINT)
-
-E("CodecPrivate", codec_private, EBML_TYPE_BINARY)
-
-E("CodecID", codec_id, EBML_TYPE_STR)
-
-E("Language", language, EBML_TYPE_STR)
-
-E("Name", name, EBML_TYPE_STR)
-
-E("MaxBlockAdditionID", max_block_addition_id, EBML_TYPE_UINT)
-
-E("TrackTimecodeScale", track_timecode_scale, EBML_TYPE_FLOAT)
-
-E("DefaultDuration", default_duration, EBML_TYPE_UINT)
-
-E("MaxCache", max_cache, EBML_TYPE_UINT)
-
-E("MinCache", min_cache, EBML_TYPE_UINT)
-
-E("FlagLacing", flag_lacing, EBML_TYPE_UINT)
-
-E("FlagForced", flag_forced, EBML_TYPE_UINT)
-
-E("FlagDefault", flag_default, EBML_TYPE_UINT)
-
-E("FlagEnabled", flag_enabled, EBML_TYPE_UINT)
-
-E("TrackType", track_type, EBML_TYPE_UINT)
-
-E("TrackUID", track_uid, EBML_TYPE_UINT)
-
-E("TrackNumber", track_number, EBML_TYPE_UINT)
-
-#define N track_entry
-E_S("TrackEntry", 20)
-F(MATROSKA_ID_TRACKNUMBER, track_number, 0)
-F(MATROSKA_ID_TRACKUID, track_uid, 0)
-F(MATROSKA_ID_TRACKTYPE, track_type, 0)
-F(MATROSKA_ID_FLAGENABLED, flag_enabled, 0)
-F(MATROSKA_ID_FLAGDEFAULT, flag_default, 0)
-F(MATROSKA_ID_FLAGFORCED, flag_forced, 0)
-F(MATROSKA_ID_FLAGLACING, flag_lacing, 0)
-F(MATROSKA_ID_MINCACHE, min_cache, 0)
-F(MATROSKA_ID_MAXCACHE, max_cache, 0)
-F(MATROSKA_ID_DEFAULTDURATION, default_duration, 0)
-F(MATROSKA_ID_TRACKTIMECODESCALE, track_timecode_scale, 0)
-F(MATROSKA_ID_MAXBLOCKADDITIONID, max_block_addition_id, 0)
-F(MATROSKA_ID_NAME, name, 0)
-F(MATROSKA_ID_LANGUAGE, language, 0)
-F(MATROSKA_ID_CODECID, codec_id, 0)
-F(MATROSKA_ID_CODECPRIVATE, codec_private, 0)
-F(MATROSKA_ID_CODECDECODEALL, codec_decode_all, 0)
-F(MATROSKA_ID_VIDEO, video, 0)
-F(MATROSKA_ID_AUDIO, audio, 0)
-F(MATROSKA_ID_CONTENTENCODINGS, content_encodings, 0)
-}};
-#undef N
-
-#define N tracks
-E_S("Tracks", 1)
-F(MATROSKA_ID_TRACKENTRY, track_entry, 1)
-}};
-#undef N
-
-E("SimpleBlock", simple_block, EBML_TYPE_BINARY)
-
-E("ReferenceBlock", reference_block, EBML_TYPE_SINT)
-
-E("BlockDuration", block_duration, EBML_TYPE_UINT)
-
-E("Block", block, EBML_TYPE_BINARY)
-
-#define N block_group
-E_S("BlockGroup", 3)
-F(MATROSKA_ID_BLOCK, block, 0)
-F(MATROSKA_ID_BLOCKDURATION, block_duration, 0)
-F(MATROSKA_ID_REFERENCEBLOCK, reference_block, 1)
-}};
-#undef N
-
-E("Timecode", timecode, EBML_TYPE_UINT)
-
-#define N cluster
-E_S("Cluster", 3)
-F(MATROSKA_ID_TIMECODE, timecode, 0)
-F(MATROSKA_ID_BLOCKGROUP, block_group, 1)
-F(MATROSKA_ID_SIMPLEBLOCK, simple_block, 1)
-}};
-#undef N
-
-E("Duration", duration, EBML_TYPE_FLOAT)
-
-E("WritingApp", writing_app, EBML_TYPE_STR)
-
-E("MuxingApp", muxing_app, EBML_TYPE_STR)
-
-E("Title", title, EBML_TYPE_STR)
-
-E("DateUTC", date_utc, EBML_TYPE_SINT)
-
-E("TimecodeScale", timecode_scale, EBML_TYPE_UINT)
-
-E("NextUID", next_uid, EBML_TYPE_BINARY)
-
-E("PrevUID", prev_uid, EBML_TYPE_BINARY)
-
-E("SegmentUID", segment_uid, EBML_TYPE_BINARY)
-
-#define N info
-E_S("Info", 9)
-F(MATROSKA_ID_SEGMENTUID, segment_uid, 0)
-F(MATROSKA_ID_PREVUID, prev_uid, 0)
-F(MATROSKA_ID_NEXTUID, next_uid, 0)
-F(MATROSKA_ID_TIMECODESCALE, timecode_scale, 0)
-F(MATROSKA_ID_DATEUTC, date_utc, 0)
-F(MATROSKA_ID_TITLE, title, 0)
-F(MATROSKA_ID_MUXINGAPP, muxing_app, 0)
-F(MATROSKA_ID_WRITINGAPP, writing_app, 0)
-F(MATROSKA_ID_DURATION, duration, 0)
-}};
-#undef N
-
-E("SeekPosition", seek_position, EBML_TYPE_UINT)
-
-E("SeekID", seek_id, EBML_TYPE_EBML_ID)
-
-#define N seek
-E_S("Seek", 2)
-F(MATROSKA_ID_SEEKID, seek_id, 0)
-F(MATROSKA_ID_SEEKPOSITION, seek_position, 0)
-}};
-#undef N
-
-#define N seek_head
-E_S("SeekHead", 1)
-F(MATROSKA_ID_SEEK, seek, 1)
-}};
-#undef N
-
-#define N segment
-E_S("Segment", 8)
-F(MATROSKA_ID_SEEKHEAD, seek_head, 1)
-F(MATROSKA_ID_INFO, info, 1)
-F(MATROSKA_ID_CLUSTER, cluster, 1)
-F(MATROSKA_ID_TRACKS, tracks, 1)
-F(MATROSKA_ID_CUES, cues, 0)
-F(MATROSKA_ID_ATTACHMENTS, attachments, 0)
-F(MATROSKA_ID_CHAPTERS, chapters, 0)
-F(MATROSKA_ID_TAGS, tags, 1)
-}};
-#undef N
-
-E("Void", void, EBML_TYPE_BINARY)
-
-E("CRC32", crc32, EBML_TYPE_BINARY)
-
-E("DocTypeReadVersion", doc_type_read_version, EBML_TYPE_UINT)
-
-E("DocTypeVersion", doc_type_version, EBML_TYPE_UINT)
-
-E("DocType", doc_type, EBML_TYPE_STR)
-
-E("EBMLMaxSizeLength", ebml_max_size_length, EBML_TYPE_UINT)
-
-E("EBMLMaxIDLength", ebml_max_id_length, EBML_TYPE_UINT)
-
-E("EBMLReadVersion", ebml_read_version, EBML_TYPE_UINT)
-
-E("EBMLVersion", ebml_version, EBML_TYPE_UINT)
-
-#define N ebml
-E_S("EBML", 7)
-F(EBML_ID_EBMLVERSION, ebml_version, 0)
-F(EBML_ID_EBMLREADVERSION, ebml_read_version, 0)
-F(EBML_ID_EBMLMAXIDLENGTH, ebml_max_id_length, 0)
-F(EBML_ID_EBMLMAXSIZELENGTH, ebml_max_size_length, 0)
-F(EBML_ID_DOCTYPE, doc_type, 0)
-F(EBML_ID_DOCTYPEVERSION, doc_type_version, 0)
-F(EBML_ID_DOCTYPEREADVERSION, doc_type_read_version, 0)
-}};
-#undef N
diff --git a/libmpdemux/ebml_types.h b/libmpdemux/ebml_types.h
deleted file mode 100644
index 252515f070..0000000000
--- a/libmpdemux/ebml_types.h
+++ /dev/null
@@ -1,477 +0,0 @@
-// Generated by TOOLS/matroska.py, do not edit manually
-
-#define EBML_ID_EBML 0x1a45dfa3
-#define EBML_ID_EBMLVERSION 0x4286
-#define EBML_ID_EBMLREADVERSION 0x42f7
-#define EBML_ID_EBMLMAXIDLENGTH 0x42f2
-#define EBML_ID_EBMLMAXSIZELENGTH 0x42f3
-#define EBML_ID_DOCTYPE 0x4282
-#define EBML_ID_DOCTYPEVERSION 0x4287
-#define EBML_ID_DOCTYPEREADVERSION 0x4285
-#define EBML_ID_CRC32 0xbf
-#define EBML_ID_VOID 0xec
-#define MATROSKA_ID_SEGMENT 0x18538067
-#define MATROSKA_ID_SEEKHEAD 0x114d9b74
-#define MATROSKA_ID_SEEK 0x4dbb
-#define MATROSKA_ID_SEEKID 0x53ab
-#define MATROSKA_ID_SEEKPOSITION 0x53ac
-#define MATROSKA_ID_INFO 0x1549a966
-#define MATROSKA_ID_SEGMENTUID 0x73a4
-#define MATROSKA_ID_PREVUID 0x3cb923
-#define MATROSKA_ID_NEXTUID 0x3eb923
-#define MATROSKA_ID_TIMECODESCALE 0x2ad7b1
-#define MATROSKA_ID_DATEUTC 0x4461
-#define MATROSKA_ID_TITLE 0x7ba9
-#define MATROSKA_ID_MUXINGAPP 0x4d80
-#define MATROSKA_ID_WRITINGAPP 0x5741
-#define MATROSKA_ID_DURATION 0x4489
-#define MATROSKA_ID_CLUSTER 0x1f43b675
-#define MATROSKA_ID_TIMECODE 0xe7
-#define MATROSKA_ID_BLOCKGROUP 0xa0
-#define MATROSKA_ID_BLOCK 0xa1
-#define MATROSKA_ID_BLOCKDURATION 0x9b
-#define MATROSKA_ID_REFERENCEBLOCK 0xfb
-#define MATROSKA_ID_SIMPLEBLOCK 0xa3
-#define MATROSKA_ID_TRACKS 0x1654ae6b
-#define MATROSKA_ID_TRACKENTRY 0xae
-#define MATROSKA_ID_TRACKNUMBER 0xd7
-#define MATROSKA_ID_TRACKUID 0x73c5
-#define MATROSKA_ID_TRACKTYPE 0x83
-#define MATROSKA_ID_FLAGENABLED 0xb9
-#define MATROSKA_ID_FLAGDEFAULT 0x88
-#define MATROSKA_ID_FLAGFORCED 0x55aa
-#define MATROSKA_ID_FLAGLACING 0x9c
-#define MATROSKA_ID_MINCACHE 0x6de7
-#define MATROSKA_ID_MAXCACHE 0x6df8
-#define MATROSKA_ID_DEFAULTDURATION 0x23e383
-#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314f
-#define MATROSKA_ID_MAXBLOCKADDITIONID 0x55ee
-#define MATROSKA_ID_NAME 0x536e
-#define MATROSKA_ID_LANGUAGE 0x22b59c
-#define MATROSKA_ID_CODECID 0x86
-#define MATROSKA_ID_CODECPRIVATE 0x63a2
-#define MATROSKA_ID_CODECDECODEALL 0xaa
-#define MATROSKA_ID_VIDEO 0xe0
-#define MATROSKA_ID_FLAGINTERLACED 0x9a
-#define MATROSKA_ID_PIXELWIDTH 0xb0
-#define MATROSKA_ID_PIXELHEIGHT 0xba
-#define MATROSKA_ID_DISPLAYWIDTH 0x54b0
-#define MATROSKA_ID_DISPLAYHEIGHT 0x54ba
-#define MATROSKA_ID_DISPLAYUNIT 0x54b2
-#define MATROSKA_ID_FRAMERATE 0x2383e3
-#define MATROSKA_ID_AUDIO 0xe1
-#define MATROSKA_ID_SAMPLINGFREQUENCY 0xb5
-#define MATROSKA_ID_OUTPUTSAMPLINGFREQUENCY 0x78b5
-#define MATROSKA_ID_CHANNELS 0x9f
-#define MATROSKA_ID_BITDEPTH 0x6264
-#define MATROSKA_ID_CONTENTENCODINGS 0x6d80
-#define MATROSKA_ID_CONTENTENCODING 0x6240
-#define MATROSKA_ID_CONTENTENCODINGORDER 0x5031
-#define MATROSKA_ID_CONTENTENCODINGSCOPE 0x5032
-#define MATROSKA_ID_CONTENTENCODINGTYPE 0x5033
-#define MATROSKA_ID_CONTENTCOMPRESSION 0x5034
-#define MATROSKA_ID_CONTENTCOMPALGO 0x4254
-#define MATROSKA_ID_CONTENTCOMPSETTINGS 0x4255
-#define MATROSKA_ID_CUES 0x1c53bb6b
-#define MATROSKA_ID_CUEPOINT 0xbb
-#define MATROSKA_ID_CUETIME 0xb3
-#define MATROSKA_ID_CUETRACKPOSITIONS 0xb7
-#define MATROSKA_ID_CUETRACK 0xf7
-#define MATROSKA_ID_CUECLUSTERPOSITION 0xf1
-#define MATROSKA_ID_ATTACHMENTS 0x1941a469
-#define MATROSKA_ID_ATTACHEDFILE 0x61a7
-#define MATROSKA_ID_FILEDESCRIPTION 0x467e
-#define MATROSKA_ID_FILENAME 0x466e
-#define MATROSKA_ID_FILEMIMETYPE 0x4660
-#define MATROSKA_ID_FILEDATA 0x465c
-#define MATROSKA_ID_FILEUID 0x46ae
-#define MATROSKA_ID_CHAPTERS 0x1043a770
-#define MATROSKA_ID_EDITIONENTRY 0x45b9
-#define MATROSKA_ID_EDITIONUID 0x45bc
-#define MATROSKA_ID_EDITIONFLAGHIDDEN 0x45bd
-#define MATROSKA_ID_EDITIONFLAGDEFAULT 0x45db
-#define MATROSKA_ID_EDITIONFLAGORDERED 0x45dd
-#define MATROSKA_ID_CHAPTERATOM 0xb6
-#define MATROSKA_ID_CHAPTERUID 0x73c4
-#define MATROSKA_ID_CHAPTERTIMESTART 0x91
-#define MATROSKA_ID_CHAPTERTIMEEND 0x92
-#define MATROSKA_ID_CHAPTERFLAGHIDDEN 0x98
-#define MATROSKA_ID_CHAPTERFLAGENABLED 0x4598
-#define MATROSKA_ID_CHAPTERSEGMENTUID 0x6e67
-#define MATROSKA_ID_CHAPTERSEGMENTEDITIONUID 0x6ebc
-#define MATROSKA_ID_CHAPTERDISPLAY 0x80
-#define MATROSKA_ID_CHAPSTRING 0x85
-#define MATROSKA_ID_CHAPLANGUAGE 0x437c
-#define MATROSKA_ID_CHAPCOUNTRY 0x437e
-#define MATROSKA_ID_TAGS 0x1254c367
-#define MATROSKA_ID_TAG 0x7373
-#define MATROSKA_ID_TARGETS 0x63c0
-#define MATROSKA_ID_TARGETTYPEVALUE 0x68ca
-#define MATROSKA_ID_TARGETTRACKUID 0x63c5
-#define MATROSKA_ID_TARGETEDITIONUID 0x63c9
-#define MATROSKA_ID_TARGETCHAPTERUID 0x63c4
-#define MATROSKA_ID_TARGETATTACHMENTUID 0x63c6
-#define MATROSKA_ID_SIMPLETAG 0x67c8
-#define MATROSKA_ID_TAGNAME 0x45a3
-#define MATROSKA_ID_TAGLANGUAGE 0x447a
-#define MATROSKA_ID_TAGSTRING 0x4487
-
-
-struct ebml_simple_tag {
- struct bstr tag_name;
- struct bstr tag_language;
- struct bstr tag_string;
-
- int n_tag_name;
- int n_tag_language;
- int n_tag_string;
-};
-
-struct ebml_targets {
- uint64_t target_type_value;
- uint64_t target_track_uid;
- uint64_t target_edition_uid;
- uint64_t target_chapter_uid;
- uint64_t target_attachment_uid;
-
- int n_target_type_value;
- int n_target_track_uid;
- int n_target_edition_uid;
- int n_target_chapter_uid;
- int n_target_attachment_uid;
-};
-
-struct ebml_tag {
- struct ebml_targets targets;
- struct ebml_simple_tag *simple_tag;
-
- int n_targets;
- int n_simple_tag;
-};
-
-struct ebml_tags {
- struct ebml_tag *tag;
-
- int n_tag;
-};
-
-struct ebml_chapter_display {
- struct bstr chap_string;
- struct bstr *chap_language;
- struct bstr *chap_country;
-
- int n_chap_string;
- int n_chap_language;
- int n_chap_country;
-};
-
-struct ebml_chapter_atom {
- uint64_t chapter_uid;
- uint64_t chapter_time_start;
- uint64_t chapter_time_end;
- uint64_t chapter_flag_hidden;
- uint64_t chapter_flag_enabled;
- struct bstr chapter_segment_uid;
- uint64_t chapter_segment_edition_uid;
- struct ebml_chapter_display *chapter_display;
-
- int n_chapter_uid;
- int n_chapter_time_start;
- int n_chapter_time_end;
- int n_chapter_flag_hidden;
- int n_chapter_flag_enabled;
- int n_chapter_segment_uid;
- int n_chapter_segment_edition_uid;
- int n_chapter_display;
-};
-
-struct ebml_edition_entry {
- uint64_t edition_uid;
- uint64_t edition_flag_hidden;
- uint64_t edition_flag_default;
- uint64_t edition_flag_ordered;
- struct ebml_chapter_atom *chapter_atom;
-
- int n_edition_uid;
- int n_edition_flag_hidden;
- int n_edition_flag_default;
- int n_edition_flag_ordered;
- int n_chapter_atom;
-};
-
-struct ebml_chapters {
- struct ebml_edition_entry *edition_entry;
-
- int n_edition_entry;
-};
-
-struct ebml_attached_file {
- struct bstr file_description;
- struct bstr file_name;
- struct bstr file_mime_type;
- struct bstr file_data;
- uint64_t file_uid;
-
- int n_file_description;
- int n_file_name;
- int n_file_mime_type;
- int n_file_data;
- int n_file_uid;
-};
-
-struct ebml_attachments {
- struct ebml_attached_file *attached_file;
-
- int n_attached_file;
-};
-
-struct ebml_cue_track_positions {
- uint64_t cue_track;
- uint64_t cue_cluster_position;
-
- int n_cue_track;
- int n_cue_cluster_position;
-};
-
-struct ebml_cue_point {
- uint64_t cue_time;
- struct ebml_cue_track_positions *cue_track_positions;
-
- int n_cue_time;
- int n_cue_track_positions;
-};
-
-struct ebml_cues {
- struct ebml_cue_point *cue_point;
-
- int n_cue_point;
-};
-
-struct ebml_content_compression {
- uint64_t content_comp_algo;
- struct bstr content_comp_settings;
-
- int n_content_comp_algo;
- int n_content_comp_settings;
-};
-
-struct ebml_content_encoding {
- uint64_t content_encoding_order;
- uint64_t content_encoding_scope;
- uint64_t content_encoding_type;
- struct ebml_content_compression content_compression;
-
- int n_content_encoding_order;
- int n_content_encoding_scope;
- int n_content_encoding_type;
- int n_content_compression;
-};
-
-struct ebml_content_encodings {
- struct ebml_content_encoding *content_encoding;
-
- int n_content_encoding;
-};
-
-struct ebml_audio {
- double sampling_frequency;
- double output_sampling_frequency;
- uint64_t channels;
- uint64_t bit_depth;
-
- int n_sampling_frequency;
- int n_output_sampling_frequency;
- int n_channels;
- int n_bit_depth;
-};
-
-struct ebml_video {
- uint64_t flag_interlaced;
- uint64_t pixel_width;
- uint64_t pixel_height;
- uint64_t display_width;
- uint64_t display_height;
- uint64_t display_unit;
- double frame_rate;
-
- int n_flag_interlaced;
- int n_pixel_width;
- int n_pixel_height;
- int n_display_width;
- int n_display_height;
- int n_display_unit;
- int n_frame_rate;
-};
-
-struct ebml_track_entry {
- uint64_t track_number;
- uint64_t track_uid;
- uint64_t track_type;
- uint64_t flag_enabled;
- uint64_t flag_default;
- uint64_t flag_forced;
- uint64_t flag_lacing;
- uint64_t min_cache;
- uint64_t max_cache;
- uint64_t default_duration;
- double track_timecode_scale;
- uint64_t max_block_addition_id;
- struct bstr name;
- struct bstr language;
- struct bstr codec_id;
- struct bstr codec_private;
- uint64_t codec_decode_all;
- struct ebml_video video;
- struct ebml_audio audio;
- struct ebml_content_encodings content_encodings;
-
- int n_track_number;
- int n_track_uid;
- int n_track_type;
- int n_flag_enabled;
- int n_flag_default;
- int n_flag_forced;
- int n_flag_lacing;
- int n_min_cache;
- int n_max_cache;
- int n_default_duration;
- int n_track_timecode_scale;
- int n_max_block_addition_id;
- int n_name;
- int n_language;
- int n_codec_id;
- int n_codec_private;
- int n_codec_decode_all;
- int n_video;
- int n_audio;
- int n_content_encodings;
-};
-
-struct ebml_tracks {
- struct ebml_track_entry *track_entry;
-
- int n_track_entry;
-};
-
-struct ebml_block_group {
- struct bstr block;
- uint64_t block_duration;
- int64_t *reference_block;
-
- int n_block;
- int n_block_duration;
- int n_reference_block;
-};
-
-struct ebml_cluster {
- uint64_t timecode;
- struct ebml_block_group *block_group;
- struct bstr *simple_block;
-
- int n_timecode;
- int n_block_group;
- int n_simple_block;
-};
-
-struct ebml_info {
- struct bstr segment_uid;
- struct bstr prev_uid;
- struct bstr next_uid;
- uint64_t timecode_scale;
- int64_t date_utc;
- struct bstr title;
- struct bstr muxing_app;
- struct bstr writing_app;
- double duration;
-
- int n_segment_uid;
- int n_prev_uid;
- int n_next_uid;
- int n_timecode_scale;
- int n_date_utc;
- int n_title;
- int n_muxing_app;
- int n_writing_app;
- int n_duration;
-};
-
-struct ebml_seek {
- uint32_t seek_id;
- uint64_t seek_position;
-
- int n_seek_id;
- int n_seek_position;
-};
-
-struct ebml_seek_head {
- struct ebml_seek *seek;
-
- int n_seek;
-};
-
-struct ebml_segment {
- struct ebml_seek_head *seek_head;
- struct ebml_info *info;
- struct ebml_cluster *cluster;
- struct ebml_tracks *tracks;
- struct ebml_cues cues;
- struct ebml_attachments attachments;
- struct ebml_chapters chapters;
- struct ebml_tags *tags;
-
- int n_seek_head;
- int n_info;
- int n_cluster;
- int n_tracks;
- int n_cues;
- int n_attachments;
- int n_chapters;
- int n_tags;
-};
-
-struct ebml_ebml {
- uint64_t ebml_version;
- uint64_t ebml_read_version;
- uint64_t ebml_max_id_length;
- uint64_t ebml_max_size_length;
- struct bstr doc_type;
- uint64_t doc_type_version;
- uint64_t doc_type_read_version;
-
- int n_ebml_version;
- int n_ebml_read_version;
- int n_ebml_max_id_length;
- int n_ebml_max_size_length;
- int n_doc_type;
- int n_doc_type_version;
- int n_doc_type_read_version;
-};
-extern const struct ebml_elem_desc ebml_ebml_desc;
-extern const struct ebml_elem_desc ebml_segment_desc;
-extern const struct ebml_elem_desc ebml_seek_head_desc;
-extern const struct ebml_elem_desc ebml_seek_desc;
-extern const struct ebml_elem_desc ebml_info_desc;
-extern const struct ebml_elem_desc ebml_cluster_desc;
-extern const struct ebml_elem_desc ebml_block_group_desc;
-extern const struct ebml_elem_desc ebml_tracks_desc;
-extern const struct ebml_elem_desc ebml_track_entry_desc;
-extern const struct ebml_elem_desc ebml_video_desc;
-extern const struct ebml_elem_desc ebml_audio_desc;
-extern const struct ebml_elem_desc ebml_content_encodings_desc;
-extern const struct ebml_elem_desc ebml_content_encoding_desc;
-extern const struct ebml_elem_desc ebml_content_compression_desc;
-extern const struct ebml_elem_desc ebml_cues_desc;
-extern const struct ebml_elem_desc ebml_cue_point_desc;
-extern const struct ebml_elem_desc ebml_cue_track_positions_desc;
-extern const struct ebml_elem_desc ebml_attachments_desc;
-extern const struct ebml_elem_desc ebml_attached_file_desc;
-extern const struct ebml_elem_desc ebml_chapters_desc;
-extern const struct ebml_elem_desc ebml_edition_entry_desc;
-extern const struct ebml_elem_desc ebml_chapter_atom_desc;
-extern const struct ebml_elem_desc ebml_chapter_display_desc;
-extern const struct ebml_elem_desc ebml_tags_desc;
-extern const struct ebml_elem_desc ebml_tag_desc;
-extern const struct ebml_elem_desc ebml_targets_desc;
-extern const struct ebml_elem_desc ebml_simple_tag_desc;
-
-#define MAX_EBML_SUBELEMENTS 20
diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h
index 06f52324e5..58390650b2 100644
--- a/libmpdemux/stheader.h
+++ b/libmpdemux/stheader.h
@@ -33,6 +33,7 @@ struct demuxer;
struct demux_stream *ds; \
struct codecs *codec; \
unsigned int format; \
+ int libav_codec_id; \
int initialized; \
/* number of seconds stream should be delayed \
* (according to dwStart or similar) */ \
@@ -46,6 +47,7 @@ struct demuxer;
double pts; \
/* decoder context */ \
void *context; \
+ const char *codecname; \
char *lang; /* track language */ \
char *title; /* track title */ \
bool default_track; \
diff --git a/libmpdemux/video.c b/libmpdemux/video.c
index 2e41cf0b4b..e788818825 100644
--- a/libmpdemux/video.c
+++ b/libmpdemux/video.c
@@ -636,7 +636,7 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
if(video_codec == VIDEO_MPEG12){
sh_video->pts+=frame_time;
if(picture_coding_type==1)
- d_video->flags |= 1;
+ d_video->keyframe = true;
if(picture_coding_type<=2 && sh_video->i_pts){
sh_video->pts=sh_video->i_pts;
sh_video->i_pts=pts;