Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 13/23] fftools/ffmpeg: reindent after previous commit
Date: Sat, 25 Mar 2023 20:15:19 +0100
Message-ID: <20230325191529.10578-13-anton@khirnov.net> (raw)
In-Reply-To: <20230325191529.10578-1-anton@khirnov.net>

---
 fftools/ffmpeg.c | 142 +++++++++++++++++++++++------------------------
 1 file changed, 71 insertions(+), 71 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9ae3d3891f..5bfe465e97 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3179,92 +3179,92 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
     if (ost->bitexact)
         enc_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
 
-        if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
-            av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
+    if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
+        av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
 
-        if (enc->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE) {
-            ret = av_dict_set(&ost->encoder_opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
-            if (ret < 0)
-                return ret;
-        }
-
-        ret = hw_device_setup_for_encode(ost);
-        if (ret < 0) {
-            av_log(ost, AV_LOG_ERROR,
-                   "Encoding hardware device setup failed: %s\n", av_err2str(ret));
+    if (enc->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE) {
+        ret = av_dict_set(&ost->encoder_opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
+        if (ret < 0)
             return ret;
-        }
+    }
 
-        if ((ret = avcodec_open2(ost->enc_ctx, enc, &ost->encoder_opts)) < 0) {
-            if (ret == AVERROR_EXPERIMENTAL)
-                abort_codec_experimental(enc, 1);
-            av_log(ost, AV_LOG_ERROR, "Error while opening encoder - maybe "
-                   "incorrect parameters such as bit_rate, rate, width or height.\n");
-            return ret;
-        }
+    ret = hw_device_setup_for_encode(ost);
+    if (ret < 0) {
+        av_log(ost, AV_LOG_ERROR,
+               "Encoding hardware device setup failed: %s\n", av_err2str(ret));
+        return ret;
+    }
 
-        if (ost->enc_ctx->frame_size) {
-            av_assert0(ost->sq_idx_encode >= 0);
-            sq_frame_samples(output_files[ost->file_index]->sq_encode,
-                             ost->sq_idx_encode, ost->enc_ctx->frame_size);
-        }
+    if ((ret = avcodec_open2(ost->enc_ctx, enc, &ost->encoder_opts)) < 0) {
+        if (ret == AVERROR_EXPERIMENTAL)
+            abort_codec_experimental(enc, 1);
+        av_log(ost, AV_LOG_ERROR, "Error while opening encoder - maybe "
+               "incorrect parameters such as bit_rate, rate, width or height.\n");
+        return ret;
+    }
 
-        assert_avoptions(ost->encoder_opts);
-        if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000 &&
-            ost->enc_ctx->codec_id != AV_CODEC_ID_CODEC2 /* don't complain about 700 bit/s modes */)
-            av_log(ost, AV_LOG_WARNING, "The bitrate parameter is set too low."
-                                        " It takes bits/s as argument, not kbits/s\n");
+    if (ost->enc_ctx->frame_size) {
+        av_assert0(ost->sq_idx_encode >= 0);
+        sq_frame_samples(output_files[ost->file_index]->sq_encode,
+                         ost->sq_idx_encode, ost->enc_ctx->frame_size);
+    }
 
-        ret = avcodec_parameters_from_context(ost->st->codecpar, ost->enc_ctx);
-        if (ret < 0) {
-            av_log(ost, AV_LOG_FATAL,
-                   "Error initializing the output stream codec context.\n");
-            exit_program(1);
-        }
+    assert_avoptions(ost->encoder_opts);
+    if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000 &&
+        ost->enc_ctx->codec_id != AV_CODEC_ID_CODEC2 /* don't complain about 700 bit/s modes */)
+        av_log(ost, AV_LOG_WARNING, "The bitrate parameter is set too low."
+                                    " It takes bits/s as argument, not kbits/s\n");
 
-        if (ost->enc_ctx->nb_coded_side_data) {
-            int i;
+    ret = avcodec_parameters_from_context(ost->st->codecpar, ost->enc_ctx);
+    if (ret < 0) {
+        av_log(ost, AV_LOG_FATAL,
+               "Error initializing the output stream codec context.\n");
+        exit_program(1);
+    }
 
-            for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
-                const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i];
-                uint8_t *dst_data;
+    if (ost->enc_ctx->nb_coded_side_data) {
+        int i;
 
-                dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size);
-                if (!dst_data)
-                    return AVERROR(ENOMEM);
-                memcpy(dst_data, sd_src->data, sd_src->size);
-            }
+        for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
+            const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i];
+            uint8_t *dst_data;
+
+            dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size);
+            if (!dst_data)
+                return AVERROR(ENOMEM);
+            memcpy(dst_data, sd_src->data, sd_src->size);
         }
+    }
 
