Skip to content

Commit bf510d4

Browse files
committed
fix(ffmpeg_producer): revert seekable changes
1 parent deb7d07 commit bf510d4

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/modules/ffmpeg/producer/av_producer.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ struct AVProducer::Impl
542542
std::string afilter_;
543543
std::string vfilter_;
544544

545-
boost::optional<bool> seekable_;
546-
545+
int seekable_ = 2;
547546
int64_t frame_count_ = 0;
548547
bool frame_flush_ = true;
549548
int64_t frame_time_ = AV_NOPTS_VALUE;
@@ -570,18 +569,19 @@ struct AVProducer::Impl
570569
boost::optional<int64_t> start,
571570
boost::optional<int64_t> duration,
572571
bool loop,
573-
boost::optional<bool> seekable)
572+
int seekable)
574573
: frame_factory_(frame_factory)
575574
, format_desc_(format_desc)
576575
, format_tb_({format_desc.duration, format_desc.time_scale})
577576
, name_(name)
578577
, path_(path)
579-
, input_(path, graph_, seekable)
578+
, input_(path, graph_, seekable >= 0 && seekable < 2 ? boost::optional<bool>(false) : boost::optional<bool>())
580579
, start_(start ? av_rescale_q(*start, format_tb_, TIME_BASE_Q) : AV_NOPTS_VALUE)
581580
, duration_(duration ? av_rescale_q(*duration, format_tb_, TIME_BASE_Q) : AV_NOPTS_VALUE)
582581
, loop_(loop)
583582
, afilter_(afilter)
584583
, vfilter_(vfilter)
584+
, seekable_(seekable)
585585
{
586586
diagnostics::register_graph(graph_);
587587
graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));
@@ -593,6 +593,8 @@ struct AVProducer::Impl
593593
state_["loop"] = loop;
594594
update_state();
595595

596+
CASPAR_LOG(debug) << print() << " seekable: " << seekable_;
597+
596598
thread_ = boost::thread([=] {
597599
try {
598600
run();
@@ -994,10 +996,9 @@ struct AVProducer::Impl
994996
time = time + (input_->start_time != AV_NOPTS_VALUE ? input_->start_time : 0);
995997

996998
// TODO (fix) Dont seek if time is close future.
997-
if (!seekable_ || *seekable_) {
999+
if (seekable_) {
9981000
input_.seek(time);
9991001
}
1000-
10011002
frame_flush_ = true;
10021003
frame_count_ = 0;
10031004
buffer_eof_ = false;
@@ -1053,7 +1054,7 @@ AVProducer::AVProducer(std::shared_ptr<core::frame_factory> frame_factory,
10531054
boost::optional<int64_t> start,
10541055
boost::optional<int64_t> duration,
10551056
boost::optional<bool> loop,
1056-
boost::optional<bool> seekable)
1057+
int seekable)
10571058
: impl_(new Impl(std::move(frame_factory),
10581059
std::move(format_desc),
10591060
std::move(name),

src/modules/ffmpeg/producer/av_producer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AVProducer
2323
boost::optional<int64_t> start,
2424
boost::optional<int64_t> duration,
2525
boost::optional<bool> loop,
26-
boost::optional<bool> seekable);
26+
int seekable);
2727

2828
core::draw_frame prev_frame();
2929
core::draw_frame next_frame();

src/modules/ffmpeg/producer/ffmpeg_producer.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct ffmpeg_producer : public core::frame_producer
7272
boost::optional<int64_t> start,
7373
boost::optional<int64_t> duration,
7474
boost::optional<bool> loop,
75-
boost::optional<bool> seekable)
75+
int seekable)
7676
: filename_(filename)
7777
, frame_factory_(frame_factory)
7878
, format_desc_(format_desc)
@@ -315,7 +315,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const core::frame_producer
315315
return core::frame_producer::empty();
316316
}
317317

318-
auto seekable_opt = get_param(L"SEEKABLE", params, static_cast<int>(-1));
318+
auto seekable = get_param(L"SEEKABLE", params, static_cast<int>(-1));
319319

320320
auto loop = contains_param(L"LOOP", params);
321321

@@ -346,16 +346,14 @@ spl::shared_ptr<core::frame_producer> create_producer(const core::frame_producer
346346
duration = out - in;
347347
}
348348

349-
boost::optional<bool> seekable;
350-
351349
auto ext = boost::to_lower_copy(boost::filesystem::path(path).extension().wstring());
352-
if (seekable_opt == -1) {
350+
if (seekable == -1) {
353351
if ((!start || !*start) && ext == L".mxf") {
354352
// mxf does a lot of unecessary seeking for FooterPartition.
355-
seekable = false;
353+
seekable = 1;
354+
} else {
355+
seekable = 2;
356356
}
357-
} else {
358-
seekable = seekable_opt > 0;
359357
}
360358

361359
// TODO (fix) use raw input?

0 commit comments

Comments
 (0)