summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-29 01:56:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-29 02:16:26 +0200
commit706bd8ea19a6f723795547885714033ac68a4d74 (patch)
tree39f7933c9432b35801c81903fa7dc352de92fe95 /libavformat
parent0f8f9248471bbee5649c8efdc52d02c1cf93bba1 (diff)
parentc83f44dba11930744e167856b48fbc24a8ff0e63 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (35 commits) h264_idct_10bit: port x86 assembly to cpuflags. x86inc: clip num_args to 7 on x86-32. x86inc: sync to latest version from x264. fft: rename "z" to "zc" to prevent name collision. wv: return meaningful error codes. wv: return AVERROR_EOF on EOF, not EIO. mp3dec: forward errors for av_get_packet(). mp3dec: remove a pointless local variable. mp3dec: remove commented out cruft. lavfi: bump minor to mark stabilizing the ABI. FATE: add tests for yadif. FATE: add a test for delogo video filter. FATE: add a test for amix audio filter. audiogen: allow specifying random seed as a commandline parameter. vc1dec: Override invalid macroblock quantizer vc1: avoid reading beyond the last line in vc1_draw_sprites() vc1dec: check that coded slice positions and interlacing match. vc1dec: Do not ignore ff_vc1_parse_frame_header_adv return value configure: Move parts that should not be user-selectable to CONFIG_EXTRA lavf: remove commented out cruft in avformat_find_stream_info() ... Conflicts: Makefile configure libavcodec/vc1dec.c libavcodec/x86/h264_deblock.asm libavcodec/x86/h264_deblock_10bit.asm libavcodec/x86/h264dsp_mmx.c libavfilter/version.h libavformat/mp3dec.c libavformat/utils.c libavformat/wv.c libavutil/x86/x86inc.asm Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hls.c2
-rw-r--r--libavformat/mp3dec.c7
-rw-r--r--libavformat/rtpdec.c1
-rw-r--r--libavformat/rtsp.c1
-rw-r--r--libavformat/rtspdec.c1
-rw-r--r--libavformat/rtspenc.c1
-rw-r--r--libavformat/sapenc.c1
-rw-r--r--libavformat/tls.c4
-rw-r--r--libavformat/utils.c5
-rw-r--r--libavformat/wv.c47
10 files changed, 36 insertions, 34 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 9d4a2bc39f..11b6ab1273 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -420,8 +420,6 @@ reload:
ret = ffurl_read(v->input, buf, buf_size);
if (ret > 0)
return ret;
- if (ret < 0 && ret != AVERROR_EOF)
- return ret;
ffurl_close(v->input);
v->input = NULL;
v->cur_seq_no++;
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index f6db77a8d2..3d52c3fe86 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -196,7 +196,6 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
MP3Context *mp3 = s->priv_data;
int ret, size;
int64_t pos;
- // AVStream *st = s->streams[0];
size= MP3_PACKET_SIZE;
pos = avio_tell(s->pb);
@@ -204,15 +203,15 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
size= FFMIN(size, mp3->filesize - pos);
ret= av_get_packet(s->pb, pkt, size);
-
- pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
- pkt->stream_index = 0;
if (ret <= 0) {
if(ret<0)
return ret;
return AVERROR_EOF;
}
+ pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+ pkt->stream_index = 0;
+
if (ret >= ID3v1_TAG_SIZE &&
memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0)
ret -= ID3v1_TAG_SIZE;
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3a272e33c7..989695ee78 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -21,6 +21,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/avstring.h"
+#include "libavutil/time.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c00ff99686..cbcda2e71d 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -27,6 +27,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "avio_internal.h"
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index d34da53ded..f642a56644 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -23,6 +23,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index ece879eee1..927dd38d56 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -31,6 +31,7 @@
#include "avio_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
+#include "libavutil/time.h"
#include "url.h"
#define SDP_MAX_SIZE 16384
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index c1923f31c6..c1d8db3761 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -24,6 +24,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/time.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
diff --git a/libavformat/tls.c b/libavformat/tls.c
index 908bd505aa..38dd70c9df 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -266,7 +266,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int size)
if (ret > 0)
return ret;
if (ret == 0)
- return AVERROR(EIO);
+ return AVERROR_EOF;
if ((ret = do_tls_poll(h, ret)) < 0)
return ret;
}
@@ -281,7 +281,7 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
if (ret > 0)
return ret;
if (ret == 0)
- return AVERROR(EIO);
+ return AVERROR_EOF;
if ((ret = do_tls_poll(h, ret)) < 0)
return ret;
}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b753598950..eda5e28721 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -37,6 +37,7 @@
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
+#include "libavutil/time.h"
#include "libavutil/timestamp.h"
#include "riff.h"
#include "audiointerleave.h"
@@ -2765,9 +2766,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num)
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX);
if (st->info->duration_count && !st->r_frame_rate.num
- && tb_unreliable(st->codec) /*&&
- //FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ...
- st->time_base.num*duration_sum[i]/st->info->duration_count*101LL > st->time_base.den*/){
+ && tb_unreliable(st->codec)) {
int num = 0;
double best_error= 0.01;
diff --git a/libavformat/wv.c b/libavformat/wv.c
index 767f4f48ef..a80cad776d 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -90,17 +90,17 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
if(!append){
tag = avio_rl32(pb);
if (tag != MKTAG('w', 'v', 'p', 'k'))
- return -1;
+ return AVERROR_INVALIDDATA;
size = avio_rl32(pb);
if(size < 24 || size > WV_BLOCK_LIMIT){
av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size;
ver = avio_rl16(pb);
if(ver < 0x402 || ver > 0x410){
av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
avio_r8(pb); // track no
avio_r8(pb); // track sub index
@@ -128,7 +128,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
int64_t block_end = avio_tell(pb) + wc->blksize - 24;
if(!pb->seekable){
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
while(avio_tell(pb) < block_end){
int id, size;
@@ -141,7 +141,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
case 0xD:
if(size <= 1){
av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
chan = avio_r8(pb);
switch(size - 2){
@@ -164,7 +164,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
break;
default:
av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
break;
case 0x27:
@@ -178,7 +178,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
}
if(rate == -1){
av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET);
}
@@ -189,15 +189,15 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
if(wc->flags && bpp != wc->bpp){
av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if(wc->flags && !wc->multichannel && chan != wc->chan){
av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if(wc->flags && rate != -1 && rate != wc->rate){
av_log(ctx, AV_LOG_ERROR, "Sampling rate differ, this block: %i, header block: %i\n", rate, wc->rate);
- return -1;
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size - 24;
return 0;
@@ -208,11 +208,12 @@ static int wv_read_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
WVContext *wc = s->priv_data;
AVStream *st;
+ int ret;
wc->block_parsed = 0;
for(;;){
- if(wv_read_block_header(s, pb, 0) < 0)
- return -1;
+ if ((ret = wv_read_block_header(s, pb, 0)) < 0)
+ return ret;
if(!AV_RN32(wc->extra))
avio_skip(pb, wc->blksize - 24);
else
@@ -222,7 +223,7 @@ static int wv_read_header(AVFormatContext *s)
/* now we are ready: build format streams */
st = avformat_new_stream(s, NULL);
if (!st)
- return -1;
+ return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_WAVPACK;
st->codec->channels = wc->chan;
@@ -254,10 +255,10 @@ static int wv_read_packet(AVFormatContext *s,
uint32_t block_samples;
if (url_feof(s->pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
if(wc->block_parsed){
- if(wv_read_block_header(s, s->pb, 0) < 0)
- return -1;
+ if ((ret = wv_read_block_header(s, s->pb, 0)) < 0)
+ return ret;
}
pos = wc->pos;
@@ -275,7 +276,7 @@ static int wv_read_packet(AVFormatContext *s,
while(!(wc->flags & WV_END_BLOCK)){
if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
av_free_packet(pkt);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if((ret = av_append_packet(s->pb, pkt, 4)) < 0){
av_free_packet(pkt);
@@ -285,14 +286,14 @@ static int wv_read_packet(AVFormatContext *s,
if(size < 24 || size > WV_BLOCK_LIMIT){
av_free_packet(pkt);
av_log(s, AV_LOG_ERROR, "Incorrect block size %d\n", size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size;
ver = avio_rl16(s->pb);
if(ver < 0x402 || ver > 0x410){
av_free_packet(pkt);
av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
avio_r8(s->pb); // track no
avio_r8(s->pb); // track sub index
@@ -304,9 +305,9 @@ static int wv_read_packet(AVFormatContext *s,
}
memcpy(wc->extra, pkt->data + pkt->size - WV_EXTRA_SIZE, WV_EXTRA_SIZE);
- if(wv_read_block_header(s, s->pb, 1) < 0){
+ if ((ret = wv_read_block_header(s, s->pb, 1)) < 0){
av_free_packet(pkt);
- return -1;
+ return ret;
}
ret = av_append_packet(s->pb, pkt, wc->blksize);
if(ret < 0){
@@ -345,14 +346,14 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
}
/* if timestamp is out of bounds, return error */
if(timestamp < 0 || timestamp >= s->duration)
- return -1;
+ return AVERROR(EINVAL);
pos = avio_tell(s->pb);
do{
ret = av_read_frame(s, pkt);
if (ret < 0){
avio_seek(s->pb, pos, SEEK_SET);
- return -1;
+ return ret;
}
pts = pkt->pts;
av_free_packet(pkt);