diff mbox series

[FFmpeg-devel,v5] avcodec/mpeg12enc: support mpeg2 encoder const profile

Message ID 1590751378-7395-1-git-send-email-lance.lmwang@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v5] avcodec/mpeg12enc: support mpeg2 encoder const profile | expand

Checks

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

Commit Message

Lance Wang May 29, 2020, 11:22 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/mpeg12enc.c | 2 ++
 libavcodec/profiles.h  | 6 ++++++
 2 files changed, 8 insertions(+)

Comments

Marton Balint May 29, 2020, 7:07 p.m. UTC | #1
On Fri, 29 May 2020, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/mpeg12enc.c | 2 ++
> libavcodec/profiles.h  | 6 ++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index cab7076..9fbbcef 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -41,6 +41,7 @@
> #include "mpeg12data.h"
> #include "mpegutils.h"
> #include "mpegvideo.h"
> +#include "profiles.h"
> 
> static const uint8_t svcd_scan_offset_placeholder[] = {
>     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
>     {     "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" },
>     FF_MPV_COMMON_OPTS
> +    FF_MPEG2_PROFILE_OPTS
>     { NULL },
> };
> 
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index e414ea7..d6a139e 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -43,6 +43,12 @@
>     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
>     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> 
> +#define FF_MPEG2_PROFILE_OPTS \
> +    FF_AVCTX_PROFILE_OPTION("mpeg2_422",     NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg2_high",    NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg2_main",    NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg2_simple",  NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\

You no longer need the mpeg2 prefix. Also please add the supported 
profiles to the documentation of the mpeg2 encoder. There are also some 
profiles (spatially scalable and snr scalable) missing. Is it intentional?

Thanks,
Marton

> +
> extern const AVProfile ff_aac_profiles[];
> extern const AVProfile ff_dca_profiles[];
> extern const AVProfile ff_dnxhd_profiles[];
> -- 
> 1.8.3.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".
Lance Wang May 29, 2020, 11:20 p.m. UTC | #2
On Fri, May 29, 2020 at 09:07:52PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 29 May 2020, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/mpeg12enc.c | 2 ++
> > libavcodec/profiles.h  | 6 ++++++
> > 2 files changed, 8 insertions(+)
> > 
> > diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> > index cab7076..9fbbcef 100644
> > --- a/libavcodec/mpeg12enc.c
> > +++ b/libavcodec/mpeg12enc.c
> > @@ -41,6 +41,7 @@
> > #include "mpeg12data.h"
> > #include "mpegutils.h"
> > #include "mpegvideo.h"
> > +#include "profiles.h"
> > 
> > static const uint8_t svcd_scan_offset_placeholder[] = {
> >     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> > @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >     {     "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" },
> >     FF_MPV_COMMON_OPTS
> > +    FF_MPEG2_PROFILE_OPTS
> >     { NULL },
> > };
> > 
> > diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> > index e414ea7..d6a139e 100644
> > --- a/libavcodec/profiles.h
> > +++ b/libavcodec/profiles.h
> > @@ -43,6 +43,12 @@
> >     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
> >     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> > 
> > +#define FF_MPEG2_PROFILE_OPTS \
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_422",     NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_high",    NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_main",    NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_simple",  NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> 
> You no longer need the mpeg2 prefix. Also please add the supported profiles

That's great to hear, why the mpeg4 and aac has the prefix, it's misleading. 
So I understand in the cli, it's not necessary to use the mpeg2 prefix anymore?

> to the documentation of the mpeg2 encoder. There are also some profiles
OK, I'll update the document, I haven't see other native mpeg4, aac document
for the profile, even encoder, so I haven't update it.

> (spatially scalable and snr scalable) missing. Is it intentional?

Yes, I haven't used them yet, I'm not sure it's supported by the native encoder.

> 
> Thanks,
> Marton
> 
> > +
> > extern const AVProfile ff_aac_profiles[];
> > extern const AVProfile ff_dca_profiles[];
> > extern const AVProfile ff_dnxhd_profiles[];
> > -- 
> > 1.8.3.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".
Lance Wang May 30, 2020, 2 p.m. UTC | #3
On Fri, May 29, 2020 at 09:07:52PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 29 May 2020, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/mpeg12enc.c | 2 ++
> > libavcodec/profiles.h  | 6 ++++++
> > 2 files changed, 8 insertions(+)
> > 
> > diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> > index cab7076..9fbbcef 100644
> > --- a/libavcodec/mpeg12enc.c
> > +++ b/libavcodec/mpeg12enc.c
> > @@ -41,6 +41,7 @@
> > #include "mpeg12data.h"
> > #include "mpegutils.h"
> > #include "mpegvideo.h"
> > +#include "profiles.h"
> > 
> > static const uint8_t svcd_scan_offset_placeholder[] = {
> >     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> > @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >     {     "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" },
> >     FF_MPV_COMMON_OPTS
> > +    FF_MPEG2_PROFILE_OPTS
> >     { NULL },
> > };
> > 
> > diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> > index e414ea7..d6a139e 100644
> > --- a/libavcodec/profiles.h
> > +++ b/libavcodec/profiles.h
> > @@ -43,6 +43,12 @@
> >     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
> >     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> > 
> > +#define FF_MPEG2_PROFILE_OPTS \
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_422",     NULL, VIDEO, FF_PROFILE_MPEG2_422)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_high",    NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_main",    NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
> > +    FF_AVCTX_PROFILE_OPTION("mpeg2_simple",  NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
> 
> You no longer need the mpeg2 prefix. Also please add the supported profiles
> to the documentation of the mpeg2 encoder. There are also some profiles
> (spatially scalable and snr scalable) missing. Is it intentional?

I have update the patch, after further consideration, I add ss and snr scalable profile,
as user can set it by integer(2 and 3) still, so it's better to keep them consistent.
> 
> Thanks,
> Marton
> 
> > +
> > extern const AVProfile ff_aac_profiles[];
> > extern const AVProfile ff_dca_profiles[];
> > extern const AVProfile ff_dnxhd_profiles[];
> > -- 
> > 1.8.3.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".
diff mbox series

Patch

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index cab7076..9fbbcef 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -41,6 +41,7 @@ 
 #include "mpeg12data.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
+#include "profiles.h"
 
 static const uint8_t svcd_scan_offset_placeholder[] = {
     0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
@@ -1167,6 +1168,7 @@  static const AVOption mpeg2_options[] = {
     {     "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" },
     FF_MPV_COMMON_OPTS
+    FF_MPEG2_PROFILE_OPTS
     { NULL },
 };
 
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index e414ea7..d6a139e 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -43,6 +43,12 @@ 
     FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO, FF_PROFILE_MPEG4_MAIN)\
     FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO, FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
 
+#define FF_MPEG2_PROFILE_OPTS \
+    FF_AVCTX_PROFILE_OPTION("mpeg2_422",     NULL, VIDEO, FF_PROFILE_MPEG2_422)\
+    FF_AVCTX_PROFILE_OPTION("mpeg2_high",    NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
+    FF_AVCTX_PROFILE_OPTION("mpeg2_main",    NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
+    FF_AVCTX_PROFILE_OPTION("mpeg2_simple",  NULL, VIDEO, FF_PROFILE_MPEG2_SIMPLE)\
+
 extern const AVProfile ff_aac_profiles[];
 extern const AVProfile ff_dca_profiles[];
 extern const AVProfile ff_dnxhd_profiles[];