Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration
@ 2022-07-23 14:09 Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 02/27] fftools/ffmpeg: stop accessing the encoder context unnecessarily Anton Khirnov
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

Mistakenly reintroduced in 4740fea7ddf.
---
 fftools/ffmpeg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 632ac25cb2..841dd6f08a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1216,18 +1216,18 @@ static void do_video_out(OutputFile *of,
                 if (delta0 > 1.1)
                     nb0_frames = llrintf(delta0 - 0.6);
             }
-            next_picture->pkt_duration = 1;
+            next_picture->duration = 1;
             break;
         case VSYNC_VFR:
             if (delta <= -0.6)
                 nb_frames = 0;
             else if (delta > 0.6)
                 ost->sync_opts = llrint(sync_ipts);
-            next_picture->pkt_duration = duration;
+            next_picture->duration = duration;
             break;
         case VSYNC_DROP:
         case VSYNC_PASSTHROUGH:
-            next_picture->pkt_duration = duration;
+            next_picture->duration = duration;
             ost->sync_opts = llrint(sync_ipts);
             break;
         default:
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 02/27] fftools/ffmpeg: stop accessing the encoder context unnecessarily
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 03/27] fftools/ffmpeg: remove an unnecessary avcodec_close() call Anton Khirnov
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

The same information is available from AVStream.codecpar. This will
allow to stop allocating an encoder unless encoding is actually
performed.
---
 fftools/ffmpeg.c     | 15 ++++++++-------
 fftools/ffmpeg_mux.c |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 841dd6f08a..7c340f4570 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1454,13 +1454,14 @@ static void print_final_stats(int64_t total_size)
 
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
-        switch (ost->enc_ctx->codec_type) {
+        AVCodecParameters *par = ost->st->codecpar;
+        switch (par->codec_type) {
             case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
             case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
             case AVMEDIA_TYPE_SUBTITLE: subtitle_size += ost->data_size; break;
             default:                 other_size += ost->data_size; break;
         }
-        extra_size += ost->enc_ctx->extradata_size;
+        extra_size += par->extradata_size;
         data_size  += ost->data_size;
         if (   (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))
             != AV_CODEC_FLAG_PASS1)
@@ -1526,7 +1527,7 @@ static void print_final_stats(int64_t total_size)
 
         for (j = 0; j < of->nb_streams; j++) {
             OutputStream *ost = output_streams[of->ost_index + j];
-            enum AVMediaType type = ost->enc_ctx->codec_type;
+            enum AVMediaType type = ost->st->codecpar->codec_type;
 
             total_size    += ost->data_size;
             total_packets += atomic_load(&ost->packets_written);
@@ -1603,12 +1604,12 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         if (!ost->stream_copy)
             q = ost->quality / (float) FF_QP2LAMBDA;
 
-        if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+        if (vid && ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
             av_bprintf(&buf, "q=%2.1f ", q);
             av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
                        ost->file_index, ost->index, q);
         }
-        if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+        if (!vid && ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
             float fps;
             uint64_t frame_number = atomic_load(&ost->packets_written);
 
@@ -3362,8 +3363,8 @@ static int transcode_init(void)
      */
     for (i = 0; i < nb_output_streams; i++) {
         if (!output_streams[i]->stream_copy &&
-            (output_streams[i]->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
-             output_streams[i]->enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO))
+            (output_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
+             output_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))
             continue;
 
         ret = init_output_stream_wrapper(output_streams[i], NULL, 0);
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index df9cb73d0e..7f6da997a4 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -201,7 +201,7 @@ static int write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
     if (debug_ts) {
         av_log(NULL, AV_LOG_INFO, "muxer <- type:%s "
                 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
-                av_get_media_type_string(ost->enc_ctx->codec_type),
+                av_get_media_type_string(st->codecpar->codec_type),
                 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
                 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
                 av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 03/27] fftools/ffmpeg: remove an unnecessary avcodec_close() call
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 02/27] fftools/ffmpeg: stop accessing the encoder context unnecessarily Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 04/27] fftools/ffmpeg_filter: remove unused function argument Anton Khirnov
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

No encoders can possibly be opened at this point. And even if some were,
they would be closed in ffmpeg_cleanup().
---
 fftools/ffmpeg.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 7c340f4570..1cf704ab82 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3344,13 +3344,8 @@ static int transcode_init(void)
 
     /* init input streams */
     for (i = 0; i < nb_input_streams; i++)
-        if ((ret = init_input_stream(i, error, sizeof(error))) < 0) {
-            for (i = 0; i < nb_output_streams; i++) {
-                ost = output_streams[i];
-                avcodec_close(ost->enc_ctx);
-            }
+        if ((ret = init_input_stream(i, error, sizeof(error))) < 0)
             goto dump_format;
-        }
 
     /*
      * initialize stream copy and subtitle/data streams.
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 04/27] fftools/ffmpeg_filter: remove unused function argument
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 02/27] fftools/ffmpeg: stop accessing the encoder context unnecessarily Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 03/27] fftools/ffmpeg: remove an unnecessary avcodec_close() call Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt() Anton Khirnov
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 122b17686a..f16f4b13b1 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -52,7 +52,7 @@ static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *c
     }
 }
 
-static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx,
+static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx,
                                     const AVCodec *codec, enum AVPixelFormat target)
 {
     if (codec && codec->pix_fmts) {
@@ -102,7 +102,7 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
         return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
     }
     if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
-        return av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
+        return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
     } else if (ost->enc && ost->enc->pix_fmts) {
         const enum AVPixelFormat *p;
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (2 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 04/27] fftools/ffmpeg_filter: remove unused function argument Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 06/27] fftools/ffmpeg: drop the -vol option Anton Khirnov
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

It only uses strict_std_compliance, so pass just that value. Makes it
more clear what fields are accessed.
---
 fftools/ffmpeg_filter.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f16f4b13b1..f715ecb6b6 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -52,8 +52,9 @@ static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *c
     }
 }
 
-static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx,
-                                    const AVCodec *codec, enum AVPixelFormat target)
+static enum AVPixelFormat
+choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target,
+                 int strict_std_compliance)
 {
     if (codec && codec->pix_fmts) {
         const enum AVPixelFormat *p = codec->pix_fmts;
@@ -62,7 +63,7 @@ static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx,
         int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
         enum AVPixelFormat best= AV_PIX_FMT_NONE;
 
-        if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+        if (strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
             p = get_compliance_normal_pix_fmts(codec, p);
         }
         for (; *p != AV_PIX_FMT_NONE; p++) {
@@ -102,7 +103,8 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
         return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
     }
     if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
-        return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
+        return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc, ost->enc_ctx->pix_fmt,
+                                                    ost->enc_ctx->strict_std_compliance));
     } else if (ost->enc && ost->enc->pix_fmts) {
         const enum AVPixelFormat *p;
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 06/27] fftools/ffmpeg: drop the -vol option
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (3 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 07/27] fftools/ffmpeg: drop OutputStream.ref_par Anton Khirnov
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

It has been deprecated in favor of the volume filter since 2012.
---
 fftools/ffmpeg.c        |  4 ----
 fftools/ffmpeg_filter.c | 10 ----------
 fftools/ffmpeg_opt.c    |  3 ---
 3 files changed, 17 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 1cf704ab82..1780e535ae 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2840,10 +2840,6 @@ static int init_output_stream_streamcopy(OutputStream *ost)
 
     switch (par_dst->codec_type) {
     case AVMEDIA_TYPE_AUDIO:
-        if (audio_volume != 256) {
-            av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n");
-            exit_program(1);
-        }
         if((par_dst->block_align == 1 || par_dst->block_align == 1152 || par_dst->block_align == 576) && par_dst->codec_id == AV_CODEC_ID_MP3)
             par_dst->block_align= 0;
         if(par_dst->codec_id == AV_CODEC_ID_AC3)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f715ecb6b6..6807bf384a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -913,16 +913,6 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
 //         av_bprint_finalize(&pan_buf, NULL);
 //     }
 
-    if (audio_volume != 256) {
-        char args[256];
-
-        av_log(NULL, AV_LOG_WARNING, "-vol has been deprecated. Use the volume "
-               "audio filter instead.\n");
-
-        snprintf(args, sizeof(args), "%f", audio_volume / 256.);
-        AUTO_INSERT_FILTER_INPUT("-vol", "volume", args);
-    }
-
     snprintf(name, sizeof(name), "trim for input stream %d:%d",
              ist->file_index, ist->st->index);
     if (copy_ts) {
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 8ac73c0efc..81754f7d91 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -157,7 +157,6 @@ float audio_drift_threshold = 0.1;
 float dts_delta_threshold   = 10;
 float dts_error_threshold   = 3600*30;
 
-int audio_volume      = 256;
 int audio_sync_method = 0;
 enum VideoSyncMethod video_sync_method = VSYNC_AUTO;
 float frame_drop_threshold = 0;
@@ -4029,8 +4028,6 @@ const OptionDef options[] = {
     { "atag",           OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
                         OPT_OUTPUT,                                                { .func_arg = opt_old2new },
         "force audio tag/fourcc", "fourcc/tag" },
-    { "vol",            OPT_AUDIO | HAS_ARG  | OPT_INT,                            { &audio_volume },
-        "change audio volume (256=normal)" , "volume" },
     { "sample_fmt",     OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_SPEC |
                         OPT_STRING | OPT_INPUT | OPT_OUTPUT,                       { .off = OFFSET(sample_fmts) },
         "set sample format", "format" },
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 07/27] fftools/ffmpeg: drop OutputStream.ref_par
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (4 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 06/27] fftools/ffmpeg: drop the -vol option Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 08/27] fftools/ffmpeg: do not use the encoder context for streamcopy Anton Khirnov
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

It serves no purpose, codec parameters can be written directly to
AVStream.codecpar with the same effect.
---
 fftools/ffmpeg.c     | 37 ++++++++++++++++---------------------
 fftools/ffmpeg.h     |  1 -
 fftools/ffmpeg_opt.c |  6 ------
 3 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 1780e535ae..cad9f1e885 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -587,7 +587,6 @@ static void ffmpeg_cleanup(int ret)
         if (ost->enc_ctx)
             av_freep(&ost->enc_ctx->stats_in);
         avcodec_free_context(&ost->enc_ctx);
-        avcodec_parameters_free(&ost->ref_par);
 
         av_freep(&output_streams[i]);
     }
@@ -2757,11 +2756,10 @@ static int init_output_stream_streamcopy(OutputStream *ost)
 {
     OutputFile *of = output_files[ost->file_index];
     InputStream *ist = get_input_stream(ost);
-    AVCodecParameters *par_dst = ost->st->codecpar;
-    AVCodecParameters *par_src = ost->ref_par;
+    AVCodecParameters *par = ost->st->codecpar;
     AVRational sar;
     int i, ret;
-    uint32_t codec_tag = par_dst->codec_tag;
+    uint32_t codec_tag = par->codec_tag;
 
     av_assert0(ist && !ost->filter);
 
@@ -2774,7 +2772,7 @@ static int init_output_stream_streamcopy(OutputStream *ost)
         return ret;
     }
 
-    ret = avcodec_parameters_from_context(par_src, ost->enc_ctx);
+    ret = avcodec_parameters_from_context(par, ost->enc_ctx);
     if (ret < 0) {
         av_log(NULL, AV_LOG_FATAL,
                "Error getting reference codec parameters.\n");
@@ -2784,16 +2782,12 @@ static int init_output_stream_streamcopy(OutputStream *ost)
     if (!codec_tag) {
         unsigned int codec_tag_tmp;
         if (!of->format->codec_tag ||
-            av_codec_get_id (of->format->codec_tag, par_src->codec_tag) == par_src->codec_id ||
-            !av_codec_get_tag2(of->format->codec_tag, par_src->codec_id, &codec_tag_tmp))
-            codec_tag = par_src->codec_tag;
+            av_codec_get_id (of->format->codec_tag, par->codec_tag) == par->codec_id ||
+            !av_codec_get_tag2(of->format->codec_tag, par->codec_id, &codec_tag_tmp))
+            codec_tag = par->codec_tag;
     }
 
-    ret = avcodec_parameters_copy(par_dst, par_src);
-    if (ret < 0)
-        return ret;
-
-    par_dst->codec_tag = codec_tag;
+    par->codec_tag = codec_tag;
 
     if (!ost->frame_rate.num)
         ost->frame_rate = ist->framerate;
@@ -2838,26 +2832,27 @@ static int init_output_stream_streamcopy(OutputStream *ost)
             av_display_rotation_set((int32_t *)sd, -ost->rotate_override_value);
     }
 
-    switch (par_dst->codec_type) {
+    switch (par->codec_type) {
     case AVMEDIA_TYPE_AUDIO:
-        if((par_dst->block_align == 1 || par_dst->block_align == 1152 || par_dst->block_align == 576) && par_dst->codec_id == AV_CODEC_ID_MP3)
-            par_dst->block_align= 0;
-        if(par_dst->codec_id == AV_CODEC_ID_AC3)
-            par_dst->block_align= 0;
+        if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) &&
+            par->codec_id == AV_CODEC_ID_MP3)
+            par->block_align = 0;
+        if (par->codec_id == AV_CODEC_ID_AC3)
+            par->block_align = 0;
         break;
     case AVMEDIA_TYPE_VIDEO:
         if (ost->frame_aspect_ratio.num) { // overridden by the -aspect cli option
             sar =
                 av_mul_q(ost->frame_aspect_ratio,
-                         (AVRational){ par_dst->height, par_dst->width });
+                         (AVRational){ par->height, par->width });
             av_log(NULL, AV_LOG_WARNING, "Overriding aspect ratio "
                    "with stream copy may produce invalid files\n");
             }
         else if (ist->st->sample_aspect_ratio.num)
             sar = ist->st->sample_aspect_ratio;
         else
-            sar = par_src->sample_aspect_ratio;
-        ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar;
+            sar = par->sample_aspect_ratio;
+        ost->st->sample_aspect_ratio = par->sample_aspect_ratio = sar;
         ost->st->avg_frame_rate = ist->st->avg_frame_rate;
         ost->st->r_frame_rate = ist->st->r_frame_rate;
         break;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 0c9498c23e..59c2f47a66 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -481,7 +481,6 @@ typedef struct OutputStream {
     AVBSFContext            *bsf_ctx;
 
     AVCodecContext *enc_ctx;
-    AVCodecParameters *ref_par; /* associated input codec parameters with encoders options applied */
     const AVCodec *enc;
     int64_t max_frames;
     AVFrame *filtered_frame;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 81754f7d91..32e0d9a7ff 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1573,12 +1573,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
     }
     ost->enc_ctx->codec_type = type;
 
