GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Gtk+ Tutorials & Resources
Goto page Previous  1, 2
 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> General GTK+ Discussion
Author Message
tadeboro
Never Seen the Sunlight


Joined: 23 Jul 2008
Posts: 2114
Location: Slovenia

PostPosted: Thu Sep 03, 2009 6:06 pm    Post subject: Reply with quote

Hello.
wally_bkg wrote:
My most pressing issues are how do I embed a gstreamer video output (xvimagesink or ximagesink) window inside a gtk application (I'd prefer glade3 and the convert script for UI design at this point), and what gtk+ widgits are available to plot analog data in a stripchart type scrolling display, if any.
First of all, the difference between ximagesink and xvimagesink is only in hardware acceleration - xvimagesink uses capabilities of your GPU to render contents while ximagesing is a software renderer. In real world application, you'll almost certainly want to use xvimagesink.

Embedding is relatively simple. Create your GUI as usually and use GtkDrawingArea as a widget that will display video (we use GtkDrawingArea mainly because it has it's own GdkWindow, so GtkEventBox would be OK too). Now you need to create your multimedia pipeline, connect it's message bus and wait for "prepare-xwindow-id" message to arrive. When you get it, obtain the X resource ID from GdkWindow and set it as xoverlay ID. That's it. When your start your pipeline, video will be displayed on your widget.

A sample code that shows intercepting GStreamer's message and X ID setting would look like this:
Code: (C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
static GstBusSyncReply
create_window( GstBus      *bus,
               GstMessage  *message,
               GtkWidget   *draw )
{
    /* ignore anything but 'prepare-xwindow-id' element messages */
   
if( GST_MESSAGE_TYPE( message ) != GST_MESSAGE_ELEMENT )
        return( GST_BUS_PASS );
   
    if( ! gst_structure_has_name( message->structure, "prepare-xwindow-id" ) )
        return( GST_BUS_PASS );
   
    gst_x_overlay_set_xwindow_id(
            GST_X_OVERLAY( GST_MESSAGE_SRC( message ) ),
            GDK_WINDOW_XWINDOW( gtk_widget_get_window( draw ) ) );
   
    gst_message_unref (message);
   
    return( GST_BUS_DROP );
}

int
main( int    argc,
      char **argv)
{
    /* Declarations here */
   
GtkWidget  *draw_area;
    GstBus     *bus;
    GstElement *pipeline;
    /* ... */

   
gtk_init( &argc, &argv );

    /* Create widget here */

    /* Create pipeline here */

    /* Embedding */
   
bus = gst_pipeline_get_bus( GST_PIPELINE( pipeline ) );
    gst_bus_set_sync_handler( bus,
                              (GstBusSyncHandler)create_window,
                              draw_area );

    /* More code here */

   
return( 0 );
}
(This code is modification of code, obtained from here: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#gst-plugins-base-libs-gstxoverlay.description.)

And about analog display. There is no stock widget to display any of this stuff since this is quite specialized stuff and against GTK+'s philosophy to keep default widget set non-polluted with gazillions of poorly maintained widgets. You'll probably be able to find one already coded on the web, since there are quite a few audio mangling applications that use GTK+ as their graphical toolkit. But if your demands are relatively simple, you may also get away by simply plotting your data onto GtkDrawingArea.

I hope this post helped a bit.

Tadej
Back to top
caracal
GTK+ Guru


Joined: 21 Jun 2007
Posts: 207
Location: Wilkes Barre Pa

PostPosted: Thu Oct 01, 2009 2:27 am    Post subject: Re: Too few gstreamer tutorials and examples! Reply with quote

[quote="wally_bkg"]
I'd say gstreamer is close to undocumented when you get right down to it. None of the freedesktop.org documentation offers any context beyond a simple "helloworld" type audio file player. These docs are very incomplete and mostly are just autogenerated reference material that are really only useful once you've learned nearly everything and just need the details of the minutia.
[ /quote]

Tell me about it!! I have been working on this list since Jan 15, 2008 and what we have here is they only tangible resources that i could find on gstreamer.
Back to top
wally_bkg
Familiar Face


Joined: 02 Sep 2009
Posts: 20

PostPosted: Thu Oct 08, 2009 1:10 pm    Post subject: Reply with quote

I didn't see this in your tutorial but if you have a complete gtk+ installation the program /usr/bin/gtk-demo is a nice way to browse the behavior of the widgets and look at sample code to exercise them.

Wish I'd known about this earlier.

On Ubuntu you usually have to install the gtk2.0-examples package to get it.

--wally.
Back to top
caracal
GTK+ Guru


Joined: 21 Jun 2007
Posts: 207
Location: Wilkes Barre Pa

PostPosted: Fri Oct 09, 2009 6:25 pm    Post subject: Reply with quote

I just just figured everyone knew about they example and demo folders in gtk+ source that's kind how you get the reference manuals by downloading the source.
Back to top
urb
Familiar Face


Joined: 09 Nov 2009
Posts: 5

PostPosted: Thu Jan 14, 2010 1:06 am    Post subject: GTK docs for Win32 developers in HTMLHelp (chm) format. Reply with quote

Hello, below I put a links to GTK API docs in CHM format (HTMLHelp). Useful for a programmers uses GTK on MS Windows.

These docs was converted by pyhtmlhelp.

http://www.speedyshare.com/files/20324955/gtk-docs-chm.zip
Back to top
boolde
Familiar Face


Joined: 04 May 2010
Posts: 8

PostPosted: Tue May 04, 2010 6:05 pm    Post subject: Reply with quote

thanks a lot
Back to top
ramesh
GTK+ Guru


Joined: 16 Nov 2006
Posts: 270
Location: INDIA

PostPosted: Fri Jul 30, 2010 4:11 am    Post subject: Reply with quote

Hi all

Can i get video c, c++, unix and gtk+ video tutorials.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> General GTK+ Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP