fftools/ffmpeg_dec: move InputStream.pkt to Decoder

It is purely internal to decoding.
This commit is contained in:
Anton Khirnov 2023-05-18 05:41:53 +02:00
parent dadeb28e25
commit 5b05e9e32a
3 changed files with 7 additions and 7 deletions

View File

@ -349,7 +349,6 @@ typedef struct InputStream {
AVCodecContext *dec_ctx;
const AVCodec *dec;
const AVCodecDescriptor *codec_desc;
AVPacket *pkt;
AVRational framerate_guessed;

View File

@ -33,6 +33,7 @@
struct Decoder {
AVFrame *frame;
AVPacket *pkt;
};
void dec_free(Decoder **pdec)
@ -43,6 +44,7 @@ void dec_free(Decoder **pdec)
return;
av_frame_free(&dec->frame);
av_packet_free(&dec->pkt);
av_freep(pdec);
}
@ -61,6 +63,10 @@ static int dec_alloc(Decoder **pdec)
if (!dec->frame)
goto fail;
dec->pkt = av_packet_alloc();
if (!dec->pkt)
goto fail;
*pdec = dec;
@ -418,7 +424,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
int ret;
if (dec->codec_type == AVMEDIA_TYPE_SUBTITLE)
return transcode_subtitles(ist, pkt ? pkt : ist->pkt);
return transcode_subtitles(ist, pkt ? pkt : d->pkt);
// With fate-indeo3-2, we're getting 0-sized packets before EOF for some
// reason. This seems like a semi-critical bug. Don't trigger EOF, and

View File

@ -817,7 +817,6 @@ static void ist_free(InputStream **pist)
dec_free(&ist->decoder);
av_packet_free(&ist->pkt);
av_dict_free(&ist->decoder_opts);
avsubtitle_free(&ist->prev_sub.subtitle);
av_frame_free(&ist->sub2video.frame);
@ -1197,10 +1196,6 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
exit_program(1);
}
ist->pkt = av_packet_alloc();
if (!ist->pkt)
report_and_exit(AVERROR(ENOMEM));
if (o->bitexact)
ist->dec_ctx->flags |= AV_CODEC_FLAG_BITEXACT;