WinGui: Fix another instance of the Caliburn vs Json.net sillyness where objects...
[HandBrake.git] / libhb / common.h
blobd1fe733352099844b4ab0e0a7a3a28f8b7e47393
1 /* common.h
3 Copyright (c) 2003-2015 HandBrake Team
4 This file is part of the HandBrake source code
5 Homepage: <http://handbrake.fr/>.
6 It may be used under the terms of the GNU General Public License v2.
7 For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
8 */
10 #ifndef HB_COMMON_H
11 #define HB_COMMON_H
13 #include <math.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <stdarg.h>
17 #include <string.h>
18 #include <unistd.h>
19 #include <inttypes.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <dirent.h>
25 * It seems WinXP doesn't align the stack of new threads to 16 bytes.
26 * To prevent crashes in SSE functions, we need to force stack alignement
27 * of new threads.
29 #if defined( __GNUC__ ) && (defined( _WIN32 ) || defined( __MINGW32__ ))
30 # define attribute_align_thread __attribute__((force_align_arg_pointer))
31 #else
32 # define attribute_align_thread
33 #endif
35 #if defined( __GNUC__ ) && !(defined( _WIN32 ) || defined( __MINGW32__ ))
36 # define HB_WPRINTF(s,v) __attribute__((format(printf,s,v)))
37 #else
38 # define HB_WPRINTF(s,v)
39 #endif
41 #if defined( SYS_MINGW )
42 # define fseek fseeko64
43 # define ftell ftello64
44 # undef fseeko
45 # define fseeko fseeko64
46 # undef ftello
47 # define ftello ftello64
48 # define flockfile(...)
49 # define funlockfile(...)
50 # define getc_unlocked getc
51 # undef off_t
52 # define off_t off64_t
53 #endif
55 #ifndef MIN
56 #define MIN( a, b ) ( (a) > (b) ? (b) : (a) )
57 #endif
58 #ifndef MAX
59 #define MAX( a, b ) ( (a) > (b) ? (a) : (b) )
60 #endif
62 #define HB_ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
64 #ifndef HB_DEBUG_ASSERT
65 #define HB_DEBUG_ASSERT(x, y) { if ((x)) { hb_error("ASSERT: %s", y); exit(1); } }
66 #endif
68 #define EVEN( a ) ((a) + ((a) & 1))
69 #define MULTIPLE_MOD(a, b) (((b) * (int)(((a) + ((b) / 2)) / (b))))
70 #define MULTIPLE_MOD_UP(a, b) (((b) * (int)(((a) + ((b) - 1)) / (b))))
71 #define MULTIPLE_MOD_DOWN(a, b) (((b) * (int)((a) / (b))))
73 #define HB_DVD_READ_BUFFER_SIZE 2048
75 typedef struct hb_handle_s hb_handle_t;
76 typedef struct hb_hwd_s hb_hwd_t;
77 typedef struct hb_list_s hb_list_t;
78 typedef struct hb_rate_s hb_rate_t;
79 typedef struct hb_dither_s hb_dither_t;
80 typedef struct hb_mixdown_s hb_mixdown_t;
81 typedef struct hb_encoder_s hb_encoder_t;
82 typedef struct hb_container_s hb_container_t;
83 typedef struct hb_rational_s hb_rational_t;
84 typedef struct hb_geometry_s hb_geometry_t;
85 typedef struct hb_geometry_settings_s hb_geometry_settings_t;
86 typedef struct hb_image_s hb_image_t;
87 typedef struct hb_job_s hb_job_t;
88 typedef struct hb_title_set_s hb_title_set_t;
89 typedef struct hb_title_s hb_title_t;
90 typedef struct hb_chapter_s hb_chapter_t;
91 typedef struct hb_audio_s hb_audio_t;
92 typedef struct hb_audio_config_s hb_audio_config_t;
93 typedef struct hb_subtitle_s hb_subtitle_t;
94 typedef struct hb_subtitle_config_s hb_subtitle_config_t;
95 typedef struct hb_attachment_s hb_attachment_t;
96 typedef struct hb_metadata_s hb_metadata_t;
97 typedef struct hb_coverart_s hb_coverart_t;
98 typedef struct hb_state_s hb_state_t;
99 typedef union hb_esconfig_u hb_esconfig_t;
100 typedef struct hb_work_private_s hb_work_private_t;
101 typedef struct hb_work_object_s hb_work_object_t;
102 typedef struct hb_filter_private_s hb_filter_private_t;
103 typedef struct hb_filter_object_s hb_filter_object_t;
104 typedef struct hb_buffer_s hb_buffer_t;
105 typedef struct hb_buffer_settings_s hb_buffer_settings_t;
106 typedef struct hb_image_format_s hb_image_format_t;
107 typedef struct hb_fifo_s hb_fifo_t;
108 typedef struct hb_lock_s hb_lock_t;
109 typedef enum
111 HB_ERROR_NONE = 0,
112 HB_ERROR_CANCELED = 1,
113 HB_ERROR_WRONG_INPUT = 2,
114 HB_ERROR_INIT = 3,
115 HB_ERROR_UNKNOWN = 4,
116 HB_ERROR_READ = 5
117 } hb_error_code;
119 #include "ports.h"
120 #ifdef __LIBHB__
121 #include "internal.h"
122 #define PRIVATE
123 #else
124 #define PRIVATE const
125 #endif
126 #include "audio_remap.h"
127 #include "libavutil/channel_layout.h"
129 #ifdef USE_QSV
130 #include "libavcodec/qsv.h"
131 #endif
133 hb_list_t * hb_list_init();
134 int hb_list_count( const hb_list_t * );
135 void hb_list_add( hb_list_t *, void * );
136 void hb_list_insert( hb_list_t * l, int pos, void * p );
137 void hb_list_rem( hb_list_t *, void * );
138 void * hb_list_item( const hb_list_t *, int );
139 void hb_list_close( hb_list_t ** );
141 void hb_reduce( int *x, int *y, int num, int den );
142 void hb_limit_rational( int *x, int *y, int num, int den, int limit );
143 void hb_reduce64( int64_t *x, int64_t *y, int64_t num, int64_t den );
144 void hb_limit_rational64( int64_t *x, int64_t *y, int64_t num, int64_t den, int64_t limit );
146 #define HB_KEEP_WIDTH 0x01
147 #define HB_KEEP_HEIGHT 0x02
148 #define HB_KEEP_DISPLAY_ASPECT 0x04
150 void hb_job_set_encoder_preset (hb_job_t *job, const char *preset);
151 void hb_job_set_encoder_tune (hb_job_t *job, const char *tune);
152 void hb_job_set_encoder_options(hb_job_t *job, const char *options);
153 void hb_job_set_encoder_profile(hb_job_t *job, const char *profile);
154 void hb_job_set_encoder_level (hb_job_t *job, const char *level);
155 void hb_job_set_file (hb_job_t *job, const char *file);
157 hb_audio_t *hb_audio_copy(const hb_audio_t *src);
158 hb_list_t *hb_audio_list_copy(const hb_list_t *src);
159 void hb_audio_close(hb_audio_t **audio);
160 void hb_audio_config_init(hb_audio_config_t * audiocfg);
161 int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg);
162 hb_audio_config_t * hb_list_audio_config_item(hb_list_t * list, int i);
164 int hb_subtitle_add_ssa_header(hb_subtitle_t *subtitle, const char *font,
165 int fs, int width, int height);
166 hb_subtitle_t *hb_subtitle_copy(const hb_subtitle_t *src);
167 hb_list_t *hb_subtitle_list_copy(const hb_list_t *src);
168 void hb_subtitle_close( hb_subtitle_t **sub );
169 int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg, int track);
170 int hb_srt_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg,
171 const char *lang);
172 int hb_subtitle_can_force( int source );
173 int hb_subtitle_can_burn( int source );
174 int hb_subtitle_can_pass( int source, int mux );
176 int hb_audio_can_apply_drc(uint32_t codec, uint32_t codec_param, int encoder);
177 int hb_audio_can_apply_drc2(hb_handle_t *h, int title_idx,
178 int audio_idx, int encoder);
180 hb_attachment_t *hb_attachment_copy(const hb_attachment_t *src);
182 hb_list_t *hb_attachment_list_copy(const hb_list_t *src);
183 void hb_attachment_close(hb_attachment_t **attachment);
185 hb_metadata_t * hb_metadata_init();
186 hb_metadata_t * hb_metadata_copy(const hb_metadata_t *src);
187 void hb_metadata_close(hb_metadata_t **metadata);
188 void hb_metadata_set_name( hb_metadata_t *metadata, const char *name );
189 void hb_metadata_set_artist( hb_metadata_t *metadata, const char *artist );
190 void hb_metadata_set_composer( hb_metadata_t *metadata, const char *composer );
191 void hb_metadata_set_release_date( hb_metadata_t *metadata, const char *release_date );
192 void hb_metadata_set_comment( hb_metadata_t *metadata, const char *comment );
193 void hb_metadata_set_genre( hb_metadata_t *metadata, const char *genre );
194 void hb_metadata_set_album( hb_metadata_t *metadata, const char *album );
195 void hb_metadata_set_album_artist( hb_metadata_t *metadata, const char *album_artist );
196 void hb_metadata_set_description( hb_metadata_t *metadata, const char *description );
197 void hb_metadata_set_long_description( hb_metadata_t *metadata, const char *long_description );
198 void hb_metadata_add_coverart( hb_metadata_t *metadata, const uint8_t *data, int size, int type );
199 void hb_metadata_rem_coverart( hb_metadata_t *metadata, int ii );
201 hb_chapter_t *hb_chapter_copy(const hb_chapter_t *src);
202 hb_list_t *hb_chapter_list_copy(const hb_list_t *src);
203 void hb_chapter_close(hb_chapter_t **chapter);
204 void hb_chapter_set_title(hb_chapter_t *chapter, const char *title);
206 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_rate_s.cs when changing this struct
207 struct hb_rate_s
209 const char *name;
210 int rate;
213 struct hb_dither_s
215 const char *description;
216 const char *short_name;
217 int method;
220 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_mixdown_s.cs when changing this struct
221 struct hb_mixdown_s
223 const char *name;
224 const char *short_name;
225 int amixdown;
228 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_encoder_s.cs when changing this struct
229 struct hb_encoder_s
231 const char *name; // note: used in presets
232 const char *short_name; // note: used in CLI
233 const char *long_name; // used in log
234 int codec; // HB_*CODEC_* define
235 int muxers; // supported muxers
238 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_container_s.cs when changing this struct
239 struct hb_container_s
241 const char *name;
242 const char *short_name;
243 const char *long_name;
244 const char *default_extension;
245 int format;
248 struct hb_rational_s
250 int num;
251 int den;
254 struct hb_geometry_s
256 int width;
257 int height;
258 hb_rational_t par;
261 struct hb_geometry_settings_s
263 int mode; // Anamorphic mode, see job struct anamorphic
264 int keep; // Specifies settings that shouldn't be changed
265 int itu_par; // use dvd dimensions to determine PAR
266 int modulus; // pixel alignment for loose anamorphic
267 int crop[4]; // Pixels cropped from source before scaling
268 int maxWidth; // max destination storage width
269 int maxHeight; // max destination storage height
270 hb_geometry_t geometry;
273 struct hb_image_s
275 int format;
276 int width;
277 int height;
278 uint8_t *data;
280 struct image_plane
282 uint8_t *data;
283 int width;
284 int height;
285 int stride;
286 int height_stride;
287 int size;
288 } plane[4];
291 void hb_image_close(hb_image_t **_image);
293 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_subtitle_config_s.cs when changing this struct
294 struct hb_subtitle_config_s
296 enum subdest { RENDERSUB, PASSTHRUSUB } dest;
297 int force;
298 int default_track;
300 /* SRT subtitle tracks only */
301 char src_filename[256];
302 char src_codeset[40];
303 int64_t offset;
306 /*******************************************************************************
307 * Lists of rates, mixdowns, encoders etc.
308 *******************************************************************************
310 * Use hb_*_get_next() to get the next list item (use NULL to get the first).
312 * Use hb_*_get_from_name() to get the value corresponding to a name.
313 * The name can be either the short or full name.
314 * Legacy names are sanitized to currently-supported values whenever possible.
315 * Returns 0 or -1 if no value could be found.
317 * Use hb_*_get_name() and hb_*_get_short_name() to get the corresponding value.
318 * Returns NULL if the value is invalid.
320 * Use hb_*_get_long_name() when the name is not descriptive enough for you.
322 * hb_*_sanitize_name() are convenience functions for use when dealing
323 * with full names (e.g. to translate legacy values while loading a preset).
325 * Names are case-insensitive; libhb will ensure that the lists do not contain
326 * more than one entry with the same name.
328 * Use hb_*_get_limits() to get the minimum/maximum for lists with numerically
329 * ordered values.
331 * Use hb_*_get_best() to sanitize a value based on other relevant parameters.
333 * Use hb_*_get_default() to get the default based on other relevant parameters.
337 void hb_common_global_init();
339 int hb_video_framerate_get_from_name(const char *name);
340 const char* hb_video_framerate_get_name(int framerate);
341 const char* hb_video_framerate_sanitize_name(const char *name);
342 const hb_rate_t* hb_video_framerate_get_next(const hb_rate_t *last);
344 int hb_audio_samplerate_get_best(uint32_t codec, int samplerate, int *sr_shift);
345 int hb_audio_samplerate_get_from_name(const char *name);
346 const char* hb_audio_samplerate_get_name(int samplerate);
347 const hb_rate_t* hb_audio_samplerate_get_next(const hb_rate_t *last);
349 int hb_audio_bitrate_get_best(uint32_t codec, int bitrate, int samplerate, int mixdown);
350 int hb_audio_bitrate_get_default(uint32_t codec, int samplerate, int mixdown);
351 void hb_audio_bitrate_get_limits(uint32_t codec, int samplerate, int mixdown, int *low, int *high);
352 const hb_rate_t* hb_audio_bitrate_get_next(const hb_rate_t *last);
354 void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction);
355 const char* hb_video_quality_get_name(uint32_t codec);
357 const char* const* hb_video_encoder_get_presets (int encoder);
358 const char* const* hb_video_encoder_get_tunes (int encoder);
359 const char* const* hb_video_encoder_get_profiles(int encoder);
360 const char* const* hb_video_encoder_get_levels (int encoder);
362 void hb_audio_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction);
363 float hb_audio_quality_get_best(uint32_t codec, float quality);
364 float hb_audio_quality_get_default(uint32_t codec);
366 void hb_audio_compression_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction);
367 float hb_audio_compression_get_best(uint32_t codec, float compression);
368 float hb_audio_compression_get_default(uint32_t codec);
370 int hb_audio_dither_get_default();
371 int hb_audio_dither_get_default_method(); // default method, if enabled && supported
372 int hb_audio_dither_is_supported(uint32_t codec);
373 int hb_audio_dither_get_from_name(const char *name);
374 const char* hb_audio_dither_get_description(int method);
375 const hb_dither_t* hb_audio_dither_get_next(const hb_dither_t *last);
377 int hb_mixdown_is_supported(int mixdown, uint32_t codec, uint64_t layout);
378 int hb_mixdown_has_codec_support(int mixdown, uint32_t codec);
379 int hb_mixdown_has_remix_support(int mixdown, uint64_t layout);
380 int hb_mixdown_get_discrete_channel_count(int mixdown);
381 int hb_mixdown_get_low_freq_channel_count(int mixdown);
382 int hb_mixdown_get_best(uint32_t codec, uint64_t layout, int mixdown);
383 int hb_mixdown_get_default(uint32_t codec, uint64_t layout);
384 hb_mixdown_t* hb_mixdown_get_from_mixdown(int mixdown);
385 int hb_mixdown_get_from_name(const char *name);
386 const char* hb_mixdown_get_name(int mixdown);
387 const char* hb_mixdown_get_short_name(int mixdown);
388 const char* hb_mixdown_sanitize_name(const char *name);
389 const hb_mixdown_t* hb_mixdown_get_next(const hb_mixdown_t *last);
391 int hb_video_encoder_get_default(int muxer);
392 hb_encoder_t* hb_video_encoder_get_from_codec(int codec);
393 int hb_video_encoder_get_from_name(const char *name);
394 const char* hb_video_encoder_get_name(int encoder);
395 const char* hb_video_encoder_get_short_name(int encoder);
396 const char* hb_video_encoder_get_long_name(int encoder);
397 const char* hb_video_encoder_sanitize_name(const char *name);
398 const hb_encoder_t* hb_video_encoder_get_next(const hb_encoder_t *last);
401 * hb_audio_encoder_get_fallback_for_passthru() will sanitize a passthru codec
402 * to the matching audio encoder (if any is available).
404 * hb_audio_encoder_get_from_name(), hb_audio_encoder_sanitize_name() will
405 * sanitize legacy encoder names, but won't convert passthru to an encoder.
407 int hb_audio_encoder_get_fallback_for_passthru(int passthru);
408 int hb_audio_encoder_get_default(int muxer);
409 hb_encoder_t* hb_audio_encoder_get_from_codec(int codec);
410 int hb_audio_encoder_get_from_name(const char *name);
411 const char* hb_audio_encoder_get_name(int encoder);
412 const char* hb_audio_encoder_get_short_name(int encoder);
413 const char* hb_audio_encoder_get_long_name(int encoder);
414 const char* hb_audio_encoder_sanitize_name(const char *name);
415 const hb_encoder_t* hb_audio_encoder_get_next(const hb_encoder_t *last);
418 * Not typically used by the UIs
419 * (set hb_job_t.acodec_copy_mask, hb_job_t.acodec_fallback instead).
421 void hb_autopassthru_apply_settings(hb_job_t *job);
422 void hb_autopassthru_print_settings(hb_job_t *job);
423 int hb_autopassthru_get_encoder(int in_codec, int copy_mask, int fallback, int muxer);
425 hb_container_t* hb_container_get_from_format(int format);
426 int hb_container_get_from_name(const char *name);
427 int hb_container_get_from_extension(const char *extension); // not really a container name
428 const char* hb_container_get_name(int format);
429 const char* hb_container_get_short_name(int format);
430 const char* hb_container_get_long_name(int format);
431 const char* hb_container_get_default_extension(int format);
432 const char* hb_container_sanitize_name(const char *name);
433 const hb_container_t* hb_container_get_next(const hb_container_t *last);
435 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_set_s.cs when changing this struct
436 struct hb_title_set_s
438 hb_list_t * list_title;
439 int feature; // Detected DVD feature title
440 char path[1024];
443 typedef enum
445 HB_ANAMORPHIC_NONE,
446 HB_ANAMORPHIC_STRICT,
447 HB_ANAMORPHIC_LOOSE,
448 HB_ANAMORPHIC_CUSTOM
449 } hb_anamorphic_mode_t;
451 /******************************************************************************
452 * hb_job_t: settings to be filled by the UI
453 * Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs when changing this struct
454 *****************************************************************************/
455 struct hb_job_s
457 PRIVATE const char * json; // JSON encoded job string
459 /* ID assigned by UI so it can groups job passes together */
460 int sequence_id;
462 /* Pointer to the title to be ripped */
463 hb_title_t * title;
464 int feature; // Detected DVD feature title
466 /* Chapter selection */
467 int chapter_start;
468 int chapter_end;
470 /* Include chapter marker track in mp4? */
471 int chapter_markers;
473 // Video filters
474 int grayscale; // Black and white encoding
475 hb_list_t * list_filter;
477 PRIVATE int crop[4];
478 PRIVATE int width;
479 PRIVATE int height;
480 hb_rational_t par;
482 /* Video settings:
483 vcodec: output codec
484 vquality: output quality (if < 0.0, bitrate is used instead)
485 vbitrate: output bitrate (Kbps)
486 vrate: output framerate
487 cfr: 0 (vfr), 1 (cfr), 2 (pfr) [see render.c]
488 pass: 0, 1 or 2 (or -1 for scan)
489 areBframes: boolean to note if b-frames are used */
490 #define HB_VCODEC_MASK 0x0000FFF
491 #define HB_VCODEC_INVALID 0x0000000
492 #define HB_VCODEC_X264 0x0000001
493 #define HB_VCODEC_THEORA 0x0000002
494 #define HB_VCODEC_X265 0x0000004
495 #define HB_VCODEC_FFMPEG_MPEG4 0x0000010
496 #define HB_VCODEC_FFMPEG_MPEG2 0x0000020
497 #define HB_VCODEC_FFMPEG_VP8 0x0000040
498 #define HB_VCODEC_FFMPEG_MASK 0x00000F0
499 #define HB_VCODEC_QSV_H264 0x0000100
500 #define HB_VCODEC_QSV_MASK 0x0000F00
501 #define HB_VCODEC_H264_MASK (HB_VCODEC_X264|HB_VCODEC_QSV_H264)
503 int vcodec;
504 double vquality;
505 int vbitrate;
506 hb_rational_t vrate;
507 int cfr;
508 PRIVATE int pass_id;
509 int twopass; // Enable 2-pass encode. Boolean
510 int fastfirstpass;
511 char *encoder_preset;
512 char *encoder_tune;
513 char *encoder_options;
514 char *encoder_profile;
515 char *encoder_level;
516 int areBframes;
518 int color_matrix_code;
519 int color_prim;
520 int color_transfer;
521 int color_matrix;
522 // see https://developer.apple.com/quicktime/icefloe/dispatch019.html#colr
523 #define HB_COLR_PRI_BT709 1
524 #define HB_COLR_PRI_UNDEF 2
525 #define HB_COLR_PRI_EBUTECH 5 // use for bt470bg
526 #define HB_COLR_PRI_SMPTEC 6 // smpte170m; also use for bt470m and smpte240m
527 // 0, 3-4, 7-65535: reserved
528 #define HB_COLR_TRA_BT709 1 // also use for bt470m, bt470bg and smpte170m
529 #define HB_COLR_TRA_UNDEF 2
530 #define HB_COLR_TRA_SMPTE240M 7
531 // 0, 3-6, 8-65535: reserved
532 #define HB_COLR_MAT_BT709 1
533 #define HB_COLR_MAT_UNDEF 2
534 #define HB_COLR_MAT_SMPTE170M 6 // also use for fcc and bt470bg
535 #define HB_COLR_MAT_SMPTE240M 7
536 // 0, 3-5, 8-65535: reserved
538 hb_list_t * list_chapter;
540 /* List of audio settings. */
541 hb_list_t * list_audio;
542 int acodec_copy_mask; // Auto Passthru allowed codecs
543 int acodec_fallback; // Auto Passthru fallback encoder
545 /* Subtitles */
546 hb_list_t * list_subtitle;
548 hb_list_t * list_attachment;
550 hb_metadata_t * metadata;
553 * Muxer settings
554 * mux: output file format
555 * file: file path
557 #define HB_MUX_MASK 0xFF0001
558 #define HB_MUX_INVALID 0x000000
559 #define HB_MUX_MP4V2 0x010000
560 #define HB_MUX_AV_MP4 0x020000
561 #define HB_MUX_MASK_MP4 0x030000
562 #define HB_MUX_LIBMKV 0x100000
563 #define HB_MUX_AV_MKV 0x200000
564 #define HB_MUX_MASK_MKV 0x300000
565 #define HB_MUX_MASK_AV 0x220000
566 /* default muxer for each container */
567 #define HB_MUX_MP4 HB_MUX_AV_MP4
568 #define HB_MUX_MKV HB_MUX_AV_MKV
570 int mux;
571 char * file;
573 int mp4_optimize;
574 int ipod_atom;
576 int indepth_scan;
577 hb_subtitle_config_t select_subtitle_config;
579 int angle; // dvd angle to encode
580 int frame_to_start; // declare eof when we hit this frame
581 int64_t pts_to_start; // drop frames until we pass this pts
582 // in the time-linearized input stream
583 int frame_to_stop; // declare eof when we hit this frame
584 int64_t pts_to_stop; // declare eof when we pass this pts in
585 // the time-linearized input stream
586 int start_at_preview; // if non-zero, encoding will start
587 // at the position of preview n
588 int seek_points; // out of N previews
589 uint32_t frames_to_skip; // decode but discard this many frames
590 // initially (for frame accurate positioning
591 // to non-I frames).
592 int use_opencl;
593 int use_hwd;
594 PRIVATE int use_decomb;
595 PRIVATE int use_detelecine;
597 // QSV-specific settings
598 struct
600 int decode;
601 int async_depth;
602 #ifdef USE_QSV
603 av_qsv_context *ctx;
604 #endif
605 // shared encoding parameters
606 // initialized by the QSV encoder, then used upstream (e.g. by filters)
607 // to configure their output so that it matches what the encoder expects
608 struct
610 int pic_struct;
611 int align_width;
612 int align_height;
613 int is_init_done;
614 } enc_info;
615 } qsv;
617 #ifdef __LIBHB__
618 /* Internal data */
619 hb_handle_t * h;
620 volatile hb_error_code * done_error;
621 volatile int * die;
622 volatile int done;
624 uint64_t st_pause_date;
625 uint64_t st_paused;
627 hb_fifo_t * fifo_mpeg2; /* MPEG-2 video ES */
628 hb_fifo_t * fifo_raw; /* Raw pictures */
629 hb_fifo_t * fifo_sync; /* Raw pictures, framerate corrected */
630 hb_fifo_t * fifo_render; /* Raw pictures, scaled */
631 hb_fifo_t * fifo_mpeg4; /* MPEG-4 video ES */
633 hb_list_t * list_work;
635 hb_esconfig_t config;
637 hb_mux_data_t * mux_data;
638 #endif
641 /* Audio starts here */
642 /* Audio Codecs: Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs when changing these consts */
643 #define HB_ACODEC_INVALID 0x00000000
644 #define HB_ACODEC_MASK 0x03FFFF00
645 #define HB_ACODEC_LAME 0x00000200
646 #define HB_ACODEC_VORBIS 0x00000400
647 #define HB_ACODEC_AC3 0x00000800
648 #define HB_ACODEC_LPCM 0x00001000
649 #define HB_ACODEC_DCA 0x00002000
650 #define HB_ACODEC_CA_AAC 0x00004000
651 #define HB_ACODEC_CA_HAAC 0x00008000
652 #define HB_ACODEC_FFAAC 0x00010000
653 #define HB_ACODEC_FFMPEG 0x00020000
654 #define HB_ACODEC_DCA_HD 0x00040000
655 #define HB_ACODEC_MP3 0x00080000
656 #define HB_ACODEC_FFFLAC 0x00100000
657 #define HB_ACODEC_FFFLAC24 0x00200000
658 #define HB_ACODEC_FDK_AAC 0x00400000
659 #define HB_ACODEC_FDK_HAAC 0x00800000
660 #define HB_ACODEC_FFEAC3 0x01000000
661 #define HB_ACODEC_FFTRUEHD 0x02000000
662 #define HB_ACODEC_FF_MASK 0x03FF2800
663 #define HB_ACODEC_PASS_FLAG 0x40000000
664 #define 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)
665 #define HB_ACODEC_AUTO_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_PASS_MASK)
666 #define HB_ACODEC_ANY (HB_ACODEC_PASS_FLAG | HB_ACODEC_MASK)
667 #define HB_ACODEC_AAC_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFAAC)
668 #define HB_ACODEC_AC3_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_AC3)
669 #define HB_ACODEC_DCA_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_DCA)
670 #define HB_ACODEC_DCA_HD_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_DCA_HD)
671 #define HB_ACODEC_EAC3_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3)
672 #define HB_ACODEC_FLAC_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC)
673 #define HB_ACODEC_MP3_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_MP3)
674 #define HB_ACODEC_TRUEHD_PASS (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD)
676 #define HB_SUBSTREAM_BD_TRUEHD 0x72
677 #define HB_SUBSTREAM_BD_AC3 0x76
678 #define HB_SUBSTREAM_BD_DTSHD 0x72
679 #define HB_SUBSTREAM_BD_DTS 0x71
681 /* define an invalid VBR quality compatible with all VBR-capable codecs */
682 #define HB_INVALID_AUDIO_QUALITY (-3.)
684 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio_config_s.cs when changing this struct
685 struct hb_audio_config_s
687 /* Output */
688 struct
690 enum
692 // make sure audio->config.out.mixdown isn't treated as unsigned
693 HB_INVALID_AMIXDOWN = -1,
694 HB_AMIXDOWN_NONE = 0,
695 HB_AMIXDOWN_MONO,
696 HB_AMIXDOWN_LEFT,
697 HB_AMIXDOWN_RIGHT,
698 HB_AMIXDOWN_STEREO,
699 HB_AMIXDOWN_DOLBY,
700 HB_AMIXDOWN_DOLBYPLII,
701 HB_AMIXDOWN_5POINT1,
702 HB_AMIXDOWN_6POINT1,
703 HB_AMIXDOWN_7POINT1,
704 HB_AMIXDOWN_5_2_LFE,
705 } mixdown; /* Audio mixdown */
706 int track; /* Output track number */
707 uint32_t codec; /* Output audio codec */
708 int samplerate; /* Output sample rate (Hz) */
709 int samples_per_frame; /* Number of samples per frame */
710 int bitrate; /* Output bitrate (Kbps) */
711 double quality; /* Output quality (encoder-specific) */
712 double compression_level; /* Output compression level (encoder-specific) */
713 double dynamic_range_compression; /* Amount of DRC applied to this track */
714 double gain; /* Gain (in dB), negative is quieter */
715 int normalize_mix_level; /* mix level normalization (boolean) */
716 int dither_method; /* dither algorithm */
717 char * name; /* Output track name */
718 int delay;
719 } out;
721 /* Input */
722 struct
724 int track; /* Input track number */
725 PRIVATE uint32_t codec; /* Input audio codec */
726 PRIVATE uint32_t codec_param; /* Per-codec config info */
727 PRIVATE uint32_t reg_desc; /* Registration descriptor of source */
728 PRIVATE uint32_t stream_type; /* Stream type from source stream */
729 PRIVATE uint32_t substream_type; /* Substream type for multiplexed streams */
730 PRIVATE uint32_t version; /* Bitsream version */
731 PRIVATE uint32_t flags; /* Bitstream flags, codec-specific */
732 PRIVATE uint32_t mode; /* Bitstream mode, codec-specific */
733 PRIVATE int samplerate; /* Input sample rate (Hz) */
734 PRIVATE int sample_bit_depth; /* Input samples' bit depth (0 if unknown) */
735 PRIVATE int samples_per_frame; /* Number of samples per frame */
736 PRIVATE int bitrate; /* Input bitrate (bps) */
737 PRIVATE int matrix_encoding; /* Source matrix encoding mode, set by the audio decoder */
738 PRIVATE uint64_t channel_layout; /* Source channel layout, set by the audio decoder */
739 PRIVATE hb_chan_map_t * channel_map; /* Source channel map, set by the audio decoder */
740 } in;
742 struct
744 PRIVATE char description[1024];
745 PRIVATE char simple[1024];
746 PRIVATE char iso639_2[4];
747 #define HB_AUDIO_TYPE_NONE 0
748 #define HB_AUDIO_TYPE_NORMAL 1
749 #define HB_AUDIO_TYPE_VISUALLY_IMPAIRED 2
750 #define HB_AUDIO_TYPE_COMMENTARY 3
751 #define HB_AUDIO_TYPE_ALT_COMMENTARY 4
752 #define HB_AUDIO_TYPE_BD_SECONDARY 5
753 PRIVATE uint8_t type; /* normal, visually impaired, director's commentary */
754 } lang;
757 #ifdef __LIBHB__
758 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio_s.cs when changing this struct
759 struct hb_audio_s
761 int id;
763 hb_audio_config_t config;
765 struct {
766 hb_fifo_t * fifo_in; /* AC3/MPEG/LPCM ES */
767 hb_fifo_t * fifo_raw; /* Raw audio */
768 hb_fifo_t * fifo_sync; /* Resampled, synced raw audio */
769 hb_fifo_t * fifo_out; /* MP3/AAC/Vorbis ES */
771 hb_esconfig_t config;
772 hb_mux_data_t * mux_data;
773 hb_fifo_t * scan_cache;
774 } priv;
776 #endif
778 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_chapter_s.cs when changing this struct
779 struct hb_chapter_s
781 int index;
782 int pgcn;
783 int pgn;
784 int cell_start;
785 int cell_end;
786 uint64_t block_start;
787 uint64_t block_end;
788 uint64_t block_count;
790 /* Visual-friendly duration */
791 int hours;
792 int minutes;
793 int seconds;
795 /* Exact duration (in 1/90000s) */
796 uint64_t duration;
798 /* Optional chapter title */
799 char *title;
803 * A subtitle track.
805 * Required fields when a demuxer creates a subtitle track are:
806 * > id
807 * - ID of this track
808 * - must be unique for all tracks within a single job,
809 * since it is used to look up the appropriate in-FIFO with GetFifoForId()
810 * > format
811 * - format of the packets the subtitle decoder work-object sends to sub->fifo_raw
812 * - for passthru subtitles, is also the format of the final packets sent to sub->fifo_out
813 * - PICTURESUB for banded 8-bit YAUV pixels; see decvobsub.c documentation for more info
814 * - TEXTSUB for UTF-8 text marked up with <b>, <i>, or <u>
815 * - read by the muxers, and by the subtitle burn-in logic in the hb_sync_video work-object
816 * > source
817 * - used to create the appropriate subtitle decoder work-object in do_job()
818 * > config.dest
819 * - whether to render the subtitle on the video track (RENDERSUB) or
820 * to pass it through its own subtitle track in the output container (PASSTHRUSUB)
821 * - all newly created non-VOBSUB tracks should default to PASSTHRUSUB
822 * - all newly created VOBSUB tracks should default to RENDERSUB, for legacy compatibility
823 * > lang
824 * - user-readable description of the subtitle track
825 * - may correspond to the language of the track (see the 'iso639_2' field)
826 * - may correspond to the type of track (see the 'type' field; ex: "Closed Captions")
827 * > iso639_2
828 * - language code for the subtitle, or "und" if unknown
830 * Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_subtitle_s.cs when changing this struct
832 struct hb_subtitle_s
834 int id;
835 int track;
836 int out_track;
838 hb_subtitle_config_t config;
840 enum subtype { PICTURESUB, TEXTSUB } format;
841 enum subsource { VOBSUB, SRTSUB, CC608SUB, /*unused*/CC708SUB, UTF8SUB, TX3GSUB, SSASUB, PGSSUB } source;
842 char lang[1024];
843 char iso639_2[4];
844 uint8_t type; /* Closed Caption, Childrens, Directors etc */
846 // Color lookup table for VOB subtitle tracks. Each entry is in YCbCr format.
847 // Must be filled out by the demuxer for VOB subtitle tracks.
848 uint32_t palette[16];
849 uint8_t palette_set;
850 int width;
851 int height;
853 // Codec private data for subtitles originating from FFMPEG sources
854 uint8_t * extradata;
855 int extradata_size;
857 int hits; /* How many hits/occurrences of this subtitle */
858 int forced_hits; /* How many forced hits in this subtitle */
860 #ifdef __LIBHB__
861 /* Internal data */
862 PRIVATE uint32_t codec; /* Input "codec" */
863 PRIVATE uint32_t reg_desc; /* registration descriptor of source */
864 PRIVATE uint32_t stream_type; /* stream type from source stream */
865 PRIVATE uint32_t substream_type;/* substream for multiplexed streams */
867 hb_fifo_t * fifo_in; /* SPU ES */
868 hb_fifo_t * fifo_raw; /* Decoded SPU */
869 hb_fifo_t * fifo_sync;/* Synced */
870 hb_fifo_t * fifo_out; /* Correct Timestamps, ready to be muxed */
871 hb_mux_data_t * mux_data;
872 #endif
876 * An attachment.
878 * These are usually used for attaching embedded fonts to movies containing SSA subtitles.
880 struct hb_attachment_s
882 enum attachtype { FONT_TTF_ATTACH, FONT_OTF_ATTACH, HB_ART_ATTACH } type;
883 char * name;
884 char * data;
885 int size;
888 struct hb_coverart_s
890 uint8_t *data;
891 uint32_t size;
892 enum arttype {
893 HB_ART_UNDEFINED,
894 HB_ART_BMP,
895 HB_ART_GIF,
896 HB_ART_PNG,
897 HB_ART_JPEG
898 } type;
901 struct hb_metadata_s
903 char *name;
904 char *artist; // Actors
905 char *composer;
906 char *release_date;
907 char *comment;
908 char *album; // DVD
909 char *album_artist; // Director
910 char *genre;
911 char *description;
912 char *long_description;
913 hb_list_t * list_coverart;
916 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs when changing this struct
917 struct hb_title_s
919 enum { HB_DVD_TYPE, HB_BD_TYPE, HB_STREAM_TYPE, HB_FF_STREAM_TYPE } type;
920 uint32_t reg_desc;
921 char path[1024];
922 char name[1024];
923 int index;
924 int playlist;
925 int vts;
926 int ttn;
927 int cell_start;
928 int cell_end;
929 uint64_t block_start;
930 uint64_t block_end;
931 uint64_t block_count;
932 int angle_count;
933 void * opaque_priv;
935 /* Visual-friendly duration */
936 int hours;
937 int minutes;
938 int seconds;
940 /* Exact duration (in 1/90000s) */
941 uint64_t duration;
943 int has_resolution_change;
944 hb_geometry_t geometry;
945 hb_rational_t dar; // aspect ratio for the title's video
946 hb_rational_t container_dar; // aspect ratio from container (0 if none)
947 int color_prim;
948 int color_transfer;
949 int color_matrix;
950 hb_rational_t vrate;
951 int crop[4];
952 enum {HB_DVD_DEMUXER, HB_TS_DEMUXER, HB_PS_DEMUXER, HB_NULL_DEMUXER} demuxer;
953 int detected_interlacing;
954 int pcr_pid; /* PCR PID for TS streams */
955 int video_id; /* demuxer stream id for video */
956 int video_codec; /* worker object id of video codec */
957 uint32_t video_stream_type; /* stream type from source stream */
958 int video_codec_param; /* codec specific config */
959 char * video_codec_name;
960 int video_bitrate;
961 char * container_name;
962 int data_rate;
964 // additional supported video decoders (e.g. HW-accelerated implementations)
965 int video_decode_support;
966 #define HB_DECODE_SUPPORT_SW 0x01 // software (libavcodec or mpeg2dec)
967 #define HB_DECODE_SUPPORT_QSV 0x02 // Intel Quick Sync Video
968 #define HB_DECODE_SUPPORT_DXVA2 0x04 // Microsoft DXVA2
970 hb_metadata_t * metadata;
972 hb_list_t * list_chapter;
973 hb_list_t * list_audio;
974 hb_list_t * list_subtitle;
975 hb_list_t * list_attachment;
977 uint32_t flags;
978 // set if video stream doesn't have IDR frames
979 #define HBTF_NO_IDR (1 << 0)
980 #define HBTF_SCAN_COMPLETE (1 << 1)
982 // whether OpenCL scaling is supported for this source
983 int opencl_support;
986 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_state_s.cs when changing this struct
987 struct hb_state_s
989 #define HB_STATE_IDLE 1
990 #define HB_STATE_SCANNING 2
991 #define HB_STATE_SCANDONE 4
992 #define HB_STATE_WORKING 8
993 #define HB_STATE_PAUSED 16
994 #define HB_STATE_WORKDONE 32
995 #define HB_STATE_MUXING 64
996 #define HB_STATE_SEARCHING 128
997 int state;
999 union
1001 struct
1003 /* HB_STATE_SCANNING */
1004 float progress;
1005 int preview_cur;
1006 int preview_count;
1007 int title_cur;
1008 int title_count;
1009 } scanning;
1011 struct
1013 /* HB_STATE_WORKING */
1014 #define HB_PASS_SUBTITLE -1
1015 #define HB_PASS_ENCODE 0
1016 #define HB_PASS_ENCODE_1ST 1 // Some code depends on these values being
1017 #define HB_PASS_ENCODE_2ND 2 // 1 and 2. Do not change.
1018 int pass_id;
1019 int pass;
1020 int pass_count;
1021 float progress;
1022 float rate_cur;
1023 float rate_avg;
1024 int hours;
1025 int minutes;
1026 int seconds;
1027 int sequence_id;
1028 } working;
1030 struct
1032 /* HB_STATE_WORKDONE */
1033 hb_error_code error;
1034 } workdone;
1036 struct
1038 /* HB_STATE_MUXING */
1039 float progress;
1040 } muxing;
1041 } param;
1044 typedef struct hb_work_info_s
1046 const char * name;
1047 int profile;
1048 int level;
1049 int bitrate;
1050 hb_rational_t rate;
1051 uint32_t version;
1052 uint32_t flags;
1053 uint32_t mode;
1054 union
1056 struct
1057 { // info only valid for video decoders
1058 hb_geometry_t geometry;
1059 int color_prim;
1060 int color_transfer;
1061 int color_matrix;
1062 int video_decode_support;
1064 struct
1065 { // info only valid for audio decoders
1066 uint64_t channel_layout;
1067 hb_chan_map_t * channel_map;
1068 int samples_per_frame;
1069 int sample_bit_depth;
1070 int matrix_encoding;
1073 } hb_work_info_t;
1075 struct hb_work_object_s
1077 int id;
1078 char * name;
1080 #ifdef __LIBHB__
1081 int (* init) ( hb_work_object_t *, hb_job_t * );
1082 int (* work) ( hb_work_object_t *, hb_buffer_t **,
1083 hb_buffer_t ** );
1084 void (* close) ( hb_work_object_t * );
1085 /* the info entry point is used by scan to get bitstream information
1086 * during a decode (i.e., it should only be called after at least one
1087 * call to the 'work' entry point). currently it's only called for
1088 * video streams & can be null for other work objects. */
1089 int (* info) ( hb_work_object_t *, hb_work_info_t * );
1090 /* the bitstream info entry point is used by scan to get bitstream
1091 * information from a buffer. it doesn't have to be called during a
1092 * decode (it can be called even if init & work haven't been).
1093 * currently it's only called for audio streams & can be null for
1094 * other work objects. */
1095 int (* bsinfo) ( hb_work_object_t *, const hb_buffer_t *,
1096 hb_work_info_t * );
1097 void (* flush) ( hb_work_object_t * );
1099 hb_fifo_t * fifo_in;
1100 hb_fifo_t * fifo_out;
1101 hb_esconfig_t * config;
1103 /* Pointer hb_audio_t so we have access to the info in the audio worker threads. */
1104 hb_audio_t * audio;
1106 /* Pointer hb_subtitle_t so we have access to the info in the subtitle worker threads. */
1107 hb_subtitle_t * subtitle;
1109 hb_work_private_t * private_data;
1111 hb_thread_t * thread;
1112 int yield;
1113 volatile int * done;
1114 int status;
1115 int codec_param;
1116 hb_title_t * title;
1118 hb_work_object_t * next;
1119 int thread_sleep_interval;
1121 hb_handle_t * h;
1122 #endif
1125 extern hb_work_object_t hb_sync_video;
1126 extern hb_work_object_t hb_sync_audio;
1127 extern hb_work_object_t hb_decvobsub;
1128 extern hb_work_object_t hb_encvobsub;
1129 extern hb_work_object_t hb_deccc608;
1130 extern hb_work_object_t hb_decsrtsub;
1131 extern hb_work_object_t hb_decutf8sub;
1132 extern hb_work_object_t hb_dectx3gsub;
1133 extern hb_work_object_t hb_decssasub;
1134 extern hb_work_object_t hb_decpgssub;
1135 extern hb_work_object_t hb_encavcodec;
1136 extern hb_work_object_t hb_encqsv;
1137 extern hb_work_object_t hb_encx264;
1138 extern hb_work_object_t hb_enctheora;
1139 extern hb_work_object_t hb_encx265;
1140 extern hb_work_object_t hb_decavcodeca;
1141 extern hb_work_object_t hb_decavcodecv;
1142 extern hb_work_object_t hb_declpcm;
1143 extern hb_work_object_t hb_enclame;
1144 extern hb_work_object_t hb_encvorbis;
1145 extern hb_work_object_t hb_muxer;
1146 extern hb_work_object_t hb_encca_aac;
1147 extern hb_work_object_t hb_encca_haac;
1148 extern hb_work_object_t hb_encavcodeca;
1149 extern hb_work_object_t hb_reader;
1151 #define HB_FILTER_OK 0
1152 #define HB_FILTER_DELAY 1
1153 #define HB_FILTER_FAILED 2
1154 #define HB_FILTER_DROP 3
1155 #define HB_FILTER_DONE 4
1157 typedef struct hb_filter_init_s
1159 hb_job_t * job;
1160 int pix_fmt;
1161 hb_geometry_t geometry;
1162 int crop[4];
1163 hb_rational_t vrate;
1164 int cfr;
1165 } hb_filter_init_t;
1167 typedef struct hb_filter_info_s
1169 char human_readable_desc[128];
1170 hb_filter_init_t out;
1171 } hb_filter_info_t;
1173 struct hb_filter_object_s
1175 int id;
1176 int enforce_order;
1177 char * name;
1178 char * settings;
1180 #ifdef __LIBHB__
1181 int (* init) ( hb_filter_object_t *, hb_filter_init_t * );
1182 int (* post_init) ( hb_filter_object_t *, hb_job_t * );
1184 int (* work) ( hb_filter_object_t *,
1185 hb_buffer_t **, hb_buffer_t ** );
1187 void (* close) ( hb_filter_object_t * );
1188 int (* info) ( hb_filter_object_t *, hb_filter_info_t * );
1190 hb_fifo_t * fifo_in;
1191 hb_fifo_t * fifo_out;
1193 hb_subtitle_t * subtitle;
1195 hb_filter_private_t * private_data;
1197 hb_thread_t * thread;
1198 volatile int * done;
1199 int status;
1201 // Filters can drop frames and thus chapter marks
1202 // These are used to bridge the chapter to the next buffer
1203 int chapter_val;
1204 int64_t chapter_time;
1205 #endif
1208 // Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_filter_ids.cs when changing this enum
1209 enum
1211 HB_FILTER_INVALID = 0,
1212 // for QSV - important to have before other filters
1213 HB_FILTER_FIRST = 1,
1214 HB_FILTER_QSV_PRE = 1,
1216 // First, filters that may change the framerate (drop or dup frames)
1217 HB_FILTER_DETELECINE,
1218 HB_FILTER_DECOMB,
1219 HB_FILTER_DEINTERLACE,
1220 HB_FILTER_VFR,
1221 // Filters that must operate on the original source image are next
1222 HB_FILTER_DEBLOCK,
1223 HB_FILTER_DENOISE,
1224 HB_FILTER_HQDN3D = HB_FILTER_DENOISE,
1225 HB_FILTER_NLMEANS,
1226 HB_FILTER_RENDER_SUB,
1227 HB_FILTER_CROP_SCALE,
1229 // Finally filters that don't care what order they are in,
1230 // except that they must be after the above filters
1231 HB_FILTER_ROTATE,
1233 // for QSV - important to have as a last one
1234 HB_FILTER_QSV_POST,
1235 // default MSDK VPP filter
1236 HB_FILTER_QSV,
1237 HB_FILTER_LAST = HB_FILTER_QSV
1240 hb_filter_object_t * hb_filter_init( int filter_id );
1241 hb_filter_object_t * hb_filter_copy( hb_filter_object_t * filter );
1242 hb_list_t *hb_filter_list_copy(const hb_list_t *src);
1243 void hb_filter_close( hb_filter_object_t ** );
1245 typedef void hb_error_handler_t( const char *errmsg );
1247 extern void hb_register_error_handler( hb_error_handler_t * handler );
1249 char * hb_strdup_vaprintf( const char * fmt, va_list args );
1250 char * hb_strdup_printf(const char *fmt, ...) HB_WPRINTF(1, 2);
1251 char * hb_strncat_dup( const char * s1, const char * s2, size_t n );
1253 int hb_yuv2rgb(int yuv);
1254 int hb_rgb2yuv(int rgb);
1256 const char * hb_subsource_name( int source );
1258 // unparse a set of x264 settings to an HB encopts string
1259 char * hb_x264_param_unparse(const char *x264_preset, const char *x264_tune,
1260 const char *x264_encopts, const char *h264_profile,
1261 const char *h264_level, int width, int height);
1263 // x264 option name/synonym helper
1264 const char * hb_x264_encopt_name( const char * name );
1266 #ifdef USE_X265
1267 // x265 option name/synonym helper
1268 const char * hb_x265_encopt_name( const char * name );
1269 #endif
1271 #endif