-    ost->ref_par = avcodec_parameters_alloc();
-    if (!ost->ref_par) {
-        av_log(NULL, AV_LOG_ERROR, "Error allocating the encoding parameters.\n");
-        exit_program(1);
-    }
-
     ost->filtered_frame = av_frame_alloc();
     if (!ost->filtered_frame)
         exit_program(1);
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 08/27] fftools/ffmpeg: do not use the encoder context for streamcopy
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (5 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 07/27] fftools/ffmpeg: drop OutputStream.ref_par Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: deprecate -psnr Anton Khirnov
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

The streamcopy initialization code briefly needs an AVCodecContext to
apply AVOptions to. Allocate a temporary codec context, do not use the
encoding one.
---
 fftools/ffmpeg.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index cad9f1e885..0e30f8ce01 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2757,22 +2757,29 @@ static int init_output_stream_streamcopy(OutputStream *ost)
     OutputFile *of = output_files[ost->file_index];
     InputStream *ist = get_input_stream(ost);
     AVCodecParameters *par = ost->st->codecpar;
+    AVCodecContext *codec_ctx;
     AVRational sar;
     int i, ret;
     uint32_t codec_tag = par->codec_tag;
 
     av_assert0(ist && !ost->filter);
 
-    ret = avcodec_parameters_to_context(ost->enc_ctx, ist->st->codecpar);
+    codec_ctx = avcodec_alloc_context3(NULL);
+    if (!codec_ctx)
+        return AVERROR(ENOMEM);
+
+    ret = avcodec_parameters_to_context(codec_ctx, ist->st->codecpar);
     if (ret >= 0)
-        ret = av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts);
+        ret = av_opt_set_dict(codec_ctx, &ost->encoder_opts);
     if (ret < 0) {
         av_log(NULL, AV_LOG_FATAL,
                "Error setting up codec context options.\n");
+        avcodec_free_context(&codec_ctx);
         return ret;
     }
 
-    ret = avcodec_parameters_from_context(par, ost->enc_ctx);
+    ret = avcodec_parameters_from_context(par, codec_ctx);
+    avcodec_free_context(&codec_ctx);
     if (ret < 0) {
         av_log(NULL, AV_LOG_FATAL,
                "Error getting reference codec parameters.\n");
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: deprecate -psnr
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (6 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 08/27] fftools/ffmpeg: do not use the encoder context for streamcopy Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 10/27] fftools/ffmpeg: stop allocating an encoder context when not encoding Anton Khirnov
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

It is entirely redundant with -flags +psnr.
---
 doc/ffmpeg.texi      |  3 ++-
 fftools/ffmpeg.h     |  3 +++
 fftools/ffmpeg_opt.c | 12 ++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0e657b0138..974d1c108f 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -992,7 +992,8 @@ to keep the interlaced format for minimum losses.
 The alternative is to deinterlace the input stream by use of a filter
 such as @code{yadif} or @code{bwdif}, but deinterlacing introduces losses.
 @item -psnr
-Calculate PSNR of compressed frames.
+Calculate PSNR of compressed frames. This option is deprecated, pass the
+PSNR flag to the encoder instead, using @code{-flags +psnr}.
 @item -vstats
 Dump video coding statistics to @file{vstats_HHMMSS.log}.
 @item -vstats_file @var{file}
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 59c2f47a66..0795a380f8 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -49,6 +49,9 @@
 
 #include "libswresample/swresample.h"
 
+// deprecated features
+#define FFMPEG_OPT_PSNR 1
+
 enum VideoSyncMethod {
     VSYNC_AUTO = -1,
     VSYNC_PASSTHROUGH,
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 32e0d9a7ff..716b53d81f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -183,7 +183,9 @@ int64_t stats_period = 500000;
 
 static int file_overwrite     = 0;
 static int no_file_overwrite  = 0;
+#if FFMPEG_OPT_PSNR
 static int do_psnr            = 0;
+#endif
 static int input_stream_potentially_available = 0;
 static int ignore_unknown_streams = 0;
 static int copy_unknown_streams = 0;
@@ -1926,8 +1928,12 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
         }
         video_enc->rc_override_count = i;
 
-        if (do_psnr)
+#if FFMPEG_OPT_PSNR
+        if (do_psnr) {
+            av_log(NULL, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n");
             video_enc->flags|= AV_CODEC_FLAG_PSNR;
+        }
+#endif
 
         /* two pass mode */
         MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
@@ -3942,8 +3948,10 @@ const OptionDef options[] = {
     { "passlogfile",  OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC |
                       OPT_OUTPUT,                                                { .off = OFFSET(passlogfiles) },
         "select two pass log file name prefix", "prefix" },
+#if FFMPEG_OPT_PSNR
     { "psnr",         OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &do_psnr },
-        "calculate PSNR of compressed frames" },
+        "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
+#endif
     { "vstats",       OPT_VIDEO | OPT_EXPERT ,                                   { .func_arg = opt_vstats },
         "dump video coding statistics to file" },
     { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { .func_arg = opt_vstats_file },
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 10/27] fftools/ffmpeg: stop allocating an encoder context when not encoding
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (7 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: deprecate -psnr Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 11/27] fftools/ffmpeg_opt: drop a redundant assignment Anton Khirnov
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg.c     | 12 +++++++++---
 fftools/ffmpeg_opt.c | 36 ++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0e30f8ce01..30618c6a6a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1462,7 +1462,8 @@ static void print_final_stats(int64_t total_size)
         }
         extra_size += par->extradata_size;
         data_size  += ost->data_size;
-        if (   (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))
+        if (ost->enc_ctx &&
+            (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))
             != AV_CODEC_FLAG_PASS1)
             pass1_used = 0;
     }
