Example #1
0
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;

    /* codec tag */
    caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
    if (G_UNLIKELY (caps == NULL)) {
      if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) {
        GST_INFO_OBJECT (parse, "Src pad is flushing");
        return GST_FLOW_FLUSHING;
      } else {
        GST_INFO_OBJECT (parse, "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 */
    pngparse->sent_codec_tag = TRUE;
  }

  return GST_FLOW_OK;
}
static GstFlowReturn
gst_dirac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
    GstDiracParse *diracparse = GST_DIRAC_PARSE (parse);

    if (!diracparse->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_base_parse_merge_tags (parse, taglist, GST_TAG_MERGE_REPLACE);
        gst_tag_list_unref (taglist);

        /* also signals the end of first-frame processing */
        diracparse->sent_codec_tag = TRUE;
    }

    return GST_FLOW_OK;
}