Query the negotiated framerate in the caps - how?

Graham Leggett minfrin at sharp.fm
Fri Aug 21 17:09:09 PDT 2015


On 22 Aug 2015, at 12:28 AM, Graham Leggett <minfrin at sharp.fm> wrote:

>      const GstStructure *structure = gst_event_get_structure (event);
>      const GValue *fr = gst_structure_get_value(structure, "framerate”);

Turns out what I should have been doing is this instead of the above:

      caps = gst_pad_get_current_caps (GST_BASE_TRANSFORM_SINK_PAD (videotag));
      if (caps && GST_IS_CAPS(caps)) {
        structure = gst_caps_get_structure (caps, 0);
      }
      if (structure) {
        fr = gst_structure_get_value(structure, "framerate");
      }

Now I get the framerate coming through:

Redistribute latency...
CAPS event: framerate 0/1
CAPS event: framerate 25/1
CAPS event: framerate 25/1

>      taglist = gst_tag_list_new_empty ();
> 
>      g_value_init (&val, GST_TYPE_FRACTION);
>      gst_value_set_fraction (&val, fps_n, fps_d);
> 
>      gst_tag_list_add_value (taglist, GST_TAG_MERGE_REPLACE,
>         GST_TAG_FRAME_RATE, &val);
> 
>      g_value_unset (&val);
> 
>      gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (videotag),
>         gst_event_new_tag (taglist));

Now for the next problem - it appears that even though the updated framerate is replacing the previous framerate in the tag, what ends up in the final JPEG is the first attempt at writing the tag only:

pi at raspberrypi4 ~/packages/gstreamer-1.5/gst-plugins-base $ identify -verbose /var/www/stream/frame.jpg | grep unknown
    unknown: 0/1

What is expected in the EXIF is:

    unknown: 25/1

(“unknown” because imagemagick does not yet fully understand framerate from CinemaDNG)

The rest of the pipeline looks like this:

… ! videotag ! videorate ! video/x-raw,framerate=1/1 ! jpegenc ! jifmux ! queue ! multifilesink location=/var/www/stream/frame.jpg

Stepping through the EXIF writing code shows that write_exif_signed_rational_tag_from_taglist() is called on every JPEG write, as expected, but the value being written is the same pointer value every time, this never changes from the contents of the very first time the tag is written.

Is there something I am missing?

Regards,
Graham
—



More information about the gstreamer-devel mailing list