@@ -1630,7 +1631,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
                     av_bprintf(&buf, "%X", av_log2(qp_histogram[j] + 1));
             }
 
-            if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) {
+            if (enc && (enc->flags & AV_CODEC_FLAG_PSNR) &&
+                (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) {
                 int j;
                 double error, error_sum = 0;
                 double scale, scale_sum = 0;
@@ -3139,6 +3141,9 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
         break;
     }
 
+    if (ost->bitexact)
+        enc_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
+
     if (ost->sq_idx_encode >= 0)
         sq_set_tb(of->sq_encode, ost->sq_idx_encode, enc_ctx->time_base);
 
@@ -3635,7 +3640,8 @@ static int check_keyboard_interaction(int64_t cur_time)
         }
         for(i=0;i<nb_output_streams;i++) {
             OutputStream *ost = output_streams[i];
-            ost->enc_ctx->debug = debug;
+            if (ost->enc_ctx)
+                ost->enc_ctx->debug = debug;
         }
         if(debug) av_log_set_level(AV_LOG_DEBUG);
         fprintf(stderr,"debug=%d\n", debug);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 716b53d81f..f6e354355b 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1568,12 +1568,14 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
         exit_program(1);
     }
 
-    ost->enc_ctx = avcodec_alloc_context3(ost->enc);
-    if (!ost->enc_ctx) {
-        av_log(NULL, AV_LOG_ERROR, "Error allocating the encoding context.\n");
-        exit_program(1);
+    if (ost->enc) {
+        ost->enc_ctx = avcodec_alloc_context3(ost->enc);
+        if (!ost->enc_ctx) {
+            av_log(NULL, AV_LOG_ERROR, "Error allocating the encoding context.\n");
+            exit_program(1);
+        }
+        ost->enc_ctx->codec_type = type;
     }
-    ost->enc_ctx->codec_type = type;
 
     ost->filtered_frame = av_frame_alloc();
     if (!ost->filtered_frame)
@@ -1622,9 +1624,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
 
 
     if (o->bitexact) {
-        ost->enc_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
         ost->bitexact        = 1;
-    } else {
+    } else if (ost->enc_ctx) {
         ost->bitexact        = check_opt_bitexact(ost->enc_ctx, ost->encoder_opts, "flags",
                                                   AV_CODEC_FLAG_BITEXACT);
     }
@@ -1678,12 +1679,13 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
         uint32_t tag = strtol(codec_tag, &next, 0);
         if (*next)
             tag = AV_RL32(codec_tag);
-        ost->st->codecpar->codec_tag =
-        ost->enc_ctx->codec_tag = tag;
+        ost->st->codecpar->codec_tag = tag;
+        if (ost->enc_ctx)
+            ost->enc_ctx->codec_tag = tag;
     }
 
     MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st);
-    if (qscale >= 0) {
+    if (ost->enc_ctx && qscale >= 0) {
         ost->enc_ctx->flags |= AV_CODEC_FLAG_QSCALE;
         ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
     }
@@ -1700,7 +1702,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
     MATCH_PER_STREAM_OPT(bits_per_raw_sample, i, ost->bits_per_raw_sample,
                          oc, st);
 
-    if (oc->oformat->flags & AVFMT_GLOBALHEADER)
+    if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->enc_ctx)
         ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 
     av_dict_copy(&ost->sws_dict, o->g->sws_dict, 0);
@@ -1802,12 +1804,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
 {
     AVStream *st;
     OutputStream *ost;
-    AVCodecContext *video_enc;
     char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL;
 
     ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index);
     st  = ost->st;
-    video_enc = ost->enc_ctx;
 
     MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
     if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) {
@@ -1845,6 +1845,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
     MATCH_PER_STREAM_OPT(filters,        str, ost->filters,        oc, st);
 
     if (!ost->stream_copy) {
+        AVCodecContext *video_enc = ost->enc_ctx;
         const char *p = NULL;
         char *frame_size = NULL;
         char *frame_pix_fmt = NULL;
@@ -2045,18 +2046,16 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
     int n;
     AVStream *st;
     OutputStream *ost;
-    AVCodecContext *audio_enc;
 
     ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index);
     st  = ost->st;
 
-    audio_enc = ost->enc_ctx;
-    audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
 
     MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st);
     MATCH_PER_STREAM_OPT(filters,        str, ost->filters,        oc, st);
 
     if (!ost->stream_copy) {
+        AVCodecContext *audio_enc = ost->enc_ctx;
         int channels = 0;
         char *layout = NULL;
         char *sample_fmt = NULL;
@@ -2178,15 +2177,12 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc,
 {
     AVStream *st;
     OutputStream *ost;
-    AVCodecContext *subtitle_enc;
 
     ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE, source_index);
     st  = ost->st;
-    subtitle_enc = ost->enc_ctx;
-
-    subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
 
     if (!ost->stream_copy) {
+        AVCodecContext *subtitle_enc = ost->enc_ctx;
         char *frame_size = NULL;
 
         MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 11/27] fftools/ffmpeg_opt: drop a redundant assignment
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (8 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 10/27] fftools/ffmpeg: stop allocating an encoder context when not encoding Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 12/27] fftools/ffmpeg: drop unused hwaccel variables Anton Khirnov
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

The codec type will be set by avcodec_alloc_context3(), there is no
reason to set it manually.
---
 fftools/ffmpeg_opt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f6e354355b..29bc4fd97f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1574,7 +1574,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
             av_log(NULL, AV_LOG_ERROR, "Error allocating the encoding context.\n");
             exit_program(1);
         }
-        ost->enc_ctx->codec_type = type;
     }
 
     ost->filtered_frame = av_frame_alloc();
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 12/27] fftools/ffmpeg: drop unused hwaccel variables
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (9 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 11/27] fftools/ffmpeg_opt: drop a redundant assignment Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 13/27] fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c Anton Khirnov
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg.c | 3 ---
 fftools/ffmpeg.h | 6 ------
 2 files changed, 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 30618c6a6a..f39966f096 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2275,7 +2275,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_
         if (err < 0)
             goto fail;
     }
-    ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
 
     best_effort_timestamp= decoded_frame->best_effort_timestamp;
     *duration_pts = decoded_frame->duration;
@@ -4428,8 +4427,6 @@ static int transcode(void)
         ist = input_streams[i];
         if (ist->decoding_needed) {
             avcodec_close(ist->dec_ctx);
-            if (ist->hwaccel_uninit)
-                ist->hwaccel_uninit(ist->dec_ctx);
         }
     }
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 0795a380f8..bc78570d16 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -385,12 +385,8 @@ typedef struct InputStream {
     char  *hwaccel_device;
     enum AVPixelFormat hwaccel_output_format;
 
-    /* hwaccel context */
-    void  *hwaccel_ctx;
-    void (*hwaccel_uninit)(AVCodecContext *s);
     int  (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
     enum AVPixelFormat hwaccel_pix_fmt;
-    enum AVPixelFormat hwaccel_retrieved_pix_fmt;
 
     /* stats */
     // combined size of all the packets read
@@ -493,8 +489,6 @@ typedef struct OutputStream {
     int64_t last_dropped;
     int64_t last_nb0_frames[3];
 
-    void  *hwaccel_ctx;
-
     /* video only */
     AVRational frame_rate;
     AVRational max_frame_rate;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 13/27] fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (10 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 12/27] fftools/ffmpeg: drop unused hwaccel variables Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 14/27] fftools/ffmpeg: deprecate the -map_channel option Anton Khirnov
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

That is the only place where it is used. Also make it static.
---
 fftools/ffmpeg.c     | 19 -------------------
 fftools/ffmpeg.h     |  2 --
 fftools/ffmpeg_opt.c | 19 +++++++++++++++++++
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index f39966f096..ad20278aa2 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1934,25 +1934,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
     ost->streamcopy_started = 1;
 }
 
-int guess_input_channel_layout(InputStream *ist)
-{
-    AVCodecContext *dec = ist->dec_ctx;
-
-    if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
-        char layout_name[256];
-
-        if (dec->ch_layout.nb_channels > ist->guess_layout_max)
-            return 0;
-        av_channel_layout_default(&dec->ch_layout, dec->ch_layout.nb_channels);
-        if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
-            return 0;
-        av_channel_layout_describe(&dec->ch_layout, layout_name, sizeof(layout_name));
-        av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream "
-               "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
-    }
-    return 1;
-}
-
 static void check_decode_result(InputStream *ist, int *got_output, int ret)
 {
     if (*got_output || ret<0)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index bc78570d16..66a49a0cb7 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -668,8 +668,6 @@ void show_usage(void);
 void remove_avoptions(AVDictionary **a, AVDictionary *b);
 void assert_avoptions(AVDictionary *m);
 
-int guess_input_channel_layout(InputStream *ist);
-
 int configure_filtergraph(FilterGraph *fg);
 void check_filter_outputs(void);
 int filtergraph_is_simple(FilterGraph *fg);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 29bc4fd97f..444392fd45 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -862,6 +862,25 @@ static const AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVSt
         return avcodec_find_decoder(st->codecpar->codec_id);
 }
 
+static int guess_input_channel_layout(InputStream *ist)
+{
+    AVCodecContext *dec = ist->dec_ctx;
+
+    if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
+        char layout_name[256];
+
+        if (dec->ch_layout.nb_channels > ist->guess_layout_max)
+            return 0;
+        av_channel_layout_default(&dec->ch_layout, dec->ch_layout.nb_channels);
+        if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
+            return 0;
+        av_channel_layout_describe(&dec->ch_layout, layout_name, sizeof(layout_name));
+        av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream "
+               "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
+    }
+    return 1;
+}
+
 /* Add all the streams from the given input file to the global
  * list of input streams. */
 static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 14/27] fftools/ffmpeg: deprecate the -map_channel option
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (11 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 13/27] fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 15/27] fftools/ffmpeg_filter: drop a block commented out since 2012 Anton Khirnov
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

It is now entirely redundant with audio filters, and is in fact
implemented by setting up a 'pan' filter instance.
---
 doc/ffmpeg.texi         |  4 ++++
 fftools/ffmpeg.c        |  2 ++
 fftools/ffmpeg.h        |  7 +++++++
 fftools/ffmpeg_filter.c |  2 ++
 fftools/ffmpeg_opt.c    | 19 ++++++++++++++++---
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 974d1c108f..2fb0bc8ffa 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1492,6 +1492,10 @@ Allow input streams with unknown type to be copied instead of failing if copying
 such streams is attempted.
 
 @item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}]
