Commit 5d8d9e03 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/flacdec: Remove useless packet

flac_read_timestamp() applied av_init_packet() to a packet (which
initializes all fields of the packet except for data and size) and then
went on to use only the data and size fields. In other words: Said
packet can be removed and replaced by an uint8_t * and an int.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 56f25c11
...@@ -259,7 +259,7 @@ static int flac_probe(const AVProbeData *p) ...@@ -259,7 +259,7 @@ static int flac_probe(const AVProbeData *p)
static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *ppos, int64_t pos_limit) int64_t *ppos, int64_t pos_limit)
{ {
AVPacket pkt, out_pkt; AVPacket pkt;
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];
AVCodecParserContext *parser; AVCodecParserContext *parser;
int ret; int ret;
...@@ -276,6 +276,9 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde ...@@ -276,6 +276,9 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde
parser->flags |= PARSER_FLAG_USE_CODEC_TS; parser->flags |= PARSER_FLAG_USE_CODEC_TS;
for (;;){ for (;;){
uint8_t *data;
int size;
ret = ff_raw_read_partial_packet(s, &pkt); ret = ff_raw_read_partial_packet(s, &pkt);
if (ret < 0){ if (ret < 0){
if (ret == AVERROR(EAGAIN)) if (ret == AVERROR(EAGAIN))
...@@ -285,14 +288,12 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde ...@@ -285,14 +288,12 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde
av_assert1(!pkt.size); av_assert1(!pkt.size);
} }
} }
av_init_packet(&out_pkt);
av_parser_parse2(parser, st->internal->avctx, av_parser_parse2(parser, st->internal->avctx,
&out_pkt.data, &out_pkt.size, pkt.data, pkt.size, &data, &size, pkt.data, pkt.size,
pkt.pts, pkt.dts, *ppos); pkt.pts, pkt.dts, *ppos);
av_packet_unref(&pkt); av_packet_unref(&pkt);
if (out_pkt.size){ if (size) {
int size = out_pkt.size;
if (parser->pts != AV_NOPTS_VALUE){ if (parser->pts != AV_NOPTS_VALUE){
// seeking may not have started from beginning of a frame // seeking may not have started from beginning of a frame
// calculate frame start position from next frame backwards // calculate frame start position from next frame backwards
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment