Commit 39f5003a authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '5b977c1d'

* commit '5b977c1d':
  mxf: Return meaningful errors

Conflicts:
	libavformat/mxfdec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 618d2262 5b977c1d
......@@ -2297,16 +2297,16 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
{
KLVPacket klv;
MXFContext *mxf = s->priv_data;
int ret;
while (klv_read_packet(&klv, s->pb) == 0) {
int ret;
while ((ret = klv_read_packet(&klv, s->pb)) == 0) {
PRINT_KEY(s, "read packet", klv.key);
av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset);
if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
ret = mxf_decrypt_triplet(s, pkt, &klv);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "invalid encoded triplet\n");
return AVERROR_INVALIDDATA;
return ret;
}
return 0;
}
......@@ -2345,9 +2345,11 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
/* check for 8 channels AES3 element */
if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
ret = mxf_get_d10_aes3_packet(s->pb, s->streams[index],
pkt, klv.length);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
return AVERROR_INVALIDDATA;
return ret;
}
} else {
ret = av_get_packet(s->pb, pkt, klv.length);
......@@ -2373,7 +2375,7 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
pkt->pts = mxf->current_edit_unit;
}
} else if (codec->codec_type == AVMEDIA_TYPE_AUDIO) {
int ret = mxf_set_audio_pts(mxf, codec, pkt);
ret = mxf_set_audio_pts(mxf, codec, pkt);
if (ret < 0)
return ret;
}
......@@ -2386,7 +2388,7 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
skip:
avio_skip(s->pb, klv.length);
}
return url_feof(s->pb) ? AVERROR_EOF : -1;
return url_feof(s->pb) ? AVERROR_EOF : ret;
}
static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
......
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