summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatej Knopp <matej.knopp@gmail.com>2013-07-30 15:17:23 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-08-13 14:00:57 +0200
commite5ebd7d846a296f6018cf2af32fd229a4a05f424 (patch)
tree84f941c1d9f19251bb0913fb200679880636f018
parentf604bc49647204f6bf4bb0009466eb4d77d4e794 (diff)
mpegvideoparse: support field encoding for interlaced video
https://bugzilla.gnome.org/show_bug.cgi?id=705144
-rw-r--r--gst/videoparsers/gstmpegvideoparse.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
index 073a33042..b5a6d01fa 100644
--- a/gst/videoparsers/gstmpegvideoparse.c
+++ b/gst/videoparsers/gstmpegvideoparse.c
@@ -540,6 +540,21 @@ gst_mpegv_parse_process_sc (GstMpegvParse * mpvparse,
else
GST_LOG_OBJECT (mpvparse, "Couldn't parse picture at offset %d",
mpvparse->pic_offset);
+
+ /* if terminating packet is a picture, we need to check if it has same TSN as the picture that is being
+ terminated. If it does, we need to keep those together, as these packets are two fields of the same
+ frame */
+ if (packet->type == GST_MPEG_VIDEO_PACKET_PICTURE) {
+ if (info->size - off < 2) { /* we need at least two bytes to read the TSN */
+ ret = FALSE;
+ } else {
+ /* TSN is stored in first 10 bits */
+ int tsn = info->data[off] << 2 | (info->data[off + 1] & 0xC0) >> 6;
+
+ if (tsn == mpvparse->pichdr.tsn) /* prevent termination if TSN is same */
+ ret = FALSE;
+ }
+ }
}
return ret;