summaryrefslogtreecommitdiffstats
path: root/libhb
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 /libhb
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
Diffstat (limited to 'libhb')
-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
4 files changed, 74 insertions, 1 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, };