contrib/gel/jvid/bin/jplayer.cxx

Go to the documentation of this file.
00001 // This is gel/jvid/bin/jplayer.cxx
00002 #include <vcl_compiler.h>
00003 #include <vcl_iostream.h>
00004 #include <vcl_cstdlib.h> // for vcl_exit()
00005 
00006 #include <vgui/vgui.h>
00007 #include <vgui/vgui_adaptor.h>
00008 #include <vgui/vgui_window.h>
00009 #include <vgui/vgui_command.h>
00010 #include <vidl_vil1/vidl_vil1_io.h>
00011 #include <jvid/jvx_manager.h>
00012 
00013 #ifdef HAS_MPEG2
00014 # include <vidl_vil1/vidl_vil1_mpegcodec.h>
00015 #endif
00016 
00017 #ifdef HAS_MFC
00018 # include <vgui/internals/vgui_accelerate.h>
00019 #endif
00020 
00021 #ifdef VCL_WIN32
00022 #include <vidl_vil1/vidl_vil1_avicodec.h>
00023 #endif
00024 
00025 
00026 static jvx_manager* jvm = new jvx_manager();
00027 
00028 void quit_callback()
00029 {
00030   vcl_exit(1);
00031 }
00032 
00033 void file_callback()
00034 {
00035   jvm->load_video_file();
00036 }
00037 
00038 void play_callback()
00039 {
00040   jvm->play_video();
00041 }
00042 
00043 int main(int argc, char** argv)
00044 {
00045   // Register video codecs
00046 #ifdef VCL_WIN32
00047   vidl_vil1_io::register_codec(new vidl_vil1_avicodec);
00048 #endif
00049 
00050 #ifdef HAS_MPEG2
00051   vidl_vil1_io::register_codec(new vidl_vil1_mpegcodec);
00052 #endif
00053 
00054    // turn off the mfc acceleration since this seems to stop
00055    // us from doing the double buffering. It also seems to add
00056    // a certain amount of overhead
00057 #ifdef HAS_MFC
00058   vgui_accelerate::vgui_mfc_acceleration = false;
00059 #endif
00060 
00061   vcl_cout << "Joe Video\n";
00062 
00063    // Initialize the toolkit.
00064   vgui::init(argc, argv);
00065 
00066   vgui_menu menubar;
00067   vgui_menu menufile;
00068 
00069   menufile.add( "Quit", new vgui_command_cfunc( quit_callback ));
00070   menufile.add( "Load", new vgui_command_cfunc( file_callback ));
00071   menufile.add( "Play", new vgui_command_cfunc( play_callback ));
00072   menubar.add( "File", menufile);
00073   // Initialize the window
00074   unsigned w = 400, h = 340;
00075 
00076   jvm->set_grid_size_changeable(true);
00077   vcl_string title = "Joe Video Player";
00078   vgui_window *win = vgui::produce_window(w, h, menubar, title);
00079   win->get_adaptor()->set_tableau(jvm);
00080   win->set_statusbar(true);
00081   win->enable_vscrollbar(true);
00082   win->enable_hscrollbar(true);
00083   win->show();
00084   jvm->post_redraw();
00085   return  vgui::run();
00086 }

Generated on Thu Jan 8 05:18:00 2009 for contrib/gel/jvid by  doxygen 1.5.1