summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-11-08 15:45:03 +0000
committerRodeo <[email protected]>2013-11-08 15:45:03 +0000
commit6eeb619280e58feceed314a3d5864c4e17e62c11 (patch)
tree46090b95a6920475dbd337a997509b6a1090fe51
parentc7be682975ec4a26c7bb5cf143bf3b29a1a004d8 (diff)
New getters for video presets, tunes, profiles and levels.
x264 is no longer the only encoder with a built-in preset system; QSV has its own presets, and supports setting the H.264 profile and level, too. Old getters still in place for compatibility with the old API.. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5883 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/common.c57
-rw-r--r--libhb/common.h8
-rw-r--r--libhb/qsv_common.c9
-rw-r--r--libhb/qsv_common.h1
-rw-r--r--test/test.c10
5 files changed, 79 insertions, 6 deletions
diff --git a/libhb/common.c b/libhb/common.c
index 9df282cbc..1b996e04a 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -13,8 +13,10 @@
#include <sys/time.h>
#include "hb.h"
+#include "x264.h"
#include "lang.h"
#include "common.h"
+#include "h264_common.h"
#ifdef USE_QSV
#include "qsv_common.h"
#endif
@@ -1142,6 +1144,61 @@ const char* hb_video_quality_get_name(uint32_t codec)
}
}
+const char* const* hb_video_encoder_get_presets(int encoder)
+{
+ switch (encoder)
+ {
+ case HB_VCODEC_X264:
+ return x264_preset_names;
+
+#ifdef USE_QSV
+ case HB_VCODEC_QSV_H264:
+ return hb_qsv_preset_get_names();
+#endif
+
+ default:
+ return NULL;
+ }
+}
+
+const char* const* hb_video_encoder_get_tunes(int encoder)
+{
+ switch (encoder)
+ {
+ case HB_VCODEC_X264:
+ return x264_tune_names;
+
+ default:
+ return NULL;
+ }
+}
+
+const char* const* hb_video_encoder_get_profiles(int encoder)
+{
+ switch (encoder)
+ {
+ case HB_VCODEC_X264:
+ case HB_VCODEC_QSV_H264:
+ return hb_h264_profile_names;
+
+ default:
+ return NULL;
+ }
+}
+
+const char* const* hb_video_encoder_get_levels(int encoder)
+{
+ switch (encoder)
+ {
+ case HB_VCODEC_X264:
+ case HB_VCODEC_QSV_H264:
+ return hb_h264_level_names;
+
+ default:
+ return NULL;
+ }
+}
+
// Get limits and hints for the UIs.
//
// granularity sets the minimum step increments that should be used
diff --git a/libhb/common.h b/libhb/common.h
index eed194cd7..6a657465c 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -292,6 +292,11 @@ const hb_rate_t* hb_audio_bitrate_get_next(const hb_rate_t *last);
void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction);
const char* hb_video_quality_get_name(uint32_t codec);
+const char* const* hb_video_encoder_get_presets (int encoder);
+const char* const* hb_video_encoder_get_tunes (int encoder);
+const char* const* hb_video_encoder_get_profiles(int encoder);
+const char* const* hb_video_encoder_get_levels (int encoder);
+
void hb_audio_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction);
float hb_audio_quality_get_best(uint32_t codec, float quality);
float hb_audio_quality_get_default(uint32_t codec);
@@ -1242,6 +1247,8 @@ char * hb_x264_param_unparse(const char *x264_preset, const char *x264_tune,
const char *x264_encopts, const char *h264_profile,
const char *h264_level, int width, int height);
+#define HB_API_OLD_PRESET_GETTERS
+#ifdef HB_API_OLD_PRESET_GETTERS
// x264 preset/tune, qsv preset & h264 profile/level helpers
const char * const * hb_x264_presets();
const char * const * hb_x264_tunes();
@@ -1250,6 +1257,7 @@ const char * const * hb_qsv_presets();
#endif
const char * const * hb_h264_profiles();
const char * const * hb_h264_levels();
+#endif
// x264 option name/synonym helper
const char * hb_x264_encopt_name( const char * name );
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index 542f03374..44f11ffad 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -698,7 +698,7 @@ int hb_qsv_param_parse(hb_qsv_param_t *param,
return error ? HB_QSV_PARAM_BAD_VALUE : HB_QSV_PARAM_OK;
}
-const char* const* hb_qsv_presets()
+const char* const* hb_qsv_preset_get_names()
{
if (hb_get_cpu_platform() >= HB_CPU_PLATFORM_INTEL_HSW)
{
@@ -710,6 +710,13 @@ const char* const* hb_qsv_presets()
}
}
+#ifdef HB_API_OLD_PRESET_GETTERS
+const char* const* hb_qsv_presets()
+{
+ return hb_qsv_preset_get_names();
+}
+#endif
+
int hb_qsv_param_default_preset(hb_qsv_param_t *param,
mfxVideoParam *videoParam, const char *preset)
{
diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h
index 8b94fd0b4..31e1bb36b 100644
--- a/libhb/qsv_common.h
+++ b/libhb/qsv_common.h
@@ -109,6 +109,7 @@ typedef struct
mfxVideoParam *videoParam;
} hb_qsv_param_t;
+const char* const* hb_qsv_preset_get_names();
static const char* const hb_qsv_preset_names1[] = { "speed", "balanced", NULL, };
static const char* const hb_qsv_preset_names2[] = { "speed", "balanced", "quality", NULL, };
diff --git a/test/test.c b/test/test.c
index 826528172..1b1bb14ef 100644
--- a/test/test.c
+++ b/test/test.c
@@ -3143,7 +3143,7 @@ static void ShowHelp()
fprintf( out,
" --x264-preset When using x264, selects the x264 preset:\n"
" <string> ");
- x264_opts = hb_x264_presets();
+ x264_opts = hb_video_encoder_get_presets(HB_VCODEC_X264);
tmp[0] = 0;
len = 0;
while( x264_opts && *x264_opts )
@@ -3164,7 +3164,7 @@ static void ShowHelp()
fprintf( out,
" --x264-tune When using x264, selects the x264 tuning:\n"
" <string> ");
- x264_opts = hb_x264_tunes();
+ x264_opts = hb_video_encoder_get_tunes(HB_VCODEC_X264);
tmp[0] = 0;
len = 0;
while( x264_opts && *x264_opts )
@@ -3188,7 +3188,7 @@ if (hb_qsv_available())
fprintf(out,
" --qsv-preset When using QSV, selects the QSV preset:\n"
" <string> ");
- x264_opts = hb_qsv_presets();
+ x264_opts = hb_video_encoder_get_presets(HB_VCODEC_QSV_H264);
tmp[0] = 0;
len = 0;
while (x264_opts != NULL && *x264_opts != NULL)
@@ -3232,7 +3232,7 @@ else
" --h264-profile When using H.264, ensures compliance with the\n"
" <string> specified H.264 profile:\n"
" ");
- x264_opts = hb_h264_profiles();
+ x264_opts = hb_video_encoder_get_profiles(HB_VCODEC_X264);
tmp[0] = 0;
len = 0;
while( x264_opts && *x264_opts )
@@ -3254,7 +3254,7 @@ else
" --h264-level When using H.264, ensures compliance with the\n"
" <string> specified H.264 level:\n"
" ");
- x264_opts = hb_h264_levels();
+ x264_opts = hb_video_encoder_get_levels(HB_VCODEC_X264);
tmp[0] = 0;
len = 0;
while( x264_opts && *x264_opts )