jpegenc copy GstMeta twice

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

jpegenc copy GstMeta twice

neil
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);
  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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: jpegenc copy GstMeta twice

Nicolas Dufresne-5
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
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

gst-launch-1.0 multipath specifying problem

William
So a fit of setup:
misbdemux has on input and two outputs
misbfixcoordinates has two inputs and two outputs
misbsink has two inputs

So I need it to fork into two paths at misbdemux, travel through
misbfixcoordinate, and end up at misbsink.

I can test each path independently like so:

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
"video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
misbsink name=ms

and

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
name=ms

So far so good. However, when I combine them I get a problem. I can
combine them in two different ways:

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
"video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
misbsink name=ms         md. ! "meta/klv" ! mfc. ! ms.

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
name=ms      md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
"video/x-raw, format=(string)RGB" ! mfc. ! ms.

Both fail with:

WARNING: erroneous pipeline: syntax error

In both cases it's the misbfixcoordinates in the second path (mfc.)
seems to be causing the failure.

By dropping the second misbfixcoordinates I can make it run (though
without the behavior that I need):

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
"video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
misbsink name=ms         md. ! "meta/klv" ! ms.

gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
name=ms       md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
"video/x-raw, format=(string)RGB" ! ms.

So, I don't think it's anything to do with my misbfixcoordinates plug-in
as each path through it works independently and the problem doesn't
follow which pair of pads I'm using. It seems that there is a syntax
error in how I'm setting up the path. I don't see it though.

Any ideas? I have been looking at this for two days now and I am no
closer to figuring it out.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: jpegenc copy GstMeta twice

neil
In reply to this post by Nicolas Dufresne-5
Hi Nicolas:
    Thanks for your reply .  I'll create a PR on Gitlab



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-launch-1.0 multipath specifying problem

Nicolas Dufresne-5
In reply to this post by William
Hi William,

please avoid replying to existing thread for new threads, otherwise you
thread will be ignored.

regards,
Nicolas

Le mercredi 22 avril 2020 à 21:52 -0500, William Johnston a écrit :

> So a fit of setup:
> misbdemux has on input and two outputs
> misbfixcoordinates has two inputs and two outputs
> misbsink has two inputs
>
> So I need it to fork into two paths at misbdemux, travel through
> misbfixcoordinate, and end up at misbsink.
>
> I can test each path independently like so:
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
> misbsink name=ms
>
> and
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
> name=ms
>
> So far so good. However, when I combine them I get a problem. I can
> combine them in two different ways:
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
> misbsink name=ms         md. ! "meta/klv" ! mfc. ! ms.
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
> name=ms      md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
> "video/x-raw, format=(string)RGB" ! mfc. ! ms.
>
> Both fail with:
>
> WARNING: erroneous pipeline: syntax error
>
> In both cases it's the misbfixcoordinates in the second path (mfc.)
> seems to be causing the failure.
>
> By dropping the second misbfixcoordinates I can make it run (though
> without the behavior that I need):
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
> misbsink name=ms         md. ! "meta/klv" ! ms.
>
> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
> name=ms       md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
> "video/x-raw, format=(string)RGB" ! ms.
>
> So, I don't think it's anything to do with my misbfixcoordinates plug-in
> as each path through it works independently and the problem doesn't
> follow which pair of pads I'm using. It seems that there is a syntax
> error in how I'm setting up the path. I don't see it though.
>
> Any ideas? I have been looking at this for two days now and I am no
> closer to figuring it out.
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-launch-1.0 multipath specifying problem

William
Whoops! Sorry, I'll repost.

On 4/24/2020 9:52 AM, Nicolas Dufresne wrote:

> Hi William,
>
> please avoid replying to existing thread for new threads, otherwise you
> thread will be ignored.
>
> regards,
> Nicolas
>
> Le mercredi 22 avril 2020 à 21:52 -0500, William Johnston a écrit :
>> So a fit of setup:
>> misbdemux has on input and two outputs
>> misbfixcoordinates has two inputs and two outputs
>> misbsink has two inputs
>>
>> So I need it to fork into two paths at misbdemux, travel through
>> misbfixcoordinate, and end up at misbsink.
>>
>> I can test each path independently like so:
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
>> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
>> misbsink name=ms
>>
>> and
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
>> name=ms
>>
>> So far so good. However, when I combine them I get a problem. I can
>> combine them in two different ways:
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
>> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
>> misbsink name=ms         md. ! "meta/klv" ! mfc. ! ms.
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
>> name=ms      md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
>> "video/x-raw, format=(string)RGB" ! mfc. ! ms.
>>
>> Both fail with:
>>
>> WARNING: erroneous pipeline: syntax error
>>
>> In both cases it's the misbfixcoordinates in the second path (mfc.)
>> seems to be causing the failure.
>>
>> By dropping the second misbfixcoordinates I can make it run (though
>> without the behavior that I need):
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
>> "video/x-raw, format=(string)RGB" ! misbfixcoordinates name=mfc !
>> misbsink name=ms         md. ! "meta/klv" ! ms.
>>
>> gst-launch-1.0 filesrc location=/home/wgj/video/Truck.H264.ts !
>> misbdemux name=md ! "meta/klv" ! misbfixcoordinates name=mfc ! misbsink
>> name=ms       md. ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
>> "video/x-raw, format=(string)RGB" ! ms.
>>
>> So, I don't think it's anything to do with my misbfixcoordinates plug-in
>> as each path through it works independently and the problem doesn't
>> follow which pair of pads I'm using. It seems that there is a syntax
>> error in how I'm setting up the path. I don't see it though.
>>
>> Any ideas? I have been looking at this for two days now and I am no
>> closer to figuring it out.
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel