After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 624699 - [PATCH] Add 'caps' property for playbin
[PATCH] Add 'caps' property for playbin
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
unspecified
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-19 05:58 UTC by Zhao, Halley
Modified: 2011-05-17 08:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch for adding 'caps' property for playbin (4.34 KB, patch)
2010-07-19 06:02 UTC, Zhao, Halley
rejected Details | Review
gst-inspect of MixVideoSink (3.55 KB, text/plain)
2010-07-27 01:16 UTC, Zhao, Halley
  Details

Description Zhao, Halley 2010-07-19 05:58:38 UTC
1. main ideas:
‘caps’ property are defined for decodebin2/uridecodebin as “The caps on which to stop decoding. (NULL= default)”. 
But there is no ‘caps’ property for playbin2 yet, we’d better add it as well to give app the flexibility of controlling decodebin2 for newly introduced raw video caps; ‘video/x-raw-va’ for example.

2. more benefits:
'caps' property of playbin can provide more flexibility to create customized codec with corresponding sink. For example:
    a) Some audio dsp could accept compressed audio data, there could be a new caps as 'audio/x-dsp-mp3' for such device.
    b) It can also benefits thumbnail generation:
If we use playbin and customized video sink for thumbnail generation, we don’t expect decodebin2 stop at 'video/x-raw-va' but 'video/x-raw-rgb'. we need the flexibility from playbin to handle the difference of the two cases.
    c) I guess there may also be some special caps for DRM stream after decode.
Comment 1 Zhao, Halley 2010-07-19 06:02:36 UTC
Created attachment 166142 [details] [review]
proposed patch for adding 'caps' property for playbin

proposed patch for adding 'caps' property for playbin
Comment 2 Sebastian Dröge (slomo) 2010-07-19 07:12:35 UTC
I don't think this is the right approach. Instead, if anything should be exposed, the autoplug-* signals of uridecodebin/decodebin2 should be exposed to the application.
Comment 3 Zhao, Halley 2010-07-19 08:35:22 UTC
sorry, Dröge. I don't catch your idea clearly.
what's detail of your idea to let decodebin2 expose?
Comment 4 Sebastian Dröge (slomo) 2010-07-19 08:45:31 UTC
Well, after another thought nothing of uridecodebin/decodebin2's autoplug-* signals or the caps should be exposed.

As Edward has answered to your mail to gst-devel (and see my latest comment to your other bug), this should all be handled automagically already if your sink is set as video sink to playbin2 and behaves as playbin2 expects.
Comment 5 Zhao, Halley 2010-07-26 08:51:36 UTC
There are two ways to run into expose_pad in gstdecodebin2.c
1. analyze_new_pad()
  /* 1.a if autoplug-continue is FALSE or caps is a raw format, goto pad_is_final */
  if ((!apcontinue) || are_raw_caps (dbin, caps))
    goto expose_pad;
2. connect_pad()
      case GST_AUTOPLUG_SELECT_EXPOSE:
        GST_DEBUG_OBJECT (dbin, "autoplug select requested expose");
        /* expose the pad, we don't have the source element */
        expose_pad (dbin, src, dpad, pad, caps, chain);
        res = TRUE;
        goto beach;

For the second case, video-sink set from app will not take effect. because in gstplaybin2.c:
1. autoplug_select_cb() will set group->video_sink with sink by auto-plug
2. in no_more_pads_cb(), the above sink will take a higher priority than sink set from app:
    if (group->video_sink) {
      GST_INFO_OBJECT (playbin, "setting custom video sink %" GST_PTR_FORMAT,
          group->video_sink);
      gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
          group->video_sink);
    } else {
      GST_INFO_OBJECT (playbin, "setting default video sink %" GST_PTR_FORMAT,
          playbin->video_sink);
      gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
          playbin->video_sink);
    }
}

