mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
fftools/ffplay: switch to new buffersink options
This commit is contained in:
parent
b150fdd500
commit
b97ccc537d
@ -388,7 +388,6 @@ static const struct TextureFormatEntry {
|
||||
{ AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
|
||||
{ AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
|
||||
{ AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
|
||||
{ AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
|
||||
};
|
||||
|
||||
static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
|
||||
@ -895,7 +894,7 @@ static void get_sdl_pix_fmt_and_blendmode(int format, Uint32 *sdl_pix_fmt, SDL_B
|
||||
format == AV_PIX_FMT_BGR32 ||
|
||||
format == AV_PIX_FMT_BGR32_1)
|
||||
*sdl_blendmode = SDL_BLENDMODE_BLEND;
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; i++) {
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(sdl_texture_format_map); i++) {
|
||||
if (format == sdl_texture_format_map[i].format) {
|
||||
*sdl_pix_fmt = sdl_texture_format_map[i].texture_fmt;
|
||||
return;
|
||||
@ -941,7 +940,6 @@ static enum AVColorSpace sdl_supported_color_spaces[] = {
|
||||
AVCOL_SPC_BT709,
|
||||
AVCOL_SPC_BT470BG,
|
||||
AVCOL_SPC_SMPTE170M,
|
||||
AVCOL_SPC_UNSPECIFIED,
|
||||
};
|
||||
|
||||
static void set_sdl_yuv_conversion_mode(AVFrame *frame)
|
||||
@ -1874,14 +1872,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (i = 0; i < renderer_info.num_texture_formats; i++) {
|
||||
for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; j++) {
|
||||
for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map); j++) {
|
||||
if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) {
|
||||
pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
|
||||
|
||||
while ((e = av_dict_iterate(sws_dict, e))) {
|
||||
if (!strcmp(e->key, "sws_flags")) {
|
||||
@ -1926,10 +1923,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
if ((ret = av_opt_set_array(filt_out, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
|
||||
0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts)) < 0)
|
||||
goto fail;
|
||||
if (!vk_renderer &&
|
||||
(ret = av_opt_set_int_list(filt_out, "color_spaces", sdl_supported_color_spaces, AVCOL_SPC_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
(ret = av_opt_set_array(filt_out, "colorspaces", AV_OPT_SEARCH_CHILDREN,
|
||||
0, FF_ARRAY_ELEMS(sdl_supported_color_spaces),
|
||||
AV_OPT_TYPE_INT, sdl_supported_color_spaces)) < 0)
|
||||
goto fail;
|
||||
|
||||
ret = avfilter_init_dict(filt_out, NULL);
|
||||
@ -2003,8 +2003,6 @@ fail:
|
||||
|
||||
static int configure_audio_filters(VideoState *is, const char *afilters, int force_output_format)
|
||||
{
|
||||
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
|
||||
int sample_rates[2] = { 0, -1 };
|
||||
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
|
||||
char aresample_swr_opts[512] = "";
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
@ -2045,20 +2043,15 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
if ((ret = av_opt_set(filt_asink, "sample_formats", "s16", AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
|
||||
if (force_output_format) {
|
||||
av_bprint_clear(&bp);
|
||||
av_channel_layout_describe_bprint(&is->audio_tgt.ch_layout, &bp);
|
||||
sample_rates [0] = is->audio_tgt.freq;
|
||||
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
if ((ret = av_opt_set_array(filt_asink, "channel_layouts", AV_OPT_SEARCH_CHILDREN,
|
||||
0, 1, AV_OPT_TYPE_CHLAYOUT, &is->audio_tgt.ch_layout)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set(filt_asink, "ch_layouts", bp.str, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set_int_list(filt_asink, "sample_rates" , sample_rates , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
if ((ret = av_opt_set_array(filt_asink, "samplerates", AV_OPT_SEARCH_CHILDREN,
|
||||
0, 1, AV_OPT_TYPE_INT, &is->audio_tgt.freq)) < 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user