Re: video viewer please very very important



Andrea Leonardi wrote:

Dear all
We are writing an apps to view a video. This video
is loaded from a file and it's stored like RGB
sequence without header.
We made a window, and inside a loop we made a
drawing area but we can't update it:
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
for(int i=0;i<250;i++)
      {
fin.read((gchar*)rgbbuf,IMAGE_WIDTH*IMAGE_HEIGHT*3);
darea=gtk_drawing_area_new();
gtk_widget_set_size_request(darea,IMAGE_WIDTH,IMAGE_HEIGHT);
gtk_signal_connect(GTK_OBJECT(darea),"expose-event",GTK_SIGNAL_FUNC(on_darea _expose),NULL);
gtk_widget_show_all(window);
gtk_widget_destroy(darea);
}


You should not create a new gtk_drawing_area every time the
loop rolls. Create it first, then inside the loop use that
gdk_draw_rgb_image to update its' contents, followed with
something like:

    while(gtk_events_pending())
        gtk_main_iteration();

to ensure that it really gets updated and all pending
events are handled. Also that expose event is not really needed.
And please indent your code (for your own sake), even
if it's a dirty one off hack.


    Jonk




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