h263parse: Post VIDEO_CODEC tag

This commit is contained in:
Sebastian Dröge 2013-12-16 10:16:14 +01:00
parent e65b9b974a
commit bdfaf62a4a
2 changed files with 36 additions and 1 deletions

View file

@ -29,7 +29,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <gst/base/gstbytereader.h> #include <gst/base/base.h>
#include <gst/pbutils/pbutils.h>
#include "gsth263parse.h" #include "gsth263parse.h"
#include <string.h> #include <string.h>
@ -59,6 +60,8 @@ static gboolean gst_h263_parse_sink_event (GstBaseParse * parse,
GstEvent * event); GstEvent * event);
static GstFlowReturn gst_h263_parse_handle_frame (GstBaseParse * parse, static GstFlowReturn gst_h263_parse_handle_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, gint * skipsize); GstBaseParseFrame * frame, gint * skipsize);
static GstFlowReturn gst_h263_parse_pre_push_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static GstCaps *gst_h263_parse_get_sink_caps (GstBaseParse * parse, static GstCaps *gst_h263_parse_get_sink_caps (GstBaseParse * parse,
GstCaps * filter); GstCaps * filter);
@ -85,6 +88,8 @@ gst_h263_parse_class_init (GstH263ParseClass * klass)
parse_class->stop = GST_DEBUG_FUNCPTR (gst_h263_parse_stop); parse_class->stop = GST_DEBUG_FUNCPTR (gst_h263_parse_stop);
parse_class->sink_event = GST_DEBUG_FUNCPTR (gst_h263_parse_sink_event); parse_class->sink_event = GST_DEBUG_FUNCPTR (gst_h263_parse_sink_event);
parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_h263_parse_handle_frame); parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_h263_parse_handle_frame);
parse_class->pre_push_frame =
GST_DEBUG_FUNCPTR (gst_h263_parse_pre_push_frame);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_h263_parse_get_sink_caps); parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_h263_parse_get_sink_caps);
} }
@ -107,6 +112,8 @@ gst_h263_parse_start (GstBaseParse * parse)
h263parse->state = PARSING; h263parse->state = PARSING;
h263parse->sent_codec_tag = FALSE;
gst_base_parse_set_min_frame_size (parse, 4); gst_base_parse_set_min_frame_size (parse, 4);
return TRUE; return TRUE;
@ -414,3 +421,30 @@ gst_h263_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
return res; return res;
} }
static GstFlowReturn
gst_h263_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstH263Parse *h263parse = GST_H263_PARSE (parse);
if (!h263parse->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 (h263parse),
gst_event_new_tag (taglist));
/* also signals the end of first-frame processing */
h263parse->sent_codec_tag = TRUE;
}
return GST_FLOW_OK;
}

View file

@ -60,6 +60,7 @@ struct _GstH263Parse
guint bitrate; guint bitrate;
H263ParseState state; H263ParseState state;
gboolean sent_codec_tag;
}; };
struct _GstH263ParseClass struct _GstH263ParseClass