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
388 { AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },388 { AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
389 { AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },389 { AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
390 { AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },390 { AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
391 { AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
392};391};
393 392
394static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)393static 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
895 format == AV_PIX_FMT_BGR32 ||894 format == AV_PIX_FMT_BGR32 ||
896 format == AV_PIX_FMT_BGR32_1)895 format == AV_PIX_FMT_BGR32_1)
897 *sdl_blendmode = SDL_BLENDMODE_BLEND;896 *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++) {
899 if (format == sdl_texture_format_map[i].format) {898 if (format == sdl_texture_format_map[i].format) {
900 *sdl_pix_fmt = sdl_texture_format_map[i].texture_fmt;899 *sdl_pix_fmt = sdl_texture_format_map[i].texture_fmt;
901 return;900 return;
@@ -941,7 +940,6 @@ static enum AVColorSpace sdl_supported_color_spaces[] = { · 39 unmodified lines
941 AVCOL_SPC_BT709,940 AVCOL_SPC_BT709,
942 AVCOL_SPC_BT470BG,941 AVCOL_SPC_BT470BG,
943 AVCOL_SPC_SMPTE170M,942 AVCOL_SPC_SMPTE170M,
944 AVCOL_SPC_UNSPECIFIED,
945};943};
946 944
947static void set_sdl_yuv_conversion_mode(AVFrame *frame)945static 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
1874 return AVERROR(ENOMEM);1872 return AVERROR(ENOMEM);
1875 1873
1876 for (i = 0; i < renderer_info.num_texture_formats; i++) {1874 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++) {
1878 if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) {1876 if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) {
1879 pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format;1877 pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format;
1880 break;1878 break;
1881 }1879 }
1882 }1880 }
1883 }1881 }
1884 pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
1885 1882
1886 while ((e = av_dict_iterate(sws_dict, e))) {1883 while ((e = av_dict_iterate(sws_dict, e))) {
1887 if (!strcmp(e->key, "sws_flags")) {1884 if (!strcmp(e->key, "sws_flags")) {
@@ -1926,10 +1923,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c · 38 unmodified lines
1926 goto fail;1923 goto fail;
1927 }1924 }
1928 1925
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)
1930 goto fail;1928 goto fail;
1931 if (!vk_renderer &&1929 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)
1933 goto fail;1933 goto fail;
1934 1934
1935 ret = avfilter_init_dict(filt_out, NULL);1935 ret = avfilter_init_dict(filt_out, NULL);
@@ -2003,8 +2003,6 @@ fail: · 67 unmodified lines
2003 2003
2004static int configure_audio_filters(VideoState *is, const char *afilters, int force_output_format)2004static int configure_audio_filters(VideoState *is, const char *afilters, int force_output_format)
2005{2005{
2006 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
2007 int sample_rates[2] = { 0, -1 };
2008 AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;2006 AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
2009 char aresample_swr_opts[512] = "";2007 char aresample_swr_opts[512] = "";
2010 const AVDictionaryEntry *e = NULL;2008 const AVDictionaryEntry *e = NULL;
@@ -2045,20 +2043,15 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for · 34 unmodified lines
2045 goto end;2043 goto end;
2046 }2044 }
2047 2045
2048 if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)2046 if ((ret = av_opt_set(filt_asink, "sample_formats", "s16", 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)
2051 goto end;2047 goto end;
2052 2048
2053 if (force_output_format) {2049 if (force_output_format) {
2054 av_bprint_clear(&bp);2050 if ((ret = av_opt_set_array(filt_asink, "channel_layouts", AV_OPT_SEARCH_CHILDREN,
2055 av_channel_layout_describe_bprint(&is->audio_tgt.ch_layout, &bp);2051 0, 1, AV_OPT_TYPE_CHLAYOUT, &is->audio_tgt.ch_layout)) < 0)
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)
2060 goto end;2052 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)
2062 goto end;2055 goto end;
2063 }2056 }
2064 2057

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