On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse <[email protected]> wrote:
> ---
>  libavcodec/libx264.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
>
>
From d8ae813a74423d62e1c6236bad9d8d5128eb95e8 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Tue, 19 Apr 2011 16:12:13 -0700
Subject: [PATCH 5/6] In libx264 wrapper, add -level specific option.
 (cherry picked from commit f92b0084c0e02b3c816a9eb234c548487acadae8)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1"

This is a multi-part message in MIME format.
--------------1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/libx264.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)


--------------1
Content-Type: text/x-patch; name="0005-In-libx264-wrapper-add-level-specific-option.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0005-In-libx264-wrapper-add-level-specific-option.patch"

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 5971b74..2d99a83 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -38,6 +38,7 @@ typedef struct X264Context {
     const char *preset;
     const char *tune;
     const char *profile;
+    const char *level;
     int fastfirstpass;
 } X264Context;
 
@@ -163,6 +164,15 @@ static av_cold int X264_close(AVCodecContext *avctx)
     return 0;
 }
 
+#define OPT_STR(opt, param)                                             \
+    do {                                                                \
+        if (param && x264_param_parse(&x4->params, opt, param) < 0) {   \
+            av_log(avctx, AV_LOG_ERROR,                                 \
+                   "bad value for '%s': '%s'\n", opt, param);           \
+            return -1;                                                  \
+        }                                                               \
+    } while (0);                                                        \
+
 static av_cold int X264_init(AVCodecContext *avctx)
 {
     X264Context *x4 = avctx->priv_data;
@@ -249,9 +259,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->params.analyse.i_trellis          = avctx->trellis;
     x4->params.analyse.i_noise_reduction  = avctx->noise_reduction;
 
-    if (avctx->level > 0)
-        x4->params.i_level_idc = avctx->level;
-
     x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
     x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);
     x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
@@ -295,6 +302,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
             (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
     }
 
+    OPT_STR("level", x4->level);
+
     if (x4->fastfirstpass)
         x264_param_apply_fastfirstpass(&x4->params);
 
@@ -361,6 +370,7 @@ static const AVOption options[] = {
     {"tune", "Tune the encoding params", OFFSET(tune), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
     {"fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), FF_OPT_TYPE_INT, 1, 0, 1, VE},
     {"profile", "Set profile restrictions", OFFSET(profile), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
+    {"level", "Specify level (as defined by Annex A)", OFFSET(level), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
     { NULL },
 };
 

--------------1--


_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to