Commit 9818bbde authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e0c53c34'

* commit 'e0c53c34':
  nut: use meaningful error values
  FATE: use a less ambiguous end time for filter-trim-time test

Conflicts:
	libavformat/nutdec.c
	tests/fate/filter-video.mak
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1aed0513 e0c53c34
...@@ -196,7 +196,7 @@ static int nut_probe(AVProbeData *p) ...@@ -196,7 +196,7 @@ static int nut_probe(AVProbeData *p)
tmp = ffio_read_varlen(bc); \ tmp = ffio_read_varlen(bc); \
if (!(check)) { \ if (!(check)) { \
av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp); \ av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp); \
return -1; \ return AVERROR_INVALIDDATA; \
} \ } \
dst = tmp; \ dst = tmp; \
} while (0) } while (0)
...@@ -206,7 +206,7 @@ static int skip_reserved(AVIOContext *bc, int64_t pos) ...@@ -206,7 +206,7 @@ static int skip_reserved(AVIOContext *bc, int64_t pos)
pos -= avio_tell(bc); pos -= avio_tell(bc);
if (pos < 0) { if (pos < 0) {
avio_seek(bc, pos, SEEK_CUR); avio_seek(bc, pos, SEEK_CUR);
return -1; return AVERROR_INVALIDDATA;
} else { } else {
while (pos--) while (pos--)
avio_r8(bc); avio_r8(bc);
...@@ -226,7 +226,13 @@ static int decode_main_header(NUTContext *nut) ...@@ -226,7 +226,13 @@ static int decode_main_header(NUTContext *nut)
end = get_packetheader(nut, bc, 1, MAIN_STARTCODE); end = get_packetheader(nut, bc, 1, MAIN_STARTCODE);
end += avio_tell(bc); end += avio_tell(bc);
GET_V(tmp, tmp >= 2 && tmp <= NUT_VERSION); tmp = ffio_read_varlen(bc);
if (tmp < 2 && tmp > NUT_VERSION) {
av_log(s, AV_LOG_ERROR, "Version %"PRId64" not supported.\n",
tmp);
return AVERROR(ENOSYS);
}
GET_V(stream_count, tmp > 0 && tmp <= NUT_MAX_STREAMS); GET_V(stream_count, tmp > 0 && tmp <= NUT_MAX_STREAMS);
nut->max_distance = ffio_read_varlen(bc); nut->max_distance = ffio_read_varlen(bc);
...@@ -389,7 +395,7 @@ static int decode_stream_header(NUTContext *nut) ...@@ -389,7 +395,7 @@ static int decode_stream_header(NUTContext *nut)
break; break;
default: default:
av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class); av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class);
return -1; return AVERROR(ENOSYS);
} }
if (class < 3 && st->codec->codec_id == AV_CODEC_ID_NONE) if (class < 3 && st->codec->codec_id == AV_CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
...@@ -418,7 +424,7 @@ static int decode_stream_header(NUTContext *nut) ...@@ -418,7 +424,7 @@ static int decode_stream_header(NUTContext *nut)
if ((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)) { if ((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)) {
av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n", av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n",
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
return -1; return AVERROR_INVALIDDATA;
} }
ffio_read_varlen(bc); /* csp type */ ffio_read_varlen(bc); /* csp type */
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
...@@ -429,7 +435,7 @@ static int decode_stream_header(NUTContext *nut) ...@@ -429,7 +435,7 @@ static int decode_stream_header(NUTContext *nut)
if (skip_reserved(bc, end) || ffio_get_checksum(bc)) { if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
"stream header %d checksum mismatch\n", stream_id); "stream header %d checksum mismatch\n", stream_id);
return -1; return AVERROR_INVALIDDATA;
} }
stc->time_base = &nut->time_base[stc->time_base_id]; stc->time_base = &nut->time_base[stc->time_base_id];
avpriv_set_pts_info(s->streams[stream_id], 63, stc->time_base->num, avpriv_set_pts_info(s->streams[stream_id], 63, stc->time_base->num,
...@@ -537,7 +543,7 @@ static int decode_info_header(NUTContext *nut) ...@@ -537,7 +543,7 @@ static int decode_info_header(NUTContext *nut)
if (skip_reserved(bc, end) || ffio_get_checksum(bc)) { if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n"); av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
return -1; return AVERROR_INVALIDDATA;
} }
return 0; return 0;
} }
...@@ -603,7 +609,7 @@ static int find_and_decode_index(NUTContext *nut) ...@@ -603,7 +609,7 @@ static int find_and_decode_index(NUTContext *nut)
int64_t *syncpoints; int64_t *syncpoints;
uint64_t max_pts; uint64_t max_pts;
int8_t *has_keyframe; int8_t *has_keyframe;
int ret = -1; int ret = AVERROR_INVALIDDATA;
if(filesize <= 0) if(filesize <= 0)
return -1; return -1;
...@@ -615,7 +621,7 @@ static int find_and_decode_index(NUTContext *nut) ...@@ -615,7 +621,7 @@ static int find_and_decode_index(NUTContext *nut)
if(s->duration<=0) if(s->duration<=0)
s->duration = find_duration(nut, filesize); s->duration = find_duration(nut, filesize);
return -1; return ret;
} }
end = get_packetheader(nut, bc, 1, INDEX_STARTCODE); end = get_packetheader(nut, bc, 1, INDEX_STARTCODE);
...@@ -897,7 +903,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -897,7 +903,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
} else { } else {
frame_code = avio_r8(bc); frame_code = avio_r8(bc);
if (url_feof(bc)) if (url_feof(bc))
return -1; return AVERROR_EOF;
if (frame_code == 'N') { if (frame_code == 'N') {
tmp = frame_code; tmp = frame_code;
for (i = 1; i < 8; i++) for (i = 1; i < 8; i++)
......
...@@ -83,7 +83,7 @@ FATE_TRIM += fate-filter-trim-mixed ...@@ -83,7 +83,7 @@ FATE_TRIM += fate-filter-trim-mixed
fate-filter-trim-mixed: CMD = framecrc -i $(SRC) -vf trim=start=0.2:end=0.4:start_frame=1:end_frame=3 fate-filter-trim-mixed: CMD = framecrc -i $(SRC) -vf trim=start=0.2:end=0.4:start_frame=1:end_frame=3
FATE_TRIM += fate-filter-trim-time FATE_TRIM += fate-filter-trim-time
fate-filter-trim-time: CMD = framecrc -i $(SRC) -vf trim=0:0.075 fate-filter-trim-time: CMD = framecrc -i $(SRC) -vf trim=0:0.09
FATE_FILTER_VSYNTH-$(CONFIG_TRIM_FILTER) += $(FATE_TRIM) FATE_FILTER_VSYNTH-$(CONFIG_TRIM_FILTER) += $(FATE_TRIM)
......
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