summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mnauw@users.sourceforge.net>2016-12-28 13:52:50 +0100
committerMark Nauwelaerts <mnauw@users.sourceforge.net>2016-12-28 13:54:24 +0100
commitdc970791b8913e5613b99842bd938e402e5af52f (patch)
treeea8794f0ea4e2e028f0dc97c61c5f761fbef08e4
parentbdc123600398046dce2588372e9a7948ab6e3e26 (diff)
downloadgstreamer-plugins-bad-dc970791b8913e5613b99842bd938e402e5af52f.tar.gz
mpeg4videoparse: determine intra of frame at frame parse time
... rather than when determining when to end the frame. The opportunity to do so might not come when forced to drain, and it seems nicer anyway to do so at parse wrapup time.
-rw-r--r--gst/videoparsers/gstmpeg4videoparse.c26
-rw-r--r--gst/videoparsers/gstmpeg4videoparse.h1
2 files changed, 16 insertions, 11 deletions
diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c
index 83f6f94ef..38e1f459b 100644
--- a/gst/videoparsers/gstmpeg4videoparse.c
+++ b/gst/videoparsers/gstmpeg4videoparse.c
@@ -318,15 +318,7 @@ gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstMpeg4Packet * packet,
* except for final VOS end sequence code included in last VOP-frame */
if (mp4vparse->vop_offset >= 0 &&
packet->type != GST_MPEG4_VISUAL_OBJ_SEQ_END) {
- if (G_LIKELY (size > mp4vparse->vop_offset + 1)) {
- mp4vparse->intra_frame =
- ((packet->data[mp4vparse->vop_offset + 1] >> 6 & 0x3) == 0);
- } else {
- GST_WARNING_OBJECT (mp4vparse, "no data following VOP startcode");
- mp4vparse->intra_frame = FALSE;
- }
- GST_LOG_OBJECT (mp4vparse, "ending frame of size %d, is intra %d",
- packet->offset - 3, mp4vparse->intra_frame);
+ GST_LOG_OBJECT (mp4vparse, "ending frame of size %d", packet->offset - 3);
return TRUE;
}
@@ -627,10 +619,24 @@ gst_mpeg4vparse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
GstBuffer *buffer = frame->buffer;
+ GstMapInfo map;
+ gboolean intra = FALSE;
gst_mpeg4vparse_update_src_caps (mp4vparse);
- if (mp4vparse->intra_frame)
+ /* let's live up to our function name and really parse something here
+ * (which ensures it is done for all frames, whether drained or not);
+ * determine intra frame */
+ gst_buffer_map (frame->buffer, &map, GST_MAP_READ);
+ if (G_LIKELY (map.size > mp4vparse->vop_offset + 1)) {
+ intra = ((map.data[mp4vparse->vop_offset + 1] >> 6 & 0x3) == 0);
+ GST_DEBUG_OBJECT (mp4vparse, "frame intra = %d", intra);
+ } else {
+ GST_WARNING_OBJECT (mp4vparse, "no data following VOP startcode");
+ }
+ gst_buffer_unmap (frame->buffer, &map);
+
+ if (intra)
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
else
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
diff --git a/gst/videoparsers/gstmpeg4videoparse.h b/gst/videoparsers/gstmpeg4videoparse.h
index 878cf605b..149289afb 100644
--- a/gst/videoparsers/gstmpeg4videoparse.h
+++ b/gst/videoparsers/gstmpeg4videoparse.h
@@ -52,7 +52,6 @@ struct _GstMpeg4VParse {
gint vop_offset;
gboolean vo_found;
gboolean config_found;
- gboolean intra_frame;
gboolean update_caps;
gboolean sent_codec_tag;