1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

tests: drop api-codec-param test

It fundamentally depends on deprecated lavf internals.
This commit is contained in:
Anton Khirnov 2020-11-29 17:12:34 +01:00
parent fcf7ef0a81
commit fe7f0d366f
5 changed files with 0 additions and 837 deletions

View File

@ -2,7 +2,6 @@ APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac
APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264 APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264
APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264-slice APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264-slice
APITESTPROGS-yes += api-seek APITESTPROGS-yes += api-seek
APITESTPROGS-yes += api-codec-param
APITESTPROGS-$(call DEMDEC, H263, H263) += api-band APITESTPROGS-$(call DEMDEC, H263, H263) += api-band
APITESTPROGS-$(HAVE_THREADS) += api-threadmessage APITESTPROGS-$(HAVE_THREADS) += api-threadmessage
APITESTPROGS += $(APITESTPROGS-yes) APITESTPROGS += $(APITESTPROGS-yes)

View File

@ -1,256 +0,0 @@
/*
* Copyright (c) 2015 Matthieu Bouron <matthieu.bouron stupeflix.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdio.h>
#include "libavformat/avformat.h"
#include "libavutil/pixdesc.h"
#include "libavcodec/internal.h"
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
static int try_decode_video_frame(AVCodecContext *codec_ctx, AVPacket *pkt, int decode)
{
int ret = 0;
int got_frame = 0;
AVFrame *frame = NULL;
int skip_frame = codec_ctx->skip_frame;
if (!avcodec_is_open(codec_ctx)) {
const AVCodec *codec = avcodec_find_decoder(codec_ctx->codec_id);
ret = avcodec_open2(codec_ctx, codec, NULL);
if (ret < 0) {
av_log(codec_ctx, AV_LOG_ERROR, "Failed to open codec\n");
goto end;
}
}
frame = av_frame_alloc();
if (!frame) {
av_log(NULL, AV_LOG_ERROR, "Failed to allocate frame\n");
goto end;
}
if (!decode && avpriv_codec_get_cap_skip_frame_fill_param(codec_ctx->codec)) {
codec_ctx->skip_frame = AVDISCARD_ALL;
}
do {
ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, pkt);
av_assert0(decode || (!decode && !got_frame));
if (ret < 0)
break;
pkt->data += ret;
pkt->size -= ret;
if (got_frame) {
break;
}
} while (pkt->size > 0);
end:
codec_ctx->skip_frame = skip_frame;
av_frame_free(&frame);
return ret;
}
static int find_video_stream_info(AVFormatContext *fmt_ctx, int decode)
{
int ret = 0;
int i, done = 0;
AVPacket pkt;
av_init_packet(&pkt);
while (!done) {
AVCodecContext *codec_ctx = NULL;
AVStream *st;
if ((ret = av_read_frame(fmt_ctx, &pkt)) < 0) {
av_log(fmt_ctx, AV_LOG_ERROR, "Failed to read frame\n");
goto end;
}
st = fmt_ctx->streams[pkt.stream_index];
codec_ctx = st->codec;
/* Writing to AVStream.codec_info_nb_frames must not be done by
* user applications. It is done here for testing purposing as
* find_video_stream_info tries to mimic avformat_find_stream_info
* which writes to this field.
* */
if (codec_ctx->codec_type != AVMEDIA_TYPE_VIDEO ||
st->codec_info_nb_frames++ > 0) {
av_packet_unref(&pkt);
continue;
}
ret = try_decode_video_frame(codec_ctx, &pkt, decode);
if (ret < 0) {
av_log(fmt_ctx, AV_LOG_ERROR, "Failed to decode video frame\n");
goto end;
}
av_packet_unref(&pkt);
/* check if all video streams have demuxed a packet */
done = 1;
for (i = 0; i < fmt_ctx->nb_streams; i++) {
st = fmt_ctx->streams[i];
codec_ctx = st->codec;
if (codec_ctx->codec_type != AVMEDIA_TYPE_VIDEO)
continue;
done &= st->codec_info_nb_frames > 0;
}
}
end:
av_packet_unref(&pkt);
/* close all codecs opened in try_decode_video_frame */
for (i = 0; i < fmt_ctx->nb_streams; i++) {
AVStream *st = fmt_ctx->streams[i];
avcodec_close(st->codec);
}
return ret < 0;
}
static void dump_video_streams(const AVFormatContext *fmt_ctx, int decode)
{
int i;
for (i = 0; i < fmt_ctx->nb_streams; i++) {
const AVOption *opt = NULL;
const AVStream *st = fmt_ctx->streams[i];
AVCodecContext *codec_ctx = st->codec;
printf("stream=%d, decode=%d\n", i, decode);
while (opt = av_opt_next(codec_ctx, opt)) {
uint8_t *str;
if (opt->type == AV_OPT_TYPE_CONST)
continue;
if (!strcmp(opt->name, "frame_number"))
continue;
if (av_opt_get(codec_ctx, opt->name, 0, &str) >= 0) {
printf(" %s=%s\n", opt->name, str);
av_free(str);
}
}
}
}
static int open_and_probe_video_streams(AVFormatContext **fmt_ctx, const char *filename, int decode)
{
int ret = 0;
ret = avformat_open_input(fmt_ctx, filename, NULL, NULL);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to open input '%s'", filename);
goto end;
}
ret = find_video_stream_info(*fmt_ctx, decode);
if (ret < 0) {
goto end;
}
dump_video_streams(*fmt_ctx, decode);
end:
return ret;
}
static int check_video_streams(const AVFormatContext *fmt_ctx1, const AVFormatContext *fmt_ctx2)
{
int i;
int ret = 0;
av_assert0(fmt_ctx1->nb_streams == fmt_ctx2->nb_streams);
for (i = 0; i < fmt_ctx1->nb_streams; i++) {
const AVOption *opt = NULL;
const AVStream *st1 = fmt_ctx1->streams[i];
const AVStream *st2 = fmt_ctx2->streams[i];
AVCodecContext *codec_ctx1 = st1->codec;
AVCodecContext *codec_ctx2 = st2->codec;
if (codec_ctx1->codec_type != AVMEDIA_TYPE_VIDEO)
continue;
while (opt = av_opt_next(codec_ctx1, opt)) {
uint8_t *str1 = NULL, *str2 = NULL;
if (opt->type == AV_OPT_TYPE_CONST)
continue;
if (!strcmp(opt->name, "frame_number"))
continue;
av_assert0(av_opt_get(codec_ctx1, opt->name, 0, &str1) >= 0);
av_assert0(av_opt_get(codec_ctx2, opt->name, 0, &str2) >= 0);
if (strcmp(str1, str2)) {
av_log(NULL, AV_LOG_ERROR, "Field %s differs: %s %s", opt->name, str1, str2);
ret = AVERROR(EINVAL);
}
av_free(str1);
av_free(str2);
}
}
return ret;
}
int main(int argc, char* argv[])
{
int ret = 0;
AVFormatContext *fmt_ctx = NULL;
AVFormatContext *fmt_ctx_no_decode = NULL;
if (argc < 2) {
av_log(NULL, AV_LOG_ERROR, "Usage: %s <input>\n", argv[0]);
return -1;
}
if ((ret = open_and_probe_video_streams(&fmt_ctx_no_decode, argv[1], 0)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to probe '%s' without frame decoding\n", argv[1]);
goto end;
}
if ((ret = open_and_probe_video_streams(&fmt_ctx, argv[1], 1)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to probe '%s' with frame decoding\n", argv[1]);
goto end;
}
ret = check_video_streams(fmt_ctx, fmt_ctx_no_decode);
end:
avformat_close_input(&fmt_ctx);
avformat_close_input(&fmt_ctx_no_decode);
return ret;
}

View File

@ -21,14 +21,6 @@ fate-api-seek: $(APITESTSDIR)/api-seek-test$(EXESUF) fate-lavf-flv
fate-api-seek: CMD = run $(APITESTSDIR)/api-seek-test$(EXESUF) $(TARGET_PATH)/tests/data/lavf/lavf.flv 0 720 fate-api-seek: CMD = run $(APITESTSDIR)/api-seek-test$(EXESUF) $(TARGET_PATH)/tests/data/lavf/lavf.flv 0 720
fate-api-seek: CMP = null fate-api-seek: CMP = null
FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, PNG) += fate-api-png-codec-param
fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test$(EXESUF) $(TARGET_SAMPLES)/png1/lena-rgba.png
FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) += fate-api-mjpeg-codec-param
fate-api-mjpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
fate-api-mjpeg-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test$(EXESUF) $(TARGET_SAMPLES)/exif/image_small.jpg
FATE_API-$(HAVE_THREADS) += fate-api-threadmessage FATE_API-$(HAVE_THREADS) += fate-api-threadmessage
fate-api-threadmessage: $(APITESTSDIR)/api-threadmessage-test$(EXESUF) fate-api-threadmessage: $(APITESTSDIR)/api-threadmessage-test$(EXESUF)
fate-api-threadmessage: CMD = run $(APITESTSDIR)/api-threadmessage-test$(EXESUF) 3 10 30 50 2 20 40 fate-api-threadmessage: CMD = run $(APITESTSDIR)/api-threadmessage-test$(EXESUF) 3 10 30 50 2 20 40

