diff options
author | Nicola Murino <nicola.murino@gmail.com> | 2015-03-11 21:25:40 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-03-15 14:28:36 +0000 |
commit | bb3d82ef04107310e685db0bb0ddcc218dda1721 (patch) | |
tree | 9c7f6f8e4ee980bbf77ae26abcef5d78f276c233 /gst | |
parent | 0fad053497d46bba8b9785ae9c33fa29368ed7a1 (diff) |
matroskademux: for dts only stream set pts=dts for intra only formats
https://bugzilla.gnome.org/show_bug.cgi?id=745192
Diffstat (limited to 'gst')
-rw-r--r-- | gst/matroska/matroska-demux.c | 17 | ||||
-rw-r--r-- | gst/matroska/matroska-ids.h | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 489c00a04..251adfff6 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -433,6 +433,7 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml) context->to_offset = G_MAXINT64; context->alignment = 1; context->dts_only = FALSE; + context->intra_only = FALSE; demux->common.num_streams++; g_assert (demux->common.src->len == demux->common.num_streams); @@ -3480,10 +3481,13 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, buffer_timestamp = gst_matroska_track_get_buffer_timestamp (stream, sub); - if (!stream->dts_only) + if (!stream->dts_only) { GST_BUFFER_PTS (sub) = lace_time; - else + } else { GST_BUFFER_DTS (sub) = lace_time; + if (stream->intra_only) + GST_BUFFER_PTS (sub) = lace_time; + } if (GST_CLOCK_TIME_IS_VALID (lace_time)) { GstClockTime last_stop_end; @@ -4874,6 +4878,12 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * if (caps == NULL) { GST_WARNING ("Unhandled RIFF fourcc %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (vids->compression)); + } else { + static GstStaticCaps intra_caps = GST_STATIC_CAPS ("image/jpeg; " + "video/x-raw; image/png; video/x-dv; video/x-huffyuv; video/x-ffv; " + "video/x-compressed-yuv"); + context->intra_only = + gst_caps_can_intersect (gst_static_caps_get (&intra_caps), caps); } if (buf) @@ -4919,6 +4929,8 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * return NULL; } + context->intra_only = TRUE; + gst_video_info_set_format (&info, format, videocontext->pixel_width, videocontext->pixel_height); caps = gst_video_info_to_caps (&info); @@ -4972,6 +4984,7 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) { caps = gst_caps_new_empty_simple ("image/jpeg"); *codec_name = g_strdup ("Motion-JPEG"); + context->intra_only = TRUE; } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC)) { caps = gst_caps_new_empty_simple ("video/x-h264"); if (data) { diff --git a/gst/matroska/matroska-ids.h b/gst/matroska/matroska-ids.h index 40f6eb0fd..dc098dd5c 100644 --- a/gst/matroska/matroska-ids.h +++ b/gst/matroska/matroska-ids.h @@ -555,6 +555,9 @@ struct _GstMatroskaTrackContext { /* for compatibility with VFW files, where timestamp represents DTS */ gboolean dts_only; + + /* indicate that the track is raw (jpeg,raw variants) and so pts=dts */ + gboolean intra_only; }; typedef struct _GstMatroskaTrackVideoContext { |