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
5151 #include "libswresample/swresample.h"
5252
5353 // 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
5854 #define FFMPEG_OPT_QPHIST 1
5955 #define FFMPEG_OPT_ADRIFT_THRESHOLD 1
6056 #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
@@ -124,13 +120,6 @@ typedef struct StreamMap { · 63 unmodified lines
124120 char *linklabel; /* name of an output link, for mapping lavfi outputs */
125121 } StreamMap;
126122
127−#if FFMPEG_OPT_MAP_CHANNEL
128−typedef struct {
129− int file_idx, stream_idx, channel_idx; // input
130− int ofile_idx, ostream_idx; // output
131−} AudioChannelMap;
132−#endif
133−
134123 typedef struct OptionsContext {
135124 OptionGroup *g;
136125
@@ -170,10 +159,6 @@ typedef struct OptionsContext { · 33 unmodified lines
170159 /* output options */
171160 StreamMap *stream_maps;
172161 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
177162 const char **attachments;
178163 int nb_attachments;
179164
@@ -539,27 +524,15 @@ typedef struct OutputStream { · 359 unmodified lines
539524 int force_fps;
540525 #if FFMPEG_OPT_TOP
541526 int top_field_first;
542−#endif
543−#if FFMPEG_ROTATION_METADATA
544− int rotate_overridden;
545527 #endif
546528 int autoscale;
547529 int bitexact;
548530 int bits_per_raw_sample;
549−#if FFMPEG_ROTATION_METADATA
550− double rotate_override_value;
551−#endif
552531
553532 AVRational frame_aspect_ratio;
554533
555534 KeyframeForceCtx kf;
556535
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−
563536 char *logfile_prefix;
564537 FILE *logfile;
565538
@@ -684,10 +657,6 @@ extern int recast_media; · 118 unmodified lines
684657
685658 extern FILE *vstats_file;
686659
687−#if FFMPEG_OPT_PSNR
688−extern int do_psnr;
689−#endif
690−
691660 void term_init(void);
692661 void term_exit(void);
693662
fftools/ffmpeg_filter.c+0−13
@@ -1364,19 +1364,6 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, · 1363 unmodified lines
13641364 pad_idx = 0; \
13651365 } while (0)
13661366 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
13801367
13811368 choose_sample_fmts(ofp, &args);
13821369 choose_sample_rates(ofp, &args);
fftools/ffmpeg_mux.c+0−5
@@ -818,11 +818,6 @@ static void ost_free(OutputStream **post) · 817 unmodified lines
818818
819819 av_freep(&ost->attachment_filename);
820820
821−#if FFMPEG_OPT_MAP_CHANNEL
822− av_freep(&ost->audio_channels_map);
823− ost->audio_channels_mapped = 0;
824−#endif
825−
826821 av_dict_free(&ost->sws_dict);
827822 av_dict_free(&ost->swr_opts);
828823
fftools/ffmpeg_mux_init.c+2−74
@@ -706,13 +706,6 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, · 705 unmodified lines
706706 }
707707 video_enc->rc_override_count = i;
708708
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−
716709 /* two pass mode */
717710 MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
718711 if (do_pass) {
@@ -832,10 +825,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 113 unmodified lines
832825 OutputStream *ost)
833826 {
834827 AVFormatContext *oc = mux->fc;
835− AVStream *st;
836− int ret = 0;
837−
838− st = ost->st;
828+ AVStream *st = ost->st;
839829
840830 if (ost->enc_ctx) {
841831 AVCodecContext *audio_enc = ost->enc_ctx;
@@ -881,37 +871,6 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 39 unmodified lines
881871
882872 MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);
883873 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
915874 }
916875
917876 return 0;
@@ -1049,17 +1008,6 @@ static int streamcopy_init(const Muxer *mux, OutputStream *ost) · 131 unmodified lines
10491008 memcpy(sd_dst->data, sd_src->data, sd_src->size);
10501009 }
10511010
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−
10631011 switch (par->codec_type) {
10641012 case AVMEDIA_TYPE_AUDIO:
10651013 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
24792427
24802428 if (type == 's') {
24812429 for (int j = 0; j < oc->nb_streams; j++) {
2482− OutputStream *ost = of->streams[j];
24832430 if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
2484−#if FFMPEG_ROTATION_METADATA
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
2431+ av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
25042432 } else if (ret < 0)
25052433 return ret;
25062434 }
fftools/ffmpeg_opt.c+0−122
@@ -88,9 +88,6 @@ int64_t stats_period = 500000; · 87 unmodified lines
8888
8989 static int file_overwrite = 0;
9090 static int no_file_overwrite = 0;
91−#if FFMPEG_OPT_PSNR
92−int do_psnr = 0;
93−#endif
9491 int ignore_unknown_streams = 0;
9592 int copy_unknown_streams = 0;
9693 int recast_media = 0;
@@ -121,9 +118,6 @@ static void uninit_options(OptionsContext *o) · 24 unmodified lines
121118 for (i = 0; i < o->nb_stream_maps; i++)
122119 av_freep(&o->stream_maps[i].linklabel);
123120 av_freep(&o->stream_maps);
124−#if FFMPEG_OPT_MAP_CHANNEL
125− av_freep(&o->audio_channel_maps);
126−#endif
127121
128122 for (i = 0; i < o->nb_attachments; i++)
129123 av_freep(&o->attachments[i]);
@@ -403,19 +397,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg) · 273 unmodified lines
403397 if (!map)
404398 return AVERROR(ENOMEM);
405399
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−
419400 if (map[0] == '[') {
420401 /* this mapping refers to lavfi output */
421402 const char *c = map + 1;
@@ -505,99 +486,6 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) · 83 unmodified lines
505486 return 0;
506487 }
507488
508−#if FFMPEG_OPT_MAP_CHANNEL
509−static 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;
592−end:
593− av_free(mapchan);
594− return ret;
595−fail:
596− ret = AVERROR(EINVAL);
597− goto end;
598−}
599−#endif
600−
601489 static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
602490 {
603491 Scheduler *sch = optctx;
@@ -2005,21 +1893,11 @@ const OptionDef options[] = { · 1401 unmodified lines
20051893 "set hardware device used when filtering", "device" },
20061894
20071895 // 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
20131896 #if FFMPEG_OPT_ADRIFT_THRESHOLD
20141897 { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
20151898 { .func_arg = opt_adrift_threshold },
20161899 "deprecated, does nothing", "threshold" },
20171900 #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
20231901 #if FFMPEG_OPT_TOP
20241902 { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
20251903 { .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