Refreshing video after a zoom/unzoom like process using GTK

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

Refreshing video after a zoom/unzoom like process using GTK

jackson80
Greetings,

I have taken the tutorial sample
and modified it by packing two videos in the horizontal box. I actually started with four videos, but I get the same problem with two.
Both videos play great with play/pause/stop buttons and a seek bar.I also added a zoom and unzoom function.
For the zoom, I remove one of the videos from the horizontal box and the other video fills the main box.
When I unzoom, I pack the previously removed video back in the box. The problem is the newly repacked video does not appear
unless I stop and restart the videos from the beginning or if I slightly modify the entire box by grabbing a corner or side and 
adjust the size of the box.

Is there any way to get that video to display after I have repacked it without the methods I've described?

Thanks,
Jack

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

Re: Refreshing video after a zoom/unzoom like process using GTK

Sebastian Dröge-3
On Sa, 2016-03-05 at 18:47 -0700, Jack Dickerson wrote:

> Greetings,
>
> I have taken the tutorial sample
> https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tu
> torials/basic-tutorial-5.c
> and modified it by packing two videos in the horizontal box. I
> actually started with four videos, but I get the same problem with
> two.
> Both videos play great with play/pause/stop buttons and a seek bar.I
> also added a zoom and unzoom function.
> For the zoom, I remove one of the videos from the horizontal box and
> the other video fills the main box.
> When I unzoom, I pack the previously removed video back in the box.
> The problem is the newly repacked video does not appear
> unless I stop and restart the videos from the beginning or if I
> slightly modify the entire box by grabbing a corner or side and 
> adjust the size of the box.
>
> Is there any way to get that video to display after I have repacked
> it without the methods I've described?
The problem might be that the native X11 window is changing here, not
entirely sure. That would at least explain why restarting makes things
work again.

A possible solution for you would be to use gtksink or gtkglsink. These
provide you directly a GTK widget that you can put into your UI and
should be robust for these things.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing video after a zoom/unzoom like process using GTK

jackson80
I'm having difficulty getting my head around how I can use the gtksink widget. Matthew Waters spoke at what I believe was a Gnome programming conference in May 2015 and one of the slides he presented had a piece of code representing something that could be replaced with gtksink.  But then he did not include any new code showing how it would replace the old code.  Would it be possible to get a sample of how it would look using gtksink? Here is the code he presented:


GstElement *playbin = gst_element_factory_make ("playbin", NULL);
g_object_set (playbin, "uri", "file:///path/to/file.mp4", NULL);

GtkWdiget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget *video_window = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), video_window);

gtk_widget_show_all (window);

GdkWindow *video_window_xwindow = gtk_widget_get_window (video_window);
gulong embed_xid = gtk_window_get_xid (video_window_xwindow);
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (playbin), embed_xid)'

gst_element_set_state (playbin, GST_STATE_PLAYING);

This would not be an exact representation of what I'm trying to accomplish, but seeing how this would be done with gtksink should help tremendously.

Thanks,
Jack

On Sun, Mar 6, 2016 at 1:00 AM, Sebastian Dröge <[hidden email]> wrote:
On Sa, 2016-03-05 at 18:47 -0700, Jack Dickerson wrote:
> Greetings,
>
> I have taken the tutorial sample
> https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tu
> torials/basic-tutorial-5.c
> and modified it by packing two videos in the horizontal box. I
> actually started with four videos, but I get the same problem with
> two.
> Both videos play great with play/pause/stop buttons and a seek bar.I
> also added a zoom and unzoom function.
> For the zoom, I remove one of the videos from the horizontal box and
> the other video fills the main box.
> When I unzoom, I pack the previously removed video back in the box.
> The problem is the newly repacked video does not appear
> unless I stop and restart the videos from the beginning or if I
> slightly modify the entire box by grabbing a corner or side and 
> adjust the size of the box.
>
> Is there any way to get that video to display after I have repacked
> it without the methods I've described?

The problem might be that the native X11 window is changing here, not
entirely sure. That would at least explain why restarting makes things
work again.

A possible solution for you would be to use gtksink or gtkglsink. These
provide you directly a GTK widget that you can put into your UI and
should be robust for these things.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.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
|

Re: Refreshing video after a zoom/unzoom like process using GTK

Sebastian Dröge-3
On Di, 2016-03-15 at 13:22 -0700, Jack D wrote:
> I'm having difficulty getting my head around how I can use the
> gtksink widget. Matthew Waters spoke at what I believe was a Gnome
> programming conference in May 2015 and one of the slides he presented
> had a piece of code representing something that could be replaced
> with gtksink.  But then he did not include any new code showing how
> it would replace the old code.  Would it be possible to get a sample
> of how it would look using gtksink? Here is the code he presented:

Here are some example applications:
https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/gtk

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing video after a zoom/unzoom like process using GTK

jackson80
I have already seen these and other examples that I could find doing a gtksink search and they are very helpful.
But none of them address the issue listed in the code sample, that the video overlay is derived from a gtk_drawing_area.
Is there a way to attach a gtksink widget to a gtk_drawing_area derived widget or must I have all my videos defined 
as GTK_WINDOW_TOPLEVEL?

On Wed, Mar 16, 2016 at 1:01 AM, Sebastian Dröge <[hidden email]> wrote:
On Di, 2016-03-15 at 13:22 -0700, Jack D wrote:
> I'm having difficulty getting my head around how I can use the
> gtksink widget. Matthew Waters spoke at what I believe was a Gnome
> programming conference in May 2015 and one of the slides he presented
> had a piece of code representing something that could be replaced
> with gtksink.  But then he did not include any new code showing how
> it would replace the old code.  Would it be possible to get a sample
> of how it would look using gtksink? Here is the code he presented:

