diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-03-28 00:23:16 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-03-28 00:23:16 +0200 |
| commit | 6a77d4a19541446008ab4c457d0fbeb256712d39 (patch) | |
| tree | e2be0151b93da06157046f6a92d28ff471320628 /src/lib/ffmpeg.cc | |
| parent | 72b0ae6df82b5e54e3f135f0c341f564a8bd7bc2 (diff) | |
WIP: hacks to allow joining of files which don't all have subtitle streams.2187-examine-vobs
Diffstat (limited to 'src/lib/ffmpeg.cc')
| -rw-r--r-- | src/lib/ffmpeg.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 0f63ea172..15a4f130d 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -204,6 +204,7 @@ FFmpeg::setup_decoders () { boost::mutex::scoped_lock lm (_mutex); + std::cout << this << " has " << _format_context->nb_streams << "\n"; _codec_context.resize (_format_context->nb_streams); for (uint32_t i = 0; i < _format_context->nb_streams; ++i) { auto codec = avcodec_find_decoder (_format_context->streams[i]->codecpar->codec_id); @@ -213,6 +214,7 @@ FFmpeg::setup_decoders () throw std::bad_alloc (); } _codec_context[i] = context; + std::cout << this << " context " << i << " = " << context << "\n"; int r = avcodec_parameters_to_context (context, _format_context->streams[i]->codecpar); if (r < 0) { @@ -260,12 +262,21 @@ FFmpeg::video_codec_context () const AVCodecContext * FFmpeg::subtitle_codec_context () const { + std::cout << "get subtitle_codec_context\n"; auto str = _ffmpeg_content->subtitle_stream(); if (!str) { - return nullptr; + std::cout << "no stream.\n"; + return {}; + } + + auto index = str->index(_format_context); + if (index == -1) { + std::cout << "stream not in fc.\n"; + return {}; } - return _codec_context[str->index(_format_context)]; + std::cout << this << " using cc " << index << "\n"; + return _codec_context[index]; } |