View File

@ -1,286 +0,0 @@
stream=0, decode=0
b=0
ab=0
bt=4000000
flags=0x00000000
flags2=0x00000000
export_side_data=0x00000000
time_base=0/1
g=12
ar=0
ac=0
cutoff=0
frame_size=0
delay=0
qcomp=0.500000
qblur=0.500000
qmin=2
qmax=31
qdiff=3
bf=0
b_qfactor=1.250000
b_strategy=0
ps=0
mv_bits=0
header_bits=0
i_tex_bits=0
p_tex_bits=0
i_count=0
p_count=0
skip_count=0
misc_bits=0
frame_bits=0
codec_tag=0
bug=0x00000001
strict=0
b_qoffset=1.250000
err_detect=0x00000000
has_b_frames=0
block_align=0
mpeg_quant=0
rc_override_count=0
maxrate=0
minrate=0
bufsize=0
i_qfactor=-0.800000
i_qoffset=0.000000
dct=0
lumi_mask=0.000000
tcplx_mask=0.000000
scplx_mask=0.000000
p_mask=0.000000
dark_mask=0.000000
idct=0
slice_count=0
ec=0x00000003
bits_per_coded_sample=0
pred=0
aspect=180/180
sar=180/180
debug=0x00000000
dia_size=0
last_pred=0
preme=0
pre_dia_size=0
subq=8
me_range=0
global_quality=0
coder=0
context=0
slice_flags=0
mbd=0
sc_threshold=0
nr=0
rc_init_occupancy=0
threads=1
dc=0
nssew=8
skip_top=0
skip_bottom=0
profile=192
level=-99
lowres=0
skip_threshold=0
skip_factor=0
skip_exp=0
skipcmp=13
cmp=0
subcmp=0
mbcmp=0
ildctcmp=8
precmp=0
mblmin=236
mblmax=3658
mepc=256
skip_loop_filter=0
skip_idct=0
skip_frame=0
bidir_refine=1
brd_scale=0
keyint_min=25
refs=1
chromaoffset=0
trellis=0
mv0_threshold=256
b_sensitivity=40
compression_level=-1
min_prediction_order=-1
max_prediction_order=-1
timecode_frame_start=-1
bits_per_raw_sample=8
channel_layout=0
request_channel_layout=0
rc_max_vbv_use=0.000000
rc_min_vbv_use=3.000000
ticks_per_frame=1
color_primaries=2
color_trc=2
colorspace=5
color_range=2
chroma_sample_location=2
log_level_offset=0
slices=0
thread_type=0x00000003
audio_service_type=0
request_sample_fmt=none
pkt_timebase=1/25
sub_charenc=
sub_charenc_mode=0x00000000
sub_text_format=1
refcounted_frames=false
side_data_only_packets=true
apply_cropping=true
skip_alpha=false
field_order=0
dump_separator=
codec_whitelist=
pixel_format=yuvj422p
video_size=400x225
max_pixels=2147483647
max_samples=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
discard_damaged_percentage=95
stream=0, decode=1
b=0
ab=0
bt=4000000
flags=0x00000000
flags2=0x00000000
export_side_data=0x00000000
time_base=0/1
g=12
ar=0
ac=0
cutoff=0
frame_size=0
delay=0
qcomp=0.500000
qblur=0.500000
qmin=2
qmax=31
qdiff=3
bf=0
b_qfactor=1.250000
b_strategy=0
ps=0
mv_bits=0
header_bits=0
i_tex_bits=0
p_tex_bits=0
i_count=0
p_count=0
skip_count=0
misc_bits=0
frame_bits=0
codec_tag=0
bug=0x00000001
strict=0
b_qoffset=1.250000
err_detect=0x00000000
has_b_frames=0
block_align=0
mpeg_quant=0
rc_override_count=0
maxrate=0
minrate=0
bufsize=0
i_qfactor=-0.800000
i_qoffset=0.000000
dct=0
lumi_mask=0.000000
tcplx_mask=0.000000
scplx_mask=0.000000
p_mask=0.000000
dark_mask=0.000000
idct=0
slice_count=0
ec=0x00000003
bits_per_coded_sample=0
pred=0
aspect=180/180
sar=180/180
debug=0x00000000
dia_size=0
last_pred=0
preme=0
pre_dia_size=0
subq=8
me_range=0
global_quality=0
coder=0
context=0
slice_flags=0
mbd=0
sc_threshold=0
nr=0
rc_init_occupancy=0
threads=1
dc=0
nssew=8
skip_top=0
skip_bottom=0
profile=192
level=-99
lowres=0
skip_threshold=0
skip_factor=0
skip_exp=0
skipcmp=13
cmp=0
subcmp=0
mbcmp=0
ildctcmp=8
precmp=0
mblmin=236
mblmax=3658
mepc=256
skip_loop_filter=0
skip_idct=0
skip_frame=0
bidir_refine=1
brd_scale=0
keyint_min=25
refs=1
chromaoffset=0
trellis=0
mv0_threshold=256
b_sensitivity=40
compression_level=-1
min_prediction_order=-1
max_prediction_order=-1
timecode_frame_start=-1
bits_per_raw_sample=8
channel_layout=0
request_channel_layout=0
rc_max_vbv_use=0.000000
rc_min_vbv_use=3.000000
ticks_per_frame=1
color_primaries=2
color_trc=2
colorspace=5
color_range=2
chroma_sample_location=2
log_level_offset=0
slices=0
thread_type=0x00000003
audio_service_type=0
request_sample_fmt=none
pkt_timebase=1/25
sub_charenc=
sub_charenc_mode=0x00000000
sub_text_format=1
refcounted_frames=false
side_data_only_packets=true
apply_cropping=true
skip_alpha=false
field_order=0
dump_separator=
codec_whitelist=
pixel_format=yuvj422p
video_size=400x225
max_pixels=2147483647
max_samples=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
discard_damaged_percentage=95

