* [FFmpeg-devel] [PATCH 2/2] lavf/movenc: small cleanup for style
2024-03-22 10:35 [FFmpeg-devel] [PATCH 1/2] lavc/vvc_parser: small cleanup for style Jun Zhao
@ 2024-03-22 10:35 ` Jun Zhao
2024-03-23 15:03 ` [FFmpeg-devel] [PATCH 1/2] lavc/vvc_parser: " Nuo Mi
1 sibling, 0 replies; 3+ messages in thread
From: Jun Zhao @ 2024-03-22 10:35 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Jun Zhao, Jun Zhao
From: Jun Zhao <mypopydev@gmail.com>
Small cleanup for style, indent, switch case lables.
BTW, the preferred way to ease multiple indentation levels in a
switch statement is to align the switch and its subordinate
case labels in the same column
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
libavformat/movenc.c | 71 ++++++++++++++++++++++----------------------
1 file changed, 35 insertions(+), 36 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 029b08c0b0..2f0a883013 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -668,10 +668,10 @@ static int mov_write_enda_tag(AVIOContext *pb)
static int mov_write_enda_tag_be(AVIOContext *pb)
{
- avio_wb32(pb, 10);
- ffio_wfourcc(pb, "enda");
- avio_wb16(pb, 0); /* big endian */
- return 10;
+ avio_wb32(pb, 10);
+ ffio_wfourcc(pb, "enda");
+ avio_wb16(pb, 0); /* big endian */
+ return 10;
}
static void put_descr(AVIOContext *pb, int tag, unsigned int size)
@@ -979,9 +979,9 @@ static int mov_write_wave_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
ffio_wfourcc(pb, "wave");
if (track->par->codec_id != AV_CODEC_ID_QDM2) {
- avio_wb32(pb, 12); /* size */
- ffio_wfourcc(pb, "frma");
- avio_wl32(pb, track->tag);
+ avio_wb32(pb, 12); /* size */
+ ffio_wfourcc(pb, "frma");
+ avio_wl32(pb, track->tag);
}
if (track->par->codec_id == AV_CODEC_ID_AAC) {
@@ -991,9 +991,9 @@ static int mov_write_wave_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
avio_wb32(pb, 0);
mov_write_esds_tag(pb, track);
} else if (mov_pcm_le_gt16(track->par->codec_id)) {
- mov_write_enda_tag(pb);
+ mov_write_enda_tag(pb);
} else if (mov_pcm_be_gt16(track->par->codec_id)) {
- mov_write_enda_tag_be(pb);
+ mov_write_enda_tag_be(pb);
} else if (track->par->codec_id == AV_CODEC_ID_AMR_NB) {
mov_write_amr_tag(pb, track);
} else if (track->par->codec_id == AV_CODEC_ID_AC3) {
@@ -1805,11 +1805,11 @@ static const struct {
static int mov_get_dnxhd_codec_tag(AVFormatContext *s, MOVTrack *track)
{
- int tag = MKTAG('A','V','d','n');
- if (track->par->profile != AV_PROFILE_UNKNOWN &&
- track->par->profile != AV_PROFILE_DNXHD)
- tag = MKTAG('A','V','d','h');
- return tag;
+ int tag = MKTAG('A','V','d','n');
+ if (track->par->profile != AV_PROFILE_UNKNOWN &&
+ track->par->profile != AV_PROFILE_DNXHD)
+ tag = MKTAG('A','V','d','h');
+ return tag;
}
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
@@ -2997,18 +2997,18 @@ static int mov_write_gmhd_tag(AVIOContext *pb, MOVTrack *track)
* bytes are copied verbatim.
*/
if (track->tag != MKTAG('c','6','0','8')) {
- avio_wb32(pb, 0x2C); /* size */
- ffio_wfourcc(pb, "text");
- avio_wb16(pb, 0x01);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x01);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x00);
- avio_wb32(pb, 0x00004000);
- avio_wb16(pb, 0x0000);
+ avio_wb32(pb, 0x2C); /* size */
+ ffio_wfourcc(pb, "text");
+ avio_wb16(pb, 0x01);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x01);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x00);
+ avio_wb32(pb, 0x00004000);
+ avio_wb16(pb, 0x0000);
}
if (track->par->codec_tag == MKTAG('t','m','c','d')) {
@@ -4853,16 +4853,15 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
param_write_int(pb, "DisplayHeight", track->par->height);
} else {
if (track->par->codec_id == AV_CODEC_ID_AAC) {
- switch (track->par->profile)
- {
- case AV_PROFILE_AAC_HE_V2:
- param_write_string(pb, "FourCC", "AACP");
- break;
- case AV_PROFILE_AAC_HE:
- param_write_string(pb, "FourCC", "AACH");
- break;
- default:
- param_write_string(pb, "FourCC", "AACL");
+ switch (track->par->profile) {
+ case AV_PROFILE_AAC_HE_V2:
+ param_write_string(pb, "FourCC", "AACP");
+ break;
+ case AV_PROFILE_AAC_HE:
+ param_write_string(pb, "FourCC", "AACH");
+ break;
+ default:
+ param_write_string(pb, "FourCC", "AACL");
}
} else if (track->par->codec_id == AV_CODEC_ID_WMAPRO) {
param_write_string(pb, "FourCC", "WMAP");
--
2.25.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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] lavc/vvc_parser: small cleanup for style
2024-03-22 10:35 [FFmpeg-devel] [PATCH 1/2] lavc/vvc_parser: small cleanup for style Jun Zhao
2024-03-22 10:35 ` [FFmpeg-devel] [PATCH 2/2] lavf/movenc: " Jun Zhao
@ 2024-03-23 15:03 ` Nuo Mi
1 sibling, 0 replies; 3+ messages in thread
From: Nuo Mi @ 2024-03-23 15:03 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Jun Zhao, Jun Zhao
On Fri, Mar 22, 2024 at 6:36 PM Jun Zhao <mypopy@gmail.com> wrote:
> From: Jun Zhao <mypopydev@gmail.com>
>
> small cleanup for style, redundant semicolons, goto labels,
> in FFmpeg, we put goto labels at brace level.
>
Pushed this patch.
Thanks, Jun
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
> libavcodec/vvc_parser.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
> index c661595e1e..245cb214c9 100644
> --- a/libavcodec/vvc_parser.c
> +++ b/libavcodec/vvc_parser.c
> @@ -173,7 +173,7 @@ static void set_parser_ctx(AVCodecParserContext *s,
> AVCodecContext *avctx,
> h266_sub_width_c[sps->sps_chroma_format_idc];
> s->height = pps->pps_pic_height_in_luma_samples -
> (pps->pps_conf_win_top_offset + pps->pps_conf_win_bottom_offset) *
> - h266_sub_height_c[sps->sps_chroma_format_idc];;
> + h266_sub_height_c[sps->sps_chroma_format_idc];
>
> avctx->profile = sps->profile_tier_level.general_profile_idc;
> avctx->level = sps->profile_tier_level.general_level_idc;
> @@ -317,7 +317,7 @@ static int get_pu_info(PuInfo *info, const
> CodedBitstreamH266Context *h266,
> }
> info->pic_type = get_pict_type(pu);
> return 0;
> - error:
> +error:
> memset(info, 0, sizeof(*info));
> return ret;
> }
> @@ -329,7 +329,7 @@ static int append_au(AVPacket *pkt, const uint8_t
> *buf, int buf_size)
> if ((ret = av_grow_packet(pkt, buf_size)) < 0)
> goto end;
> memcpy(pkt->data + offset, buf, buf_size);
> - end:
> +end:
> return ret;
> }
>
> @@ -376,7 +376,7 @@ static int parse_nal_units(AVCodecParserContext *s,
> const uint8_t *buf,
> } else {
> ret = 1; //not a completed au
> }
> - end:
> +end:
> ff_cbs_fragment_reset(pu);
> return ret;
> }
> --
> 2.25.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".
>
_______________________________________________
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] 3+ messages in thread