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 22:16:04 +0100
commitb703142e8750c509174b4d964009aecf93f3d834 (patch)
tree22936a3161af7df64acb42f95d0b08d32e9593dd /src/lib/ffmpeg.h
parent5cb5c48441b20c478eb29001cebe3b08c0422341 (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;
};