From 62f087933c51776ca60eb58262989acab2236fd0 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 31 Mar 2012 18:48:27 +0000 Subject: Interop: Fixes / API Updates for Encoding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4573 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrakeInterop/HbLib/HbFunctions.cs | 62 ++++++++++++++++------ .../HandBrakeInterop/HbLib/Misc.cs | 19 +++++++ .../HandBrakeInterop/HbLib/NativeConstants.cs | 21 +++++--- 3 files changed, 79 insertions(+), 23 deletions(-) (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/HbLib') diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index 7cc7e1b40..8fa46453d 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -54,13 +54,6 @@ namespace HandBrake.Interop.HbLib public static extern int hb_check_update(ref hb_handle_s h, ref IntPtr version); - /// Return Type: void - ///param0: hb_handle_t* - ///param1: int - [DllImport("hb.dll", EntryPoint = "hb_set_cpu_count", CallingConvention = CallingConvention.Cdecl)] - public static extern void hb_set_cpu_count(ref hb_handle_s param0, int param1); - - /// Return Type: char* ///path: char* [DllImport("hb.dll", EntryPoint = "hb_dvd_name", CallingConvention = CallingConvention.Cdecl)] @@ -104,9 +97,6 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_detect_comb", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_detect_comb(ref hb_buffer_s buf, int width, int height, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold); - [DllImport("hb.dll", EntryPoint = "hb_get_preview_by_index", CallingConvention = CallingConvention.Cdecl)] - public static extern void hb_get_preview_by_index(IntPtr hbHandle, int title_index, int picture, IntPtr buffer); - /// Return Type: void ///param0: hb_handle_t* ///param1: hb_title_t* @@ -123,9 +113,6 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_set_size", CallingConvention = CallingConvention.Cdecl)] public static extern void hb_set_size(ref hb_job_s param0, double ratio, int pixels); - [DllImport("hb.dll", EntryPoint = "hb_set_anamorphic_size_by_index", CallingConvention = CallingConvention.Cdecl)] - public static extern void hb_set_anamorphic_size_by_index(IntPtr hbHandle, int title_index, ref int output_width, ref int output_height, ref int output_par_width, ref int output_par_height); - /// Return Type: void ///param0: hb_job_t* ///output_width: int* @@ -191,10 +178,6 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_stop", CallingConvention = CallingConvention.Cdecl)] public static extern void hb_stop(IntPtr hbHandle); - [DllImport("hb.dll", EntryPoint = "hb_get_filter_object", CallingConvention = CallingConvention.Cdecl)] - //public static extern IntPtr hb_get_filter_object(int filter_id, [In] [MarshalAs(UnmanagedType.LPStr)] string settings); - public static extern IntPtr hb_get_filter_object(int filter_id, IntPtr settings); - /// Return Type: void ///param0: hb_handle_t* ///param1: hb_state_t* @@ -296,5 +279,50 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_get_audio_encoders_count", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_get_audio_encoders_count(); + + + /// void hb_autopassthru_apply_settings( hb_job_t * job ) + [DllImport("hb.dll", EntryPoint = "hb_autopassthru_apply_settings", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_autopassthru_apply_settings(ref hb_job_s job); + + ///hb_title_set_t * hb_get_title_set( hb_handle_t * ); + [DllImport("hb.dll", EntryPoint = "hb_get_title_set", CallingConvention = CallingConvention.Cdecl)] + public static extern hb_title_set_s hb_get_title_set(IntPtr hbHandle); + + ///hb_job_t * hb_job_init_by_index( hb_handle_t *h, int title_index ); + [DllImport("hb.dll", EntryPoint = "hb_job_init_by_index", CallingConvention = CallingConvention.Cdecl)] + public static extern hb_job_s hb_job_init_by_index(IntPtr hbHandle, int title_index); + + ///hb_job_t * hb_job_init( hb_title_t * title ); + [DllImport("hb.dll", EntryPoint = "hb_job_init", CallingConvention = CallingConvention.Cdecl)] + public static extern hb_job_s hb_job_init(ref hb_title_s title); + + ///void hb_job_reset( hb_job_t * job ); + [DllImport("hb.dll", EntryPoint = "hb_job_reset", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_job_reset(ref hb_job_s job); + + ///void hb_job_close( hb_job_t ** job ); + [DllImport("hb.dll", EntryPoint = "hb_job_close", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_job_close(ref hb_job_s job); + + ///void hb_job_set_advanced_opts( hb_job_t *job, const char *advanced_opts ); + [DllImport("hb.dll", EntryPoint = "hb_job_set_advanced_opts", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_job_set_advanced_opts(ref hb_job_s job, IntPtr advanced_opts); + + ///void hb_job_set_file( hb_job_t *job, const char *file ); + [DllImport("hb.dll", EntryPoint = "hb_job_set_file", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_job_set_file(ref hb_job_s job, IntPtr file); + + ///void hb_chapter_set_title(hb_chapter_t *chapter, const char *title); + [DllImport("hb.dll", EntryPoint = "hb_chapter_set_title", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_chapter_set_title(ref hb_chapter_s chapter, IntPtr title); + + /// void hb_add_filter( hb_job_t * job, hb_filter_object_t * filter, const char * settings ); + [DllImport("hb.dll", EntryPoint = "hb_add_filter", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_add_filter(ref hb_job_s job, hb_filter_object_s filter, IntPtr settings); + + /// hb_filter_object_t * hb_filter_init( int filter_id ); + [DllImport("hb.dll", EntryPoint = "hb_filter_init", CallingConvention = CallingConvention.Cdecl)] + public static extern hb_filter_object_s hb_filter_init(int filter_id); } } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs index 753b7edd2..81c80ab13 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs @@ -410,6 +410,25 @@ namespace HandBrake.Interop.HbLib public uint x; } + [StructLayout(LayoutKind.Sequential)] + public struct hb_title_set_s + { + ///hb_list_t * + public hb_list_s list_title; + + // int + public int feature; + } + + [StructLayout(LayoutKind.Sequential)] + public struct hb_filter_object_s + { + public int id; + public int enforce_order; + public IntPtr name; + public IntPtr settings; + } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void LoggingCallback(string message); } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs index aae152dce..c85390a41 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs @@ -109,11 +109,20 @@ namespace HandBrake.Interop.HbLib public const int HB_CONFIG_MAX_SIZE = 8192; - public const int HB_FILTER_DETELECINE = 1; - public const int HB_FILTER_DEINTERLACE = 2; - public const int HB_FILTER_DEBLOCK = 3; - public const int HB_FILTER_DENOISE = 4; - public const int HB_FILTER_DECOMB = 5; - public const int HB_FILTER_ROTATE = 6; + // First, filters that may change the framerate (drop or dup frames) + public const int HB_FILTER_DETELECINE = 1; + public const int HB_FILTER_DECOMB = 2; + public const int HB_FILTER_DEINTERLACE = 3; + public const int HB_FILTER_VFR = 4; + + // Filters that must operate on the original source image are next + public const int HB_FILTER_DEBLOCK = 5; + public const int HB_FILTER_DENOISE = 6; + public const int HB_FILTER_RENDER_SUB = 7; + public const int HB_FILTER_CROP_SCALE = 8; + + // Finally filters that don't care what order they are in, + // except that they must be after the above filters + public const int HB_FILTER_ROTATE = 9; } } -- cgit v1.2.3