mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 08:41:07 +00:00
mpegvideoparse: send a video-codec tag
https://bugzilla.gnome.org/show_bug.cgi?id=569305
This commit is contained in:
parent
00e635e786
commit
a31d541f07
2 changed files with 37 additions and 0 deletions
|
@ -71,6 +71,8 @@ static gboolean gst_mpegv_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
static GstFlowReturn gst_mpegv_parse_parse_frame (GstBaseParse * parse,
|
static GstFlowReturn gst_mpegv_parse_parse_frame (GstBaseParse * parse,
|
||||||
GstBaseParseFrame * frame);
|
GstBaseParseFrame * frame);
|
||||||
static gboolean gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps);
|
static gboolean gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps);
|
||||||
|
static GstFlowReturn gst_mpegv_parse_pre_push_frame (GstBaseParse * parse,
|
||||||
|
GstBaseParseFrame * frame);
|
||||||
|
|
||||||
static void gst_mpegv_parse_set_property (GObject * object, guint prop_id,
|
static void gst_mpegv_parse_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
|
@ -164,6 +166,8 @@ gst_mpegv_parse_class_init (GstMpegvParseClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_mpegv_parse_check_valid_frame);
|
GST_DEBUG_FUNCPTR (gst_mpegv_parse_check_valid_frame);
|
||||||
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpegv_parse_parse_frame);
|
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpegv_parse_parse_frame);
|
||||||
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpegv_parse_set_caps);
|
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpegv_parse_set_caps);
|
||||||
|
parse_class->pre_push_frame =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_mpegv_parse_pre_push_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -187,6 +191,7 @@ gst_mpegv_parse_reset (GstMpegvParse * mpvparse)
|
||||||
gst_mpegv_parse_reset_frame (mpvparse);
|
gst_mpegv_parse_reset_frame (mpvparse);
|
||||||
mpvparse->profile = 0;
|
mpvparse->profile = 0;
|
||||||
mpvparse->update_caps = TRUE;
|
mpvparse->update_caps = TRUE;
|
||||||
|
mpvparse->send_codec_tag = TRUE;
|
||||||
|
|
||||||
gst_buffer_replace (&mpvparse->config, NULL);
|
gst_buffer_replace (&mpvparse->config, NULL);
|
||||||
memset (&mpvparse->sequencehdr, 0, sizeof (mpvparse->sequencehdr));
|
memset (&mpvparse->sequencehdr, 0, sizeof (mpvparse->sequencehdr));
|
||||||
|
@ -653,6 +658,37 @@ gst_mpegv_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_mpegv_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
|
{
|
||||||
|
GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse);
|
||||||
|
GstTagList *taglist;
|
||||||
|
|
||||||
|
/* tag sending done late enough in hook to ensure pending events
|
||||||
|
* have already been sent */
|
||||||
|
|
||||||
|
if (G_UNLIKELY (mpvparse->send_codec_tag)) {
|
||||||
|
gchar *codec;
|
||||||
|
|
||||||
|
/* codec tag */
|
||||||
|
codec = g_strdup_printf ("MPEG %d Video", mpvparse->mpeg_version);
|
||||||
|
taglist = gst_tag_list_new ();
|
||||||
|
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
|
||||||
|
GST_TAG_VIDEO_CODEC, codec, NULL);
|
||||||
|
g_free (codec);
|
||||||
|
|
||||||
|
gst_element_found_tags_for_pad (GST_ELEMENT (mpvparse),
|
||||||
|
GST_BASE_PARSE_SRC_PAD (mpvparse), taglist);
|
||||||
|
|
||||||
|
mpvparse->send_codec_tag = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* usual clipping applies */
|
||||||
|
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct _GstMpegvParse {
|
||||||
gint seq_offset;
|
gint seq_offset;
|
||||||
gint pic_offset;
|
gint pic_offset;
|
||||||
gboolean update_caps;
|
gboolean update_caps;
|
||||||
|
gboolean send_codec_tag;
|
||||||
|
|
||||||
GstBuffer *config;
|
GstBuffer *config;
|
||||||
guint8 profile;
|
guint8 profile;
|
||||||
|
|
Loading…
Reference in a new issue