Please help to understand pre_push functionality in GStVideoEncoderClass ?
Tim Müller
tim at centricular.com
Tue Feb 9 11:40:30 UTC 2016
On Mon, 2016-02-08 at 07:40 -0800, ssshukla26 wrote:
Hi,
> I thought that handle_frame and pre_push functions works as top half
> and bottom half of an encoding process.
Not sure why you thought that, I don't see anything in the
documentation suggesting that's how it's supposed to be used, and none
of the existing H.264 encoders I checked implement a pre_push function
either.
The pre_push function is called from gst_video_encoder_finish_frame(),
so only once *you* call gst_video_encoder_finish_frame(). It's main
purpose it to fix up the output in some way, if needed. Usually it's
not needed. (For example, one could convert the data from avc to byte-
stream format or vice versa, or add a prefix or something, or
additional metadata.)
> *2) under pre_push function I copied the encoded data from the queue
> to the
> output buffer*
>
> static GstFlowReturn *gst_myh264encoder_pre_push* (GstVideoEncoder
> *encoder,GstVideoCodecFrame *frame)
> {
> GstFlowReturn ret = GST_FLOW_OK;
>
> if(*fill_output_buffer*(encoder,frame))
> ret = GST_FLOW_ERROR;
>
> if(GST_FLOW_OK == ret)
> {
> ret = gst_video_encoder_finish_frame (encoder,frame);
> }
>
> return ret;
> }
Why don't you do this in the handle_frame() function?
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list