Here are some example applications:
https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/gtk

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.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
|

Re: Refreshing video after a zoom/unzoom like process using GTK

Sebastian Dröge-3
On Mi, 2016-03-16 at 08:37 -0700, Jack D wrote:
> I have already seen these and other examples that I could find doing
> a gtksink search and they are very helpful.
> But none of them address the issue listed in the code sample, that
> the video overlay is derived from a gtk_drawing_area.
> Is there a way to attach a gtksink widget to a gtk_drawing_area
> derived widget or must I have all my videos defined 
> as GTK_WINDOW_TOPLEVEL?

Why do you want it inside a GtkDrawingArea? You can put the widget
provided by the gtksink into any GtkBin, but GtkDrawingArea is a plain
widget so that's not possible.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing video after a zoom/unzoom like process using GTK

Russel Winder
In reply to this post by jackson80
On Wed, 2016-03-16 at 08:37 -0700, Jack D wrote:

> I have already seen these and other examples that I could find doing
> a
> gtksink search and they are very helpful.
> But none of them address the issue listed in the code sample, that
> the
> video overlay is derived from a gtk_drawing_area.
> Is there a way to attach a gtksink widget to a gtk_drawing_area
> derived
> widget or must I have all my videos defined
> as GTK_WINDOW_TOPLEVEL?
Not sure if this helps, but I replace the DrawingArea with the GtkSink:
DrawingArea was where the X11 overlay happened, replaced entirely by
just adding the GtkSink where the DrawingArea would have been.

--
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[hidden email]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [hidden email]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


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

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing video after a zoom/unzoom like process using GTK

jackson80
In reply to this post by Sebastian Dröge-3
I don't require GtkDrawingArea but I was able to successfully output multiple videos using GtkDrawingArea.
I was trying to continue with something I know will work for me.  I guess I need to determine a different GtkBin
to use to output my videos. Do you have any suggestions?  More of a Gtk question, but is it possible to pack a
GTK_WINDOW_TOPLEVEL window into a horizontal box that will be packed into another GTK_WINDOW_TOPLEVEL
window? I will attempt this and see what happens.

Thanks, 
Jack

On Wed, Mar 16, 2016 at 8:50 AM, Sebastian Dröge <[hidden email]> wrote:
On Mi, 2016-03-16 at 08:37 -0700, Jack D wrote:
> I have already seen these and other examples that I could find doing
> a gtksink search and they are very helpful.
> But none of them address the issue listed in the code sample, that
> the video overlay is derived from a gtk_drawing_area.
> Is there a way to attach a gtksink widget to a gtk_drawing_area
> derived widget or must I have all my videos defined 
> as GTK_WINDOW_TOPLEVEL?

Why do you want it inside a GtkDrawingArea? You can put the widget
provided by the gtksink into any GtkBin, but GtkDrawingArea is a plain
widget so that's not possible.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.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
|

Re: Refreshing video after a zoom/unzoom like process using GTK

Sebastian Dröge-3
On Mi, 2016-03-16 at 09:16 -0700, Jack D wrote:
> I don't require GtkDrawingArea but I was able to successfully output multiple videos using GtkDrawingArea.
> I was trying to continue with something I know will work for me.  I guess I need to determine a different GtkBin
> to use to output my videos. Do you have any suggestions?  More of a Gtk question, but is it possible to pack a
> GTK_WINDOW_TOPLEVEL window into a horizontal box that will be packed into another GTK_WINDOW_TOPLEVEL
> window? I will attempt this and see what happens.

You could use the GtkWidget that gtksink/gtkglsink gives you *instead*
of a GtkDrawingArea :) Just use it wherever you used the GtkDrawingArea
before.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing video after a zoom/unzoom like process using GTK

jackson80
Problem solved. It was much simpler than I imagined. Thank you very much, Sebastian and Russel.

old code: (I have two videos but only including details for one to save post length)

  vid_win1 = gtk_drawing_area_new ();
  gtk_widget_set_double_buffered (vid_win1, FALSE);
  g_signal_connect (vid_win1, "realize", G_CALLBACK (realize_cb), data->pipe1);

new code:
// note: pipe1 is a playbin, vidwin1 is a GtkWidget
GstElement data.sink1 = gst_element_factory_make ("gtksink", "sink1");
g_object_get (data->sink1, "widget", &vid_win1, NULL);
g_object_set (data->pipe1, "video_sink", data->sink1, NULL);
gtk_widget_set_double_buffered (vid_win1, FALSE);

// No longer need call back to set up window overlay.
//  g_signal_connect (vid_win1, "realize", G_CALLBACK (realize_cb), data->pipe1);


On Wed, Mar 16, 2016 at 9:26 AM, Sebastian Dröge <[hidden email]> wrote:
On Mi, 2016-03-16 at 09:16 -0700, Jack D wrote:
> I don't require GtkDrawingArea but I was able to successfully output multiple videos using GtkDrawingArea.
> I was trying to continue with something I know will work for me.  I guess I need to determine a different GtkBin
> to use to output my videos. Do you have any suggestions?  More of a Gtk question, but is it possible to pack a
> GTK_WINDOW_TOPLEVEL window into a horizontal box that will be packed into another GTK_WINDOW_TOPLEVEL
> window? I will attempt this and see what happens.

You could use the GtkWidget that gtksink/gtkglsink gives you *instead*
of a GtkDrawingArea :) Just use it wherever you used the GtkDrawingArea
before.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.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