mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
add ffmpeg-show-seek-frames
This commit is contained in:
parent
a9fc6e59ae
commit
560221d566
@ -50,6 +50,16 @@ ConfigVariableInt ffmpeg_max_readahead_frames
|
|||||||
"should read in advance of actual playback. Set this to 0 to "
|
"should read in advance of actual playback. Set this to 0 to "
|
||||||
"decode ffmpeg videos in the main thread."));
|
"decode ffmpeg videos in the main thread."));
|
||||||
|
|
||||||
|
ConfigVariableBool ffmpeg_show_seek_frames
|
||||||
|
("ffmpeg-show-seek-frames", true,
|
||||||
|
PRC_DESC("Set this true to allow showing the intermediate results of seeking "
|
||||||
|
"through the ffmpeg stream to a target frame, or false to hold the "
|
||||||
|
"current frame until the target frame is achieved. This has the "
|
||||||
|
"biggest effect on videos that are too expensive to decode in real "
|
||||||
|
"time: when this is true, the video can be seen to animate at least "
|
||||||
|
"a little bit; when it is false, you may get long periods of one "
|
||||||
|
"held frame."));
|
||||||
|
|
||||||
ConfigVariableBool ffmpeg_support_seek
|
ConfigVariableBool ffmpeg_support_seek
|
||||||
("ffmpeg-support-seek", true,
|
("ffmpeg-support-seek", true,
|
||||||
PRC_DESC("True to use the av_seek_frame() function to seek within ffmpeg "
|
PRC_DESC("True to use the av_seek_frame() function to seek within ffmpeg "
|
||||||
|
@ -28,6 +28,7 @@ NotifyCategoryDecl(movies, EXPCL_PANDA_MOVIES, EXPTP_PANDA_MOVIES);
|
|||||||
NotifyCategoryDecl(ffmpeg, EXPCL_PANDA_MOVIES, EXPTP_PANDA_MOVIES);
|
NotifyCategoryDecl(ffmpeg, EXPCL_PANDA_MOVIES, EXPTP_PANDA_MOVIES);
|
||||||
|
|
||||||
extern ConfigVariableInt ffmpeg_max_readahead_frames;
|
extern ConfigVariableInt ffmpeg_max_readahead_frames;
|
||||||
|
extern ConfigVariableBool ffmpeg_show_seek_frames;
|
||||||
extern ConfigVariableBool ffmpeg_support_seek;
|
extern ConfigVariableBool ffmpeg_support_seek;
|
||||||
extern ConfigVariableBool ffmpeg_global_lock;
|
extern ConfigVariableBool ffmpeg_global_lock;
|
||||||
extern ConfigVariableEnum<ThreadPriority> ffmpeg_thread_priority;
|
extern ConfigVariableEnum<ThreadPriority> ffmpeg_thread_priority;
|
||||||
|
@ -434,10 +434,14 @@ fetch_buffer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame != NULL && (frame->_end_frame < _current_frame || frame->_begin_frame > _current_frame)) {
|
if (frame != NULL) {
|
||||||
// The frame is too old or too new. Just recycle it.
|
bool too_old = (frame->_end_frame < _current_frame && !ffmpeg_show_seek_frames);
|
||||||
do_recycle_frame(frame);
|
bool too_new = frame->_begin_frame > _current_frame;
|
||||||
frame = NULL;
|
if (too_old || too_new) {
|
||||||
|
// The frame is too old or too new. Just recycle it.
|
||||||
|
do_recycle_frame(frame);
|
||||||
|
frame = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame != NULL) {
|
if (frame != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user