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 and LibVLC Multimedia Player Example (C)

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code
Author Message
caracal
GTK+ Guru


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

PostPosted: Sat Oct 03, 2009 5:55 am    Post subject: Gtk and LibVLC Multimedia Player Example (C) Reply with quote

GTK wrapper for LibVLC. This library allows you to use libvlc from C code in a GTK interface with GTK widget representing the player.

http://code.google.com/p/libvlc-gtk/
svn checkout http://libvlc-gtk.googlecode.com/svn/trunk/ libvlc-gtk-read-only

This is the example application supplyed by libvlc-gtk
Note: You need a current stable vlc.



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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8-*- */
#include "gtk-libvlc-media-player.h"

static void
on_window_destroy(GtkWindow *window, gpointer user_data)
{
    gtk_main_quit();
}

static void
on_scale_value_changed(GtkRange *range, gpointer  user_data)
{
    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("value-changed\n");
   
}

static void
on_button_play_clicked(GtkButton *button, gpointer user_data)

    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("play\n");
    gtk_libvlc_media_player_play(vlc, NULL);
}

static void
on_button_stop_clicked(GtkButton *button, gpointer user_data)

    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("stop\n");
    gtk_libvlc_media_player_stop(vlc);
}

static void
on_button_record_clicked(GtkButton *button, gpointer user_data)

    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("record\n");
    // gchar *options[] = {":vout-filter=transform", ":transform-type=90", NULL};
   
gchar *options[] = {":sout=#duplicate{dst=display,dst=std{access=file,mux=ts,dst='./test.ts'}}", NULL};
    gtk_libvlc_media_player_play(vlc, options);
}

static void
on_button_next_clicked(GtkButton *button, gpointer user_data)

    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("play next\n");
    gtk_libvlc_media_player_play_next(vlc, NULL);
}

static void
on_button_value_changed (GtkScaleButton *button,
             gdouble value, gpointer user_data)
{
    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("value-changed : %f\n", value);
    gtk_libvlc_media_player_set_volume (vlc, value);
    gtk_libvlc_media_player_get_volume(vlc);
}

static void
on_button_fullscreen_clicked(GtkButton *button, gpointer user_data)

    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("fullscreen\n");
    gtk_libvlc_media_player_set_fullscreen(vlc, TRUE);
}

static void
on_button_destroy_clicked(GtkButton *button, gpointer user_data)
{
    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    g_print("destroy\n");
    gtk_widget_destroy(GTK_WIDGET(vlc));
}

static void
on_row_displayed_playlist (GtkTreeViewColumn *col,
               GtkCellRenderer *renderer, GtkTreeModel *model,
               GtkTreeIter *iter, gpointer user_data)
{
    GtkLibVLCMedia* media;
    gtk_tree_model_get(model, iter, GTK_LIBVLC_MODEL_MEDIA_COLUMN, &media, -1);
    g_object_set(renderer, "text", media->mrl, "visible", TRUE, NULL);
}

static void
on_row_activated (GtkTreeView *tree_view, GtkTreePath *path,
          GtkTreeViewColumn *column, gpointer user_data)
{
    GtkLibVLCMediaPlayer *vlc = (GtkLibVLCMediaPlayer*)user_data;
    gtk_libvlc_media_player_play_media_at_path(vlc, path, NULL);
}

int main (int argc, char ** argv)
{
    GtkWidget *window;
    GtkWidget *hbox;   
   
    gtk_init(&argc, &argv);
   
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "GtkVLCMediaPlayer widget");
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 600, 400);
   
    g_signal_connect(G_OBJECT(window), "destroy",
             G_CALLBACK(on_window_destroy), NULL);
   
    hbox = gtk_hbox_new(TRUE, 2);
   
    GtkLibVLCInstance* instance;
    const gchar* vlc_args[] = {
        "-I dummy", /* Don't use any interface */
       
"--ignore-config", /* Don't use VLC's config */
       
"--extraintf=logger", //log anything
       
"-vvv" //be much more verbose then normal for debugging purpose
   
};
    instance = gtk_libvlc_instance_new(vlc_args);
    //instance = gtk_libvlc_instance_new(NULL);
   
    // Create players
   