+This option is deprecated and will be removed. It can be replaced by the
+@var{pan} filter. In some cases it may be easier to use some combination of the
+@var{channelsplit}, @var{channelmap}, or @var{amerge} filters.
+
 Map an audio channel from a given input to an output. If
 @var{output_file_id}.@var{stream_specifier} is not set, the audio channel will
 be mapped on all the audio streams.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ad20278aa2..19173c75e1 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -578,8 +578,10 @@ static void ffmpeg_cleanup(int ret)
         av_freep(&ost->avfilter);
         av_freep(&ost->logfile_prefix);
 
+#if FFMPEG_OPT_MAP_CHANNEL
         av_freep(&ost->audio_channels_map);
         ost->audio_channels_mapped = 0;
+#endif
 
         av_dict_free(&ost->sws_dict);
         av_dict_free(&ost->swr_opts);
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 66a49a0cb7..6417db03bd 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -51,6 +51,7 @@
 
 // deprecated features
 #define FFMPEG_OPT_PSNR 1
+#define FFMPEG_OPT_MAP_CHANNEL 1
 
 enum VideoSyncMethod {
     VSYNC_AUTO = -1,
@@ -85,10 +86,12 @@ typedef struct StreamMap {
     char *linklabel;       /* name of an output link, for mapping lavfi outputs */
 } StreamMap;
 
+#if FFMPEG_OPT_MAP_CHANNEL
 typedef struct {
     int  file_idx,  stream_idx,  channel_idx; // input
     int ofile_idx, ostream_idx;               // output
 } AudioChannelMap;
+#endif
 
 typedef struct OptionsContext {
     OptionGroup *g;
@@ -141,8 +144,10 @@ typedef struct OptionsContext {
     /* output options */
     StreamMap *stream_maps;
     int     nb_stream_maps;
+#if FFMPEG_OPT_MAP_CHANNEL
     AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
     int           nb_audio_channel_maps; /* number of (valid) -map_channel settings */
+#endif
     int metadata_global_manual;
     int metadata_streams_manual;
     int metadata_chapters_manual;
@@ -516,8 +521,10 @@ typedef struct OutputStream {
     int dropped_keyframe;
 
     /* audio only */
+#if FFMPEG_OPT_MAP_CHANNEL
     int *audio_channels_map;             /* list of the channels id to pick from the source stream */
     int audio_channels_mapped;           /* number of channels in audio_channels_map */
+#endif
 
     char *logfile_prefix;
     FILE *logfile;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 6807bf384a..5d00bfe056 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -560,6 +560,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
     pad_idx = 0;                                                            \
 } while (0)
     av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
+#if FFMPEG_OPT_MAP_CHANNEL
     if (ost->audio_channels_mapped) {
         AVChannelLayout mapped_layout = { 0 };
         int i;
@@ -572,6 +573,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
         AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
         av_bprint_clear(&args);
     }
+#endif
 
     if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
         av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 444392fd45..e6f2fb597a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -219,7 +219,9 @@ static void uninit_options(OptionsContext *o)
     for (i = 0; i < o->nb_stream_maps; i++)
         av_freep(&o->stream_maps[i].linklabel);
     av_freep(&o->stream_maps);
+#if FFMPEG_OPT_MAP_CHANNEL
     av_freep(&o->audio_channel_maps);
+#endif
     av_freep(&o->streamid_map);
     av_freep(&o->attachments);
 }
@@ -534,6 +536,7 @@ static int opt_attach(void *optctx, const char *opt, const char *arg)
     return 0;
 }
 
+#if FFMPEG_OPT_MAP_CHANNEL
 static int opt_map_channel(void *optctx, const char *opt, const char *arg)
 {
     OptionsContext *o = optctx;
@@ -542,6 +545,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
     AudioChannelMap *m;
     char *allow_unused;
     char *mapchan;
+
+    av_log(NULL, AV_LOG_WARNING,
+           "The -%s option is deprecated and will be removed. "
+           "It can be replaced by the 'pan' filter, or in some cases by "
+           "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt);
+
     mapchan = av_strdup(arg);
     if (!mapchan)
         return AVERROR(ENOMEM);
@@ -610,6 +619,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
     av_free(mapchan);
     return 0;
 }
+#endif
 
 static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
 {
@@ -2061,7 +2071,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
 
 static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
 {
-    int n;
     AVStream *st;
     OutputStream *ost;
 
@@ -2121,8 +2130,9 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
         if (!ost->avfilter)
             exit_program(1);
 
+#if FFMPEG_OPT_MAP_CHANNEL
         /* check for channel mapping for this audio stream */
-        for (n = 0; n < o->nb_audio_channel_maps; n++) {
+        for (int n = 0; n < o->nb_audio_channel_maps; n++) {
             AudioChannelMap *map = &o->audio_channel_maps[n];
             if ((map->ofile_idx   == -1 || ost->file_index == map->ofile_idx) &&
                 (map->ostream_idx == -1 || ost->st->index  == map->ostream_idx)) {
@@ -2149,6 +2159,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
                 }
             }
         }
+#endif
     }
 
     if (ost->stream_copy)
@@ -3759,8 +3770,10 @@ const OptionDef options[] = {
                         OPT_OUTPUT,                                  { .func_arg = opt_map },
         "set input stream mapping",
         "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
+#if FFMPEG_OPT_MAP_CHANNEL
     { "map_channel",    HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
-        "map an audio channel from one stream to another", "file.stream.channel[:syncfile.syncstream]" },
+        "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
+#endif
     { "map_metadata",   HAS_ARG | OPT_STRING | OPT_SPEC |
                         OPT_OUTPUT,                                  { .off       = OFFSET(metadata_map) },
         "set metadata information of outfile from infile",
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 15/27] fftools/ffmpeg_filter: drop a block commented out since 2012
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (12 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 14/27] fftools/ffmpeg: deprecate the -map_channel option Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 16/27] fftools/ffmpeg_mux: move some functions closer to their only callers Anton Khirnov
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

Since the option it relates to is deprecated, it is highly unlikely to
become useful.
---
 fftools/ffmpeg_filter.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 5d00bfe056..f9ae76f76d 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -902,19 +902,6 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
         AUTO_INSERT_FILTER_INPUT("-async", "aresample", args);
     }
 
-//     if (ost->audio_channels_mapped) {
-//         int i;
-//         AVBPrint pan_buf;
-//         av_bprint_init(&pan_buf, 256, 8192);
-//         av_bprintf(&pan_buf, "0x%"PRIx64,
-//                    av_get_default_channel_layout(ost->audio_channels_mapped));
-//         for (i = 0; i < ost->audio_channels_mapped; i++)
-//             if (ost->audio_channels_map[i] != -1)
-//                 av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]);
-//         AUTO_INSERT_FILTER_INPUT("-map_channel", "pan", pan_buf.str);
-//         av_bprint_finalize(&pan_buf, NULL);
-//     }
-
     snprintf(name, sizeof(name), "trim for input stream %d:%d",
              ist->file_index, ist->st->index);
     if (copy_ts) {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 16/27] fftools/ffmpeg_mux: move some functions closer to their only callers
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (13 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 15/27] fftools/ffmpeg_filter: drop a block commented out since 2012 Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 17/27] fftools/ffmpeg: do not log to the decoder context Anton Khirnov
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_mux.c | 196 +++++++++++++++++++++----------------------
 1 file changed, 98 insertions(+), 98 deletions(-)

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 7f6da997a4..08a76f0066 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -74,48 +74,6 @@ struct Muxer {
 
 static int want_sdp = 1;
 
-static int queue_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
-{
-    MuxStream *ms = &of->mux->streams[ost->index];
-    AVPacket *tmp_pkt = NULL;
-    int ret;
-
-    if (!av_fifo_can_write(ms->muxing_queue)) {
-        size_t cur_size = av_fifo_can_read(ms->muxing_queue);
-        size_t pkt_size = pkt ? pkt->size : 0;
-        unsigned int are_we_over_size =
-            (ms->muxing_queue_data_size + pkt_size) > ost->muxing_queue_data_threshold;
-        size_t limit    = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX;
-        size_t new_size = FFMIN(2 * cur_size, limit);
-
-        if (new_size <= cur_size) {
-            av_log(NULL, AV_LOG_ERROR,
-                   "Too many packets buffered for output stream %d:%d.\n",
-                   ost->file_index, ost->st->index);
-            return AVERROR(ENOSPC);
-        }
-        ret = av_fifo_grow2(ms->muxing_queue, new_size - cur_size);
-        if (ret < 0)
-            return ret;
-    }
-
-    if (pkt) {
-        ret = av_packet_make_refcounted(pkt);
-        if (ret < 0)
-            return ret;
-
-        tmp_pkt = av_packet_alloc();
-        if (!tmp_pkt)
-            return AVERROR(ENOMEM);
-
-        av_packet_move_ref(tmp_pkt, pkt);
-        ms->muxing_queue_data_size += tmp_pkt->size;
-    }
-    av_fifo_write(ms->muxing_queue, &tmp_pkt, 1);
-
-    return 0;
-}
-
 static int64_t filesize(AVIOContext *pb)
 {
     int64_t ret = -1;
@@ -289,62 +247,6 @@ finish:
     return (void*)(intptr_t)ret;
 }
 
-static int print_sdp(void)
-{
-    char sdp[16384];
-    int i;
-    int j, ret;
-    AVIOContext *sdp_pb;
-    AVFormatContext **avc;
-
-    for (i = 0; i < nb_output_files; i++) {
-        if (!output_files[i]->mux->header_written)
-            return 0;
-    }
-
-    avc = av_malloc_array(nb_output_files, sizeof(*avc));
-    if (!avc)
-        return AVERROR(ENOMEM);
-    for (i = 0, j = 0; i < nb_output_files; i++) {
-        if (!strcmp(output_files[i]->format->name, "rtp")) {
-            avc[j] = output_files[i]->mux->fc;
-            j++;
-        }
-    }
-
-    if (!j) {
-        av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n");
-        ret = AVERROR(EINVAL);
-        goto fail;
-    }
-
-    ret = av_sdp_create(avc, j, sdp, sizeof(sdp));
-    if (ret < 0)
-        goto fail;
-
-    if (!sdp_filename) {
-        printf("SDP:\n%s\n", sdp);
-        fflush(stdout);
-    } else {
-        ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
-        if (ret < 0) {
-            av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
-            goto fail;
-        }
-
-        avio_print(sdp_pb, sdp);
-        avio_closep(&sdp_pb);
-        av_freep(&sdp_filename);
-    }
-
-    // SDP successfully written, allow muxer threads to start
-    ret = 1;
-
-fail:
-    av_freep(&avc);
-    return ret;
-}
-
 static int submit_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
 {
     Muxer *mux = of->mux;
@@ -368,6 +270,48 @@ finish:
     return ret == AVERROR_EOF ? 0 : ret;
 }
 
+static int queue_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
+{
+    MuxStream *ms = &of->mux->streams[ost->index];
+    AVPacket *tmp_pkt = NULL;
+    int ret;
+
+    if (!av_fifo_can_write(ms->muxing_queue)) {
+        size_t cur_size = av_fifo_can_read(ms->muxing_queue);
+        size_t pkt_size = pkt ? pkt->size : 0;
+        unsigned int are_we_over_size =
+            (ms->muxing_queue_data_size + pkt_size) > ost->muxing_queue_data_threshold;
+        size_t limit    = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX;
+        size_t new_size = FFMIN(2 * cur_size, limit);
+
+        if (new_size <= cur_size) {
+            av_log(NULL, AV_LOG_ERROR,
+                   "Too many packets buffered for output stream %d:%d.\n",
+                   ost->file_index, ost->st->index);
+            return AVERROR(ENOSPC);
+        }
+        ret = av_fifo_grow2(ms->muxing_queue, new_size - cur_size);
+        if (ret < 0)
+            return ret;
+    }
+
+    if (pkt) {
+        ret = av_packet_make_refcounted(pkt);
+        if (ret < 0)
+            return ret;
+
+        tmp_pkt = av_packet_alloc();
+        if (!tmp_pkt)
+            return AVERROR(ENOMEM);
+
+        av_packet_move_ref(tmp_pkt, pkt);
+        ms->muxing_queue_data_size += tmp_pkt->size;
+    }
+    av_fifo_write(ms->muxing_queue, &tmp_pkt, 1);
+
+    return 0;
+}
+
 int of_submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
 {
     int ret;
@@ -456,6 +400,62 @@ static int thread_start(OutputFile *of)
     return 0;
 }
 
+static int print_sdp(void)
+{
+    char sdp[16384];
+    int i;
+    int j, ret;
+    AVIOContext *sdp_pb;
+    AVFormatContext **avc;
+
+    for (i = 0; i < nb_output_files; i++) {
+        if (!output_files[i]->mux->header_written)
+            return 0;
+    }
+
+    avc = av_malloc_array(nb_output_files, sizeof(*avc));
+    if (!avc)
+        return AVERROR(ENOMEM);
+    for (i = 0, j = 0; i < nb_output_files; i++) {
+        if (!strcmp(output_files[i]->format->name, "rtp")) {
+            avc[j] = output_files[i]->mux->fc;
+            j++;
+        }
+    }
+
+    if (!j) {
+        av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n");
+        ret = AVERROR(EINVAL);
+        goto fail;
+    }
+
+    ret = av_sdp_create(avc, j, sdp, sizeof(sdp));
+    if (ret < 0)
+        goto fail;
+
+    if (!sdp_filename) {
+        printf("SDP:\n%s\n", sdp);
+        fflush(stdout);
+    } else {
+        ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
+        if (ret < 0) {
+            av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
+            goto fail;
+        }
+
+        avio_print(sdp_pb, sdp);
+        avio_closep(&sdp_pb);
+        av_freep(&sdp_filename);
+    }
+
+    // SDP successfully written, allow muxer threads to start
+    ret = 1;
+
+fail:
+    av_freep(&avc);
+    return ret;
+}
+
 /* open the muxer when all the streams are initialized */
 int of_check_init(OutputFile *of)
 {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 17/27] fftools/ffmpeg: do not log to the decoder context
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (14 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 16/27] fftools/ffmpeg_mux: move some functions closer to their only callers Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 18/27] fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file() Anton Khirnov
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

That should only be done from inside the decoder. Log to NULL instead,
as is the current convention in ffmpeg.
---
 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 19173c75e1..cc0ede8a54 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -259,7 +259,7 @@ void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
         num_rects = 0;
     }
     if (sub2video_get_blank_frame(ist) < 0) {
-        av_log(ist->dec_ctx, AV_LOG_ERROR,
+        av_log(NULL, AV_LOG_ERROR,
                "Impossible to get a blank canvas.\n");
         return;
     }
@@ -2324,7 +2324,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
             end = av_rescale(subtitle.pts - ist->prev_sub.subtitle.pts,
                              1000, AV_TIME_BASE);
             if (end < ist->prev_sub.subtitle.end_display_time) {
-                av_log(ist->dec_ctx, AV_LOG_DEBUG,
+                av_log(NULL, AV_LOG_DEBUG,
                        "Subtitle duration reduced from %"PRId32" to %d%s\n",
                        ist->prev_sub.subtitle.end_display_time, end,
                        end <= 0 ? ", dropping it" : "");
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 18/27] fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (15 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 17/27] fftools/ffmpeg: do not log to the decoder context Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 19/27] fftools/ffmpeg_opt: reduce indentation in map_auto_video() Anton Khirnov
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 84 ++++++++++++++++++++++++--------------------
 1 file changed, 46 insertions(+), 38 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index e6f2fb597a..4d2cd13107 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2495,6 +2495,50 @@ static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_si
     return 0;
 }
 
