mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
pngparse: Post VIDEO_CODEC tag
This commit is contained in:
parent
6fbc101d19
commit
3faa8920ce
2 changed files with 37 additions and 1 deletions
|
@ -24,7 +24,8 @@
|
|||
|
||||
#include "gstpngparse.h"
|
||||
|
||||
#include <gst/base/gstbytereader.h>
|
||||
#include <gst/base/base.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
|
||||
#define PNG_SIGNATURE G_GUINT64_CONSTANT (0x89504E470D0A1A0A)
|
||||
|
||||
|
@ -50,6 +51,8 @@ G_DEFINE_TYPE (GstPngParse, gst_png_parse, GST_TYPE_BASE_PARSE);
|
|||
static gboolean gst_png_parse_start (GstBaseParse * parse);
|
||||
static GstFlowReturn gst_png_parse_handle_frame (GstBaseParse * parse,
|
||||
GstBaseParseFrame * frame, gint * skipsize);
|
||||
static GstFlowReturn gst_png_parse_pre_push_frame (GstBaseParse * parse,
|
||||
GstBaseParseFrame * frame);
|
||||
|
||||
static void
|
||||
gst_png_parse_class_init (GstPngParseClass * klass)
|
||||
|
@ -70,6 +73,8 @@ gst_png_parse_class_init (GstPngParseClass * klass)
|
|||
/* Override BaseParse vfuncs */
|
||||
parse_class->start = GST_DEBUG_FUNCPTR (gst_png_parse_start);
|
||||
parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_png_parse_handle_frame);
|
||||
parse_class->pre_push_frame =
|
||||
GST_DEBUG_FUNCPTR (gst_png_parse_pre_push_frame);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -90,6 +95,8 @@ gst_png_parse_start (GstBaseParse * parse)
|
|||
pngparse->width = 0;
|
||||
pngparse->height = 0;
|
||||
|
||||
pngparse->sent_codec_tag = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -209,3 +216,30 @@ beach:
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_png_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||
{
|
||||
GstPngParse *pngparse = GST_PNG_PARSE (parse);
|
||||
|
||||
if (!pngparse->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 (pngparse),
|
||||
gst_event_new_tag (taglist));
|
||||
|
||||
/* also signals the end of first-frame processing */
|
||||
pngparse->sent_codec_tag = TRUE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ struct _GstPngParse
|
|||
|
||||
guint width;
|
||||
guint height;
|
||||
|
||||
gboolean sent_codec_tag;
|
||||
};
|
||||
|
||||
struct _GstPngParseClass
|
||||
|
|
Loading…
Reference in a new issue