In summary:
without 'video/x-raw-va' in DEFAULT_RAW_CAPS, application can't change 'video_sink' property of playbin2.
Comment 6 Sebastian Dröge (slomo) 2010-07-26 12:41:01 UTC
(In reply to comment #5)

> For the second case, video-sink set from app will not take effect. because in
> gstplaybin2.c:
> 1. autoplug_select_cb() will set group->video_sink with sink by auto-plug

That's exactly the problem. The sink *must* not be autoplugged by decodebin2/uridecodebin.
Comment 7 Sebastian Dröge (slomo) 2010-07-26 13:45:13 UTC
Could you attach the output of gst-inspect on your VA sink to this bug?
Comment 8 Zhao, Halley 2010-07-27 01:07:12 UTC
(In reply to comment #6)
> (In reply to comment #5)
> 
> > For the second case, video-sink set from app will not take effect. because in
> > gstplaybin2.c:
> > 1. autoplug_select_cb() will set group->video_sink with sink by auto-plug
> 
> That's exactly the problem. The sink *must* not be autoplugged by
> decodebin2/uridecodebin.
the sink is found by playbin2 in gstplaybin2.c, autoplug_select_cb().
not decodebin2/uridecodebin
Comment 9 Zhao, Halley 2010-07-27 01:16:15 UTC
Created attachment 166614 [details]
gst-inspect of MixVideoSink

now the caps shows as 'video/x-mixvideo-private', it will change to 'video/x-raw-va' soon.
Comment 10 Zhao, Halley 2010-07-30 06:54:49 UTC
(In reply to comment #5)
> For the second case, video-sink set from app will not take effect. because in
> gstplaybin2.c:
> 1. autoplug_select_cb() will set group->video_sink with sink by auto-plug
> 2. in no_more_pads_cb(), the above sink will take a higher priority than sink
> set from app:
>     if (group->video_sink) {
>       GST_INFO_OBJECT (playbin, "setting custom video sink %" GST_PTR_FORMAT,
>           group->video_sink);
>       gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
>           group->video_sink);
>     } else {
>       GST_INFO_OBJECT (playbin, "setting default video sink %" GST_PTR_FORMAT,
>           playbin->video_sink);
>       gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
>           playbin->video_sink);
>     }
> }
as to the above code.
if we take video_sink set from app as higher priority, it will also be ok for my case.

if(playbin->video_sink) {
gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
           playbin->video_sink);
} else {
gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
           group->video_sink);
}

is it reasonable?
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2010-11-08 15:47:20 UTC
Do your decoders use 'video/x-mixvideo-private' as the first format? Then everything should work. You should also use plabin2::flags|=GST_PLAY_FLAG_NATIVE_VIDEO to avoid converters being plugged.
Comment 12 Zhao, Halley 2010-11-11 03:54:18 UTC
my issue is "video/x-mxivideo-private" isn't exposed in decodebin2, not about conversions.
finally, I find another way to force decodebin2 expose "video/x-mixvideo-private": I try to find uridecodebin in app (playbin2's "element-added" signal), and add "video/x-mixvideo-private" to "caps" of uridecodebin in app.
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2010-11-11 13:11:53 UTC
Have you figured what criteria is causing decodebin2 to not expose your pads? I think it is somewhere in decodebin2:gst_decode_bin_expose().
Comment 14 Zhao, Halley 2010-11-12 05:44:10 UTC
you can refer to "comment 5" for more details.
decodebin2 doesn't think "video/x-raw-va"("video/x-mixvideo-private") is a raw caps to expose, next playbin2 find vaimagesink (MixVideoSink); then the pipeline is final. customized video sink set to playbin2 doesn't take effect.
Comment 15 Tobias Mueller 2011-04-12 13:34:09 UTC
Reopening as I think the requested information has been provided.
Comment 16 Sebastian Dröge (slomo) 2011-04-12 13:38:05 UTC
Could you try with latest GIT of core and base and get a debug log with debug level 5? With latest GIT this should really work if you set vaimagesink as custom video sink and it should even work if you don't set any custom video sink at all (playbin2 should select vaimagesink automatically then if it discovers the va caps).

I did some changes lately that improved the behaviour of playbin2 with custom caps that are supported by sinks (i.e. not the default raw caps).
Comment 17 Sebastian Dröge (slomo) 2011-05-17 08:10:41 UTC
Ok, let's close this as NOTABUG then. It should all work now and if it doesn't this should be fixed different than with a caps property on playbin2.