+static void map_auto_video(OutputFile *of, AVFormatContext *oc,
+                           OptionsContext *o)
+{
+    InputStream *ist;
+
+        /* video: highest resolution */
+        if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) {
+            int best_score = 0, idx = -1;
+            int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
+            for (int j = 0; j < nb_input_files; j++) {
+                InputFile *ifile = input_files[j];
+                int file_best_score = 0, file_best_idx = -1;
+                for (int i = 0; i < ifile->nb_streams; i++) {
+                    int score;
+                    ist = input_streams[ifile->ist_index + i];
+                    score = ist->st->codecpar->width * ist->st->codecpar->height
+                               + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
+                               + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
+                    if (ist->user_set_discard == AVDISCARD_ALL)
+                        continue;
+                    if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                        score = 1;
+                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+                        score > file_best_score) {
+                        if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                            continue;
+                        file_best_score = score;
+                        file_best_idx = ifile->ist_index + i;
+                    }
+                }
+                if (file_best_idx >= 0) {
+                    if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                        file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
+                    if (file_best_score > best_score) {
+                        best_score = file_best_score;
+                        idx = file_best_idx;
+                    }
+               }
+            }
+            if (idx >= 0)
+                new_video_stream(o, oc, idx);
+        }
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
@@ -2573,44 +2617,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
     if (!o->nb_stream_maps) {
         char *subtitle_codec_name = NULL;
         /* pick the "best" stream of each type */
-
-        /* video: highest resolution */
-        if (!o->video_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) {
-            int best_score = 0, idx = -1;
-            int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
-            for (j = 0; j < nb_input_files; j++) {
-                InputFile *ifile = input_files[j];
-                int file_best_score = 0, file_best_idx = -1;
-                for (i = 0; i < ifile->nb_streams; i++) {
-                    int score;
-                    ist = input_streams[ifile->ist_index + i];
-                    score = ist->st->codecpar->width * ist->st->codecpar->height
-                               + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
-                               + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (ist->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                        score = 1;
-                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-                        score > file_best_score) {
-                        if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                            continue;
-                        file_best_score = score;
-                        file_best_idx = ifile->ist_index + i;
-                    }
-                }
-                if (file_best_idx >= 0) {
-                    if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                        file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (file_best_score > best_score) {
-                        best_score = file_best_score;
-                        idx = file_best_idx;
-                    }
-               }
-            }
-            if (idx >= 0)
-                new_video_stream(o, oc, idx);
-        }
+        if (!o->video_disable)
+            map_auto_video(of, oc, o);
 
         /* audio: most channels */
         if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 19/27] fftools/ffmpeg_opt: reduce indentation in map_auto_video()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (16 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 18/27] fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 20/27] fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file() Anton Khirnov
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
---
 fftools/ffmpeg_opt.c | 72 +++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 35 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 4d2cd13107..9b08c68ec5 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2499,44 +2499,46 @@ static void map_auto_video(OutputFile *of, AVFormatContext *oc,
                            OptionsContext *o)
 {
     InputStream *ist;
+    int best_score = 0, idx = -1;
+    int qcr;
 
-        /* video: highest resolution */
-        if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) {
-            int best_score = 0, idx = -1;
-            int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
-            for (int j = 0; j < nb_input_files; j++) {
-                InputFile *ifile = input_files[j];
-                int file_best_score = 0, file_best_idx = -1;
-                for (int i = 0; i < ifile->nb_streams; i++) {
-                    int score;
-                    ist = input_streams[ifile->ist_index + i];
-                    score = ist->st->codecpar->width * ist->st->codecpar->height
-                               + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
-                               + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (ist->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                        score = 1;
-                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-                        score > file_best_score) {
-                        if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                            continue;
-                        file_best_score = score;
-                        file_best_idx = ifile->ist_index + i;
-                    }
-                }
-                if (file_best_idx >= 0) {
-                    if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                        file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (file_best_score > best_score) {
-                        best_score = file_best_score;
-                        idx = file_best_idx;
-                    }
-               }
+    /* video: highest resolution */
+    if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_VIDEO) == AV_CODEC_ID_NONE)
+        return;
+
+    qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
+    for (int j = 0; j < nb_input_files; j++) {
+        InputFile *ifile = input_files[j];
+        int file_best_score = 0, file_best_idx = -1;
+        for (int i = 0; i < ifile->nb_streams; i++) {
+            int score;
+            ist = input_streams[ifile->ist_index + i];
+            score = ist->st->codecpar->width * ist->st->codecpar->height
+                       + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
+                       + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
+            if (ist->user_set_discard == AVDISCARD_ALL)
+                continue;
+            if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                score = 1;
+            if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+                score > file_best_score) {
+                if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                    continue;
+                file_best_score = score;
+                file_best_idx = ifile->ist_index + i;
             }
-            if (idx >= 0)
-                new_video_stream(o, oc, idx);
         }
