summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-01-11 16:34:26 +0100
committerCarl Hetherington <cth@carlh.net>2022-01-11 16:34:26 +0100
commit32925ee291446cfba8bbd35828ba1719373edb40 (patch)
tree6e4e823d9ea2a63b829a795e36d8a569cdd51207 /src/lib/ffmpeg.h
parentd5c44276a81e85613702567eee59412a2d99bcdd (diff)
Use a separate AVFrame for each stream when decoding.
This seems to be what ffplay does and it feels like it makes sense as frames may be built from multiple packets AFAICS.
Diffstat (limited to 'src/lib/ffmpeg.h')
-rw-r--r--src/lib/ffmpeg.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/ffmpeg.h b/src/lib/ffmpeg.h
index b0769971e..59b2dedd5 100644
--- a/src/lib/ffmpeg.h
+++ b/src/lib/ffmpeg.h
@@ -75,11 +75,14 @@ protected:
AVFormatContext* _format_context = nullptr;
std::vector<AVCodecContext*> _codec_context;
- AVFrame* _frame = nullptr;
+ /** AVFrame used for decoding video */
+ AVFrame* _video_frame = nullptr;
/** Index of video stream within AVFormatContext */
boost::optional<int> _video_stream;
+ AVFrame* audio_frame (std::shared_ptr<const FFmpegAudioStream> stream);
+
/* It would appear (though not completely verified) that one must have
a mutex around calls to avcodec_open* and avcodec_close... and here
it is.
@@ -92,6 +95,9 @@ private:
static void ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl);
static std::weak_ptr<Log> _ffmpeg_log;
+
+ /** AVFrames used for decoding audio streams; accessed with audio_frame() */
+ std::map<std::shared_ptr<const FFmpegAudioStream>, AVFrame*> _audio_frame;
};