int i;
    for(i=0; i<1; i++){
        GtkWidget *vbox;
        GtkWidget *vlc;
        GtkWidget *hbox_button;
        GtkWidget *button;
        GtkWidget *treeview;
        GtkWidget *hpaned;
        GtkWidget *scale;

        GtkTreeViewColumn *column;
        GtkCellRenderer *renderer;
       
        hpaned = gtk_hpaned_new ();
        gtk_paned_set_position (GTK_PANED(hpaned), 400);

        vbox = gtk_vbox_new(FALSE, 0);
        gtk_paned_add1 (GTK_PANED(hpaned), vbox);
       
        // Media player
       
vlc = gtk_libvlc_media_player_new(instance);
        gtk_libvlc_media_player_set_volume (GTK_LIBVLC_MEDIA_PLAYER(vlc), 0.7);
        gtk_box_pack_start (GTK_BOX(vbox), vlc, TRUE, TRUE, 2);       
       
        // HScale
       
hbox_button = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start (GTK_BOX(vbox), hbox_button, FALSE, TRUE, 0);

        scale = gtk_hscale_new_with_range (0.0, 1.0, 0.1);
        gtk_scale_set_draw_value (GTK_SCALE(scale), TRUE);
        gtk_scale_set_value_pos (GTK_SCALE(scale), GTK_POS_RIGHT);
        g_signal_connect(G_OBJECT(scale), "value-changed",
                 G_CALLBACK(on_scale_value_changed), vlc);
        gtk_box_pack_start (GTK_BOX(hbox_button), scale, TRUE, TRUE, 0);

        // Button bar
       
hbox_button = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start (GTK_BOX(vbox), hbox_button, FALSE, FALSE, 0);               
       
        //  Play button
       
button = gtk_button_new();
        gtk_button_set_image (GTK_BUTTON(button),
                      gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_play_clicked), vlc);
       
        //  Stop button
       
button = gtk_button_new();
        gtk_button_set_image (GTK_BUTTON(button),
                      gtk_image_new_from_stock(GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_stop_clicked), vlc);
       
        // Record button
       
button = gtk_button_new();
        gtk_button_set_image (GTK_BUTTON(button),
                      gtk_image_new_from_stock(GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_record_clicked), vlc);
       
        // Media next button
       
button = gtk_button_new();
        gtk_button_set_image (GTK_BUTTON(button),
                      gtk_image_new_from_stock(GTK_STOCK_MEDIA_NEXT, GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_next_clicked), vlc);
       
        // Volume button
       
button = gtk_volume_button_new ();
        gdouble value = gtk_libvlc_media_player_get_volume(GTK_LIBVLC_MEDIA_PLAYER(vlc));
        gtk_scale_button_set_value (GTK_SCALE_BUTTON(button), value);

        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
               g_signal_connect(G_OBJECT(button), "value-changed",
                 G_CALLBACK(on_button_value_changed), vlc);
       
        //  Fullscreen button
       
button = gtk_button_new();
        gtk_button_set_image (GTK_BUTTON(button),
                      gtk_image_new_from_stock(GTK_STOCK_FULLSCREEN, GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_fullscreen_clicked), vlc);
       
        // Destroy button
       
button = gtk_button_new_with_label("destroy");
        gtk_box_pack_start (GTK_BOX(hbox_button), button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(button), "clicked",
                 G_CALLBACK(on_button_destroy_clicked), vlc);

        // Playlist
       
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (GTK_LIBVLC_MEDIA_PLAYER(vlc)->media_list));
        column = gtk_tree_view_column_new();
        gtk_tree_view_column_set_title (column, "Playlist");
        renderer = gtk_cell_renderer_text_new ();
        gtk_tree_view_column_pack_start(column, renderer, FALSE);
        gtk_tree_view_column_set_cell_data_func(column, renderer, on_row_displayed_playlist,
                            NULL, NULL);
        gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
        g_signal_connect(G_OBJECT(treeview), "row-activated",
                 G_CALLBACK(on_row_activated), vlc);       

        GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
        //gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_window), treeview);
       
gtk_container_add(GTK_CONTAINER(scrolled_window), treeview);
        gtk_paned_add2 (GTK_PANED(hpaned), scrolled_window);
        //gtk_box_pack_start (GTK_BOX(hbox_player), treeview, TRUE, TRUE, 0);       

       
gtk_box_pack_start (GTK_BOX(hbox), hpaned, TRUE, TRUE, 0);


        // Populate the playlist
       
