Panda3D
 All Classes Functions Variables Enumerations
config_movies.cxx
00001 // Filename: config_movies.cxx
00002 // Created by:  jyelon (02Jul07)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_movies.h"
00016 #include "dconfig.h"
00017 #include "movieVideo.h"
00018 #include "movieVideoCursor.h"
00019 #include "movieAudio.h"
00020 #include "movieAudioCursor.h"
00021 #include "inkblotVideo.h"
00022 #include "inkblotVideoCursor.h"
00023 #include "ffmpegVideo.h"
00024 #include "ffmpegVideoCursor.h"
00025 #include "ffmpegAudio.h"
00026 #include "ffmpegAudioCursor.h"
00027 #include "userDataAudio.h"
00028 #include "userDataAudioCursor.h"
00029 #include "microphoneAudio.h"
00030 
00031 #ifdef HAVE_FFMPEG
00032 extern "C" {
00033   #include "libavcodec/avcodec.h"
00034 }
00035 #endif
00036 
00037 ConfigureDef(config_movies);
00038 NotifyCategoryDef(movies, "");
00039 NotifyCategoryDef(ffmpeg, "movies");
00040 
00041 ConfigureFn(config_movies) {
00042   init_libmovies();
00043 }
00044 
00045 ConfigVariableInt ffmpeg_max_readahead_frames
00046 ("ffmpeg-max-readahead-frames", 2,
00047  PRC_DESC("The maximum number of frames ahead which an ffmpeg decoder thread "
00048           "should read in advance of actual playback.  Set this to 0 to "
00049           "decode ffmpeg videos in the main thread."));
00050 
00051 ConfigVariableBool ffmpeg_show_seek_frames
00052 ("ffmpeg-show-seek-frames", true,
00053  PRC_DESC("Set this true to allow showing the intermediate results of seeking "
00054           "through the ffmpeg stream to a target frame, or false to hold the "
00055           "current frame until the target frame is achieved.  This has the "
00056           "biggest effect on videos that are too expensive to decode in real "
00057           "time: when this is true, the video can be seen to animate at least "
00058           "a little bit; when it is false, you may get long periods of one "
00059           "held frame."));
00060 
00061 ConfigVariableBool ffmpeg_support_seek
00062 ("ffmpeg-support-seek", true,
00063  PRC_DESC("True to use the av_seek_frame() function to seek within ffmpeg "
00064           "video files.  If this is false, Panda will only seek within a "
00065           "file by reading it from the beginning until the desired point, "
00066           "which can be much slower.  Set this false only if you suspect "
00067           "a problem with av_seek_frame()."));
00068 
00069 ConfigVariableBool ffmpeg_global_lock
00070 ("ffmpeg-global-lock", false,
00071  PRC_DESC("Set this true to enable a single global mutex across *all* ffmpeg "
00072           "operations.  Leave this false to use the mutex only for "
00073           "the ffmpeg operations that are generally known to be "
00074           "not thread-safe.  This will negatively affect ffmpeg performance, "
00075           "especially when decoding multiple videos at once (including the "
00076           "left and right channels of a stereo video).  Set this true only "
00077           "if you suspect a problem with ffmpeg's own thread-safe nature."));
00078 
00079 ConfigVariableEnum<ThreadPriority> ffmpeg_thread_priority
00080 ("ffmpeg-thread-priority", TP_normal,
00081  PRC_DESC("The default thread priority at which to start ffmpeg decoder "
00082           "threads."));
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: init_libmovies
00086 //  Description: Initializes the library.  This must be called at
00087 //               least once before any of the functions or classes in
00088 //               this library can be used.  Normally it will be
00089 //               called by the static initializers and need not be
00090 //               called explicitly, but special cases exist.
00091 ////////////////////////////////////////////////////////////////////
00092 void
00093 init_libmovies() {
00094   static bool initialized = false;
00095   if (initialized) {
00096     return;
00097   }
00098   initialized = true;
00099 
00100   MovieVideo::init_type();
00101   MovieVideoCursor::init_type();
00102   MovieAudio::init_type();
00103   MovieAudioCursor::init_type();
00104   InkblotVideo::init_type();
00105   InkblotVideoCursor::init_type();
00106   UserDataAudio::init_type();
00107   UserDataAudioCursor::init_type();
00108   MicrophoneAudio::init_type();
00109 
00110 #ifdef HAVE_FFMPEG
00111   FfmpegVirtualFile::register_protocol();
00112 
00113   FfmpegVideo::init_type();
00114   FfmpegVideoCursor::init_type();
00115   FfmpegAudio::init_type();
00116   FfmpegAudioCursor::init_type();
00117 
00118   FfmpegVideo::register_with_read_factory();
00119   FfmpegVideoCursor::register_with_read_factory();
00120 #endif
00121 }
00122 
 All Classes Functions Variables Enumerations