24 #include <libavcodec/avcodec.h> 25 #include <libavformat/avformat.h> 26 #include <libavutil/avutil.h> 29 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_FFMPEG) 30 #error Buildsystem error: BUILDING_FFMPEG not defined 36 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 35, 1) 37 #error Minimum supported version of libavcodec is 54.35.1. 40 #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54, 20, 4) 41 #error Minimum supported version of libavformat is 54.20.4. 44 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 3, 0) 45 #error Minimum supported version of libavutil is 52.3.0. 48 ConfigureDef(config_ffmpeg);
49 NotifyCategoryDef(ffmpeg,
"");
51 ConfigureFn(config_ffmpeg) {
56 (
"ffmpeg-max-readahead-frames", 2,
57 PRC_DESC(
"The maximum number of frames ahead which an ffmpeg decoder thread " 58 "should read in advance of actual playback. Set this to 0 to " 59 "decode ffmpeg videos in the main thread."));
62 (
"ffmpeg-show-seek-frames",
true,
63 PRC_DESC(
"Set this true to allow showing the intermediate results of seeking " 64 "through the ffmpeg stream to a target frame, or false to hold the " 65 "current frame until the target frame is achieved. This has the " 66 "biggest effect on videos that are too expensive to decode in real " 67 "time: when this is true, the video can be seen to animate at least " 68 "a little bit; when it is false, you may get long periods of one " 72 (
"ffmpeg-support-seek",
true,
73 PRC_DESC(
"True to use the av_seek_frame() function to seek within ffmpeg " 74 "video files. If this is false, Panda will only seek within a " 75 "file by reading it from the beginning until the desired point, " 76 "which can be much slower. Set this false only if you suspect " 77 "a problem with av_seek_frame()."));
80 (
"ffmpeg-global-lock",
false,
81 PRC_DESC(
"Set this true to enable a single global mutex across *all* ffmpeg " 82 "operations. Leave this false to use the mutex only for " 83 "the ffmpeg operations that are generally known to be " 84 "not thread-safe. This will negatively affect ffmpeg performance, " 85 "especially when decoding multiple videos at once (including the " 86 "left and right channels of a stereo video). Set this true only " 87 "if you suspect a problem with ffmpeg's own thread-safe nature."));
90 (
"ffmpeg-thread-priority", TP_normal,
91 PRC_DESC(
"The default thread priority at which to start ffmpeg decoder " 95 (
"ffmpeg-read-buffer-size", 4096,
96 PRC_DESC(
"The size in bytes of the buffer used when reading input files. " 97 "This is important for performance. A typical size is that of a " 98 "cache page, e.g. 4kb."));
101 (
"ffmpeg-prefer-libvpx",
false,
102 PRC_DESC(
"If this is true, Panda will overrule ffmpeg's best judgment on " 103 "which decoder to use for decoding VP8 and VP9 files, and try to " 104 "choose libvpx. This is useful when you want to play WebM videos " 105 "with an alpha channel, which aren't supported by ffmpeg's own " 106 "VP8/VP9 decoders."));
116 static bool initialized =
false;
124 FfmpegVideo::init_type();
125 FfmpegVideoCursor::init_type();
126 FfmpegAudio::init_type();
127 FfmpegAudioCursor::init_type();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libffmpeg()
Initializes the library.
This is a convenience class to specialize ConfigVariable as a boolean type.
This class records the different types of MovieAudio and MovieVideo that are available for loading.
static void register_with_read_factory()
Tells the BamReader how to create objects of type FfmpegVideo.
static void register_protocol()
Should be called at startup to attach the appropriate hooks between Panda and FFMpeg.
static void register_with_read_factory()
Tells the BamReader how to create objects of type FfmpegVideo.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class specializes ConfigVariable as an enumerated type.
static MovieTypeRegistry * get_global_ptr()
Returns a pointer to the global MovieTypeRegistry instance.
This is a convenience class to specialize ConfigVariable as an integer type.
void register_video_type(MakeVideoFunc func, const std::string &extensions)
Registers a MovieVideo type, so that files with any of the given extensions will be loaded as this ty...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_audio_type(MakeAudioFunc func, const std::string &extensions)
Registers a MovieAudio type, so that files with any of the given extensions will be loaded as this ty...