GtkLibVLCMedia *media;
       
        media = gtk_libvlc_media_new("rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=678&flavour=sd");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=201&flavour=ld");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("mms://vipmms9.yacast.net/aptv_live03");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("mms://vipmms9.yacast.net/bfm_bfmtv");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("http://streaming.radio.funradio.fr:80/fun-1-44-96");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("http://viphttp.yacast.net/V4/radiofrance/franceinfo_bd.m3u");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("./playlist.m3u");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
        media = gtk_libvlc_media_new("v4l2://");
        gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
        g_object_unref(media);
       
    }
   
    gtk_container_add(GTK_CONTAINER(window), hbox);
   
    gtk_widget_show_all(window);
   
    gtk_main();

    g_object_unref(G_OBJECT(instance));
   
    return 0;
}


Back to top
nmanbamboo1980
Familiar Face


Joined: 18 Mar 2009
Posts: 32

PostPosted: Fri Oct 23, 2009 10:41 am    Post subject: Reply with quote

Thank you very much.. this really works very well.

do you know how to get ur webcam feed and how did you manage to get the links for the video feed.
Back to top
caracal
GTK+ Guru


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

PostPosted: Sat Oct 24, 2009 2:27 pm    Post subject: Reply with quote

Media List
----------------
media = gtk_libvlc_media_new("rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=678&flavour=sd");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=201&flavour=ld");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("mms://vipmms9.yacast.net/aptv_live03");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("mms://vipmms9.yacast.net/bfm_bfmtv");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("http://streaming.radio.funradio.fr:80/fun-1-44-96");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("http://viphttp.yacast.net/V4/radiofrance/franceinfo_bd.m3u");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
media = gtk_libvlc_media_new("./playlist.m3u");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);

Web Camera
--------------------
media = gtk_libvlc_media_new("v4l2://");
gtk_libvlc_media_player_add_media(GTK_LIBVLC_MEDIA_PLAYER(vlc), media);
g_object_unref(media);
Back to top
nmanbamboo1980
Familiar Face


Joined: 18 Mar 2009
Posts: 32

PostPosted: Sun Oct 25, 2009 5:19 am    Post subject: Reply with quote

Iam Sorry my question was not clear.
What I meant was from where do you find such links on the web.
I have tried to search for live web feeds link, but they only open a web page with the video already embedded.

Thanks for the tip on the web cam.

Any Idea how you select the audio device, Iam using Arch Linux and have two audio devices . 1- onboard and 2- a usb sound device.
Both of the devices show up if I run $aplay -l from the command line.
In my case it plays through the onboard sound card.
I want to set it such that for this GTK sample it uses the usb sound device.
Back to top
caracal
GTK+ Guru


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

PostPosted: Mon Feb 08, 2010 9:18 pm    Post subject: Reply with quote

nmanbamboo1980 wrote:
Iam Sorry my question was not clear.
What I meant was from where do you find such links on the web.
I have tried to search for live web feeds link, but they only open a web page with the video already embedded.

Thanks for the tip on the web cam.

Any Idea how you select the audio device, Iam using Arch Linux and have two audio devices . 1- onboard and 2- a usb sound device.
Both of the devices show up if I run $aplay -l from the command line.
In my case it plays through the onboard sound card.
I want to set it such that for this GTK sample it uses the usb sound device.


const gchar* vlc_args[] = {
"-I dummy", /* Don't use any interface */
"--ignore-config", /* Don't use VLC's config */
"--extraintf=logger", //log anything
"-vvv" //be much more verbose then normal for debugging purpose
};

Use the vlc command line options here.
http://wiki.videolan.org/VLC_command-line_help
Back to top
shutffl



Joined: 14 Mar 2010
Posts: 3

PostPosted: Mon Mar 15, 2010 10:01 am    Post subject: Reply with quote

Wow!! Nice example.. Can you rewrite it for non-block main window while playing??

Edit: Sorry, block only when play radio (playlists not tested).. Video streams works..
Back to top
ginda
Familiar Face


Joined: 11 Feb 2010
Posts: 28

PostPosted: Mon Mar 22, 2010 9:43 am    Post subject: Reply with quote

I am quite new to GTK+ and C but has used LInux for a few years now. I have now managed to install libvlc-gtk and can see .c .h files in /usr/include and libraries in /usr/lib

