h264parse: Post VIDEO_CODEC tag

This commit is contained in:
Sebastian Dröge 2013-12-16 10:18:23 +01:00
parent bdfaf62a4a
commit 6934c7e2fc
2 changed files with 26 additions and 3 deletions

View file

@ -26,9 +26,8 @@
# include "config.h"
#endif
#include <gst/base/gstbytereader.h>
#include <gst/base/gstbytewriter.h>
#include <gst/base/gstadapter.h>
#include <gst/base/base.h>
#include <gst/pbutils/pbutils.h>
#include <gst/video/video.h>
#include "gsth264parse.h"
@ -207,6 +206,8 @@ gst_h264_parse_reset (GstH264Parse * h264parse)
h264parse->ts_trn_nb = GST_CLOCK_TIME_NONE;
h264parse->do_ts = TRUE;
h264parse->sent_codec_tag = FALSE;
h264parse->pending_key_unit_ts = GST_CLOCK_TIME_NONE;
h264parse->force_key_unit_event = NULL;
@ -1568,6 +1569,26 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
GstEvent *event;
h264parse = GST_H264_PARSE (parse);
if (!h264parse->sent_codec_tag) {
GstTagList *taglist;
GstCaps *caps;
taglist = gst_tag_list_new_empty ();
/* codec tag */
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
gst_pb_utils_add_codec_description_to_tag_list (taglist,
GST_TAG_VIDEO_CODEC, caps);
gst_caps_unref (caps);
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (h264parse),
gst_event_new_tag (taglist));
/* also signals the end of first-frame processing */
h264parse->sent_codec_tag = TRUE;
}
buffer = frame->buffer;
if ((event = check_pending_key_unit_event (h264parse->force_key_unit_event,

View file

@ -78,6 +78,8 @@ struct _GstH264Parse
gboolean have_sps;
gboolean have_pps;
gboolean sent_codec_tag;
/* collected SPS and PPS NALUs */
GstBuffer *sps_nals[GST_H264_MAX_SPS_COUNT];
GstBuffer *pps_nals[GST_H264_MAX_PPS_COUNT];