View File

@ -1,286 +0,0 @@
stream=0, decode=0
b=0
ab=0
bt=4000000
flags=0x00000000
flags2=0x00000000
export_side_data=0x00000000
time_base=0/1
g=12
ar=0
ac=0
cutoff=0
frame_size=0
delay=0
qcomp=0.500000
qblur=0.500000
qmin=2
qmax=31
qdiff=3
bf=0
b_qfactor=1.250000
b_strategy=0
ps=0
mv_bits=0
header_bits=0
i_tex_bits=0
p_tex_bits=0
i_count=0
p_count=0
skip_count=0
misc_bits=0
frame_bits=0
codec_tag=0
bug=0x00000001
strict=0
b_qoffset=1.250000
err_detect=0x00000000
has_b_frames=0
block_align=0
mpeg_quant=0
rc_override_count=0
maxrate=0
minrate=0
bufsize=0
i_qfactor=-0.800000
i_qoffset=0.000000
dct=0
lumi_mask=0.000000
tcplx_mask=0.000000
scplx_mask=0.000000
p_mask=0.000000
dark_mask=0.000000
idct=0
slice_count=0
ec=0x00000003
bits_per_coded_sample=0
pred=0
aspect=2835/2835
sar=2835/2835
debug=0x00000000
dia_size=0
last_pred=0
preme=0
pre_dia_size=0
subq=8
me_range=0
global_quality=0
coder=0
context=0
slice_flags=0
mbd=0
sc_threshold=0
nr=0
rc_init_occupancy=0
threads=1
dc=0
nssew=8
skip_top=0
skip_bottom=0
profile=-99
level=-99
lowres=0
skip_threshold=0
skip_factor=0
skip_exp=0
skipcmp=13
cmp=0
subcmp=0
mbcmp=0
ildctcmp=8
precmp=0
mblmin=236
mblmax=3658
mepc=256
skip_loop_filter=0
skip_idct=0
skip_frame=0
bidir_refine=1
brd_scale=0
keyint_min=25
refs=1
chromaoffset=0
trellis=0
mv0_threshold=256
b_sensitivity=40
compression_level=-1
min_prediction_order=-1
max_prediction_order=-1
timecode_frame_start=-1
bits_per_raw_sample=0
channel_layout=0
request_channel_layout=0
rc_max_vbv_use=0.000000
rc_min_vbv_use=3.000000
ticks_per_frame=1
color_primaries=2
color_trc=2
colorspace=2
color_range=2
chroma_sample_location=0
log_level_offset=0
slices=0
thread_type=0x00000003
audio_service_type=0
request_sample_fmt=none
pkt_timebase=1/25
sub_charenc=
sub_charenc_mode=0x00000000
sub_text_format=1
refcounted_frames=false
side_data_only_packets=true
apply_cropping=true
skip_alpha=false
field_order=0
dump_separator=
codec_whitelist=
pixel_format=rgba
video_size=128x128
max_pixels=2147483647
max_samples=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
discard_damaged_percentage=95
stream=0, decode=1
b=0
ab=0
bt=4000000
flags=0x00000000
flags2=0x00000000
export_side_data=0x00000000
time_base=0/1
g=12
ar=0
ac=0
cutoff=0
frame_size=0
delay=0
qcomp=0.500000
qblur=0.500000
qmin=2
qmax=31
qdiff=3
bf=0
b_qfactor=1.250000
b_strategy=0
ps=0
mv_bits=0
header_bits=0
i_tex_bits=0
p_tex_bits=0
i_count=0
p_count=0
skip_count=0
misc_bits=0
frame_bits=0
codec_tag=0
bug=0x00000001
strict=0
b_qoffset=1.250000
err_detect=0x00000000
has_b_frames=0
block_align=0
mpeg_quant=0
rc_override_count=0
maxrate=0
minrate=0
bufsize=0
i_qfactor=-0.800000
i_qoffset=0.000000
dct=0
lumi_mask=0.000000
tcplx_mask=0.000000
scplx_mask=0.000000
p_mask=0.000000
dark_mask=0.000000
idct=0
slice_count=0
ec=0x00000003
bits_per_coded_sample=0
pred=0
aspect=2835/2835
sar=2835/2835
debug=0x00000000
dia_size=0
last_pred=0
preme=0
pre_dia_size=0
subq=8
me_range=0
global_quality=0
coder=0
context=0
slice_flags=0
mbd=0
sc_threshold=0
nr=0
rc_init_occupancy=0
threads=1
dc=0
nssew=8
skip_top=0
skip_bottom=0
profile=-99
level=-99
lowres=0
skip_threshold=0
skip_factor=0
skip_exp=0
skipcmp=13
cmp=0
subcmp=0
mbcmp=0
ildctcmp=8
precmp=0
mblmin=236
mblmax=3658
mepc=256
skip_loop_filter=0
skip_idct=0
skip_frame=0
bidir_refine=1
brd_scale=0
keyint_min=25
refs=1
chromaoffset=0
trellis=0
mv0_threshold=256
b_sensitivity=40
compression_level=-1
min_prediction_order=-1
max_prediction_order=-1
timecode_frame_start=-1
bits_per_raw_sample=0
channel_layout=0
request_channel_layout=0
rc_max_vbv_use=0.000000
rc_min_vbv_use=3.000000
ticks_per_frame=1
color_primaries=2
color_trc=2
colorspace=2
color_range=2
chroma_sample_location=0
log_level_offset=0
slices=0
thread_type=0x00000003
audio_service_type=0
request_sample_fmt=none
pkt_timebase=1/25
sub_charenc=
sub_charenc_mode=0x00000000
sub_text_format=1
refcounted_frames=false
side_data_only_packets=true
apply_cropping=true
skip_alpha=false
field_order=0
dump_separator=
codec_whitelist=
pixel_format=rgba
video_size=128x128
max_pixels=2147483647
max_samples=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
discard_damaged_percentage=95