But when i try to compile the code you posted in your thread i get the following errors:

[me@localhost vlctest]$ gcc -o myapp myapp.c `pkg-config --libs --cflags gtk+-2.0`
Package libvlc-gtk was not found in the pkg-config search path.
Perhaps you should add the directory containing `libvlc-gtk.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libvlc-gtk' found
myapp.c:2:37: error: gtk-libvlc-media-player.h: No such file or directory
myapp.c:3:21: error: gtk/gtk.h: No such file or directory
myapp.c:9: error: expected â)â before â*â token
myapp.c:15: error: expected â)â before â*â token
myapp.c:23: error: expected â)â before â*â token
myapp.c:31: error: expected â)â before â*â token
myapp.c:39: error: expected â)â before â*â token
myapp.c:49: error: expected â)â before â*â token
myapp.c:57: error: expected â)â before â*â token
myapp.c:67: error: expected â)â before â*â token
myapp.c:75: error: expected â)â before â*â token
myapp.c:83: error: expected â)â before â*â token
myapp.c:93: error: expected â)â before â*â token
myapp.c: In function âmainâ:
myapp.c:102: error: âGtkWidgetâ undeclared (first use in this function)
myapp.c:102: error: (Each undeclared identifier is reported only once
myapp.c:102: error: for each function it appears in.)
myapp.c:102: error: âwindowâ undeclared (first use in this function)
myapp.c:103: error: âhboxâ undeclared (first use in this function)
myapp.c:107: error: âGTK_WINDOW_TOPLEVELâ undeclared (first use in this function)
myapp.c:109: error: âGTK_WIN_POS_CENTERâ undeclared (first use in this function)
myapp.c:113: error: âon_window_destroyâ undeclared (first use in this function)
myapp.c:115: error: âTRUEâ undeclared (first use in this function)
myapp.c:117: error: âGtkLibVLCInstanceâ undeclared (first use in this function)
myapp.c:117: error: âinstanceâ undeclared (first use in this function)
myapp.c:118: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
myapp.c:118: error: âvlc_argsâ undeclared (first use in this function)
myapp.c:118: error: expected expression before â]â token
myapp.c:130: error: âvboxâ undeclared (first use in this function)
myapp.c:131: error: âvlcâ undeclared (first use in this function)
myapp.c:132: error: âhbox_buttonâ undeclared (first use in this function)
myapp.c:133: error: âbuttonâ undeclared (first use in this function)
myapp.c:134: error: âtreeviewâ undeclared (first use in this function)
myapp.c:135: error: âhpanedâ undeclared (first use in this function)
myapp.c:136: error: âscaleâ undeclared (first use in this function)
myapp.c:138: error: âGtkTreeViewColumnâ undeclared (first use in this function)
myapp.c:138: error: âcolumnâ undeclared (first use in this function)
myapp.c:139: error: âGtkCellRendererâ undeclared (first use in this function)
myapp.c:139: error: ârendererâ undeclared (first use in this function)
myapp.c:144: error: âFALSEâ undeclared (first use in this function)
myapp.c:158: error: âGTK_POS_RIGHTâ undeclared (first use in this function)
myapp.c:160: error: âon_scale_value_changedâ undeclared (first use in this function)
myapp.c:170: error: âGTK_STOCK_MEDIA_PLAYâ undeclared (first use in this function)
myapp.c:170: error: âGTK_ICON_SIZE_BUTTONâ undeclared (first use in this function)
myapp.c:173: error: âon_button_play_clickedâ undeclared (first use in this function)
myapp.c:178: error: âGTK_STOCK_MEDIA_STOPâ undeclared (first use in this function)
myapp.c:181: error: âon_button_stop_clickedâ undeclared (first use in this function)
myapp.c:186: error: âGTK_STOCK_MEDIA_RECORDâ undeclared (first use in this function)
myapp.c:189: error: âon_button_record_clickedâ undeclared (first use in this function)
myapp.c:194: error: âGTK_STOCK_MEDIA_NEXTâ undeclared (first use in this function)
myapp.c:197: error: âon_button_next_clickedâ undeclared (first use in this function)
myapp.c:201: error: âgdoubleâ undeclared (first use in this function)
myapp.c:201: error: expected â;â before âvalueâ
myapp.c:202: error: âvalueâ undeclared (first use in this function)
myapp.c:206: error: âon_button_value_changedâ undeclared (first use in this function)
myapp.c:211: error: âGTK_STOCK_FULLSCREENâ undeclared (first use in this function)
myapp.c:214: error: âon_button_fullscreen_clickedâ undeclared (first use in this function)
myapp.c:220: error: âon_button_destroy_clickedâ undeclared (first use in this function)
myapp.c:223: error: invalid type argument of â->â (have âintâ)
myapp.c:228: error: âon_row_displayed_playlistâ undeclared (first use in this function)
myapp.c:232: error: âon_row_activatedâ undeclared (first use in this function)
myapp.c:234: error: âscrolled_windowâ undeclared (first use in this function)
myapp.c:244: error: âGtkLibVLCMediaâ undeclared (first use in this function)
myapp.c:244: error: âmediaâ undeclared (first use in this function)


So sorry for the length of above error text. Could you help me solve this issue?
Back to top
shutffl



Joined: 14 Mar 2010
Posts: 3

PostPosted: Thu Mar 25, 2010 8:57 am    Post subject: Reply with quote

gcc cannot find gtk.h.. Try pkg-config gtk+-2.0 --libs, for ex.. If gtk in system then you see result string.. As for me I try this example and it`s works.. Check your system and libraries.. And check for pkg-config.. I use ArchLinux and there pkg-config doesn`t install with gtk+glib..

upd..
I use
Code: (Plaintext)
1
svn checkout http://libvlc-gtk.googlecode.com/svn/trunk/  libvlc-gtk-read-only
for tests..
Back to top
ginda
Familiar Face


Joined: 11 Feb 2010
Posts: 28

PostPosted: Thu Mar 25, 2010 10:23 am    Post subject: Reply with quote

Hi all

I found that i was using wrong compiling command. I used below and it worked fine.

gcc -g -o myapp `pkg-config --cflags --libs gtk+-2.0 gthread-2.0 libvlc` -I/usr/include/libvlc-gtk/ -lvlc-gtk myapp.c
Back to top
ginda
Familiar Face


Joined: 11 Feb 2010
Posts: 28

PostPosted: Thu Mar 25, 2010 10:26 am    Post subject: Reply with quote

Hi all

The libvlc-gtk is very useful and helps get a gtk based video player steup very quickly.

Is there a way to achieve this with using libvlc-gtk and just use libvlc directly, if some one could provide a simple example i would really appriciate it.

Kind regards
Back to top
ramesh
GTK+ Guru


Joined: 16 Nov 2006
Posts: 260
Location: INDIA

PostPosted: Mon Apr 05, 2010 3:02 am    Post subject: Reply with quote

[quote="caracal[/quote]

Hi
can libvlc-gtk is available windows machine?

any help it should be appreciable
Back to top
mkkadamb



Joined: 18 May 2010
Posts: 2

PostPosted: Tue May 18, 2010 1:56 am    Post subject: Problem in running the code Reply with quote

Hi,
I'm new to gtk programming and this was my I'm using Eclipse to compile and run the code. The code compiles without any errors, but when I try to run the program it gives an error saying that Could not load shared object: gtk-libvlc.so.0 is not found. No file or directory found.

Can someone please help me?

Thanks.
Murali.
Back to top
mkkadamb



Joined: 18 May 2010
Posts: 2

PostPosted: Tue May 18, 2010 2:47 am    Post subject: Re: Problem in running the code Reply with quote

mkkadamb wrote:
Hi,
I'm new to gtk programming and this was my I'm using Eclipse to compile and run the code. The code compiles without any errors, but when I try to run the program it gives an error saying that Could not load shared object: gtk-libvlc.so.0 is not found. No file or directory found.

Can someone please help me?

Thanks.
Murali.


Hey,
I understood how to run the application through Eclipse. :D
I got it to work. I had to set the environment variables in the Run Configuration.

:)
Back to top
djtarki
Familiar Face


Joined: 21 Jan 2010
Posts: 5

PostPosted: Wed Jun 16, 2010 10:15 am    Post subject: Reply with quote

Thanks very much caracal. It worked like a charm under Ubuntu 10.04 64 bits and using Eclipse Galileo.

Regards.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code All times are GMT
Page 1 of 1

 


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