+        if (file_best_idx >= 0) {
+            if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+                file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
+            if (file_best_score > best_score) {
+                best_score = file_best_score;
+                idx = file_best_idx;
+            }
+       }
+    }
+    if (idx >= 0)
+        new_video_stream(o, oc, idx);
 }
 
 static int open_output_file(OptionsContext *o, const char *filename)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 20/27] fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (17 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 19/27] fftools/ffmpeg_opt: reduce indentation in map_auto_video() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 21/27] fftools/ffmpeg_opt: reduce indentation in map_auto_audio() Anton Khirnov
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 71 +++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 31 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 9b08c68ec5..e426768f7c 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2541,6 +2541,44 @@ static void map_auto_video(OutputFile *of, AVFormatContext *oc,
         new_video_stream(o, oc, idx);
 }
 
+static void map_auto_audio(OutputFile *of, AVFormatContext *oc,
+                           OptionsContext *o)
+{
+    InputStream *ist;
+
+        /* audio: most channels */
+        if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
+            int best_score = 0, idx = -1;
+            for (int j = 0; j < nb_input_files; j++) {
+                InputFile *ifile = input_files[j];
+                int file_best_score = 0, file_best_idx = -1;
+                for (int i = 0; i < ifile->nb_streams; i++) {
+                    int score;
+                    ist = input_streams[ifile->ist_index + i];
+                    score = ist->st->codecpar->ch_layout.nb_channels
+                            + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
+                            + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
+                    if (ist->user_set_discard == AVDISCARD_ALL)
+                        continue;
+                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
+                        score > file_best_score) {
+                        file_best_score = score;
+                        file_best_idx = ifile->ist_index + i;
+                    }
+                }
+                if (file_best_idx >= 0) {
+                    file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
+                    if (file_best_score > best_score) {
+                        best_score = file_best_score;
+                        idx = file_best_idx;
+                    }
+               }
+            }
+            if (idx >= 0)
+                new_audio_stream(o, oc, idx);
+        }
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
@@ -2621,38 +2659,9 @@ static int open_output_file(OptionsContext *o, const char *filename)
         /* pick the "best" stream of each type */
         if (!o->video_disable)
             map_auto_video(of, oc, o);
+        if (!o->audio_disable)
+            map_auto_audio(of, oc, o);
 
-        /* audio: most channels */
-        if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
-            int best_score = 0, idx = -1;
-            for (j = 0; j < nb_input_files; j++) {
-                InputFile *ifile = input_files[j];
-                int file_best_score = 0, file_best_idx = -1;
-                for (i = 0; i < ifile->nb_streams; i++) {
-                    int score;
-                    ist = input_streams[ifile->ist_index + i];
-                    score = ist->st->codecpar->ch_layout.nb_channels
-                            + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
-                            + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (ist->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
-                        score > file_best_score) {
-                        file_best_score = score;
-                        file_best_idx = ifile->ist_index + i;
-                    }
-                }
-                if (file_best_idx >= 0) {
-                    file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (file_best_score > best_score) {
-                        best_score = file_best_score;
-                        idx = file_best_idx;
-                    }
-               }
-            }
-            if (idx >= 0)
-                new_audio_stream(o, oc, idx);
-        }
 
         /* subtitles: pick first */
         MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 21/27] fftools/ffmpeg_opt: reduce indentation in map_auto_audio()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (18 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 20/27] fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 22/27] fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file() Anton Khirnov
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
---
 fftools/ffmpeg_opt.c | 57 ++++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index e426768f7c..174b1dd0eb 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2545,38 +2545,39 @@ static void map_auto_audio(OutputFile *of, AVFormatContext *oc,
                            OptionsContext *o)
 {
     InputStream *ist;
+    int best_score = 0, idx = -1;
 
         /* audio: most channels */
-        if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
-            int best_score = 0, idx = -1;
-            for (int j = 0; j < nb_input_files; j++) {
-                InputFile *ifile = input_files[j];
-                int file_best_score = 0, file_best_idx = -1;
-                for (int i = 0; i < ifile->nb_streams; i++) {
-                    int score;
-                    ist = input_streams[ifile->ist_index + i];
-                    score = ist->st->codecpar->ch_layout.nb_channels
-                            + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
-                            + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (ist->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
-                        score > file_best_score) {
-                        file_best_score = score;
-                        file_best_idx = ifile->ist_index + i;
-                    }
-                }
-                if (file_best_idx >= 0) {
-                    file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
-                    if (file_best_score > best_score) {
-                        best_score = file_best_score;
-                        idx = file_best_idx;
-                    }
-               }
+    if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_AUDIO) == AV_CODEC_ID_NONE)
+        return;
+
+    for (int j = 0; j < nb_input_files; j++) {
+        InputFile *ifile = input_files[j];
+        int file_best_score = 0, file_best_idx = -1;
+        for (int i = 0; i < ifile->nb_streams; i++) {
+            int score;
+            ist = input_streams[ifile->ist_index + i];
+            score = ist->st->codecpar->ch_layout.nb_channels
+                    + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
+                    + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
+            if (ist->user_set_discard == AVDISCARD_ALL)
+                continue;
+            if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
+                score > file_best_score) {
+                file_best_score = score;
+                file_best_idx = ifile->ist_index + i;
             }
-            if (idx >= 0)
-                new_audio_stream(o, oc, idx);
         }
+        if (file_best_idx >= 0) {
+            file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
+            if (file_best_score > best_score) {
+                best_score = file_best_score;
+                idx = file_best_idx;
+            }
+       }
+    }
+    if (idx >= 0)
+        new_audio_stream(o, oc, idx);
 }
 
 static int open_output_file(OptionsContext *o, const char *filename)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 22/27] fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (19 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 21/27] fftools/ffmpeg_opt: reduce indentation in map_auto_audio() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 23/27] fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle() Anton Khirnov
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 70 ++++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 32 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 174b1dd0eb..da74b0265a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2580,6 +2580,42 @@ static void map_auto_audio(OutputFile *of, AVFormatContext *oc,
         new_audio_stream(o, oc, idx);
 }
 
+static void map_auto_subtitle(OutputFile *of, AVFormatContext *oc,
+                              OptionsContext *o)
+{
+        char *subtitle_codec_name = NULL;
+        /* subtitles: pick first */
+        MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
+        if ((avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
+            for (int i = 0; i < nb_input_streams; i++)
+                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+                    AVCodecDescriptor const *input_descriptor =
+                        avcodec_descriptor_get(input_streams[i]->st->codecpar->codec_id);
+                    AVCodecDescriptor const *output_descriptor = NULL;
+                    AVCodec const *output_codec =
+                        avcodec_find_encoder(oc->oformat->subtitle_codec);
+                    int input_props = 0, output_props = 0;
+                    if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
+                        continue;
+                    if (output_codec)
+                        output_descriptor = avcodec_descriptor_get(output_codec->id);
+                    if (input_descriptor)
+                        input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
+                    if (output_descriptor)
+                        output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
+                    if (subtitle_codec_name ||
+                        input_props & output_props ||
+                        // Map dvb teletext which has neither property to any output subtitle encoder
+                        input_descriptor && output_descriptor &&
+                        (!input_descriptor->props ||
+                         !output_descriptor->props)) {
+                        new_subtitle_stream(o, oc, i);
+                        break;
+                    }
+                }
+        }
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
@@ -2656,44 +2692,14 @@ static int open_output_file(OptionsContext *o, const char *filename)
     }
 
     if (!o->nb_stream_maps) {
-        char *subtitle_codec_name = NULL;
         /* pick the "best" stream of each type */
         if (!o->video_disable)
             map_auto_video(of, oc, o);
         if (!o->audio_disable)
             map_auto_audio(of, oc, o);
+        if (!o->subtitle_disable)
+            map_auto_subtitle(of, oc, o);
 
-
-        /* subtitles: pick first */
-        MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
-        if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
-            for (i = 0; i < nb_input_streams; i++)
-                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-                    AVCodecDescriptor const *input_descriptor =
-                        avcodec_descriptor_get(input_streams[i]->st->codecpar->codec_id);
-                    AVCodecDescriptor const *output_descriptor = NULL;
-                    AVCodec const *output_codec =
-                        avcodec_find_encoder(oc->oformat->subtitle_codec);
-                    int input_props = 0, output_props = 0;
-                    if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if (output_codec)
-                        output_descriptor = avcodec_descriptor_get(output_codec->id);
-                    if (input_descriptor)
-                        input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-                    if (output_descriptor)
-                        output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-                    if (subtitle_codec_name ||
-                        input_props & output_props ||
-                        // Map dvb teletext which has neither property to any output subtitle encoder
-                        input_descriptor && output_descriptor &&
-                        (!input_descriptor->props ||
-                         !output_descriptor->props)) {
-                        new_subtitle_stream(o, oc, i);
-                        break;
-                    }
-                }
-        }
         /* Data only if codec id match */
         if (!o->data_disable ) {
             enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA);
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 23/27] fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (20 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 22/27] fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 24/27] fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file() Anton Khirnov
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
---
 fftools/ffmpeg_opt.c | 60 +++++++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index da74b0265a..04f4abb88a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2583,36 +2583,38 @@ static void map_auto_audio(OutputFile *of, AVFormatContext *oc,
 static void map_auto_subtitle(OutputFile *of, AVFormatContext *oc,
                               OptionsContext *o)
 {
-        char *subtitle_codec_name = NULL;
+    char *subtitle_codec_name = NULL;
+
         /* subtitles: pick first */
-        MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
-        if ((avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
-            for (int i = 0; i < nb_input_streams; i++)
-                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-                    AVCodecDescriptor const *input_descriptor =
-                        avcodec_descriptor_get(input_streams[i]->st->codecpar->codec_id);
-                    AVCodecDescriptor const *output_descriptor = NULL;
-                    AVCodec const *output_codec =
-                        avcodec_find_encoder(oc->oformat->subtitle_codec);
-                    int input_props = 0, output_props = 0;
-                    if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
-                        continue;
-                    if (output_codec)
-                        output_descriptor = avcodec_descriptor_get(output_codec->id);
-                    if (input_descriptor)
-                        input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-                    if (output_descriptor)
-                        output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-                    if (subtitle_codec_name ||
-                        input_props & output_props ||
-                        // Map dvb teletext which has neither property to any output subtitle encoder
-                        input_descriptor && output_descriptor &&
-                        (!input_descriptor->props ||
-                         !output_descriptor->props)) {
-                        new_subtitle_stream(o, oc, i);
-                        break;
-                    }
-                }
+    MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
+    if (!avcodec_find_encoder(oc->oformat->subtitle_codec) && !subtitle_codec_name)
+        return;
+
+    for (int i = 0; i < nb_input_streams; i++)
+        if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+            AVCodecDescriptor const *input_descriptor =
+                avcodec_descriptor_get(input_streams[i]->st->codecpar->codec_id);
+            AVCodecDescriptor const *output_descriptor = NULL;
+            AVCodec const *output_codec =
+                avcodec_find_encoder(oc->oformat->subtitle_codec);
+            int input_props = 0, output_props = 0;
+            if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
+                continue;
+            if (output_codec)
+                output_descriptor = avcodec_descriptor_get(output_codec->id);
+            if (input_descriptor)
+                input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
+            if (output_descriptor)
+                output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
+            if (subtitle_codec_name ||
+                input_props & output_props ||
+                // Map dvb teletext which has neither property to any output subtitle encoder
+                input_descriptor && output_descriptor &&
+                (!input_descriptor->props ||
+                 !output_descriptor->props)) {
+                new_subtitle_stream(o, oc, i);
+                break;
+            }
         }
 }
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 24/27] fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (21 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 23/27] fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 25/27] fftools/ffmpeg_opt: reindent Anton Khirnov
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 04f4abb88a..287527f478 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2618,6 +2618,20 @@ static void map_auto_subtitle(OutputFile *of, AVFormatContext *oc,
         }
 }
 
