diff options
author | Jun Zhao <barryjzhao@tencent.com> | 2020-09-25 19:23:54 +0800 |
---|---|---|
committer | Jun Zhao <barryjzhao@tencent.com> | 2020-09-28 09:11:21 +0800 |
commit | ef868fa4a1e2803e22382ca907ebb384867f82b6 (patch) | |
tree | 24885d268f2252e707362f3eeb7ded9c598cc8d7 /doc | |
parent | 6db1b1af4c93c98c31e8f2dc546647d77c0bdb5f (diff) |
examples/muxing: misc style fixes
misc style fixes.
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/muxing.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index bd16486a24..42f704c258 100644 --- a/doc/examples/muxing.c +++ b/doc/examples/muxing.c @@ -200,7 +200,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc, * the motion of the chroma plane does not match the luma plane. */ c->mb_decision = 2; } - break; + break; default: break; @@ -284,25 +284,25 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A } /* create resampler context */ - ost->swr_ctx = swr_alloc(); - if (!ost->swr_ctx) { - fprintf(stderr, "Could not allocate resampler context\n"); - exit(1); - } + ost->swr_ctx = swr_alloc(); + if (!ost->swr_ctx) { + fprintf(stderr, "Could not allocate resampler context\n"); + exit(1); + } - /* set options */ - av_opt_set_int (ost->swr_ctx, "in_channel_count", c->channels, 0); - av_opt_set_int (ost->swr_ctx, "in_sample_rate", c->sample_rate, 0); - av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); - av_opt_set_int (ost->swr_ctx, "out_channel_count", c->channels, 0); - av_opt_set_int (ost->swr_ctx, "out_sample_rate", c->sample_rate, 0); - av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0); - - /* initialize the resampling context */ - if ((ret = swr_init(ost->swr_ctx)) < 0) { - fprintf(stderr, "Failed to initialize the resampling context\n"); - exit(1); - } + /* set options */ + av_opt_set_int (ost->swr_ctx, "in_channel_count", c->channels, 0); + av_opt_set_int (ost->swr_ctx, "in_sample_rate", c->sample_rate, 0); + av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); + av_opt_set_int (ost->swr_ctx, "out_channel_count", c->channels, 0); + av_opt_set_int (ost->swr_ctx, "out_sample_rate", c->sample_rate, 0); + av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0); + + /* initialize the resampling context */ + if ((ret = swr_init(ost->swr_ctx)) < 0) { + fprintf(stderr, "Failed to initialize the resampling context\n"); + exit(1); + } } /* Prepare a 16 bit dummy audio frame of 'frame_size' samples and @@ -349,10 +349,10 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost) if (frame) { /* convert samples from native format to destination codec format, using the resampler */ - /* compute destination number of samples */ - dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples, - c->sample_rate, c->sample_rate, AV_ROUND_UP); - av_assert0(dst_nb_samples == frame->nb_samples); + /* compute destination number of samples */ + dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples, + c->sample_rate, c->sample_rate, AV_ROUND_UP); + av_assert0(dst_nb_samples == frame->nb_samples); /* when we pass a frame to the encoder, it may keep a reference to it * internally; @@ -519,7 +519,6 @@ static AVFrame *get_video_frame(OutputStream *ost) static int write_video_frame(AVFormatContext *oc, OutputStream *ost) { return write_frame(oc, ost->enc, ost->st, get_video_frame(ost)); - } static void close_stream(AVFormatContext *oc, OutputStream *ost) |