gdk_imlib



Hi,

This is probably the wrong place to ask this, but I guess some of you
may know the answer, being guile-gtk-gnome ppl :-)

I'm playing around with a gdk_imlib app to play mpeg files (using the
Berkeley mpeg_play code as a library to get the frames in 24 bit RGB).
This all works well and good, and has the advantage that gdk_imlib
handles the dithering for me, so I don't have to worry about the
decoder dithering for a specific X Visual...

What I want to do is place this in a GTK app, so I can provide menus/
control windows etc... but I can't find examples (simple ones!) of how
to do  this... At the minute my base code is :-

GdkWindowAttr attr;
GdkWindow *win;
GdkImlibImage *im;

gdk_init(&argc, &argv);

gdk_imlib_init();

gtk_widget_push_visual(gdk_imlib_get_visual());
gtk_widget_push_colormap(gdk_imlib_get_colormap());

im = gdk_imlib_create_image_from_data(mpeg_data, NULL, width, height);

attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT;
attr.event_mask = GDK_ALL_EVENTS_MASK;
attr.width = w;
attr.height = h;

win = gdk_window_new(NULL, &attr, 0);
gdk_window_show(win);

while(1)
{
   GetNextFrame();

   Process any events, key strokes etc...
   
   /* mpeg_data is the decoded 24 bit RGB frame from GetNextFrame() */
   im->rgb_data = mpeg_data;
   gdk_imlib_changed_image(im);
   gdk_imlib_apply_image(im, win);
}

How would I go about changing this to use a gtkWidget as the main
window, with a menu bar at the top, and the canvas with the frame below
it?

Any help appreciated, and sorry for being slightly off topic :-/

Cheers,

Mark.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]