From 8f63f241d499a01d086874af36801167b72b7036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Tue, 1 May 2012 19:59:29 +0200 Subject: Remove some useless code that duplicates av_get_packet. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Reimar Döffinger --- libavformat/au.c | 4 ---- libavformat/flvdec.c | 3 --- libavformat/gsmdec.c | 1 - libavformat/ingenientdec.c | 13 +++---------- libavformat/mmf.c | 10 +++------- libavformat/rsodec.c | 3 --- libavformat/sol.c | 4 ---- libavformat/soxdec.c | 1 - 8 files changed, 6 insertions(+), 33 deletions(-) (limited to 'libavformat') diff --git a/libavformat/au.c b/libavformat/au.c index 4dd84bfdeb..b78d1ac18e 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -189,10 +189,6 @@ static int au_read_packet(AVFormatContext *s, return ret; pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret; return 0; } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 3d23b67c29..8fce605f6e 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -656,9 +656,6 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { return AVERROR(EIO); } - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret; pkt->dts = dts; pkt->pts = pts == AV_NOPTS_VALUE ? dts : pts; pkt->stream_index = st->index; diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c index 3525a038c7..f3be47f61a 100644 --- a/libavformat/gsmdec.c +++ b/libavformat/gsmdec.c @@ -47,7 +47,6 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt) av_free_packet(pkt); return ret < 0 ? ret : AVERROR(EIO); } - pkt->size = ret; pkt->duration = 1; pkt->pts = pkt->pos / GSM_BLOCK_SIZE; diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index f16f4690ae..f595a7e87f 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -44,17 +44,10 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", size, w, h, unk1, unk2); - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - - pkt->pos = avio_tell(s->pb); - pkt->stream_index = 0; - ret = avio_read(s->pb, pkt->data, size); - if (ret < 0) { - av_free_packet(pkt); + ret = av_get_packet(s->pb, pkt, size); + if (ret < 0) return ret; - } - pkt->size = ret; + pkt->stream_index = 0; return ret; } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 6240e49bee..25882ee859 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -275,17 +275,13 @@ static int mmf_read_packet(AVFormatContext *s, if(!size) return AVERROR(EIO); - if (av_new_packet(pkt, size)) - return AVERROR(EIO); - pkt->stream_index = 0; - - ret = avio_read(s->pb, pkt->data, pkt->size); + ret = av_get_packet(s->pb, pkt, size); if (ret < 0) - av_free_packet(pkt); + return ret; + pkt->stream_index = 0; mmf->data_size -= ret; - pkt->size = ret; return ret; } diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index 3933fc08c6..3fa85be163 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -83,9 +83,6 @@ static int rso_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - /* note: we need to modify the packet size here to handle the last packet */ - pkt->size = ret; - return 0; } diff --git a/libavformat/sol.c b/libavformat/sol.c index b2ecd82c46..8650f0b355 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -135,10 +135,6 @@ static int sol_read_packet(AVFormatContext *s, return ret; pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret; return 0; } diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index a0b65d9160..46b07b73c8 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -140,7 +140,6 @@ static int sox_read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - pkt->size = ret; return 0; } -- cgit v1.2.3