#include <gst/base/gstbitwriter.h>
#include <gst/codecparsers/gstav1parser.h>
#include <gst/video/video.h>
+#include <gst/pbutils/pbutils.h>
#include "gstvideoparserselements.h"
#include "gstav1parse.h"
{
GstBaseParse parent;
+ gboolean first_frame;
+
gint width;
gint height;
gint subsampling_x;
self->show_frame = FALSE;
self->last_parsed_offset = 0;
self->highest_spatial_id = 0;
+ self->first_frame = TRUE;
gst_av1_parse_reset_obu_data_state (self);
g_clear_pointer (&self->colorimetry, g_free);
g_clear_pointer (&self->parser, gst_av1_parser_free);
if (!frame->buffer)
return GST_FLOW_OK;
+ if (self->first_frame) {
+ GstTagList *taglist;
+ GstCaps *caps;
+
+ /* codec tag */
+ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
+ if (caps == NULL) {
+ if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (self))) {
+ GST_INFO_OBJECT (self, "Src pad is flushing");
+ return GST_FLOW_FLUSHING;
+ } else {
+ GST_INFO_OBJECT (self, "Src pad is not negotiated!");
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
+ }
+
+ taglist = gst_tag_list_new_empty ();
+ gst_pb_utils_add_codec_description_to_tag_list (taglist,
+ GST_TAG_VIDEO_CODEC, caps);
+ gst_caps_unref (caps);
+
+ gst_base_parse_merge_tags (parse, taglist, GST_TAG_MERGE_REPLACE);
+ gst_tag_list_unref (taglist);
+
+ /* also signals the end of first-frame processing */
+ self->first_frame = FALSE;
+ }
+
if (self->align == GST_AV1_PARSE_ALIGN_FRAME) {
/* When the input align to TU, it may may contain more than one frames
inside its buffer. When splitting a TU into frames, the base parse