Video, how to?



Hi everyone!

I am building a little app, which includes some video capabilities,
this video is about 200x100 frames and up to 20 frames/sec and down
to 1 frame/sec...

Ok... which is the best method for this kind of application? (of course using gtk, no directly Xlibs)

My first try is this method:
  
[interface.c[
...
  video_image = gdk_image_new(GDK_IMAGE_FASTEST,visual = 
gdk_window_get_visual(BlueEyes->window),WIDTH_DEFAULT,HEIGHT_DEFAULT);
  video_image_widget = gtk_image_new(video_image, NULL);
  gtk_widget_show (video_image_widget);
  gtk_box_pack_start (GTK_BOX (vbox6), video_image_widget, TRUE, TRUE, 0);
...

void paint ( PLUGIN_VIDEO *frame )
{
 guint32 color=0,colorr=0,colorg=0,colorb=0;
 guint16 *mem=video_image->mem;
 int x,y,p=0;
 
 for(y=0;y<frame->HEIGHT;y++)
        for(x=0;x<frame->WIDTH;x++)
                { 
                // RGB24 format
                colorr=((unsigned char)(frame->video_data[p].R & 0xf8)) <<8;
                colorg=((unsigned char)(frame->video_data[p].G & 0xfc)) <<3;
                colorb=((unsigned char)(frame->video_data[p].B & 0xf8)) >>3;
                
                color=colorr+colorg+colorb;

                mem[p++]=color;
                }
 gtk_widget_draw(video_image_widget  ,NULL);
}


I think it is not very fast, neither optimal, but, which is the best method?

P.D: Sorry for my very poor and very-fast-written english!


-- 
David Rivera Pericás

Ing.Técnico de Telecomunicaciones (esp. Telemática).




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