diff options
author | sr55 <[email protected]> | 2018-06-05 21:52:23 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-06-05 21:52:23 +0100 |
commit | 5c5b4d7773126d3f4852deb01856c905d2398b5e (patch) | |
tree | 54eaf4d35c86d71372e16b5f4536a8f3ca851f09 /win/CS/HandBrake.Interop/Interop/HbLib | |
parent | 5445592f20e5e645dce0df077afe7ecc2617b95f (diff) |
WinGui: Rename HandBrake.ApplicationServices back to HandBrake.Interop. It's moving back to being more of an libhb interop/abstraction library only.
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop/HbLib')
14 files changed, 942 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs new file mode 100644 index 000000000..33d3f0bca --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs @@ -0,0 +1,17 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="HBDelegates.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Contains delegates for HandBrake interop. +// </summary> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void LoggingCallback(string message); +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs new file mode 100644 index 000000000..c55c8a927 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -0,0 +1,462 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="HBFunctions.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the HBFunctions type. +// </summary> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System; + using System.Runtime.InteropServices; + + /// <summary> + /// Contains p-invoke function declarations to hblib. + /// </summary> + public static class HBFunctions + { + [DllImport("hb", EntryPoint = "hb_register_logger", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_register_logger(LoggingCallback callback); + + [DllImport("hb", EntryPoint = "hb_register_error_handler", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_register_error_handler(LoggingCallback callback); + + [DllImport("hb", EntryPoint = "hb_global_init", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_global_init(); + + /// Return Type: hb_handle_t* + ///verbose: int + ///update_check: int + [DllImport("hb", EntryPoint = "hb_init", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_init(int verbose, int update_check); + + + /// Return Type: hb_handle_t* + ///verbose: int + ///update_check: int + [DllImport("hb", EntryPoint = "hb_init_dl", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_init_dl(int verbose, int update_check); + + + /// Return Type: char* + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_get_version", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_version(IntPtr hbHandle); + + + /// Return Type: int + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_get_build", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_get_build(IntPtr hbHandle); + + + /// Return Type: int + ///h: hb_handle_t* + ///version: char** + [DllImport("hb", EntryPoint = "hb_check_update", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_check_update(IntPtr handle, ref IntPtr version); + + + /// Return Type: char* + ///path: char* + [DllImport("hb", EntryPoint = "hb_dvd_name", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_dvd_name(IntPtr path); + + + /// Return Type: void + ///enable: int + [DllImport("hb", EntryPoint = "hb_dvd_set_dvdnav", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_dvd_set_dvdnav(int enable); + + /// Return Type: void + ///param0: hb_handle_t* + ///path: char* + ///title_index: int + ///preview_count: int + ///store_previews: int + [DllImport("hb", EntryPoint = "hb_scan", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_scan(IntPtr hbHandle, IntPtr path, int title_index, int preview_count, int store_previews, ulong min_duration); + + [DllImport("hb", EntryPoint = "hb_scan_stop", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_scan_stop(IntPtr hbHandle); + + /// Return Type: hb_list_t* + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_get_titles", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_titles(IntPtr hbHandle); + + [DllImport("hb", EntryPoint = "hb_set_anamorphic_size2", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_geometry_settings_s uiGeometry, ref hb_geometry_s result); + + + /// Return Type: int + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_count", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_count(IntPtr hbHandle); + + + /// Return Type: hb_job_t* + ///param0: hb_handle_t* + ///param1: int + [DllImport("hb", EntryPoint = "hb_job", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_job(IntPtr hbHandle, int jobIndex); + + /// Return Type: void + ///param0: hb_handle_t* + ///param1: hb_job_t* + [DllImport("hb", EntryPoint = "hb_rem", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_rem(IntPtr hbHandle, IntPtr job); + + + /// Return Type: void + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_start", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_start(IntPtr hbHandle); + + + /// Return Type: void + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_pause", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_pause(IntPtr hbHandle); + + + /// Return Type: void + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_resume", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_resume(IntPtr hbHandle); + + + /// Return Type: void + ///param0: hb_handle_t* + [DllImport("hb", EntryPoint = "hb_stop", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_stop(IntPtr hbHandle); + + + /// Return Type: void + ///param0: hb_handle_t** + [DllImport("hb", EntryPoint = "hb_close", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_close(IntPtr hbHandle); + + [DllImport("hb", EntryPoint = "hb_global_close", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_global_close(); + + //hb_list_t * hb_list_init(); + [DllImport("hb", EntryPoint = "hb_list_init", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_list_init(); + + //int hb_list_count( const hb_list_t * ); + [DllImport("hb", EntryPoint = "hb_list_count", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_list_count(IntPtr listPtr); + + //void hb_list_add( hb_list_t *, void * ); + [DllImport("hb", EntryPoint = "hb_list_add", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_list_add(IntPtr listPtr, IntPtr item); + + //void hb_list_insert( hb_list_t * l, int pos, void * p ); + [DllImport("hb", EntryPoint = "hb_list_insert", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_list_insert(IntPtr listPtr, int pos, IntPtr item); + + //void hb_list_rem( hb_list_t *, void * ); + [DllImport("hb", EntryPoint = "hb_list_rem", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_list_rem(IntPtr listPtr, IntPtr item); + + //void * hb_list_item( const hb_list_t *, int ); + [DllImport("hb", EntryPoint = "hb_list_item", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_list_item(IntPtr listPtr, int itemIndex); + + //void hb_list_close( hb_list_t ** ); + [DllImport("hb", EntryPoint = "hb_list_close", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_list_close(IntPtr listPtrPtr); + + [DllImport("hb", EntryPoint = "hb_subtitle_can_force", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_subtitle_can_force(int source); + + [DllImport("hb", EntryPoint = "hb_subtitle_can_burn", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_subtitle_can_burn(int source); + + [DllImport("hb", EntryPoint = "hb_subtitle_can_pass", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_subtitle_can_pass(int source, int mux); + + + // int hb_video_framerate_get_from_name(const char *name) + [DllImport("hb", EntryPoint = "hb_video_framerate_get_from_name", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_video_framerate_get_from_name(IntPtr name); + +//const char* hb_video_framerate_get_name(int framerate); +//const char* hb_video_framerate_sanitize_name(const char *name); + + // returns hb_rate_s + [DllImport("hb", EntryPoint = "hb_video_framerate_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_framerate_get_next(IntPtr last); + + +//int hb_audio_samplerate_get_best(uint32_t codec, int samplerate, int *sr_shift); +//int hb_audio_samplerate_get_from_name(const char *name); +//const char* hb_audio_samplerate_get_name(int samplerate); + + // returns hb_rate_s + [DllImport("hb", EntryPoint = "hb_audio_samplerate_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_audio_samplerate_get_next(IntPtr last); + + [DllImport("hb", EntryPoint = "hb_audio_samplerate_find_closest", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_audio_samplerate_find_closest(int samplerate, uint codec); + + [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_best", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_audio_bitrate_get_best(uint codec, int bitrate, int samplerate, int mixdown); + + [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_default", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_audio_bitrate_get_default(uint codec, int samplerate, int mixdown); + + [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_limits", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_audio_bitrate_get_limits(uint codec, int samplerate, int mixdown, ref int low, ref int high); + + [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_audio_bitrate_get_next(IntPtr last); + + [DllImport("hb", EntryPoint = "hb_video_quality_get_limits", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_video_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); + + [DllImport("hb", EntryPoint = "hb_video_quality_get_name", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_quality_get_name(uint codec); + + [DllImport("hb", EntryPoint = "hb_audio_quality_get_limits", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_audio_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); + +//float hb_audio_quality_get_best(uint32_t codec, float quality); + + [DllImport("hb", EntryPoint = "hb_audio_quality_get_default", CallingConvention = CallingConvention.Cdecl)] + public static extern float hb_audio_quality_get_default(uint codec); + + + [DllImport("hb", EntryPoint = "hb_audio_compression_get_limits", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_audio_compression_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); + +//float hb_audio_compression_get_best(uint32_t codec, float compression); + + [DllImport("hb", EntryPoint = "hb_audio_compression_get_default", CallingConvention = CallingConvention.Cdecl)] + public static extern float hb_audio_compression_get_default(uint codec); + + +//int hb_audio_dither_get_default(); +//int hb_audio_dither_get_default_method(); // default method, if enabled && supported +//int hb_audio_dither_is_supported(uint32_t codec); +//int hb_audio_dither_get_from_name(const char *name); +//const char* hb_audio_dither_get_description(int method); +//const hb_dither_t* hb_audio_dither_get_next(const hb_dither_t *last); + + // hb_audio_can_apply_drc2(hb_handle_t *h, int title_idx, int audio_idx, int encoder) + [DllImport("hb", EntryPoint = "hb_audio_can_apply_drc2", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder); + + [DllImport("hb", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout); + + [DllImport("hb", EntryPoint = "hb_mixdown_has_codec_support", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_mixdown_has_codec_support(int mixdown, uint codec); + + [DllImport("hb", EntryPoint = "hb_mixdown_has_remix_support", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_mixdown_has_remix_support(int mixdown, ulong layout); + +//int hb_mixdown_get_discrete_channel_count(int mixdown); +//int hb_mixdown_get_low_freq_channel_count(int mixdown); + + [DllImport("hb", EntryPoint = "hb_mixdown_get_best", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_mixdown_get_best(uint codec, ulong layout, int mixdown); + + [DllImport("hb", EntryPoint = "hb_mixdown_get_default", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_mixdown_get_default(uint codec, ulong layout); + +//int hb_mixdown_get_from_name(const char *name); +//const char* hb_mixdown_get_name(int mixdown); +//const char* hb_mixdown_get_short_name(int mixdown); +//const char* hb_mixdown_sanitize_name(const char *name); + + [DllImport("hb", EntryPoint = "hb_mixdown_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_mixdown_get_next(IntPtr last); + +//int hb_video_encoder_get_default(int muxer); +//int hb_video_encoder_get_from_name(const char *name); +//const char* hb_video_encoder_get_name(int encoder); +//const char* hb_video_encoder_get_short_name(int encoder); +//const char* hb_video_encoder_get_long_name(int encoder); +//const char* hb_video_encoder_sanitize_name(const char *name); + + [DllImport("hb", EntryPoint = "hb_video_encoder_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_encoder_get_next(IntPtr last); + +/* + * hb_audio_encoder_get_fallback_for_passthru() will sanitize a passthru codec + * to the matching audio encoder (if any is available). + * + * hb_audio_encoder_get_from_name(), hb_audio_encoder_sanitize_name() will + * sanitize legacy encoder names, but won't convert passthru to an encoder. + */ +//int hb_audio_encoder_get_fallback_for_passthru(int passthru); +//int hb_audio_encoder_get_default(int muxer); +//int hb_audio_encoder_get_from_name(const char *name); +//const char* hb_audio_encoder_get_name(int encoder); +//const char* hb_audio_encoder_get_short_name(int encoder); +//const char* hb_audio_encoder_get_long_name(int encoder); +//const char* hb_audio_encoder_sanitize_name(const char *name); + + [DllImport("hb", EntryPoint = "hb_audio_encoder_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_audio_encoder_get_next(IntPtr last); + +//int hb_container_get_from_name(const char *name); +//int hb_container_get_from_extension(const char *extension); // not really a container name +//const char* hb_container_get_name(int format); +//const char* hb_container_get_short_name(int format); +//const char* hb_container_get_long_name(int format); +//const char* hb_container_get_default_extension(int format); +//const char* hb_container_sanitize_name(const char *name); + + [DllImport("hb", EntryPoint = "hb_container_get_from_name", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_container_get_from_name([In] [MarshalAs(UnmanagedType.LPStr)] string name); + + [DllImport("hb", EntryPoint = "hb_container_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_container_get_next(IntPtr last); + + [DllImport("hb", EntryPoint = "hb_video_encoder_get_presets", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_encoder_get_presets(int encoder); + + [DllImport("hb", EntryPoint = "hb_video_encoder_get_tunes", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_encoder_get_tunes(int encoder); + + [DllImport("hb", EntryPoint = "hb_video_encoder_get_profiles", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_encoder_get_profiles(int encoder); + + [DllImport("hb", EntryPoint = "hb_video_encoder_get_levels", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_video_encoder_get_levels(int encoder); + + + [DllImport("hb", EntryPoint = "lang_get_next", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lang_get_next(IntPtr last); + + [DllImport("hb", EntryPoint = "lang_for_code2", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lang_for_code2([In] [MarshalAs(UnmanagedType.LPStr)] string code2); + + + ///hb_title_set_t * hb_get_title_set( hb_handle_t * ); + [DllImport("hb", EntryPoint = "hb_get_title_set", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_title_set(IntPtr hbHandle); + + ///hb_job_t * hb_job_init_by_index( hb_handle_t *h, int title_index ); + [DllImport("hb", EntryPoint = "hb_job_init_by_index", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_job_init_by_index(IntPtr hbHandle, int title_index); + + ///void hb_job_close( hb_job_t ** job ); + [DllImport("hb", EntryPoint = "hb_job_close", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_job_close(IntPtr job); + + ///void hb_chapter_set_title(hb_chapter_t *chapter, const char *title); + [DllImport("hb", EntryPoint = "hb_chapter_set_title", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_chapter_set_title(IntPtr chapter, [In] [MarshalAs(UnmanagedType.LPStr)] string title); + + ///void hb_chapter_set_title(hb_chapter_t *chapter, const char *title); + [DllImport("hb", EntryPoint = "hb_chapter_set_title", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_chapter_set_title__ptr(IntPtr chapter, IntPtr title); + + /// hb_filter_object_t * hb_filter_init( int filter_id ); + [DllImport("hb", EntryPoint = "hb_filter_init", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_filter_init(int filter_id); + + [DllImport("hb", EntryPoint = "hb_generate_filter_settings_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_generate_filter_settings_json( + int filter_id, + [In] [MarshalAs(UnmanagedType.LPStr)] string preset, + [In] [MarshalAs(UnmanagedType.LPStr)] string tune, + [In] [MarshalAs(UnmanagedType.LPStr)] string custom); + + /// char* hb_filter_get_presets_json(int filter_id); + [DllImport("hb", EntryPoint = "hb_filter_get_presets_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_filter_get_presets_json(int filter_id); + + /// char* hb_filter_get_tuness_json(int filter_id); + [DllImport("hb", EntryPoint = "hb_filter_get_tunes_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_filter_get_tunes_json(int filter_id); + + // char ** hb_filter_get_keys(int filter_id); + [DllImport("hb", EntryPoint = "hb_filter_get_keys", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_filter_get_keys(int filter_id); + + [DllImport("hb", EntryPoint = "hb_x264_encopt_name", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_x264_encopt_name(IntPtr name); + + [DllImport("hb", EntryPoint = "hb_check_h264_level", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_check_h264_level([In] [MarshalAs(UnmanagedType.LPStr)] string level, int width, int height, int fps_num, int fps_den, int interlaced, int fake_interlaced); + + [DllImport("hb", EntryPoint = "hb_x264_param_unparse", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_x264_param_unparse( + int bit_depth, + [In] [MarshalAs(UnmanagedType.LPStr)] string x264_preset, + [In] [MarshalAs(UnmanagedType.LPStr)] string x264_tune, + [In] [MarshalAs(UnmanagedType.LPStr)] string x264_encopts, + [In] [MarshalAs(UnmanagedType.LPStr)] string x264_profile, + [In] [MarshalAs(UnmanagedType.LPStr)] string h264_level, + int width, + int height); + + + [DllImport("hb", EntryPoint = "hb_get_opencl_env", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_get_opencl_env(); + + [DllImport("hb", EntryPoint = "hb_qsv_available", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_qsv_available(); + + [DllImport("hb", EntryPoint = "hb_qsv_info_init", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_qsv_info_init(); + + // hb_image_t* hb_get_preview2(hb_handle_t* h, int title_idx, int picture, hb_geometry_settings_t* geo, int deinterlace); + [DllImport("hb", EntryPoint = "hb_get_preview2", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace); + + // void hb_image_close(hb_image_t **_image); + [DllImport("hb", EntryPoint = "hb_image_close", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_image_close(IntPtr image); + + /* JSON API */ + + // char * hb_get_title_set_json(hb_handle_t * h); + [DllImport("hb", EntryPoint = "hb_get_title_set_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_title_set_json(IntPtr hbHandle); + + // char * hb_job_init_json(hb_handle_t *h, int title_index); + [DllImport("hb", EntryPoint = "hb_job_init_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_job_init_json(IntPtr hbHandle, int title_index); + + // hb_job_t * hb_json_to_job(hb_handle_t * h, const char * json_job); + [DllImport("hb", EntryPoint = "hb_json_to_job", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_json_to_job(IntPtr hbHandle, IntPtr json_job); + + // int hb_add_json( hb_handle_t *, const char * ) + [DllImport("hb", EntryPoint = "hb_add_json", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_add_json(IntPtr hbHandle, IntPtr json_job); + + //char * hb_set_anamorphic_size_json(const char * json_param); + [DllImport("hb", EntryPoint = "hb_set_anamorphic_size_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_set_anamorphic_size_json(IntPtr json_param); + + // char * hb_get_state_json(hb_handle_t * h); + [DllImport("hb", EntryPoint = "hb_get_state_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_state_json(IntPtr hbHandle); + + // char* hb_get_preview_params_json(int title_idx, int preview_idx, int deinterlace, hb_geometry_settings_t *settings) + [DllImport("hb", EntryPoint = "hb_get_preview_params_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_get_preview_params_json(int title_idx, int preview_idx, int deinterlace, ref hb_geometry_settings_s settings); + + //void hb_presets_builtin_init(void); + [DllImport("hb", EntryPoint = "hb_presets_builtin_init", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_presets_builtin_init(); + + // char * hb_presets_builtin_get_json(void); // Get list of HandBrake builtin presets as json string + [DllImport("hb", EntryPoint = "hb_presets_builtin_get_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_presets_builtin_get_json(); + + // char * hb_presets_read_file_json(const char *filename); + [DllImport("hb", EntryPoint = "hb_presets_read_file_json", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_presets_read_file_json(IntPtr filename); + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs new file mode 100644 index 000000000..aacec1bcf --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs @@ -0,0 +1,69 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="NativeConstants.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the NativeConstants type. +// </summary> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + public class NativeConstants + { + // Audio encoders + public const uint HB_ACODEC_MASK = 0x03FFFF00; + public const uint HB_ACODEC_LAME = 0x00000200; + public const uint HB_ACODEC_VORBIS = 0x00000400; + public const uint HB_ACODEC_AC3 = 0x00000800; + public const uint HB_ACODEC_LPCM = 0x00001000; + public const uint HB_ACODEC_DCA = 0x00002000; + public const uint HB_ACODEC_CA_AAC = 0x00004000; + public const uint HB_ACODEC_CA_HAAC = 0x00008000; + public const uint HB_ACODEC_FFAAC = 0x00010000; + public const uint HB_ACODEC_FFMPEG = 0x00020000; + public const uint HB_ACODEC_DCA_HD = 0x00040000; + public const uint HB_ACODEC_MP3 = 0x00080000; + public const uint HB_ACODEC_FFFLAC = 0x00100000; + public const uint HB_ACODEC_FFFLAC24 = 0x00200000; + public const uint HB_ACODEC_FDK_AAC = 0x00400000; + public const uint HB_ACODEC_FDK_HAAC = 0x00800000; + public const uint HB_ACODEC_FFEAC3 = 0x01000000; + public const uint HB_ACODEC_FFTRUEHD = 0x02000000; + public const uint HB_ACODEC_FF_MASK = 0x03FF2800; + public const uint HB_ACODEC_PASS_FLAG = 0x40000000; + public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_AC3 | HB_ACODEC_DCA | HB_ACODEC_DCA_HD | HB_ACODEC_FFAAC | HB_ACODEC_FFEAC3 | HB_ACODEC_FFFLAC | HB_ACODEC_MP3 | HB_ACODEC_FFTRUEHD); + public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_EAC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3); + public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC); + public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD); + + // VideoEncoders + public const uint HB_VCODEC_QSV_H264 = 0x0000100; + public const uint HB_VCODEC_QSV_H265 = 0x0000200; + public const uint HB_VCODEC_QSV_H265_10BIT = 0x0000400; + public const uint HB_VCODEC_QSV_MASK = 0x0000F00; + + // Encode state + public const int HB_STATE_IDLE = 1; + public const int HB_STATE_SCANNING = 2; + public const int HB_STATE_SCANDONE = 4; + public const int HB_STATE_WORKING = 8; + public const int HB_STATE_PAUSED = 16; + public const int HB_STATE_WORKDONE = 32; + public const int HB_STATE_MUXING = 64; + public const int HB_STATE_SEARCHING = 128; + + // Keep aspect ratio values + public const int HB_KEEP_WIDTH = 0x01; + public const int HB_KEEP_HEIGHT = 0x02; + public const int HB_KEEP_DISPLAY_ASPECT = 0x04; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs new file mode 100644 index 000000000..949f7d694 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs @@ -0,0 +1,21 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_job_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the hb_job_s type. +// </summary> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + internal enum hb_anamorphic_mode_t + { + HB_ANAMORPHIC_NONE, + HB_ANAMORPHIC_STRICT, + HB_ANAMORPHIC_LOOSE, + HB_ANAMORPHIC_CUSTOM, + HB_ANAMORPHIC_AUTO + } ; +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs new file mode 100644 index 000000000..2611cab47 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs @@ -0,0 +1,29 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_container_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + [StructLayout(LayoutKind.Sequential)] + internal struct hb_container_s + { + [MarshalAs(UnmanagedType.LPStr)] + public string name; + + [MarshalAs(UnmanagedType.LPStr)] + public string short_name; + + [MarshalAs(UnmanagedType.LPStr)] + public string long_name; + + [MarshalAs(UnmanagedType.LPStr)] + public string default_extension; + + public int format; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs new file mode 100644 index 000000000..54c5b182f --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs @@ -0,0 +1,28 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_encoder_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + [StructLayout(LayoutKind.Sequential)] + internal struct hb_encoder_s + { + [MarshalAs(UnmanagedType.LPStr)] + public string name; + + [MarshalAs(UnmanagedType.LPStr)] + public string short_name; + + [MarshalAs(UnmanagedType.LPStr)] + public string long_name; + + public int codec; + + public int muxers; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs new file mode 100644 index 000000000..f0c996ca8 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_error_code.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the hb_error_code type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + /// <summary> + /// The hb_error_code. + /// </summary> + internal enum hb_error_code + { + HB_ERROR_NONE = 0, + HB_ERROR_CANCELED, + HB_ERROR_WRONG_INPUT, + HB_ERROR_INIT, + HB_ERROR_UNKNOWN, + HB_ERROR_READ + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs new file mode 100644 index 000000000..62b0889cb --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs @@ -0,0 +1,46 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_filter_ids.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + public enum hb_filter_ids + { + HB_FILTER_INVALID = 0, + // for QSV - important to have before other filters + HB_FILTER_FIRST = 1, + HB_FILTER_QSV_PRE = 1, + + // First, filters that may change the framerate (drop or dup frames) + HB_FILTER_DETELECINE, + HB_FILTER_COMB_DETECT, + HB_FILTER_DECOMB, + HB_FILTER_DEINTERLACE, + HB_FILTER_VFR, + // Filters that must operate on the original source image are next + HB_FILTER_DEBLOCK, + HB_FILTER_DENOISE, + HB_FILTER_HQDN3D = HB_FILTER_DENOISE, + HB_FILTER_NLMEANS, + HB_FILTER_RENDER_SUB, + HB_FILTER_CROP_SCALE, + HB_FILTER_LAPSHARP, + HB_FILTER_UNSHARP, + HB_FILTER_ROTATE, + HB_FILTER_GRAYSCALE, + HB_FILTER_PAD, + + // Finally filters that don't care what order they are in, + // except that they must be after the above filters + HB_FILTER_AVFILTER, + + // for QSV - important to have as a last one + HB_FILTER_QSV_POST, + // default MSDK VPP filter + HB_FILTER_QSV, + HB_FILTER_LAST = HB_FILTER_QSV + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs new file mode 100644 index 000000000..c665a5306 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs @@ -0,0 +1,101 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_geometry.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the hb_geometry type. +// </summary> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + /// <summary> + /// The hb_geometry_s. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + public struct hb_geometry_s + { + /// <summary> + /// The width. + /// </summary> + public int width; + + /// <summary> + /// The height. + /// </summary> + public int height; + + /// <summary> + /// The par. + /// </summary> + public hb_rational_t par; + } + + /// <summary> + /// The hb_ui_geometry_s. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + public struct hb_geometry_settings_s + { + /// <summary> + /// Anamorphic mode, see job struct anamorphic + /// </summary> + public int mode; + + /// <summary> + /// Specifies settings that shouldn't be changed + /// </summary> + public int keep; + + /// <summary> + /// use dvd dimensions to determine PAR + /// </summary> + public int itu_par; + + /// <summary> + /// pixel alignment for loose anamorphic + /// </summary> + public int modulus; + + /// <summary> + /// Cropping + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)] + public int[] crop; + + /// <summary> + /// max destination storage width + /// </summary> + public int maxWidth; + + /// <summary> + /// max destination storage height + /// </summary> + public int maxHeight; + + /// <summary> + /// Pixel aspect used in custom anamorphic + /// </summary> + public hb_geometry_s geometry; + } + + /// <summary> + /// The hb_rational_t. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + public struct hb_rational_t + { + /// <summary> + /// The num. W + /// </summary> + public int num; + + /// <summary> + /// The den. H + /// </summary> + public int den; + } +}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs new file mode 100644 index 000000000..2d2632622 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs @@ -0,0 +1,41 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_image_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the hb_image_s type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System; + using System.Runtime.InteropServices; + + /// <summary> + /// The hb_image_s. + /// </summary> + internal struct hb_image_s + { + public int format; + public int width; + public int height; + public IntPtr data; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)] + public image_plane[] plane; + } + + /// <summary> + /// The image_plane. + /// </summary> + internal struct image_plane + { + public IntPtr data; + public int width; + public int height; + public int stride; + public int height_stride; + public int size; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs new file mode 100644 index 000000000..06fb6af6b --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs @@ -0,0 +1,25 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_mixdown_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + [StructLayout(LayoutKind.Sequential)] + internal struct hb_mixdown_s + { + [MarshalAs(UnmanagedType.LPStr)] + public string name; + + /// char* + [MarshalAs(UnmanagedType.LPStr)] + public string short_name; + + /// int + public int amixdown; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs new file mode 100644 index 000000000..f10c320ce --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs @@ -0,0 +1,22 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_rate_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System.Runtime.InteropServices; + + [StructLayout(LayoutKind.Sequential)] + internal struct hb_rate_s + { + /// char* + [MarshalAs(UnmanagedType.LPStr)] + public string name; + + /// int + public int rate; + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs new file mode 100644 index 000000000..0cfb0038b --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs @@ -0,0 +1,28 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="hb_subtitle.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + public enum hb_subtitle_s_subsource + { + VOBSUB, + + SRTSUB, + + CC608SUB, + + CC708SUB, + + UTF8SUB, + + TX3GSUB, + + SSASUB, + + PGSSUB + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs new file mode 100644 index 000000000..8a9d8ab64 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs @@ -0,0 +1,29 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="iso639_lang_t.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <auto-generated>Disable Stylecop Warnings for this file</auto-generated> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.HbLib +{ + using System; + using System.Runtime.InteropServices; + + [StructLayout(LayoutKind.Sequential)] + internal struct iso639_lang_t + { + public IntPtr eng_name; + + public IntPtr native_name; + + [MarshalAs(UnmanagedType.LPStr)] + public string iso639_1; + + [MarshalAs(UnmanagedType.LPStr)] + public string iso639_2; + + [MarshalAs(UnmanagedType.LPStr)] + public string iso639_2b; + } +} |