How to pause a playbin after the first frame is displayed?

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

How to pause a playbin after the first frame is displayed?

wl2776
Administrator
Hi all.
I am rather new to GStreamer and developing a player with simple editing capabilities (cut and merge).
This is going to be an ActiveX control.

The previous version of this player was developed with DirectShow, and I must copy its behavior as much exactly as possible.

Now I need an analog of StopWhenReady functionality.
This function stops the DS graph after it displays the first frame.
How can I implement this?
Reply | Threaded
Open this post in threaded view
|

Re: How to pause a playbin after the first frame is displayed?

Stefan Sauer
Am 17.12.2009 12:47, schrieb Vladimir Eremeev:

>
> Hi all.
> I am rather new to GStreamer and developing a player with simple editing
> capabilities (cut and merge).
> This is going to be an ActiveX control.
>
> The previous version of this player was developed with DirectShow, and I
> must copy its behavior as much exactly as possible.
>
> Now I need an analog of StopWhenReady functionality.
> This function stops the DS graph after it displays the first frame.
> How can I implement this?

This is the paused state in gstreamer:
gst_element_set_state(pipeline, GST_STATE_PAUSED);

register a signal handler to the message bus of the pipeline and wait for the
READY_TO_PAUSED state change message for the pipeline.

Stefan

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to pause a playbin after the first frame is displayed?

wl2776
Administrator

Stefan Kost wrote
> Now I need an analog of StopWhenReady functionality.

register a signal handler to the message bus of the pipeline and wait for the
READY_TO_PAUSED state change message for the pipeline.
Stefan
Stefan, thank you for the answer. However, I am missing something.
Where should I look for this message?
I've found the enum GstStateChange in headers and in reference. Which variable (structure member) is assigned these values?

Here is how I do currently:

// initialization
player = gst_element_factory_make("playbin2","playbin0");
GstElement *bus = (GstElement *)gst_pipeline_get_bus(GST_PIPELINE(player));
gst_bus_set_sync_handler (GST_BUS(bus), (GstBusSyncHandler)gst_bus_sync_handler, this);
gst_bus_add_watch (GST_BUS(bus), bus_call, this);
gst_object_unref(bus);

//handlers
GstBusSyncReply CControlMainDialog::bus_sync_handler(GstBus * bus, GstMessage * message)
{
  g_print("bus_sync_handler: message %s(%d) from %s\n",GST_MESSAGE_TYPE_NAME(messaef),GST_MESSAGE_TYPE(message),GST_MESSAGE_SRC_NAME(message));

  switch (GST_MESSAGE_TYPE (message)) {
// process message
  }
  gst_message_unref (message);
  return GST_BUS_DROP;	
}

gboolean CControlMainDialog::bus_watch(GstBus* bus, GstMessage *msg)
{
 g_print("bus_watch: message %s(%d) from %s\n",GST_MESSAGE_TYPE_NAME(msg),GST_MESSAGE_TYPE(msg),GST_MESSAGE_SRC_NAME(msg));
  switch (GST_MESSAGE_TYPE (msg)) {
// process message
  }
  gst_message_unref (msg);
  return TRUE;	
}

However, I didn't see any hints about that state change.
Reply | Threaded
Open this post in threaded view
|

Re: How to pause a playbin after the first frame is displayed?

wl2776
Administrator
wl2776 wrote
Stefan, thank you for the answer. However, I am missing something.
Where should I look for this message?
I've found the enum GstStateChange in headers and in reference. Which variable (structure member) is assigned these values?
Yes, I've done this.