History

fftools/ffplay: switch to new buffersink options

Anton Khirnov committed 2 years ago

Commit b97ccc51 parent b150fdd1 file · +12 −19Browse files

Unified · Split

fftools/ffplay.c+12−19
@@ -388,7 +388,6 @@ static const struct TextureFormatEntry { · 387 unmodified lines
388388 { AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
389389 { AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
390390 { AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
391− { AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
392391 };
393392
394393 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 · 500 unmodified lines
895894 format == AV_PIX_FMT_BGR32 ||
896895 format == AV_PIX_FMT_BGR32_1)
897896 *sdl_blendmode = SDL_BLENDMODE_BLEND;
898− for (i = 0; i < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; i++) {
897+ for (i = 0; i < FF_ARRAY_ELEMS(sdl_texture_format_map); i++) {
899898 if (format == sdl_texture_format_map[i].format) {
900899 *sdl_pix_fmt = sdl_texture_format_map[i].texture_fmt;
901900 return;
@@ -941,7 +940,6 @@ static enum AVColorSpace sdl_supported_color_spaces[] = { · 39 unmodified lines
941940 AVCOL_SPC_BT709,
942941 AVCOL_SPC_BT470BG,
943942 AVCOL_SPC_SMPTE170M,
944− AVCOL_SPC_UNSPECIFIED,
945943 };
946944
947945 static void set_sdl_yuv_conversion_mode(AVFrame *frame)
@@ -1874,14 +1872,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c · 926 unmodified lines
18741872 return AVERROR(ENOMEM);
18751873
18761874 for (i = 0; i < renderer_info.num_texture_formats; i++) {
1877− for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; j++) {
1875+ for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map); j++) {
18781876 if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) {
18791877 pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format;
18801878 break;
18811879 }
18821880 }
18831881 }
1884− pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
18851882
18861883 while ((e = av_dict_iterate(sws_dict, e))) {
18871884 if (!strcmp(e->key, "sws_flags")) {
@@ -1926,10 +1923,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c · 38 unmodified lines
19261923 goto fail;
19271924 }
19281925
1929− if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
1926+ if ((ret = av_opt_set_array(filt_out, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
1927+ 0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts)) < 0)
19301928 goto fail;
19311929 if (!vk_renderer &&
1932− (ret = av_opt_set_int_list(filt_out, "color_spaces", sdl_supported_color_spaces, AVCOL_SPC_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
1930+ (ret = av_opt_set_array(filt_out, "colorspaces", AV_OPT_SEARCH_CHILDREN,
1931+ 0, FF_ARRAY_ELEMS(sdl_supported_color_spaces),
1932+ AV_OPT_TYPE_INT, sdl_supported_color_spaces)) < 0)
19331933 goto fail;
19341934
19351935 ret = avfilter_init_dict(filt_out, NULL);
@@ -2003,8 +2003,6 @@ fail: · 67 unmodified lines
20032003
20042004 static int configure_audio_filters(VideoState *is, const char *afilters, int force_output_format)
20052005 {
2006− static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
2007− int sample_rates[2] = { 0, -1 };
20082006 AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
20092007 char aresample_swr_opts[512] = "";
20102008 const AVDictionaryEntry *e = NULL;
@@ -2045,20 +2043,15 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for · 34 unmodified lines
20452043 goto end;
20462044 }
20472045
2048− if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
2049− goto end;
2050− if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
2046+ if ((ret = av_opt_set(filt_asink, "sample_formats", "s16", AV_OPT_SEARCH_CHILDREN)) < 0)
20512047 goto end;
20522048
20532049 if (force_output_format) {
2054− av_bprint_clear(&bp);
2055− av_channel_layout_describe_bprint(&is->audio_tgt.ch_layout, &bp);
2056− sample_rates [0] = is->audio_tgt.freq;
2057− if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
2058− goto end;
2059− if ((ret = av_opt_set(filt_asink, "ch_layouts", bp.str, AV_OPT_SEARCH_CHILDREN)) < 0)
2050+ if ((ret = av_opt_set_array(filt_asink, "channel_layouts", AV_OPT_SEARCH_CHILDREN,
2051+ 0, 1, AV_OPT_TYPE_CHLAYOUT, &is->audio_tgt.ch_layout)) < 0)
20602052 goto end;
2061− if ((ret = av_opt_set_int_list(filt_asink, "sample_rates" , sample_rates , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
2053+ if ((ret = av_opt_set_array(filt_asink, "samplerates", AV_OPT_SEARCH_CHILDREN,
2054+ 0, 1, AV_OPT_TYPE_INT, &is->audio_tgt.freq)) < 0)
20622055 goto end;
20632056 }
20642057

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t