+static void map_auto_data(OutputFile *of, AVFormatContext *oc,
+                          OptionsContext *o)
+{
+        /* Data only if codec id match */
+            enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_DATA);
+            for (int i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
+                if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
+                    continue;
+                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_DATA
+                    && input_streams[i]->st->codecpar->codec_id == codec_id )
+                    new_data_stream(o, oc, i);
+            }
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
@@ -2701,18 +2715,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
             map_auto_audio(of, oc, o);
         if (!o->subtitle_disable)
             map_auto_subtitle(of, oc, o);
-
-        /* Data only if codec id match */
-        if (!o->data_disable ) {
-            enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA);
-            for (i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
-                if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
-                    continue;
-                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_DATA
-                    && input_streams[i]->st->codecpar->codec_id == codec_id )
-                    new_data_stream(o, oc, i);
-            }
-        }
+        if (!o->data_disable)
+            map_auto_data(of, oc, o);
     } else {
         for (i = 0; i < o->nb_stream_maps; i++) {
             StreamMap *map = &o->stream_maps[i];
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 25/27] fftools/ffmpeg_opt: reindent
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (22 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 24/27] fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 26/27] fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file() Anton Khirnov
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 287527f478..a472b254cb 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2621,15 +2621,15 @@ static void map_auto_subtitle(OutputFile *of, AVFormatContext *oc,
 static void map_auto_data(OutputFile *of, AVFormatContext *oc,
                           OptionsContext *o)
 {
-        /* Data only if codec id match */
-            enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_DATA);
-            for (int i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
-                if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
-                    continue;
-                if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_DATA
-                    && input_streams[i]->st->codecpar->codec_id == codec_id )
-                    new_data_stream(o, oc, i);
-            }
+    /* Data only if codec id match */
+    enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_DATA);
+    for (int i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
+        if (input_streams[i]->user_set_discard == AVDISCARD_ALL)
+            continue;
+        if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_DATA
+            && input_streams[i]->st->codecpar->codec_id == codec_id )
+            new_data_stream(o, oc, i);
+    }
 }
 
 static int open_output_file(OptionsContext *o, const char *filename)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 26/27] fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file()
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (23 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 25/27] fftools/ffmpeg_opt: reindent Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 27/27] fftools/ffmpeg_opt: reindent Anton Khirnov
  2022-07-23 15:21 ` [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Andreas Rheinhardt
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 157 ++++++++++++++++++++++---------------------
 1 file changed, 81 insertions(+), 76 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index a472b254cb..672ac87b3e 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2632,13 +2632,91 @@ static void map_auto_data(OutputFile *of, AVFormatContext *oc,
     }
 }
 
+static void map_manual(OutputFile *of, AVFormatContext *oc,
+                       OptionsContext *o, const StreamMap *map)
+{
+            InputStream *ist;
+            OutputStream *ost;
+
+            if (map->disabled)
+                return;
+
+            if (map->linklabel) {
+                FilterGraph *fg;
+                OutputFilter *ofilter = NULL;
+                int j, k;
+
+                for (j = 0; j < nb_filtergraphs; j++) {
+                    fg = filtergraphs[j];
+                    for (k = 0; k < fg->nb_outputs; k++) {
+                        AVFilterInOut *out = fg->outputs[k]->out_tmp;
+                        if (out && !strcmp(out->name, map->linklabel)) {
+                            ofilter = fg->outputs[k];
+                            goto loop_end;
+                        }
+                    }
+                }
+loop_end:
+                if (!ofilter) {
+                    av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist "
+                           "in any defined filter graph, or was already used elsewhere.\n", map->linklabel);
+                    exit_program(1);
+                }
+                init_output_filter(ofilter, o, oc);
+            } else {
+                int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
+
+                ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
+                if (ist->user_set_discard == AVDISCARD_ALL) {
+                    av_log(NULL, AV_LOG_FATAL, "Stream #%d:%d is disabled and cannot be mapped.\n",
+                           map->file_index, map->stream_index);
+                    exit_program(1);
+                }
+                if(o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
+                    return;
+                if(o->   audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
+                    return;
+                if(o->   video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
+                    return;
+                if(o->    data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
+                    return;
+
+                ost = NULL;
+                switch (ist->st->codecpar->codec_type) {
+                case AVMEDIA_TYPE_VIDEO:      ost = new_video_stream     (o, oc, src_idx); break;
+                case AVMEDIA_TYPE_AUDIO:      ost = new_audio_stream     (o, oc, src_idx); break;
+                case AVMEDIA_TYPE_SUBTITLE:   ost = new_subtitle_stream  (o, oc, src_idx); break;
+                case AVMEDIA_TYPE_DATA:       ost = new_data_stream      (o, oc, src_idx); break;
+                case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
+                case AVMEDIA_TYPE_UNKNOWN:
+                    if (copy_unknown_streams) {
+                        ost = new_unknown_stream   (o, oc, src_idx);
+                        break;
+                    }
+                default:
+                    av_log(NULL, ignore_unknown_streams ? AV_LOG_WARNING : AV_LOG_FATAL,
+                           "Cannot map stream #%d:%d - unsupported type.\n",
+                           map->file_index, map->stream_index);
+                    if (!ignore_unknown_streams) {
+                        av_log(NULL, AV_LOG_FATAL,
+                               "If you want unsupported types ignored instead "
+                               "of failing, please use the -ignore_unknown option\n"
+                               "If you want them copied, please use -copy_unknown\n");
+                        exit_program(1);
+                    }
+                }
+                if (ost)
+                    ost->sync_ist = input_streams[  input_files[map->sync_file_index]->ist_index
+                                                  + map->sync_stream_index];
+            }
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
     int i, j, err;
     OutputFile *of;
     OutputStream *ost;
-    InputStream  *ist;
     AVDictionary *unused_opts = NULL, *format_opts = NULL;
     const AVDictionaryEntry *e = NULL;
 
@@ -2718,81 +2796,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
         if (!o->data_disable)
             map_auto_data(of, oc, o);
     } else {
-        for (i = 0; i < o->nb_stream_maps; i++) {
-            StreamMap *map = &o->stream_maps[i];
-
-            if (map->disabled)
-                continue;
-
-            if (map->linklabel) {
-                FilterGraph *fg;
-                OutputFilter *ofilter = NULL;
-                int j, k;
-
-                for (j = 0; j < nb_filtergraphs; j++) {
-                    fg = filtergraphs[j];
-                    for (k = 0; k < fg->nb_outputs; k++) {
-                        AVFilterInOut *out = fg->outputs[k]->out_tmp;
-                        if (out && !strcmp(out->name, map->linklabel)) {
-                            ofilter = fg->outputs[k];
-                            goto loop_end;
-                        }
-                    }
-                }
-loop_end:
-                if (!ofilter) {
-                    av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist "
-                           "in any defined filter graph, or was already used elsewhere.\n", map->linklabel);
-                    exit_program(1);
-                }
-                init_output_filter(ofilter, o, oc);
-            } else {
-                int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
-
-                ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
-                if (ist->user_set_discard == AVDISCARD_ALL) {
-                    av_log(NULL, AV_LOG_FATAL, "Stream #%d:%d is disabled and cannot be mapped.\n",
-                           map->file_index, map->stream_index);
-                    exit_program(1);
-                }
-                if(o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
-                    continue;
-                if(o->   audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
-                    continue;
-                if(o->   video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
-                    continue;
-                if(o->    data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
-                    continue;
-
-                ost = NULL;
-                switch (ist->st->codecpar->codec_type) {
-                case AVMEDIA_TYPE_VIDEO:      ost = new_video_stream     (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_AUDIO:      ost = new_audio_stream     (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_SUBTITLE:   ost = new_subtitle_stream  (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_DATA:       ost = new_data_stream      (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
-                case AVMEDIA_TYPE_UNKNOWN:
-                    if (copy_unknown_streams) {
-                        ost = new_unknown_stream   (o, oc, src_idx);
-                        break;
-                    }
-                default:
-                    av_log(NULL, ignore_unknown_streams ? AV_LOG_WARNING : AV_LOG_FATAL,
-                           "Cannot map stream #%d:%d - unsupported type.\n",
-                           map->file_index, map->stream_index);
-                    if (!ignore_unknown_streams) {
-                        av_log(NULL, AV_LOG_FATAL,
-                               "If you want unsupported types ignored instead "
-                               "of failing, please use the -ignore_unknown option\n"
-                               "If you want them copied, please use -copy_unknown\n");
-                        exit_program(1);
-                    }
-                }
-                if (ost)
-                    ost->sync_ist = input_streams[  input_files[map->sync_file_index]->ist_index
-                                                  + map->sync_stream_index];
-            }
-        }
+        for (int i = 0; i < o->nb_stream_maps; i++)
+            map_manual(of, oc, o, &o->stream_maps[i]);
     }
 
     /* handle attached files */
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [FFmpeg-devel] [PATCH 27/27] fftools/ffmpeg_opt: reindent
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (24 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 26/27] fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file() Anton Khirnov
@ 2022-07-23 14:09 ` Anton Khirnov
  2022-07-23 15:21 ` [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Andreas Rheinhardt
  26 siblings, 0 replies; 28+ messages in thread
From: Anton Khirnov @ 2022-07-23 14:09 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg_opt.c | 140 +++++++++++++++++++++----------------------
 1 file changed, 70 insertions(+), 70 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 672ac87b3e..d7049069f4 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2635,80 +2635,80 @@ static void map_auto_data(OutputFile *of, AVFormatContext *oc,
 static void map_manual(OutputFile *of, AVFormatContext *oc,
                        OptionsContext *o, const StreamMap *map)
 {
-            InputStream *ist;
-            OutputStream *ost;
-
-            if (map->disabled)
-                return;
-
-            if (map->linklabel) {
-                FilterGraph *fg;
-                OutputFilter *ofilter = NULL;
-                int j, k;
-
-                for (j = 0; j < nb_filtergraphs; j++) {
-                    fg = filtergraphs[j];
-                    for (k = 0; k < fg->nb_outputs; k++) {
-                        AVFilterInOut *out = fg->outputs[k]->out_tmp;
-                        if (out && !strcmp(out->name, map->linklabel)) {
-                            ofilter = fg->outputs[k];
-                            goto loop_end;
-                        }
-                    }
+    InputStream *ist;
+    OutputStream *ost;
+
+    if (map->disabled)
+        return;
+
+    if (map->linklabel) {
+        FilterGraph *fg;
+        OutputFilter *ofilter = NULL;
+        int j, k;
+
+        for (j = 0; j < nb_filtergraphs; j++) {
+            fg = filtergraphs[j];
+            for (k = 0; k < fg->nb_outputs; k++) {
+                AVFilterInOut *out = fg->outputs[k]->out_tmp;
+                if (out && !strcmp(out->name, map->linklabel)) {
+                    ofilter = fg->outputs[k];
+                    goto loop_end;
                 }
+            }
+        }
 loop_end:
-                if (!ofilter) {
-                    av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist "
-                           "in any defined filter graph, or was already used elsewhere.\n", map->linklabel);
-                    exit_program(1);
-                }
-                init_output_filter(ofilter, o, oc);
-            } else {
-                int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
+        if (!ofilter) {
+            av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist "
+                   "in any defined filter graph, or was already used elsewhere.\n", map->linklabel);
+            exit_program(1);
+        }
+        init_output_filter(ofilter, o, oc);
+    } else {
+        int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
 
-                ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
-                if (ist->user_set_discard == AVDISCARD_ALL) {
-                    av_log(NULL, AV_LOG_FATAL, "Stream #%d:%d is disabled and cannot be mapped.\n",
-                           map->file_index, map->stream_index);
-                    exit_program(1);
-                }
-                if(o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
-                    return;
-                if(o->   audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
-                    return;
-                if(o->   video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
-                    return;
-                if(o->    data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
-                    return;
-
-                ost = NULL;
-                switch (ist->st->codecpar->codec_type) {
-                case AVMEDIA_TYPE_VIDEO:      ost = new_video_stream     (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_AUDIO:      ost = new_audio_stream     (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_SUBTITLE:   ost = new_subtitle_stream  (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_DATA:       ost = new_data_stream      (o, oc, src_idx); break;
-                case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
-                case AVMEDIA_TYPE_UNKNOWN:
-                    if (copy_unknown_streams) {
-                        ost = new_unknown_stream   (o, oc, src_idx);
-                        break;
-                    }
-                default:
-                    av_log(NULL, ignore_unknown_streams ? AV_LOG_WARNING : AV_LOG_FATAL,
-                           "Cannot map stream #%d:%d - unsupported type.\n",
-                           map->file_index, map->stream_index);
-                    if (!ignore_unknown_streams) {
-                        av_log(NULL, AV_LOG_FATAL,
-                               "If you want unsupported types ignored instead "
-                               "of failing, please use the -ignore_unknown option\n"
-                               "If you want them copied, please use -copy_unknown\n");
-                        exit_program(1);
-                    }
-                }
-                if (ost)
-                    ost->sync_ist = input_streams[  input_files[map->sync_file_index]->ist_index
-                                                  + map->sync_stream_index];
+        ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
+        if (ist->user_set_discard == AVDISCARD_ALL) {
+            av_log(NULL, AV_LOG_FATAL, "Stream #%d:%d is disabled and cannot be mapped.\n",
+                   map->file_index, map->stream_index);
+            exit_program(1);
+        }
+        if(o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
+            return;
+        if(o->   audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
+            return;
+        if(o->   video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
+            return;
+        if(o->    data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
+            return;
+
+        ost = NULL;
+        switch (ist->st->codecpar->codec_type) {
+        case AVMEDIA_TYPE_VIDEO:      ost = new_video_stream     (o, oc, src_idx); break;
+        case AVMEDIA_TYPE_AUDIO:      ost = new_audio_stream     (o, oc, src_idx); break;
+        case AVMEDIA_TYPE_SUBTITLE:   ost = new_subtitle_stream  (o, oc, src_idx); break;
+        case AVMEDIA_TYPE_DATA:       ost = new_data_stream      (o, oc, src_idx); break;
+        case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
+        case AVMEDIA_TYPE_UNKNOWN:
+            if (copy_unknown_streams) {
+                ost = new_unknown_stream   (o, oc, src_idx);
+                break;
+            }
+        default:
+            av_log(NULL, ignore_unknown_streams ? AV_LOG_WARNING : AV_LOG_FATAL,
+                   "Cannot map stream #%d:%d - unsupported type.\n",
+                   map->file_index, map->stream_index);
+            if (!ignore_unknown_streams) {
+                av_log(NULL, AV_LOG_FATAL,
+                       "If you want unsupported types ignored instead "
+                       "of failing, please use the -ignore_unknown option\n"
+                       "If you want them copied, please use -copy_unknown\n");
+                exit_program(1);
             }
+        }
+        if (ost)
+            ost->sync_ist = input_streams[  input_files[map->sync_file_index]->ist_index
+                                          + map->sync_stream_index];
+    }
 }
 
 static int open_output_file(OptionsContext *o, const char *filename)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration
  2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
                   ` (25 preceding siblings ...)
  2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 27/27] fftools/ffmpeg_opt: reindent Anton Khirnov
