summaryrefslogtreecommitdiff
path: root/libavformat/mpc8.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-31 22:41:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-31 22:41:00 +0200
commitd1dad7c824c14939a0e18fa262f3e51957de6e3e (patch)
tree615f6ba80611f53e520d2ae479d9d4409077a78d /libavformat/mpc8.c
parentd2ca5dd0f33b0fdbb5d2a7429c8f71ff1dffffb7 (diff)
parentf2ed006c90ccb65cd143d8b0fcfc28ffb98c4289 (diff)
downloadffmpeg-d1dad7c824c14939a0e18fa262f3e51957de6e3e.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpc8: return more meaningful error codes. mpc: return more meaningful error codes. wv,mpc8: don't return apetag data in packets. rtmp: do not warn about receiving metadata packets x86: h264dsp: Adjust YASM #ifdefs x86: yadif: Mark mmxext optimizations as such h264: convert loop filter strength dsp function to yasm. Improve descriptiveness of a number of codec and container long names Conflicts: libavcodec/flvdec.c libavcodec/libopenjpegdec.c libavformat/apetag.c libavformat/mp3dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpc8.c')
-rw-r--r--libavformat/mpc8.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 026115481d..2951c27e78 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -52,6 +52,8 @@ typedef struct {
int frame;
int64_t header_pos;
int64_t samples;
+
+ int64_t apetag_start;
} MPCContext;
static inline int64_t bs_get_v(uint8_t **bs)
@@ -200,7 +202,7 @@ static int mpc8_read_header(AVFormatContext *s)
c->header_pos = avio_tell(pb);
if(avio_rl32(pb) != TAG_MPCK){
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
while(!url_feof(pb)){
@@ -212,14 +214,14 @@ static int mpc8_read_header(AVFormatContext *s)
}
if(tag != TAG_STREAMHDR){
av_log(s, AV_LOG_ERROR, "Stream header not found\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
pos = avio_tell(pb);
avio_skip(pb, 4); //CRC
c->ver = avio_r8(pb);
if(c->ver != 8){
av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
c->samples = ffio_read_varlen(pb);
ffio_read_varlen(pb); //silence samples at the beginning
@@ -245,7 +247,7 @@ static int mpc8_read_header(AVFormatContext *s)
if (pb->seekable) {
int64_t pos = avio_tell(s->pb);
- ff_ape_parse_tag(s);
+ c->apetag_start = ff_ape_parse_tag(s);
avio_seek(s->pb, pos, SEEK_SET);
}
@@ -260,6 +262,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
while(!url_feof(s->pb)){
pos = avio_tell(s->pb);
+
+ /* don't return bogus packets with the ape tag data */
+ if (c->apetag_start && pos >= c->apetag_start)
+ return AVERROR_EOF;
+
mpc8_get_chunk_header(s->pb, &tag, &size);
if (size < 0)
return -1;