add ffmpeg-show-seek-frames

This commit is contained in:
David Rose 2011-11-22 22:38:01 +00:00
parent a9fc6e59ae
commit 560221d566
3 changed files with 19 additions and 4 deletions

View File

@ -50,6 +50,16 @@ ConfigVariableInt ffmpeg_max_readahead_frames
"should read in advance of actual playback. Set this to 0 to "
"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
("ffmpeg-support-seek", true,
PRC_DESC("True to use the av_seek_frame() function to seek within ffmpeg "

View File

@ -28,6 +28,7 @@ NotifyCategoryDecl(movies, EXPCL_PANDA_MOVIES, EXPTP_PANDA_MOVIES);
NotifyCategoryDecl(ffmpeg, EXPCL_PANDA_MOVIES, EXPTP_PANDA_MOVIES);
extern ConfigVariableInt ffmpeg_max_readahead_frames;
extern ConfigVariableBool ffmpeg_show_seek_frames;
extern ConfigVariableBool ffmpeg_support_seek;
extern ConfigVariableBool ffmpeg_global_lock;
extern ConfigVariableEnum<ThreadPriority> ffmpeg_thread_priority;

View File

@ -434,11 +434,15 @@ fetch_buffer() {
}
}
if (frame != NULL && (frame->_end_frame < _current_frame || frame->_begin_frame > _current_frame)) {
if (frame != NULL) {
bool too_old = (frame->_end_frame < _current_frame && !ffmpeg_show_seek_frames);
bool too_new = frame->_begin_frame > _current_frame;
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 (_current_frame_buffer != NULL) {