Please help to understand pre_push functionality in GStVideoEncoderClass ?

Thiago Santos thiagoss at osg.samsung.com
Tue Feb 9 11:56:34 UTC 2016


On 02/08/2016 12:40 PM, ssshukla26 wrote:
> Hi,
>
> I thought that handle_frame and pre_push functions works as top half and
> bottom half of an encoding process.
>
> So as per my understanding I did as follows,
>
> *1) under handle_frame function I encoded the incoming frame and stored the
> same onto a queue*
>
> static GstFlowReturn *gst_myh264encoder_handle_frame* (GstVideoEncoder
> *encoder,GstVideoCodecFrame *frame)
> {
>      GstFlowReturn ret = GST_FLOW_OK;
>      GstBuffer *input_buffer =  frame->input_buffer;
>      GstMapInfo ip_info;
>
>      gst_buffer_map(input_buffer, &ip_info, GST_MAP_READ);
>      if(0 == ip_info.size)
>      {
>          g_print("GST_FLOW_EOS in %s @ %d\n",__func__,__LINE__);
>          ret = GST_FLOW_EOS;
>      }
>      else
>      {
>          if(*encode_frame*((void *)ip_info.data,ip_info.size))
>          {
>              g_print("GST_FLOW_ERROR in %s @ %d\n",__func__,__LINE__);
>              ret = GST_FLOW_ERROR;
>          }
>      }
>      gst_buffer_unmap(input_buffer, &ip_info);
>
>      return ret;
> }
>
> *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;
> }
>
> And what I saw is that the *pre_push* functionality is not being called at
> all ! Why so ?  I also has registered the function pointer as follows under
> my class initialization function,
>
> *gstvideoencoder_class->pre_push = gst_myh264encoder_pre_push;*
>
> Please help guys am so much stuck . Please I need help in this.

You should do all encoding process in the handle_frame function and then 
call gst_video_encoder_finish_frame(). pre_push() is used modifying the 
output buffer before it is sent downstream but I guess you don't need it.

You can check how other video encoders implement it in one of the 
upstream modules.

Regards,

>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Please-help-to-understand-pre-push-functionality-in-GStVideoEncoderClass-tp4675723.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


-- 
Thiago Sousa Santos
Senior Multimedia Engineer, Open Source Group
Samsung Research America - Silicon Valley



More information about the gstreamer-devel mailing list