Allocate buffer duration with frame-rate value using GST_BUFFER_DURATION

Shaf shaf.nttf at gmail.com
Thu Apr 25 23:46:21 UTC 2019


I found the below solution working.

GstStructure *capsstruct;
gint rate = 1, frames = 30;

capsstruct = gst_caps_get_structure(caps, 0);	
	if (gst_structure_has_field(capsstruct, FRAMERATE)) {
		const GValue *framerate_val = gst_structure_get_value(capsstruct,
FRAMERATE);
		 if (G_VALUE_TYPE(framerate_val) == GST_TYPE_FRACTION) {			
			frames = gst_value_get_fraction_numerator(framerate_val);
			rate = gst_value_get_fraction_denominator(framerate_val);
		 }						
	}
		
GST_BUFFER_PTS(buffer) = ctx->timestamp;
GST_BUFFER_DURATION(buffer) = gst_util_uint64_scale_int(rate, GST_SECOND,
frames);





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list