What's it the right way to communicate between elements (gstomxvideodec and gstv4l2sink)

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

What's it the right way to communicate between elements (gstomxvideodec and gstv4l2sink)

alan wang
Hello

I have a requirement that when dealing with h264 stream If some flag is detected in the stream. The v4l2sink should be noticed.

The work flow is like:
gstomxvideodec.c--->handle_frame-->[certain flag detected]--->notify--->gstv4l2sink.c

Below is what I've done in gstomxvideodec.c:gst_omx_video_dec_handle_frame


    caps =
        gst_caps_new_full (gst_structure_new ("flag",
        "flag", G_TYPE_INT, 1, NULL), NULL);

    if (!gst_pad_push_event (GST_VIDEO_DECODER_SINK_PAD(decoder),
                gst_event_new_caps (caps))) {
      return GST_FLOW_ERROR;
    }

I was hoping, above code would invoke gstv4l2sink.c:gst_v4l2sink_set_caps. Then I can extract the caps and do I have to do.

But all I got is error message says: 

(gst-launch-1.0:7180): GStreamer-WARNING **: pad omxh264dec-omxh264dec0:sink pushing caps event in wrong direction
0:00:01.210275279  7180 0xb5c01920 WARN                 qtdemux qtdemux.c:5307:gst_qtdemux_loop:<qtdemux0> error: streaming stopped, reason error
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: GStreamer encountered a general stream error.


It seems that, the event caps is sent to qtdemux not to v4l2sink as I expected.

So what is the right way to communicate between gstomxvidedec and v4l2sink ?

Thank You for your time.

Alan


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

Re: What's it the right way to communicate between elements (gstomxvideodec and gstv4l2sink)

Thiago Sousa Santos-2


On Mon, Sep 5, 2016 at 10:31 AM, alan wang <[hidden email]> wrote:
Hello

I have a requirement that when dealing with h264 stream If some flag is detected in the stream. The v4l2sink should be noticed.

The work flow is like:
gstomxvideodec.c--->handle_frame-->[certain flag detected]--->notify--->gstv4l2sink.c

It depends on the kind of information you want to pass onwards. Usually, you have 3 choices:

1) If it is a format change: use a caps event
2) If it is some event in the middle of the stream (like a metadata change) you can use a custom GstEvent to notify downstream.
3) If is a flag that indicates some particular information for a frame, you can attach a buffer meta to a GstBuffer.

If you provide more details on what this flag is and how it is used we could try to guide you better on how to do it.

Below is what I've done in gstomxvideodec.c:gst_omx_video_dec_handle_frame


    caps =
        gst_caps_new_full (gst_structure_new ("flag",
        "flag", G_TYPE_INT, 1, NULL), NULL);

    if (!gst_pad_push_event (GST_VIDEO_DECODER_SINK_PAD(decoder),
                gst_event_new_caps (caps))) {
      return GST_FLOW_ERROR;
    }

I was hoping, above code would invoke gstv4l2sink.c:gst_v4l2sink_set_caps. Then I can extract the caps and do I have to do.

But all I got is error message says: 

(gst-launch-1.0:7180): GStreamer-WARNING **: pad omxh264dec-omxh264dec0:sink pushing caps event in wrong direction
0:00:01.210275279  7180 0xb5c01920 WARN                 qtdemux qtdemux.c:5307:gst_qtdemux_loop:<qtdemux0> error: streaming stopped, reason error
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: GStreamer encountered a general stream error.


It seems that, the event caps is sent to qtdemux not to v4l2sink as I expected.

So what is the right way to communicate between gstomxvidedec and v4l2sink ?

Thank You for your time.

Alan


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Thiago Sousa Santos

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

Re: What's it the right way to communicate between elements (gstomxvideodec and gstv4l2sink)

alan wang
Thank You Thiago.

Actually the flag indicates that the h264 stream has video_full_range_flag set in it.

So my approach is, if gstomxvideodec detects video_full_range_flag is set in sps of a h264 stream. I'd like v4l2sink could be informed. So that I can pass some arguments through v4l2_ioctl.
Of course, I also did some development in gstomxvideodec to parse sps.

Thanks for your time

2016-09-05 21:52 GMT+08:00 Thiago Sousa Santos <[hidden email]>:


On Mon, Sep 5, 2016 at 10:31 AM, alan wang <[hidden email]> wrote:
Hello

I have a requirement that when dealing with h264 stream If some flag is detected in the stream. The v4l2sink should be noticed.

The work flow is like:
gstomxvideodec.c--->handle_frame-->[certain flag detected]--->notify--->gstv4l2sink.c

It depends on the kind of information you want to pass onwards. Usually, you have 3 choices:

1) If it is a format change: use a caps event
2) If it is some event in the middle of the stream (like a metadata change) you can use a custom GstEvent to notify downstream.
3) If is a flag that indicates some particular information for a frame, you can attach a buffer meta to a GstBuffer.

If you provide more details on what this flag is and how it is used we could try to guide you better on how to do it.

Below is what I've done in gstomxvideodec.c:gst_omx_video_dec_handle_frame


    caps =
        gst_caps_new_full (gst_structure_new ("flag",
        "flag", G_TYPE_INT, 1, NULL), NULL);

    if (!gst_pad_push_event (GST_VIDEO_DECODER_SINK_PAD(decoder),
                gst_event_new_caps (caps))) {
      return GST_FLOW_ERROR;
    }

I was hoping, above code would invoke gstv4l2sink.c:gst_v4l2sink_set_caps. Then I can extract the caps and do I have to do.

But all I got is error message says: 

(gst-launch-1.0:7180): GStreamer-WARNING **: pad omxh264dec-omxh264dec0:sink pushing caps event in wrong direction
0:00:01.210275279  7180 0xb5c01920 WARN                 qtdemux qtdemux.c:5307:gst_qtdemux_loop:<qtdemux0> error: streaming stopped, reason error
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: GStreamer encountered a general stream error.


It seems that, the event caps is sent to qtdemux not to v4l2sink as I expected.

So what is the right way to communicate between gstomxvidedec and v4l2sink ?

Thank You for your time.

Alan


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Thiago Sousa Santos

_______________________________________________
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