History

fftools/ffmpeg: remove options deprecated before 6.0

Anton Khirnov committed 2 years ago

Commit e48055f1 parent f7545e98 files · +3 −345Browse files

Showing the changes to fftools (5 of 8 files). Show all

Unified · Split

5 files
  1. fftools/ffmpeg.h +0 −31
  2. fftools/ffmpeg_filter.c +0 −13
  3. fftools/ffmpeg_mux.c +0 −5
  4. fftools/ffmpeg_mux_init.c +2 −74
  5. fftools/ffmpeg_opt.c +0 −122
fftools/ffmpeg.h+0−31
@@ -51,10 +51,6 @@ · 50 unmodified lines
51#include "libswresample/swresample.h"51#include "libswresample/swresample.h"
52 52
53// deprecated features53// deprecated features
54#define FFMPEG_OPT_PSNR 1
55#define FFMPEG_OPT_MAP_CHANNEL 1
56#define FFMPEG_OPT_MAP_SYNC 1
57#define FFMPEG_ROTATION_METADATA 1
58#define FFMPEG_OPT_QPHIST 154#define FFMPEG_OPT_QPHIST 1
59#define FFMPEG_OPT_ADRIFT_THRESHOLD 155#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
60#define FFMPEG_OPT_ENC_TIME_BASE_NUM 156#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
@@ -124,13 +120,6 @@ typedef struct StreamMap { · 63 unmodified lines
124 char *linklabel; /* name of an output link, for mapping lavfi outputs */120 char *linklabel; /* name of an output link, for mapping lavfi outputs */
125} StreamMap;121} StreamMap;
126 122
127#if FFMPEG_OPT_MAP_CHANNEL
128typedef struct {
129 int file_idx, stream_idx, channel_idx; // input
130 int ofile_idx, ostream_idx; // output
131} AudioChannelMap;
132#endif
133
134typedef struct OptionsContext {123typedef struct OptionsContext {
135 OptionGroup *g;124 OptionGroup *g;
136 125
@@ -170,10 +159,6 @@ typedef struct OptionsContext { · 33 unmodified lines
170 /* output options */159 /* output options */
171 StreamMap *stream_maps;160 StreamMap *stream_maps;
172 int nb_stream_maps;161 int nb_stream_maps;
173#if FFMPEG_OPT_MAP_CHANNEL
174 AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
175 int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
176#endif
177 const char **attachments;162 const char **attachments;
178 int nb_attachments;163 int nb_attachments;
179 164
@@ -539,27 +524,15 @@ typedef struct OutputStream { · 359 unmodified lines
539 int force_fps;524 int force_fps;
540#if FFMPEG_OPT_TOP525#if FFMPEG_OPT_TOP
541 int top_field_first;526 int top_field_first;
542#endif
543#if FFMPEG_ROTATION_METADATA
544 int rotate_overridden;
545#endif527#endif
546 int autoscale;528 int autoscale;
547 int bitexact;529 int bitexact;
548 int bits_per_raw_sample;530 int bits_per_raw_sample;
549#if FFMPEG_ROTATION_METADATA
550 double rotate_override_value;
551#endif
552 531
553 AVRational frame_aspect_ratio;532 AVRational frame_aspect_ratio;
554 533
555 KeyframeForceCtx kf;534 KeyframeForceCtx kf;
556 535
557 /* audio only */
558#if FFMPEG_OPT_MAP_CHANNEL
559 int *audio_channels_map; /* list of the channels id to pick from the source stream */
560 int audio_channels_mapped; /* number of channels in audio_channels_map */
561#endif
562
563 char *logfile_prefix;536 char *logfile_prefix;
564 FILE *logfile;537 FILE *logfile;
565 538
@@ -684,10 +657,6 @@ extern int recast_media; · 118 unmodified lines
684 657
685extern FILE *vstats_file;658extern FILE *vstats_file;
686 659
687#if FFMPEG_OPT_PSNR
688extern int do_psnr;
689#endif
690
691void term_init(void);660void term_init(void);
692void term_exit(void);661void term_exit(void);
693 662
fftools/ffmpeg_filter.c+0−13
@@ -1364,19 +1364,6 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, · 1363 unmodified lines
1364 pad_idx = 0; \1364 pad_idx = 0; \
1365} while (0)1365} while (0)
1366 av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);1366 av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
1367#if FFMPEG_OPT_MAP_CHANNEL
1368 if (ost->audio_channels_mapped) {
1369 AVChannelLayout mapped_layout = { 0 };
1370 av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped);
1371 av_channel_layout_describe_bprint(&mapped_layout, &args);
1372 for (int i = 0; i < ost->audio_channels_mapped; i++)
1373 if (ost->audio_channels_map[i] != -1)
1374 av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]);
1375
1376 AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
1377 av_bprint_clear(&args);
1378 }
1379#endif
1380 1367
1381 choose_sample_fmts(ofp, &args);1368 choose_sample_fmts(ofp, &args);
1382 choose_sample_rates(ofp, &args);1369 choose_sample_rates(ofp, &args);
fftools/ffmpeg_mux.c+0−5
@@ -818,11 +818,6 @@ static void ost_free(OutputStream **post) · 817 unmodified lines
818 818
819 av_freep(&ost->attachment_filename);819 av_freep(&ost->attachment_filename);
820 820
821#if FFMPEG_OPT_MAP_CHANNEL
822 av_freep(&ost->audio_channels_map);
823 ost->audio_channels_mapped = 0;
824#endif
825
826 av_dict_free(&ost->sws_dict);821 av_dict_free(&ost->sws_dict);
827 av_dict_free(&ost->swr_opts);822 av_dict_free(&ost->swr_opts);
828 823
fftools/ffmpeg_mux_init.c+2−74
@@ -706,13 +706,6 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, · 705 unmodified lines
706 }706 }
707 video_enc->rc_override_count = i;707 video_enc->rc_override_count = i;
708 708
709#if FFMPEG_OPT_PSNR
710 if (do_psnr) {
711 av_log(ost, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n");
712 video_enc->flags|= AV_CODEC_FLAG_PSNR;
713 }
714#endif
715
716 /* two pass mode */709 /* two pass mode */
717 MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);710 MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
718 if (do_pass) {711 if (do_pass) {
@@ -832,10 +825,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 113 unmodified lines
832 OutputStream *ost)825 OutputStream *ost)
833{826{
834 AVFormatContext *oc = mux->fc;827 AVFormatContext *oc = mux->fc;
835 AVStream *st;828 AVStream *st = ost->st;
836 int ret = 0;
837
838 st = ost->st;
839 829
840 if (ost->enc_ctx) {830 if (ost->enc_ctx) {
841 AVCodecContext *audio_enc = ost->enc_ctx;831 AVCodecContext *audio_enc = ost->enc_ctx;
@@ -881,37 +871,6 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 39 unmodified lines
881 871
882 MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);872 MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);
883 ost->apad = av_strdup(ost->apad);873 ost->apad = av_strdup(ost->apad);
884
885#if FFMPEG_OPT_MAP_CHANNEL
886 /* check for channel mapping for this audio stream */
887 for (int n = 0; n < o->nb_audio_channel_maps; n++) {
888 AudioChannelMap *map = &o->audio_channel_maps[n];
889 if ((map->ofile_idx == -1 || ost->file->index == map->ofile_idx) &&
890 (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {
891 InputStream *ist;
892
893 if (map->channel_idx == -1) {
894 ist = NULL;
895 } else if (!ost->ist) {
896 av_log(ost, AV_LOG_FATAL, "Cannot determine input stream for channel mapping %d.%d\n",
897 ost->file->index, ost->st->index);
898 continue;
899 } else {
900 ist = ost->ist;
901 }
902
903 if (!ist || (ist->file->index == map->file_idx && ist->index == map->stream_idx)) {
904 ret = av_reallocp_array(&ost->audio_channels_map,
905 ost->audio_channels_mapped + 1,
906 sizeof(*ost->audio_channels_map));
907 if (ret < 0)
908 return ret;
909
910 ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;
911 }
912 }
913 }
914#endif
915 }874 }
916 875
917 return 0;876 return 0;
@@ -1049,17 +1008,6 @@ static int streamcopy_init(const Muxer *mux, OutputStream *ost) · 131 unmodified lines
1049 memcpy(sd_dst->data, sd_src->data, sd_src->size);1008 memcpy(sd_dst->data, sd_src->data, sd_src->size);
1050 }1009 }
1051 1010
1052#if FFMPEG_ROTATION_METADATA
1053 if (ost->rotate_overridden) {
1054 AVPacketSideData *sd = av_packet_side_data_new(&ost->st->codecpar->coded_side_data,
1055 &ost->st->codecpar->nb_coded_side_data,
1056 AV_PKT_DATA_DISPLAYMATRIX,
1057 sizeof(int32_t) * 9, 0);
1058 if (sd)
1059 av_display_rotation_set((int32_t *)sd->data, -ost->rotate_override_value);
1060 }
1061#endif
1062
1063 switch (par->codec_type) {1011 switch (par->codec_type) {
1064 case AVMEDIA_TYPE_AUDIO:1012 case AVMEDIA_TYPE_AUDIO:
1065 if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) &&1013 if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) &&
@@ -2479,28 +2427,8 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc, · 1413 unmodified lines
2479 2427
2480 if (type == 's') {2428 if (type == 's') {
2481 for (int j = 0; j < oc->nb_streams; j++) {2429 for (int j = 0; j < oc->nb_streams; j++) {
2482 OutputStream *ost = of->streams[j];
2483 if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {2430 if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
2484#if FFMPEG_ROTATION_METADATA2431 av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
2485 if (!strcmp(o->metadata.opt[i].u.str, "rotate")) {
2486 char *tail;
2487 double theta = av_strtod(val, &tail);
2488 if (!*tail) {
2489 ost->rotate_overridden = 1;
2490 ost->rotate_override_value = theta;
2491 }
2492
2493 av_log(ost, AV_LOG_WARNING,
2494 "Conversion of a 'rotate' metadata key to a "
2495 "proper display matrix rotation is deprecated. "
2496 "See -display_rotation for setting rotation "
2497 "instead.");
2498 } else {
2499#endif
2500 av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
2501#if FFMPEG_ROTATION_METADATA
2502 }
2503#endif
2504 } else if (ret < 0)2432 } else if (ret < 0)
2505 return ret;2433 return ret;
2506 }2434 }
fftools/ffmpeg_opt.c+0−122
@@ -88,9 +88,6 @@ int64_t stats_period = 500000; · 87 unmodified lines
88 88
89static int file_overwrite = 0;89static int file_overwrite = 0;
90static int no_file_overwrite = 0;90static int no_file_overwrite = 0;
91#if FFMPEG_OPT_PSNR
92int do_psnr = 0;
93#endif
94int ignore_unknown_streams = 0;91int ignore_unknown_streams = 0;
95int copy_unknown_streams = 0;92int copy_unknown_streams = 0;
96int recast_media = 0;93int recast_media = 0;
@@ -121,9 +118,6 @@ static void uninit_options(OptionsContext *o) · 24 unmodified lines
121 for (i = 0; i < o->nb_stream_maps; i++)118 for (i = 0; i < o->nb_stream_maps; i++)
122 av_freep(&o->stream_maps[i].linklabel);119 av_freep(&o->stream_maps[i].linklabel);
123 av_freep(&o->stream_maps);120 av_freep(&o->stream_maps);
124#if FFMPEG_OPT_MAP_CHANNEL
125 av_freep(&o->audio_channel_maps);
126#endif
127 121
128 for (i = 0; i < o->nb_attachments; i++)122 for (i = 0; i < o->nb_attachments; i++)
129 av_freep(&o->attachments[i]);123 av_freep(&o->attachments[i]);
@@ -403,19 +397,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg) · 273 unmodified lines
403 if (!map)397 if (!map)
404 return AVERROR(ENOMEM);398 return AVERROR(ENOMEM);
405 399
406#if FFMPEG_OPT_MAP_SYNC
407 {
408 /* parse sync stream first, just pick first matching stream */
409 char *sync = strchr(map, ',');
410
411 if (sync) {
412 *sync = 0;
413 av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
414 }
415 }
416#endif
417
418
419 if (map[0] == '[') {400 if (map[0] == '[') {
420 /* this mapping refers to lavfi output */401 /* this mapping refers to lavfi output */
421 const char *c = map + 1;402 const char *c = map + 1;
@@ -505,99 +486,6 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) · 83 unmodified lines
505 return 0;486 return 0;
506}487}
507 488
508#if FFMPEG_OPT_MAP_CHANNEL
509static int opt_map_channel(void *optctx, const char *opt, const char *arg)
510{
511 OptionsContext *o = optctx;
512 int n, ret;
513 AVStream *st;
514 AudioChannelMap *m;
515 char *allow_unused;
516 char *mapchan;
517
518 av_log(NULL, AV_LOG_WARNING,
519 "The -%s option is deprecated and will be removed. "
520 "It can be replaced by the 'pan' filter, or in some cases by "
521 "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt);
522
523 mapchan = av_strdup(arg);
524 if (!mapchan)
525 return AVERROR(ENOMEM);
526
527 ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
528 if (ret < 0)
529 goto end;
530
531 m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
532
533 /* muted channel syntax */
534 n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx);
535 if ((n == 1 || n == 3) && m->channel_idx == -1) {
536 m->file_idx = m->stream_idx = -1;
537 if (n == 1)
538 m->ofile_idx = m->ostream_idx = -1;
539 av_free(mapchan);
540 return 0;
541 }
542
543 /* normal syntax */
544 n = sscanf(arg, "%d.%d.%d:%d.%d",
545 &m->file_idx, &m->stream_idx, &m->channel_idx,
546 &m->ofile_idx, &m->ostream_idx);
547
548 if (n != 3 && n != 5) {
549 av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: "
550 "[file.stream.channel|-1][:syncfile:syncstream]\n");
551 goto fail;
552 }
553
554 if (n != 5) // only file.stream.channel specified
555 m->ofile_idx = m->ostream_idx = -1;
556
557 /* check input */
558 if (m->file_idx < 0 || m->file_idx >= nb_input_files) {
559 av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n",
560 m->file_idx);
561 goto fail;
562 }
563 if (m->stream_idx < 0 ||
564 m->stream_idx >= input_files[m->file_idx]->nb_streams) {
565 av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n",
566 m->file_idx, m->stream_idx);
567 goto fail;
568 }
569 st = input_files[m->file_idx]->ctx->streams[m->stream_idx];
570 if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
571 av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n",
572 m->file_idx, m->stream_idx);
573 goto fail;
574 }
575 /* allow trailing ? to map_channel */
576 if (allow_unused = strchr(mapchan, '?'))
577 *allow_unused = 0;
578 if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels ||
579 input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) {
580 if (allow_unused) {
581 av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n",
582 m->file_idx, m->stream_idx, m->channel_idx);
583 } else {
584 av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n"
585 "To ignore this, add a trailing '?' to the map_channel.\n",
586 m->file_idx, m->stream_idx, m->channel_idx);
587 goto fail;
588 }
589
590 }
591 ret = 0;
592end:
593 av_free(mapchan);
594 return ret;
595fail:
596 ret = AVERROR(EINVAL);
597 goto end;
598}
599#endif
600
601static int opt_sdp_file(void *optctx, const char *opt, const char *arg)489static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
602{490{
603 Scheduler *sch = optctx;491 Scheduler *sch = optctx;
@@ -2005,21 +1893,11 @@ const OptionDef options[] = { · 1401 unmodified lines
2005 "set hardware device used when filtering", "device" },1893 "set hardware device used when filtering", "device" },
2006 1894
2007 // deprecated options1895 // deprecated options
2008#if FFMPEG_OPT_MAP_CHANNEL
2009 { "map_channel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
2010 { .func_arg = opt_map_channel },
2011 "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
2012#endif
2013#if FFMPEG_OPT_ADRIFT_THRESHOLD1896#if FFMPEG_OPT_ADRIFT_THRESHOLD
2014 { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,1897 { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
2015 { .func_arg = opt_adrift_threshold },1898 { .func_arg = opt_adrift_threshold },
2016 "deprecated, does nothing", "threshold" },1899 "deprecated, does nothing", "threshold" },
2017#endif1900#endif
2018#if FFMPEG_OPT_PSNR
2019 { "psnr", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT,
2020 { &do_psnr },
2021 "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
2022#endif
2023#if FFMPEG_OPT_TOP1901#if FFMPEG_OPT_TOP
2024 { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,1902 { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
2025 { .off = OFFSET(top_field_first) },1903 { .off = OFFSET(top_field_first) },

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