[FFmpeg-cvslog] avcodec/mpeg12enc: support mpeg2 encoder const profile

Limin Wang git at videolan.org
Mon Jun 1 02:06:18 EEST 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Sat May 30 21:25:32 2020 +0800| [dd76226842f268c7f85a125da1834e3af2413be4] | committer: Limin Wang

avcodec/mpeg12enc: support mpeg2 encoder const profile

Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd76226842f268c7f85a125da1834e3af2413be4
---

 doc/encoders.texi      | 14 ++++++++++++++
 libavcodec/mpeg12enc.c |  2 ++
 libavcodec/profiles.h  |  8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 954f0f6fe3..1331b79458 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
 @subsection Options
 
 @table @option
+ at item profile @var{integer}
+Select the mpeg2 profile to encode:
+
+ at table @samp
+ at item 422
+ at item main
+ at item ss
+Spatially Scalable
+ at item snr
+SNR Scalable
+ at item high
+ at item simple
+ at 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 cab7076a58..9fbbcef607 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 e414ea77a7..d2419257dc 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -43,6 +43,14 @@
     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("422",           NULL, VIDEO, FF_PROFILE_MPEG2_422)\
+    FF_AVCTX_PROFILE_OPTION("high",          NULL, VIDEO, FF_PROFILE_MPEG2_HIGH)\
+    FF_AVCTX_PROFILE_OPTION("ss",            NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
+    FF_AVCTX_PROFILE_OPTION("snr",           NULL, VIDEO, FF_PROFILE_MPEG2_SNR_SCALABLE)\
+    FF_AVCTX_PROFILE_OPTION("main",          NULL, VIDEO, FF_PROFILE_MPEG2_MAIN)\
+    FF_AVCTX_PROFILE_OPTION("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[];



More information about the ffmpeg-cvslog mailing list