diff options
author | Sven Gothel <[email protected]> | 2017-12-28 04:22:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2017-12-28 04:22:22 +0100 |
commit | 4f47ef35fe043a34904f4dca49dd2218d18e8a87 (patch) | |
tree | 2680b60a363a2763893ba911615b5d090475f6a5 | |
parent | 91f558c0b1334bb14d3a9de5dd26741d20dd6ac4 (diff) |
NVENC: Fix HB_VCODEC_FFMPEG_H264 -> HB_VCODEC_FFMPEG_H264_{NVENC,VAAPI}
Adding the specific FFMPEG encoder suffix allows support for more encoders like VAAPI.
Cleaned up overall HB_VCODED_* to 32bit signed integer space within 0x7FFFFFFF.
-rw-r--r-- | gtk/src/callbacks.c | 4 | ||||
-rw-r--r-- | libhb/common.c | 16 | ||||
-rw-r--r-- | libhb/common.h | 58 | ||||
-rw-r--r-- | libhb/encavcodec.c | 20 | ||||
-rw-r--r-- | libhb/muxavformat.c | 4 | ||||
-rw-r--r-- | libhb/work.c | 12 |
6 files changed, 58 insertions, 56 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index d30427f69..5726f65bb 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -5483,8 +5483,8 @@ format_vquality_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud) case HB_VCODEC_FFMPEG_MPEG2: case HB_VCODEC_FFMPEG_VP8: case HB_VCODEC_FFMPEG_VP9: - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: case HB_VCODEC_THEORA: { return g_strdup_printf("%s: %d", vqname, (int)val); diff --git a/libhb/common.c b/libhb/common.c index ee3eba208..a6ee2c424 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -238,8 +238,8 @@ hb_encoder_internal_t hb_video_encoders[] = { { "H.264 (x264)", "x264", "H.264 (libx264)", HB_VCODEC_X264_8BIT, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, { { "H.264 10-bit (x264)", "x264_10bit", "H.264 10-bit (libx264)", HB_VCODEC_X264_10BIT, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, { { "H.264 (Intel QSV)", "qsv_h264", "H.264 (Intel Media SDK)", HB_VCODEC_QSV_H264, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, - { { "H.264 (NVENC)", "h264_nvenc", "H.264 (NVENC)", HB_VCODEC_FFMPEG_H264, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_FF_H264, }, - { { "H.265 (NVENC)", "hvec_nvenc", "H.265 (NVENC)", HB_VCODEC_FFMPEG_H265, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_FF_H265, }, + { { "H.264 (NVENC)", "h264_nvenc", "H.264 (NVENC)", HB_VCODEC_FFMPEG_H264_NVENC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_FF_H264, }, + { { "H.265 (NVENC)", "hvec_nvenc", "H.265 (NVENC)", HB_VCODEC_FFMPEG_H265_NVENC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_FF_H265, }, { { "H.265 (x265)", "x265", "H.265 (libx265)", HB_VCODEC_X265_8BIT, HB_MUX_AV_MP4|HB_MUX_AV_MKV, }, NULL, 1, HB_GID_VCODEC_H265, }, { { "H.265 10-bit (x265)", "x265_10bit", "H.265 10-bit (libx265)", HB_VCODEC_X265_10BIT, HB_MUX_AV_MP4|HB_MUX_AV_MKV, }, NULL, 1, HB_GID_VCODEC_H265, }, { { "H.265 12-bit (x265)", "x265_12bit", "H.265 12-bit (libx265)", HB_VCODEC_X265_12BIT, HB_MUX_AV_MP4|HB_MUX_AV_MKV, }, NULL, 1, HB_GID_VCODEC_H265, }, @@ -291,8 +291,8 @@ static int hb_video_encoder_is_enabled(int encoder) return (api != NULL); } - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: { return hb_av_encoder_present(encoder); } @@ -1299,8 +1299,8 @@ void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, */ case HB_VCODEC_X264_8BIT: case HB_VCODEC_X265_8BIT: - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: *direction = 1; *granularity = 0.1; *low = 0.; @@ -1371,8 +1371,8 @@ const char* hb_video_quality_get_name(uint32_t codec) case HB_VCODEC_X265_16BIT: return "RF"; - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: case HB_VCODEC_FFMPEG_VP8: case HB_VCODEC_FFMPEG_VP9: return "CQ"; diff --git a/libhb/common.h b/libhb/common.h index 22a08df28..e14a5049e 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -501,34 +501,36 @@ struct hb_job_s cfr: 0 (vfr), 1 (cfr), 2 (pfr) [see render.c] pass: 0, 1 or 2 (or -1 for scan) areBframes: boolean to note if b-frames are used */ -#define HB_VCODEC_MASK 0x00FFFFF -#define HB_VCODEC_INVALID 0x0000000 -#define HB_VCODEC_THEORA 0x0000002 -#define HB_VCODEC_FFMPEG_MPEG4 0x0000010 -#define HB_VCODEC_FFMPEG_MPEG2 0x0000020 -#define HB_VCODEC_FFMPEG_VP8 0x0000040 -#define HB_VCODEC_FFMPEG_VP9 0x0000050 -#define HB_VCODEC_FFMPEG_H264 0x0000070 -#define HB_VCODEC_FFMPEG_H265 0x0000080 -#define HB_VCODEC_FFMPEG_MASK 0x00000F0 -#define HB_VCODEC_QSV_H264 0x0000100 -#define HB_VCODEC_QSV_H265_8BIT 0x0000200 -#define HB_VCODEC_QSV_H265_10BIT 0x0000400 -#define HB_VCODEC_QSV_H265_MASK 0x0000600 -#define HB_VCODEC_QSV_H265 HB_VCODEC_QSV_H265_8BIT -#define HB_VCODEC_QSV_MASK 0x0000F00 -#define HB_VCODEC_X264_8BIT 0x0010000 -#define HB_VCODEC_X264 HB_VCODEC_X264_8BIT -#define HB_VCODEC_X264_10BIT 0x0020000 -#define HB_VCODEC_X264_MASK 0x0030000 -#define HB_VCODEC_H264_MASK (HB_VCODEC_X264_MASK|HB_VCODEC_QSV_H264|HV_VCODEC_FFMPEG_H264) -#define HB_VCODEC_X265_8BIT 0x0001000 -#define HB_VCODEC_X265 HB_VCODEC_X265_8BIT -#define HB_VCODEC_X265_10BIT 0x0002000 -#define HB_VCODEC_X265_12BIT 0x0004000 -#define HB_VCODEC_X265_16BIT 0x0008000 -#define HB_VCODEC_X265_MASK 0x000F000 -#define HB_VCODEC_H265_MASK (HB_VCODEC_X265_MASK|HB_VCODEC_QSV_H265_MASK|HB_VCODEC_FFMPEG_H265) +#define HB_VCODEC_MASK 0x7FFFFFFF +#define HB_VCODEC_INVALID 0x00000000 +#define HB_VCODEC_THEORA 0x00000002 +#define HB_VCODEC_FFMPEG_MPEG4 0x00000010 +#define HB_VCODEC_FFMPEG_MPEG2 0x00000020 +#define HB_VCODEC_FFMPEG_VP8 0x00000030 +#define HB_VCODEC_FFMPEG_VP9 0x00000040 +#define HB_VCODEC_FFMPEG_H264_NVENC 0x00000070 +#define HB_VCODEC_FFMPEG_H265_NVENC 0x00000080 +#define HB_VCODEC_FFMPEG_H264_VAAPI 0x00000090 +#define HB_VCODEC_FFMPEG_H265_VAAPI 0x000000A0 +#define HB_VCODEC_FFMPEG_MASK 0x000000F0 +#define HB_VCODEC_QSV_H264 0x00001000 +#define HB_VCODEC_QSV_H265_8BIT 0x00002000 +#define HB_VCODEC_QSV_H265 HB_VCODEC_QSV_H265_8BIT +#define HB_VCODEC_QSV_H265_10BIT 0x00004000 +#define HB_VCODEC_QSV_H265_MASK 0x00006000 +#define HB_VCODEC_QSV_MASK 0x0000F000 +#define HB_VCODEC_X264_8BIT 0x00010000 +#define HB_VCODEC_X264 HB_VCODEC_X264_8BIT +#define HB_VCODEC_X264_10BIT 0x00020000 +#define HB_VCODEC_X264_MASK 0x00030000 +#define HB_VCODEC_H264_MASK (HB_VCODEC_X264_MASK|HB_VCODEC_QSV_H264|HV_VCODEC_FFMPEG_H264_NVENC|HB_VCODEC_FFMPEG_H264_VAAPI) +#define HB_VCODEC_X265_8BIT 0x00040000 +#define HB_VCODEC_X265 HB_VCODEC_X265_8BIT +#define HB_VCODEC_X265_10BIT 0x00080000 +#define HB_VCODEC_X265_12BIT 0x000C0000 +#define HB_VCODEC_X265_16BIT 0x00100000 +#define HB_VCODEC_X265_MASK 0x001C0000 +#define HB_VCODEC_H265_MASK (HB_VCODEC_X265_MASK|HB_VCODEC_QSV_H265_MASK|HB_VCODEC_FFMPEG_H265_NVENC|HB_VCODEC_FFMPEG_H265_VAAPI) /* define an invalid CQ value compatible with all CQ-capable codecs */ #define HB_INVALID_VIDEO_QUALITY (-1000.) diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 00496c801..4e47f2504 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -829,8 +829,8 @@ static int apply_encoder_preset(int vcodec, AVCodecContext *context, AVDictionar case HB_VCODEC_FFMPEG_VP8: case HB_VCODEC_FFMPEG_VP9: return apply_vpx_preset(av_opts, preset); - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: av_dict_set( av_opts, "preset", preset, 0); break; default: @@ -848,8 +848,8 @@ const char* const* hb_av_preset_get_names(int encoder) case HB_VCODEC_FFMPEG_VP9: return vpx_preset_names; - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: return h26x_nvenc_preset_names; default: @@ -861,9 +861,9 @@ const char* const* hb_av_profile_get_names(int encoder) { switch (encoder) { - case HB_VCODEC_FFMPEG_H264: + case HB_VCODEC_FFMPEG_H264_NVENC: return h264_nvenc_profile_names; - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H265_NVENC: return h265_nvenc_profile_names; default: @@ -875,8 +875,8 @@ const char* const* hb_av_level_get_names(int encoder) { switch (encoder) { - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: return h26x_nvenc_level_names; default: @@ -888,9 +888,9 @@ int hb_av_encoder_present(int encoder) { switch (encoder) { - case HB_VCODEC_FFMPEG_H264: + case HB_VCODEC_FFMPEG_H264_NVENC: return NULL != avcodec_find_encoder_by_name("h264_nvenc"); - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H265_NVENC: return NULL != avcodec_find_encoder_by_name("hevc_nvenc"); default: diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 18e134588..99ba9c9a4 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -214,7 +214,7 @@ static int avformatInit( hb_mux_object_t * m ) case HB_VCODEC_X264_8BIT: case HB_VCODEC_X264_10BIT: case HB_VCODEC_QSV_H264: - case HB_VCODEC_FFMPEG_H264: + case HB_VCODEC_FFMPEG_H264_NVENC: track->st->codecpar->codec_id = AV_CODEC_ID_H264; if (job->mux == HB_MUX_AV_MP4 && job->inline_parameter_sets) { @@ -340,7 +340,7 @@ static int avformatInit( hb_mux_object_t * m ) case HB_VCODEC_X265_16BIT: case HB_VCODEC_QSV_H265: case HB_VCODEC_QSV_H265_10BIT: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H265_NVENC: track->st->codecpar->codec_id = AV_CODEC_ID_HEVC; if (job->mux == HB_MUX_AV_MP4 && job->inline_parameter_sets) { diff --git a/libhb/work.c b/libhb/work.c index 1f6c5961d..94720d5f2 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -223,11 +223,11 @@ hb_work_object_t* hb_video_encoder(hb_handle_t *h, int vcodec) w = hb_get_work(h, WORK_ENCAVCODEC); w->codec_param = AV_CODEC_ID_VP9; break; - case HB_VCODEC_FFMPEG_H264: + case HB_VCODEC_FFMPEG_H264_NVENC: w = hb_get_work(h, WORK_ENCAVCODEC); w->codec_param = AV_CODEC_ID_H264; break; - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H265_NVENC: w = hb_get_work(h, WORK_ENCAVCODEC); w->codec_param = AV_CODEC_ID_HEVC; break; @@ -482,8 +482,8 @@ void hb_display_job_info(hb_job_t *job) case HB_VCODEC_QSV_H264: case HB_VCODEC_QSV_H265: case HB_VCODEC_QSV_H265_10BIT: - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: hb_log(" + profile: %s", job->encoder_profile); default: break; @@ -498,8 +498,8 @@ void hb_display_job_info(hb_job_t *job) case HB_VCODEC_QSV_H264: case HB_VCODEC_QSV_H265: case HB_VCODEC_QSV_H265_10BIT: - case HB_VCODEC_FFMPEG_H264: - case HB_VCODEC_FFMPEG_H265: + case HB_VCODEC_FFMPEG_H264_NVENC: + case HB_VCODEC_FFMPEG_H265_NVENC: hb_log(" + level: %s", job->encoder_level); default: break; |