From: "Lukáš Lalinský" <lukas@lalinsky.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/libmp3lame: make it possible to set copyright/original flags Date: Tue, 09 May 2023 10:18:56 +0200 Message-ID: <da920422-1e2d-45c2-8902-629a9162896d@app.fastmail.com> (raw) [-- Attachment #1: Type: text/plain, Size: 241 bytes --] I'd like the control the copyright and original bits in output MP3 frames. I've added two options to the libmp3lame encoder, the defaults are copying the defaults from LAME (original=1, copyright=0). Patch attached. Regards, Lukas Lalinsky [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-avcodec-libmp3lame-make-it-possible-to-set-copyright.patch --] [-- Type: text/x-patch; name="0001-avcodec-libmp3lame-make-it-possible-to-set-copyright.patch", Size: 2962 bytes --] From 3f5d5f99e862b66867a8a93c8e5928b9e866e010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= <lalinsky@gmail.com> Date: Tue, 9 May 2023 08:30:03 +0200 Subject: [PATCH] avcodec/libmp3lame: make it possible to set copyright/original flags --- doc/encoders.texi | 8 ++++++++ libavcodec/libmp3lame.c | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3cb6fc1ce7..f8c691ba1a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -864,6 +864,14 @@ Enable the encoder to use ABR when set to 1. The @command{lame} @option{--abr} sets the target bitrate, while this options only tells FFmpeg to use ABR still relies on @option{b} to set bitrate. +@item copyright (@emph{-c}) +Set MPEG audio copyright flag when set to 1. The default value is 0 +(disabled). + +@item original (@emph{-o}) +Set MPEG audio original flag when set to 1. The default value is 1 +(enabled). + @end table @section libopencore-amrnb diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index e119189f2a..312bc4230f 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -55,6 +55,8 @@ typedef struct LAMEContext { float *samples_flt[2]; AudioFrameQueue afq; AVFloatDSPContext *fdsp; + int copyright; + int original; } LAMEContext; @@ -137,6 +139,12 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) /* bit reservoir usage */ lame_set_disable_reservoir(s->gfp, !s->reservoir); + /* copyright flag */ + lame_set_copyright(s->gfp, s->copyright); + + /* original flag */ + lame_set_original(s->gfp, s->original); + /* set specified parameters */ if (lame_init_params(s->gfp) < 0) { ret = AVERROR_EXTERNAL; @@ -303,9 +311,11 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, #define OFFSET(x) offsetof(LAMEContext, x) #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "reservoir", "use bit reservoir", OFFSET(reservoir), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AE }, - { "joint_stereo", "use joint stereo", OFFSET(joint_stereo), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AE }, - { "abr", "use ABR", OFFSET(abr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AE }, + { "reservoir", "use bit reservoir", OFFSET(reservoir), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AE }, + { "joint_stereo", "use joint stereo", OFFSET(joint_stereo), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AE }, + { "abr", "use ABR", OFFSET(abr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AE }, + { "copyright", "set copyright flag", OFFSET(copyright), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AE}, + { "original", "set original flag", OFFSET(original), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AE}, { NULL }, }; -- 2.25.1 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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".
next reply other threads:[~2023-05-09 8:19 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-09 8:18 Lukáš Lalinský [this message] 2023-05-10 7:45 ` Paul B Mahol
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=da920422-1e2d-45c2-8902-629a9162896d@app.fastmail.com \ --to=lukas@lalinsky.com \ --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