jpegenc copy GstMeta twice

Nicolas Dufresne nicolas at ndufresne.ca
Wed Apr 22 15:52:53 UTC 2020


Le mercredi 22 avril 2020 à 03:42 -0500, neil a écrit :
> I registered a new GstMeta representing video processing information without
> any tag. I found two such metas after the jpegenc element.
> 
> jpegenc copy all the metadata in gst_jpegenc_term_destination and then calls
> gst_video_encoder_finish_frame.
> 
> static void
> gst_jpegenc_term_destination (j_compress_ptr cinfo)
> {
>   ...
>   outbuf = gst_buffer_new ();
>   gst_buffer_copy_into (outbuf, jpegenc->current_frame->input_buffer,
>       GST_BUFFER_COPY_METADATA, 0, -1);

That seems totally uneeded, the base class takes care of that already.
Probably a left-over when this was ported to use the base class.

>   gst_buffer_append_memory (outbuf, jpegenc->output_mem);
>   jpegenc->output_mem = NULL;
> 
>   jpegenc->current_frame->output_buffer = outbuf;
>   ...
>   jpegenc->res = gst_video_encoder_finish_frame (GST_VIDEO_ENCODER
> (jpegenc),
>       jpegenc->current_frame);
>   ...
> }
> 
> and in gst_video_encoder_finish_frame, video_encoder will call
> transform_meta and copy GstMeta again.
> GstFlowReturn
> gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
>     GstVideoCodecFrame * frame)
> {
>   ...
>   if (encoder_class->transform_meta) {
>     if (G_LIKELY (frame->input_buffer)) {
>       CopyMetaData data;
> 
>       data.encoder = encoder;
>       data.frame = frame;
>       gst_buffer_foreach_meta (frame->input_buffer, foreach_metadata,
> &data);
>     } else {
>       GST_WARNING_OBJECT (encoder,
>           "Can't copy metadata because input frame disappeared");
>     }
>   }
>   ...
> }
> 
> So what is the story behind the design? and how could I define my custom
> GstMeta.

> 
> looking forward to your reply
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list