@ 2022-07-23 15:21 ` Andreas Rheinhardt
  26 siblings, 0 replies; 28+ messages in thread
From: Andreas Rheinhardt @ 2022-07-23 15:21 UTC (permalink / raw)
  To: ffmpeg-devel

Anton Khirnov:
> Mistakenly reintroduced in 4740fea7ddf.
> ---
>  fftools/ffmpeg.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 632ac25cb2..841dd6f08a 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -1216,18 +1216,18 @@ static void do_video_out(OutputFile *of,
>                  if (delta0 > 1.1)
>                      nb0_frames = llrintf(delta0 - 0.6);
>              }
> -            next_picture->pkt_duration = 1;
> +            next_picture->duration = 1;
>              break;
>          case VSYNC_VFR:
>              if (delta <= -0.6)
>                  nb_frames = 0;
>              else if (delta > 0.6)
>                  ost->sync_opts = llrint(sync_ipts);
> -            next_picture->pkt_duration = duration;
> +            next_picture->duration = duration;
>              break;
>          case VSYNC_DROP:
>          case VSYNC_PASSTHROUGH:
> -            next_picture->pkt_duration = duration;
> +            next_picture->duration = duration;
>              ost->sync_opts = llrint(sync_ipts);
>              break;
>          default:

Please apply this ASAP.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2022-07-23 15:21 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 14:09 [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 02/27] fftools/ffmpeg: stop accessing the encoder context unnecessarily Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 03/27] fftools/ffmpeg: remove an unnecessary avcodec_close() call Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 04/27] fftools/ffmpeg_filter: remove unused function argument Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 06/27] fftools/ffmpeg: drop the -vol option Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 07/27] fftools/ffmpeg: drop OutputStream.ref_par Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 08/27] fftools/ffmpeg: do not use the encoder context for streamcopy Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: deprecate -psnr Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 10/27] fftools/ffmpeg: stop allocating an encoder context when not encoding Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 11/27] fftools/ffmpeg_opt: drop a redundant assignment Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 12/27] fftools/ffmpeg: drop unused hwaccel variables Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 13/27] fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 14/27] fftools/ffmpeg: deprecate the -map_channel option Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 15/27] fftools/ffmpeg_filter: drop a block commented out since 2012 Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 16/27] fftools/ffmpeg_mux: move some functions closer to their only callers Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 17/27] fftools/ffmpeg: do not log to the decoder context Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 18/27] fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 19/27] fftools/ffmpeg_opt: reduce indentation in map_auto_video() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 20/27] fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 21/27] fftools/ffmpeg_opt: reduce indentation in map_auto_audio() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 22/27] fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 23/27] fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 24/27] fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 25/27] fftools/ffmpeg_opt: reindent Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 26/27] fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file() Anton Khirnov
2022-07-23 14:09 ` [FFmpeg-devel] [PATCH 27/27] fftools/ffmpeg_opt: reindent Anton Khirnov
2022-07-23 15:21 ` [FFmpeg-devel] [PATCH 01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git