1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace HandBrake.Interop
{
public partial class NativeConstants
{
public const int HB_ACODEC_MASK = 0x00FF00;
public const int HB_ACODEC_FAAC = 0x000100;
public const int HB_ACODEC_LAME = 0x000200;
public const int HB_ACODEC_VORBIS = 0x000400;
public const int HB_ACODEC_AC3 = 0x000800;
public const int HB_ACODEC_MPGA = 0x001000;
public const int HB_ACODEC_LPCM = 0x002000;
public const int HB_ACODEC_DCA = 0x004000;
public const int HB_ACODEC_FFMPEG = 0x008000;
public const int HB_ACODEC_CA_AAC = 0x010000;
public const int HB_AMIXDOWN_DCA_FORMAT_MASK = 0x00FFF000;
public const int HB_AMIXDOWN_A52_FORMAT_MASK = 0x00000FF0;
public const int HB_AMIXDOWN_DISCRETE_CHANNEL_COUNT_MASK = 0x0000000F;
public const int HB_AMIXDOWN_MONO = 0x01000001;
public const int HB_AMIXDOWN_STEREO = 0x02002022;
public const int HB_AMIXDOWN_DOLBY = 0x042070A2;
public const int HB_AMIXDOWN_DOLBYPLII = 0x084094A2;
public const int HB_AMIXDOWN_6CH = 0x10089176;
public const int HB_VCODEC_MASK = 0x0000FF;
public const int HB_VCODEC_FFMPEG = 0x000001;
public const int HB_VCODEC_X264 = 0x000002;
public const int HB_VCODEC_THEORA = 0x000004;
public const int HB_MUX_MASK = 0xFF0000;
public const int HB_MUX_MP4 = 0x010000;
public const int HB_MUX_PSP = 0x020000;
public const int HB_MUX_AVI = 0x040000;
public const int HB_MUX_OGM = 0x080000;
public const int HB_MUX_IPOD = 0x100000;
public const int HB_MUX_MKV = 0x200000;
public const int HBTF_NO_IDR = 1 << 0;
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_ERROR_NONE = 0;
public const int HB_ERROR_CANCELED = 1;
public const int HB_ERROR_UNKNOWN = 2;
public const int AUDIO_F_DOLBY = 1 << 31;
public const int HB_FRAME_IDR = 0x01;
public const int HB_FRAME_I = 0x02;
public const int HB_FRAME_AUDIO = 0x04;
public const int HB_FRAME_P = 0x10;
public const int HB_FRAME_B = 0x20;
public const int HB_FRAME_BREF = 0x40;
public const int HB_FRAME_KEY = 0x0F;
public const int HB_FRAME_REF = 0xF0;
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;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_anamorphic_substruct
{
/// int
public int mode;
/// int
public int itu_par;
/// int
public int par_width;
/// int
public int par_height;
/// int
public int dar_width;
/// int
public int dar_height;
/// int
public int keep_display_aspect;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_job_s
{
/// int
public int sequence_id;
/// hb_title_t*
public IntPtr title;
public int feature;
/// int
public int chapter_start;
/// int
public int chapter_end;
/// int
public int chapter_markers;
/// int[4]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)]
public int[] crop;
/// int
public int deinterlace;
/// hb_list_t*
public IntPtr filters;
/// int
public int width;
/// int
public int height;
/// int
public int keep_ratio;
/// int
public int grayscale;
public hb_anamorphic_substruct anamorphic;
public int modulus;
/// int
public int maxWidth;
/// int
public int maxHeight;
/// int
public int vcodec;
/// float
public float vquality;
/// int
public int vbitrate;
/// int
public int vrate;
/// int
public int vrate_base;
/// int
public int vfr;
/// int
public int cfr;
/// int
public int pass;
/// int
public int h264_13;
/// int
public int h264_level;
/// char*
//[MarshalAs(UnmanagedType.LPStr)]
//public string x264opts;
public IntPtr x264opts;
/// int
public int areBframes;
/// int
public int color_matrix;
/// hb_list_t*
public IntPtr list_audio;
/// hb_list_t*
public IntPtr list_subtitle;
/// int
public int mux;
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string file;
/// int
public int largeFileSize;
/// int
public int mp4_optimize;
/// int
public int ipod_atom;
/// int
public int indepth_scan;
/// hb_subtitle_config_t->hb_subtitle_config_s
public hb_subtitle_config_s select_subtitle_config;
/// int
public int angle;
public int frame_to_start;
public long pts_to_start;
/// int
public int frame_to_stop;
/// int64_t->int
public long pts_to_stop;
/// int
public int start_at_preview;
/// int
public int seek_points;
/// uint32_t->unsigned int
public uint frames_to_skip;
// Padding for the part of the struct we don't care about marshaling.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24644, ArraySubType = UnmanagedType.U1)]
public byte[] padding;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_list_s
{
/// void**
public IntPtr items;
/// int
public int items_alloc;
/// int
public int items_count;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_rate_s
{
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string @string;
/// int
public int rate;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_handle_s
{
public int id;
/// int
public int build;
/// char[32]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string version;
/// hb_thread_t*
public IntPtr update_thread;
/// int
public int die;
/// hb_thread_t*
public IntPtr main_thread;
/// int
public int pid;
/// hb_list_t*
public IntPtr list_title;
/// hb_thread_t*
public IntPtr scan_thread;
/// hb_list_t*
public IntPtr jobs;
/// hb_job_t*
public IntPtr current_job;
/// int
public int job_count;
/// int
public int job_count_permanent;
/// int
public int work_die;
/// int
public int work_error;
/// hb_thread_t*
public IntPtr work_thread;
/// int
public int cpu_count;
/// hb_lock_t*
public IntPtr state_lock;
/// hb_state_t->hb_state_s
public hb_state_s state;
/// int
public int paused;
/// hb_lock_t*
public IntPtr pause_lock;
/// int
public int scanCount;
/// hb_interjob_t*
public IntPtr interjob;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_chapter_s
{
/// int
public int index;
/// int
public int pgcn;
/// int
public int pgn;
/// int
public int cell_start;
/// int
public int cell_end;
/// int
public int block_start;
/// int
public int block_end;
/// int
public int block_count;
/// int
public int hours;
/// int
public int minutes;
/// int
public int seconds;
/// uint64_t->unsigned int
public ulong duration;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string title;
}
public enum hb_subtitle_s_subtype
{
PICTURESUB,
TEXTSUB,
}
public enum hb_subtitle_s_subsource
{
VOBSUB,
SRTSUB,
CC608SUB,
CC708SUB,
UTF8SUB,
TX3GSUB,
SSASUB
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_subtitle_s
{
/// int
public int id;
/// int
public int track;
/// hb_subtitle_config_t->hb_subtitle_config_s
public hb_subtitle_config_s config;
/// hb_subtitle_s_subtype
public hb_subtitle_s_subtype format;
/// hb_subtitle_s_subsource
public hb_subtitle_s_subsource source;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string lang;
/// char[4]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string iso639_2;
/// uint8_t->unsigned char
public byte type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)]
public uint[] palette;
public int width;
public int height;
/// int
public int hits;
/// int
public int forced_hits;
/// hb_fifo_t*
public IntPtr fifo_in;
/// hb_fifo_t*
public IntPtr fifo_raw;
/// hb_fifo_t*
public IntPtr fifo_sync;
/// hb_fifo_t*
public IntPtr fifo_out;
/// hb_mux_data_t*
public IntPtr mux_data;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_metadata_s
{
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string name;
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string artist;
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string composer;
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string release_date;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string comment;
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string album;
/// char[255]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
public string genre;
/// uint32_t->unsigned int
public uint coverart_size;
/// uint8_t*
public IntPtr coverart;
}
public enum Anonymous_990d28ea_6cf3_4fbc_8143_4df9513e9550
{
HB_DVD_TYPE,
HB_STREAM_TYPE,
}
public enum Anonymous_618ebeca_0ad9_4a71_9a49_18e50ac2e9db
{
/// HB_MPEG2_PS_DEMUXER -> 0
HB_MPEG2_PS_DEMUXER = 0,
HB_MPEG2_TS_DEMUXER,
HB_NULL_DEMUXER,
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_title_s
{
/// Anonymous_990d28ea_6cf3_4fbc_8143_4df9513e9550
public Anonymous_990d28ea_6cf3_4fbc_8143_4df9513e9550 type;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string dvd;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string name;
//public fixed byte dvd[1024];
//public fixed byte name[1024];
/// int
public int index;
/// int
public int vts;
/// int
public int ttn;
/// int
public int cell_start;
/// int
public int cell_end;
/// int
public int block_start;
/// int
public int block_end;
/// int
public int block_count;
/// int
public int angle_count;
/// int
public int hours;
/// int
public int minutes;
/// int
public int seconds;
/// uint64_t->unsigned int
public ulong duration;
/// double
public double aspect;
/// double
public double container_aspect;
/// int
public int width;
/// int
public int height;
/// int
public int pixel_aspect_width;
/// int
public int pixel_aspect_height;
/// int
public int rate;
/// int
public int rate_base;
/// int[4]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)]
public int[] crop;
//public fixed int crop[4];
/// Anonymous_618ebeca_0ad9_4a71_9a49_18e50ac2e9db
public Anonymous_618ebeca_0ad9_4a71_9a49_18e50ac2e9db demuxer;
/// int
public int detected_interlacing;
/// int
public int video_id;
/// int
public int video_codec;
/// int
public int video_codec_param;
/// char*
public IntPtr video_codec_name;
/// int
public int video_bitrate;
/// char*
public IntPtr container_name;
/// int
public int data_rate;
/// hb_metadata_t*
public IntPtr metadata;
/// hb_list_t*
public IntPtr list_chapter;
/// hb_list_t*
public IntPtr list_audio;
/// hb_list_t*
public IntPtr list_subtitle;
/// hb_job_t*
public IntPtr job;
/// uint32_t->unsigned int
public uint flags;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_state_scanning_s
{
/// int
public int title_cur;
/// int
public int title_count;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_state_working_s
{
/// float
public float progress;
/// int
public int job_cur;
/// int
public int job_count;
/// float
public float rate_cur;
/// float
public float rate_avg;
/// int
public int hours;
/// int
public int minutes;
/// int
public int seconds;
/// int
public int sequence_id;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_state_workdone_s
{
/// int
public int error;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_state_muxing_s
{
/// float
public float progress;
}
[StructLayout(LayoutKind.Explicit)]
public struct hb_state_param_u
{
[FieldOffset(0)]
public hb_state_scanning_s scanning;
[FieldOffset(0)]
public hb_state_working_s working;
[FieldOffset(0)]
public hb_state_workdone_s workdone;
[FieldOffset(0)]
public hb_state_muxing_s muxing;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_state_s
{
/// int
public int state;
public hb_state_param_u param;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_audio_s
{
/// int
public int id;
/// hb_audio_config_t->hb_audio_config_s
public hb_audio_config_s config;
// Padding for the part of the struct we don't care about marshaling.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24600, ArraySubType = UnmanagedType.U1)]
public byte[] padding;
/// Anonymous_e6c7b779_b5a3_4e80_9fa8_13619d14f545
//public Anonymous_e6c7b779_b5a3_4e80_9fa8_13619d14f545 priv;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_audio_config_s
{
public hb_audio_config_output_s output;
public hb_audio_config_input_s input;
/// Anonymous_a0a59d69_d9a4_4003_a198_f7c51511e31d
public Anonymous_a0a59d69_d9a4_4003_a198_f7c51511e31d flags;
public hb_audio_config_lang_s lang;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_audio_config_output_s
{
/// int
public int track;
/// uint32_t->unsigned int
public uint codec;
/// int
public int samplerate;
/// int
public int bitrate;
/// int
public int mixdown;
/// double
public double dynamic_range_compression;
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string name;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_audio_config_input_s
{
/// int
public int track;
/// uint32_t->unsigned int
public uint codec;
/// uint32_t->unsigned int
public uint codec_param;
/// uint32_t->unsigned int
public uint version;
/// uint32_t->unsigned int
public uint mode;
/// int
public int samplerate;
/// int
public int bitrate;
/// int
public int channel_layout;
}
[StructLayout(LayoutKind.Explicit)]
public struct Anonymous_a0a59d69_d9a4_4003_a198_f7c51511e31d
{
/// int
[FieldOffset(0)]
public int ac3;
/// int
[FieldOffset(0)]
public int dca;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_audio_config_lang_s
{
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string description;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string simple;
/// char[4]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string iso639_2;
/// uint8_t->unsigned char
public byte type;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_mixdown_s
{
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string human_readable_name;
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string internal_name;
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string short_name;
/// int
public int amixdown;
}
public enum hb_subtitle_config_s_subdest
{
RENDERSUB,
PASSTHRUSUB,
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct hb_subtitle_config_s
{
/// hb_subtitle_config_s_subdest
public hb_subtitle_config_s_subdest dest;
/// int
public int force;
/// int
public int default_track;
/// char[128]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string src_filename;
/// char[40]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string src_codeset;
/// int64_t->int
public long offset;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_fifo_s
{
/// hb_lock_t*
public IntPtr @lock;
/// uint32_t->unsigned int
public uint capacity;
/// uint32_t->unsigned int
public uint size;
/// uint32_t->unsigned int
public uint buffer_size;
/// hb_buffer_t*
public IntPtr first;
/// hb_buffer_t*
public IntPtr last;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_lock_s
{
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_buffer_s
{
/// int
public int size;
/// int
public int alloc;
/// uint8_t*
[MarshalAs(UnmanagedType.LPStr)]
public string data;
/// int
public int cur;
/// int64_t->int
public long sequence;
/// int
public int id;
/// int64_t->int
public long start;
/// int64_t->int
public long stop;
/// int
public int new_chap;
/// uint8_t->unsigned char
public byte frametype;
/// uint16_t->unsigned int
public uint flags;
/// int64_t->int
public long renderOffset;
/// int
public int x;
/// int
public int y;
/// int
public int width;
/// int
public int height;
/// hb_buffer_t*
public IntPtr sub;
/// hb_buffer_t*
public IntPtr next;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_mux_data_s
{
/// MP4TrackId->uint32_t->unsigned int
public uint track;
/// uint8_t->unsigned char
public byte subtitle;
/// int
public int sub_format;
/// uint64_t->unsigned int
public ulong sum_dur;
}
[StructLayout(LayoutKind.Sequential)]
public struct hb_interjob_s
{
/// int
public int last_job;
/// int
public int frame_count;
/// uint64_t->unsigned int
public ulong total_time;
/// int
public int render_dropped;
/// int
public int vrate;
/// int
public int vrate_base;
/// hb_subtitle_t*
public IntPtr select_subtitle;
}
/// Return Type: void
///param0: void*
public delegate void hb_thread_s_function(IntPtr param0);
[StructLayout(LayoutKind.Sequential)]
public struct hb_thread_s
{
/// char*
[MarshalAs(UnmanagedType.LPStr)]
public string name;
/// int
public int priority;
/// hb_thread_s_function
public hb_thread_s_function AnonymousMember1;
/// void*
public IntPtr arg;
/// hb_lock_t*
public IntPtr @lock;
/// int
public int exited;
/// pthread_t->ptw32_handle_t->Anonymous_55c509b5_bbf2_4788_a684_ac1bd0056655
public ptw32_handle_t thread;
}
[StructLayout(LayoutKind.Sequential)]
public struct ptw32_handle_t
{
/// void*
public IntPtr p;
/// unsigned int
public uint x;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void LoggingCallback(string message);
public partial class HbLib
{
[DllImport("hb.dll", EntryPoint = "hb_calc_bitrate", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_calc_bitrate(ref hb_job_s job, int size);
[DllImport("hb.dll", EntryPoint = "hb_register_logger", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_register_logger(LoggingCallback callback);
[DllImport("hb.dll", EntryPoint = "hb_register_error_handler", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_register_error_handler(LoggingCallback callback);
/// Return Type: hb_handle_t*
///verbose: int
///update_check: int
[DllImport("hb.dll", 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.dll", 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.dll", EntryPoint = "hb_get_version", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_get_version(ref hb_handle_s param0);
/// Return Type: int
///param0: hb_handle_t*
[DllImport("hb.dll", EntryPoint = "hb_get_build", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_get_build(ref hb_handle_s param0);
/// Return Type: int
///h: hb_handle_t*
///version: char**
[DllImport("hb.dll", EntryPoint = "hb_check_update", CallingConvention = CallingConvention.Cdecl)]
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)]
public static extern IntPtr hb_dvd_name(IntPtr path);
/// Return Type: void
///enable: int
[DllImport("hb.dll", 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.dll", EntryPoint = "hb_scan", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_scan(IntPtr hbHandle, [In] [MarshalAs(UnmanagedType.LPStr)] string path, int title_index, int preview_count, int store_previews);
/// Return Type: hb_list_t*
///param0: hb_handle_t*
[DllImport("hb.dll", EntryPoint = "hb_get_titles", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_get_titles(IntPtr hbHandle);
/// Return Type: int
///buf: hb_buffer_t*
///width: int
///height: int
///color_equal: int
///color_diff: int
///threshold: int
///prog_equal: int
///prog_diff: int
///prog_threshold: int
[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*
///param2: int
///param3: uint8_t*
[DllImport("hb.dll", EntryPoint = "hb_get_preview", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_get_preview(IntPtr hbHandle, ref hb_title_s title, int preview, IntPtr buffer);
/// Return Type: void
///param0: hb_job_t*
///ratio: double
///pixels: int
[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*
///output_height: int*
///output_par_width: int*
///output_par_height: int*
[DllImport("hb.dll", EntryPoint = "hb_set_anamorphic_size", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_set_anamorphic_size(ref hb_job_s job, ref int output_width, ref int output_height, ref int output_par_width, ref int output_par_height);
/// Return Type: int
///param0: hb_handle_t*
[DllImport("hb.dll", 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.dll", EntryPoint = "hb_job", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_job(IntPtr hbHandle, int jobIndex);
[DllImport("hb.dll", EntryPoint = "hb_set_chapter_name", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_set_chapter_name(IntPtr hbHandle, int title_index, int chapter_index, [In] [MarshalAs(UnmanagedType.LPStr)] string chapter_name);
[DllImport("hb.dll", EntryPoint = "hb_set_job", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_set_job(IntPtr hbHandle, int title_index, ref hb_job_s job);
/// Return Type: void
///param0: hb_handle_t*
///param1: hb_job_t*
[DllImport("hb.dll", EntryPoint = "hb_add", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_add(IntPtr hbHandle, ref hb_job_s job);
/// Return Type: void
///param0: hb_handle_t*
///param1: hb_job_t*
[DllImport("hb.dll", 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.dll", EntryPoint = "hb_start", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_start(IntPtr hbHandle);
/// Return Type: void
///param0: hb_handle_t*
[DllImport("hb.dll", EntryPoint = "hb_pause", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_pause(IntPtr hbHandle);
/// Return Type: void
///param0: hb_handle_t*
[DllImport("hb.dll", EntryPoint = "hb_resume", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_resume(IntPtr hbHandle);
/// Return Type: void
///param0: hb_handle_t*
[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*
[DllImport("hb.dll", EntryPoint = "hb_get_state", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_get_state(IntPtr hbHandle, ref hb_state_s state);
/// Return Type: void
///param0: hb_handle_t*
///param1: hb_state_t*
[DllImport("hb.dll", EntryPoint = "hb_get_state2", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_get_state2(ref hb_handle_s param0, ref hb_state_s param1);
/// Return Type: int
///param0: hb_handle_t*
[DllImport("hb.dll", EntryPoint = "hb_get_scancount", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_get_scancount(ref hb_handle_s param0);
/// Return Type: void
///param0: hb_handle_t**
[DllImport("hb.dll", EntryPoint = "hb_close", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_close(IntPtr hbHandle);
[DllImport("hb.dll", EntryPoint = "hb_global_close", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_global_close();
}
}
|