decoder/ffmpeg: pass InputStream by pointer

Prepare for an implementation without InputStream.
This commit is contained in:
Max Kellermann 2020-09-21 14:04:35 +02:00
parent 85849c9396
commit a22d1c88d7
1 changed files with 11 additions and 7 deletions

View File

@ -207,7 +207,7 @@ PtsToPcmFrame(uint64_t pts, const AVStream &stream,
* #AVFrame. * #AVFrame.
*/ */
static DecoderCommand static DecoderCommand
FfmpegSendFrame(DecoderClient &client, InputStream &is, FfmpegSendFrame(DecoderClient &client, InputStream *is,
AVCodecContext &codec_context, AVCodecContext &codec_context,
const AVFrame &frame, const AVFrame &frame,
size_t &skip_bytes, size_t &skip_bytes,
@ -234,7 +234,7 @@ FfmpegSendFrame(DecoderClient &client, InputStream &is,
} }
static DecoderCommand static DecoderCommand
FfmpegReceiveFrames(DecoderClient &client, InputStream &is, FfmpegReceiveFrames(DecoderClient &client, InputStream *is,
AVCodecContext &codec_context, AVCodecContext &codec_context,
AVFrame &frame, AVFrame &frame,
size_t &skip_bytes, size_t &skip_bytes,
@ -286,7 +286,7 @@ FfmpegReceiveFrames(DecoderClient &client, InputStream &is,
* desired time stamp has been reached * desired time stamp has been reached
*/ */
static DecoderCommand static DecoderCommand
ffmpeg_send_packet(DecoderClient &client, InputStream &is, ffmpeg_send_packet(DecoderClient &client, InputStream *is,
const AVPacket &packet, const AVPacket &packet,
AVCodecContext &codec_context, AVCodecContext &codec_context,
const AVStream &stream, const AVStream &stream,
@ -444,7 +444,7 @@ FfmpegScanTag(const AVFormatContext &format_context, int audio_stream,
* DecoderClient::SubmitTag(). * DecoderClient::SubmitTag().
*/ */
static void static void
FfmpegCheckTag(DecoderClient &client, InputStream &is, FfmpegCheckTag(DecoderClient &client, InputStream *is,
AVFormatContext &format_context, int audio_stream) AVFormatContext &format_context, int audio_stream)
{ {
AVStream &stream = *format_context.streams[audio_stream]; AVStream &stream = *format_context.streams[audio_stream];
@ -462,7 +462,7 @@ FfmpegCheckTag(DecoderClient &client, InputStream &is,
} }
static void static void
FfmpegDecode(DecoderClient &client, InputStream &input, FfmpegDecode(DecoderClient &client, InputStream *input,
AVFormatContext &format_context) AVFormatContext &format_context)
{ {
const int find_result = const int find_result =
@ -515,7 +515,11 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
? FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base) ? FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base)
: FromFfmpegTimeChecked(format_context.duration, AV_TIME_BASE_Q); : FromFfmpegTimeChecked(format_context.duration, AV_TIME_BASE_Q);
client.Ready(audio_format, input.IsSeekable(), total_time); client.Ready(audio_format,
input
? input->IsSeekable()
: (format_context.ctx_flags & AVFMTCTX_UNSEEKABLE) != 0,
total_time);
FfmpegParseMetaData(client, format_context, audio_stream); FfmpegParseMetaData(client, format_context, audio_stream);
@ -587,7 +591,7 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
FormatDebug(ffmpeg_domain, "detected input format '%s' (%s)", FormatDebug(ffmpeg_domain, "detected input format '%s' (%s)",
input_format->name, input_format->long_name); input_format->name, input_format->long_name);
FfmpegDecode(client, input, *format_context); FfmpegDecode(client, &input, *format_context);
} }
static bool static bool