diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-12-02 12:27:40 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-12-02 12:27:40 +0000 |
| commit | 2d5b8cdde08044d323aa7193dfac6c9f8bca7131 (patch) | |
| tree | 8922f6718fb1d77627ad0a8cb5bca50927a49670 /src/lib/ffmpeg.cc | |
| parent | 2e42ac51aaea7391e4e7ba88b72930d6106a5df7 (diff) | |
Fix problems with FFmpeg files that have all-zero stream IDs.
Diffstat (limited to 'src/lib/ffmpeg.cc')
| -rw-r--r-- | src/lib/ffmpeg.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index e85a2c44e..e5e5f317a 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -118,6 +118,24 @@ FFmpeg::setup_general () throw DecodeError (N_("could not find video stream")); } + /* Hack: if the AVStreams have zero IDs, put some in. We + use the IDs so that we can cope with VOBs, in which streams + move about in index but remain with the same ID in different + VOBs. However, some files have all-zero IDs, hence this hack. + */ + + uint32_t i = 0; + while (i < _format_context->nb_streams && _format_context->streams[i]->id == 0) { + ++i; + } + + if (i == _format_context->nb_streams) { + /* Put in our own IDs */ + for (uint32_t i = 0; i < _format_context->nb_streams; ++i) { + _format_context->streams[i]->id = i; + } + } + _frame = avcodec_alloc_frame (); if (_frame == 0) { throw DecodeError (N_("could not allocate frame")); |