-        /*
-         * Add global input side data. For now this is naive, and copies it
-         * from the input stream's global side data. All side data should
-         * really be funneled over AVFrame and libavfilter, then added back to
-         * packet side data, and then potentially using the first packet for
-         * global side data.
-         */
-        if (ist) {
-            int i;
-            for (i = 0; i < ist->st->nb_side_data; i++) {
-                AVPacketSideData *sd = &ist->st->side_data[i];
-                if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
-                    uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, sd->size);
-                    if (!dst)
-                        return AVERROR(ENOMEM);
-                    memcpy(dst, sd->data, sd->size);
-                    if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
-                        av_display_rotation_set((int32_t *)dst, 0);
-                }
+    /*
+     * Add global input side data. For now this is naive, and copies it
+     * from the input stream's global side data. All side data should
+     * really be funneled over AVFrame and libavfilter, then added back to
+     * packet side data, and then potentially using the first packet for
+     * global side data.
+     */
+    if (ist) {
+        int i;
+        for (i = 0; i < ist->st->nb_side_data; i++) {
+            AVPacketSideData *sd = &ist->st->side_data[i];
+            if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
+                uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, sd->size);
+                if (!dst)
+                    return AVERROR(ENOMEM);
+                memcpy(dst, sd->data, sd->size);
+                if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
+                    av_display_rotation_set((int32_t *)dst, 0);
             }
         }
+    }
 
-        // copy timebase while removing common factors
-        if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
-            ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 1});
+    // copy timebase while removing common factors
+    if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
+        ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 1});
 
-        // copy estimated duration as a hint to the muxer
-        if (ost->st->duration <= 0 && ist && ist->st->duration > 0)
-            ost->st->duration = av_rescale_q(ist->st->duration, ist->st->time_base, ost->st->time_base);
+    // copy estimated duration as a hint to the muxer
+    if (ost->st->duration <= 0 && ist && ist->st->duration > 0)
+        ost->st->duration = av_rescale_q(ist->st->duration, ist->st->time_base, ost->st->time_base);
 
     ost->mux_timebase = enc_ctx->time_base;
 
-- 
2.39.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".

  parent reply	other threads:[~2023-03-25 19:17 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 19:15 [FFmpeg-devel] [PATCH 01/23] fftools/ffmpeg: drop InputStream.processing_needed Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 02/23] fftools/ffmpeg: move initializing next_[pd]ts to add_input_streams() Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 03/23] fftools/sync_queue: use timebase from input frames/packets Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 04/23] fftools/sync_queue: document overall design Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 05/23] fftools/sync_queue: support operation with no limiting streams Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 06/23] fftools/sync_queue: make sure audio duration matches sample count Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 07/23] fftools/sync_queue: allow requesting a specific number of audio samples Anton Khirnov
2023-03-29 23:41   ` James Almer
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 08/23] fftools/ffmpeg: use sync queues for enforcing audio frame size Anton Khirnov
2023-03-25 21:43   ` Michael Niedermayer
2023-03-27  5:15     ` [FFmpeg-devel] [PATCH] fftools/ffmpeg: do not return finished streams from choose_output() Anton Khirnov
2023-03-29 17:59       ` Michael Niedermayer
2023-03-30  8:48         ` Anton Khirnov
2023-04-02 15:58           ` Michael Niedermayer
2023-04-03 10:09             ` [FFmpeg-devel] [PATCH] fftools/ffmpeg: make sure non-lavfi streams are closed on input EOF Anton Khirnov
2023-04-05 22:33               ` Michael Niedermayer
2023-04-06  7:27                 ` Anton Khirnov
2023-03-29 18:08     ` [FFmpeg-devel] [PATCH 08/23] fftools/ffmpeg: use sync queues for enforcing audio frame size Michael Niedermayer
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 09/23] fftools/ffmpeg: stop handling AVMEDIA_TYPE_DATA in init_output_stream_encode() Anton Khirnov
2023-03-25 19:43   ` James Almer
2023-03-26  9:20     ` Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 10/23] fftools/ffmpeg: drop unnecessarily indirection Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 11/23] fftools/ffmpeg: use stack variables to shorten code Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 12/23] fftools/ffmpeg: move encoder initialization to init_output_stream_encode Anton Khirnov
2023-03-25 19:15 ` Anton Khirnov [this message]
2023-03-28 22:42   ` [FFmpeg-devel] [PATCH 13/23] fftools/ffmpeg: reindent after previous commit Michael Niedermayer
2023-03-29  0:16     ` Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 14/23] fftools/ffmpeg: move initializing encoders to a new file Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 15/23] fftools/ffmpeg: simplify output stream initialization call graph Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 16/23] fftools/ffmpeg: replace ff_dlog() with av_log() Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 17/23] fftools/ffmpeg: move subtitle encoding to ffmpeg_enc.c Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 18/23] fftools/ffmpeg: move audio/video encoding code " Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 19/23] fftools/ffmpeg: add encoder private data Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 20/23] fftools/ffmpeg: stop including os_support.h Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 21/23] fftools/ffmpeg: clean up system header includes Anton Khirnov
2023-03-27  5:35   ` Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 22/23] fftools/ffmpeg: clean up local includes Anton Khirnov
2023-03-25 19:15 ` [FFmpeg-devel] [PATCH 23/23] fftools/ffmpeg_enc: factorize calling enc_init() Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230325191529.10578-13-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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