diff options
author | Rodeo <[email protected]> | 2013-07-13 18:16:00 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-07-13 18:16:00 +0000 |
commit | 8228a6411ed3c76d521dc398ddb5329154786f43 (patch) | |
tree | f6314fa9a64726b5c5cd1c781d46725456145b27 /libhb | |
parent | 00b5d615c59958cb0078a6d3d8a126337335b734 (diff) |
Add hb_video_quality_get_limits and hb_video_quality_get_name to libhb API.
Includes a MacGui implementation.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5647 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 49 | ||||
-rw-r--r-- | libhb/common.h | 3 | ||||
-rw-r--r-- | libhb/work.c | 5 |
3 files changed, 55 insertions, 2 deletions
diff --git a/libhb/common.c b/libhb/common.c index 18302e3b8..3eaa941b3 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -1087,6 +1087,55 @@ const hb_rate_t* hb_audio_bitrate_get_next(const hb_rate_t *last) // // direction says whether 'low' limit is highest or lowest // quality (direction 0 == lowest value is worst quality) +void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, + float *granularity, int *direction) +{ + switch (codec) + { + case HB_VCODEC_X264: + *direction = 1; + *granularity = 0.1; + *low = 0.; + *high = 51.; + break; + + case HB_VCODEC_THEORA: + *direction = 0; + *granularity = 1.; + *low = 0.; + *high = 63.; + break; + + case HB_VCODEC_FFMPEG_MPEG2: + case HB_VCODEC_FFMPEG_MPEG4: + default: + *direction = 1; + *granularity = 1.; + *low = 1.; + *high = 31.; + break; + } +} + +const char* hb_video_quality_get_name(uint32_t codec) +{ + switch (codec) + { + case HB_VCODEC_X264: + return "RF"; + + default: + return "QP"; + } +} + +// Get limits and hints for the UIs. +// +// granularity sets the minimum step increments that should be used +// (it's ok to round up to some nice multiple if you like) +// +// direction says whether 'low' limit is highest or lowest +// quality (direction 0 == lowest value is worst quality) void hb_audio_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction) { diff --git a/libhb/common.h b/libhb/common.h index 2ce180034..5a21eab84 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -264,6 +264,9 @@ int hb_audio_bitrate_get_default(uint32_t codec, int samplerate, in void hb_audio_bitrate_get_limits(uint32_t codec, int samplerate, int mixdown, int *low, int *high); 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); + 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); diff --git a/libhb/work.c b/libhb/work.c index 433e9c5c3..b23a3619a 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -318,9 +318,10 @@ void hb_display_job_info(hb_job_t *job) hb_log( " + h264 level: %s", job->h264_level ); } - if( job->vquality >= 0 ) + if (job->vquality >= 0) { - hb_log( " + quality: %.2f %s", job->vquality, job->vcodec == HB_VCODEC_X264 ? "(RF)" : "(QP)" ); + hb_log(" + quality: %.2f (%s)", job->vquality, + hb_video_quality_get_name(job->vcodec)); } else { |