[FFmpeg-cvslog] avcodec/libmp3lame: make it possible to set copyright/original flags
Lukáš Lalinský
git at videolan.org
Wed May 10 10:44:02 EEST 2023
ffmpeg | branch: master | Lukáš Lalinský <lalinsky at gmail.com> | Tue May 9 08:30:03 2023 +0200| [b5af451901e116c568442e72b8534cbd13545e73] | committer: Paul B Mahol
avcodec/libmp3lame: make it possible to set copyright/original flags
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5af451901e116c568442e72b8534cbd13545e73
---
doc/encoders.texi | 7 +++++++
libavcodec/libmp3lame.c | 16 +++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 3cb6fc1ce7..20cb8a1421 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -864,6 +864,13 @@ 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.
+ at item copyright (@emph{-c})
+Set MPEG audio copyright flag when set to 1. The default value is 0
+(disabled).
+
+ at 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 },
};
More information about the ffmpeg-cvslog
mailing list