diff mbox series

[FFmpeg-devel] avcodec/mpeg12enc: support mpeg2 encoder const level

Message ID 1596373624-28433-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit ad49dd7694a504d8f205b1a6a9e5347354be12d0
Headers show
Series [FFmpeg-devel] avcodec/mpeg12enc: support mpeg2 encoder const level | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang Aug. 2, 2020, 1:07 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 doc/encoders.texi      | 10 ++++++++++
 libavcodec/mpeg12enc.c |  6 ++++++
 2 files changed, 16 insertions(+)

Comments

Lance Wang Aug. 11, 2020, 2:22 p.m. UTC | #1
On Sun, Aug 02, 2020 at 09:07:04PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  doc/encoders.texi      | 10 ++++++++++
>  libavcodec/mpeg12enc.c |  6 ++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index de0472e..13aa5de 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2902,6 +2902,16 @@ SNR Scalable
>  @item simple
>  @end table
>  
> +@item level
> +Select the mpeg2 level to encode:
> +
> +@table @samp
> +@item high
> +@item high1440
> +@item main
> +@item low
> +@end table
> +
>  @item seq_disp_ext @var{integer}
>  Specifies if the encoder should write a sequence_display_extension to the
>  output.
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index 9fbbcef..f246427 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -1167,6 +1167,12 @@ static const AVOption mpeg2_options[] = {
>      {     "secam",        NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_SECAM      },  0, 0, VE, "video_format" },
>      {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
>      {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> +#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value }, 0, 0, VE, "avctx.level"
> +    { LEVEL("high",     4) },
> +    { LEVEL("high1440", 6) },
> +    { LEVEL("main",     8) },
> +    { LEVEL("low",     10) },
> +#undef LEVEL
>      FF_MPV_COMMON_OPTS
>      FF_MPEG2_PROFILE_OPTS
>      { NULL },
> -- 
> 1.8.3.1
> 

will apply tomorrow if no objection.
Paul B Mahol Aug. 11, 2020, 3:43 p.m. UTC | #2
On 8/11/20, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> On Sun, Aug 02, 2020 at 09:07:04PM +0800, lance.lmwang@gmail.com wrote:
>> From: Limin Wang <lance.lmwang@gmail.com>
>>
>> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
>> ---
>>  doc/encoders.texi      | 10 ++++++++++
>>  libavcodec/mpeg12enc.c |  6 ++++++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git a/doc/encoders.texi b/doc/encoders.texi
>> index de0472e..13aa5de 100644
>> --- a/doc/encoders.texi
>> +++ b/doc/encoders.texi
>> @@ -2902,6 +2902,16 @@ SNR Scalable
>>  @item simple
>>  @end table
>>
>> +@item level
>> +Select the mpeg2 level to encode:
>> +
>> +@table @samp
>> +@item high
>> +@item high1440
>> +@item main
>> +@item low
>> +@end table
>> +
>>  @item seq_disp_ext @var{integer}
>>  Specifies if the encoder should write a sequence_display_extension to the
>>  output.
>> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
>> index 9fbbcef..f246427 100644
>> --- a/libavcodec/mpeg12enc.c
>> +++ b/libavcodec/mpeg12enc.c
>> @@ -1167,6 +1167,12 @@ static const AVOption mpeg2_options[] = {
>>      {     "secam",        NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
>> VIDEO_FORMAT_SECAM      },  0, 0, VE, "video_format" },
>>      {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
>> VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
>>      {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
>> VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
>> +#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> value }, 0, 0, VE, "avctx.level"
>> +    { LEVEL("high",     4) },
>> +    { LEVEL("high1440", 6) },
>> +    { LEVEL("main",     8) },
>> +    { LEVEL("low",     10) },
>> +#undef LEVEL
>>      FF_MPV_COMMON_OPTS
>>      FF_MPEG2_PROFILE_OPTS
>>      { NULL },
>> --
>> 1.8.3.1
>>
>
> will apply tomorrow if no objection.

Is this actually correct at all?

Our encoder supports all levels?

>
> --
> Thanks,
> Limin Wang
> _______________________________________________
> 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".
Lance Wang Aug. 11, 2020, 4:14 p.m. UTC | #3
On Tue, Aug 11, 2020 at 05:43:24PM +0200, Paul B Mahol wrote:
> On 8/11/20, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> > On Sun, Aug 02, 2020 at 09:07:04PM +0800, lance.lmwang@gmail.com wrote:
> >> From: Limin Wang <lance.lmwang@gmail.com>
> >>
> >> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> >> ---
> >>  doc/encoders.texi      | 10 ++++++++++
> >>  libavcodec/mpeg12enc.c |  6 ++++++
> >>  2 files changed, 16 insertions(+)
> >>
> >> diff --git a/doc/encoders.texi b/doc/encoders.texi
> >> index de0472e..13aa5de 100644
> >> --- a/doc/encoders.texi
> >> +++ b/doc/encoders.texi
> >> @@ -2902,6 +2902,16 @@ SNR Scalable
> >>  @item simple
> >>  @end table
> >>
> >> +@item level
> >> +Select the mpeg2 level to encode:
> >> +
> >> +@table @samp
> >> +@item high
> >> +@item high1440
> >> +@item main
> >> +@item low
> >> +@end table
> >> +
> >>  @item seq_disp_ext @var{integer}
> >>  Specifies if the encoder should write a sequence_display_extension to the
> >>  output.
> >> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> >> index 9fbbcef..f246427 100644
> >> --- a/libavcodec/mpeg12enc.c
> >> +++ b/libavcodec/mpeg12enc.c
> >> @@ -1167,6 +1167,12 @@ static const AVOption mpeg2_options[] = {
> >>      {     "secam",        NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
> >> VIDEO_FORMAT_SECAM      },  0, 0, VE, "video_format" },
> >>      {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
> >> VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
> >>      {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 =
> >> VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> >> +#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> >> value }, 0, 0, VE, "avctx.level"
> >> +    { LEVEL("high",     4) },
> >> +    { LEVEL("high1440", 6) },
> >> +    { LEVEL("main",     8) },
> >> +    { LEVEL("low",     10) },
> >> +#undef LEVEL
> >>      FF_MPV_COMMON_OPTS
> >>      FF_MPEG2_PROFILE_OPTS
> >>      { NULL },
> >> --
> >> 1.8.3.1
> >>
> >
> > will apply tomorrow if no objection.
> 
> Is this actually correct at all?
It's just add const string for level so that user don't look for what's the
level for the actual integer. If don't add const low level, user can input 10
for low still.
> 
> Our encoder supports all levels?

I don't think so. Now it'll be sured to set the level field correctly only.


> 
> >
> > --
> > Thanks,
> > Limin Wang
> > _______________________________________________
> > 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".
diff mbox series

Patch

diff --git a/doc/encoders.texi b/doc/encoders.texi
index de0472e..13aa5de 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2902,6 +2902,16 @@  SNR Scalable
 @item simple
 @end table
 
+@item level
+Select the mpeg2 level to encode:
+
+@table @samp
+@item high
+@item high1440
+@item main
+@item low
+@end table
+
 @item seq_disp_ext @var{integer}
 Specifies if the encoder should write a sequence_display_extension to the
 output.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 9fbbcef..f246427 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -1167,6 +1167,12 @@  static const AVOption mpeg2_options[] = {
     {     "secam",        NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_SECAM      },  0, 0, VE, "video_format" },
     {     "mac",          NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC        },  0, 0, VE, "video_format" },
     {     "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
+#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value }, 0, 0, VE, "avctx.level"
+    { LEVEL("high",     4) },
+    { LEVEL("high1440", 6) },
+    { LEVEL("main",     8) },
+    { LEVEL("low",     10) },
+#undef LEVEL
     FF_MPV_COMMON_OPTS
     FF_MPEG2_PROFILE_OPTS
     { NULL },