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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(
    clippy::approx_constant,
    clippy::type_complexity,
    clippy::unreadable_literal,
    clippy::upper_case_acronyms
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

use glib_sys as glib;
use gobject_sys as gobject;
use gstreamer_sys as gst;

#[allow(unused_imports)]
use libc::{
    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
    intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};

#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};

// Enums
pub type GstTagDemuxResult = c_int;
pub const GST_TAG_DEMUX_RESULT_BROKEN_TAG: GstTagDemuxResult = 0;
pub const GST_TAG_DEMUX_RESULT_AGAIN: GstTagDemuxResult = 1;
pub const GST_TAG_DEMUX_RESULT_OK: GstTagDemuxResult = 2;

pub type GstTagImageType = c_int;
pub const GST_TAG_IMAGE_TYPE_NONE: GstTagImageType = -1;
pub const GST_TAG_IMAGE_TYPE_UNDEFINED: GstTagImageType = 0;
pub const GST_TAG_IMAGE_TYPE_FRONT_COVER: GstTagImageType = 1;
pub const GST_TAG_IMAGE_TYPE_BACK_COVER: GstTagImageType = 2;
pub const GST_TAG_IMAGE_TYPE_LEAFLET_PAGE: GstTagImageType = 3;
pub const GST_TAG_IMAGE_TYPE_MEDIUM: GstTagImageType = 4;
pub const GST_TAG_IMAGE_TYPE_LEAD_ARTIST: GstTagImageType = 5;
pub const GST_TAG_IMAGE_TYPE_ARTIST: GstTagImageType = 6;
pub const GST_TAG_IMAGE_TYPE_CONDUCTOR: GstTagImageType = 7;
pub const GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA: GstTagImageType = 8;
pub const GST_TAG_IMAGE_TYPE_COMPOSER: GstTagImageType = 9;
pub const GST_TAG_IMAGE_TYPE_LYRICIST: GstTagImageType = 10;
pub const GST_TAG_IMAGE_TYPE_RECORDING_LOCATION: GstTagImageType = 11;
pub const GST_TAG_IMAGE_TYPE_DURING_RECORDING: GstTagImageType = 12;
pub const GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE: GstTagImageType = 13;
pub const GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE: GstTagImageType = 14;
pub const GST_TAG_IMAGE_TYPE_FISH: GstTagImageType = 15;
pub const GST_TAG_IMAGE_TYPE_ILLUSTRATION: GstTagImageType = 16;
pub const GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO: GstTagImageType = 17;
pub const GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO: GstTagImageType = 18;

// Constants
pub const GST_TAG_ACOUSTID_FINGERPRINT: &[u8] = b"chromaprint-fingerprint\0";
pub const GST_TAG_ACOUSTID_ID: &[u8] = b"acoustid-id\0";
pub const GST_TAG_CAPTURING_CONTRAST: &[u8] = b"capturing-contrast\0";
pub const GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO: &[u8] = b"capturing-digital-zoom-ratio\0";
pub const GST_TAG_CAPTURING_EXPOSURE_COMPENSATION: &[u8] = b"capturing-exposure-compensation\0";
pub const GST_TAG_CAPTURING_EXPOSURE_MODE: &[u8] = b"capturing-exposure-mode\0";
pub const GST_TAG_CAPTURING_EXPOSURE_PROGRAM: &[u8] = b"capturing-exposure-program\0";
pub const GST_TAG_CAPTURING_FLASH_FIRED: &[u8] = b"capturing-flash-fired\0";
pub const GST_TAG_CAPTURING_FLASH_MODE: &[u8] = b"capturing-flash-mode\0";
pub const GST_TAG_CAPTURING_FOCAL_LENGTH: &[u8] = b"capturing-focal-length\0";
pub const GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM: &[u8] = b"capturing-focal-length-35mm\0";
pub const GST_TAG_CAPTURING_FOCAL_RATIO: &[u8] = b"capturing-focal-ratio\0";
pub const GST_TAG_CAPTURING_GAIN_ADJUSTMENT: &[u8] = b"capturing-gain-adjustment\0";
pub const GST_TAG_CAPTURING_ISO_SPEED: &[u8] = b"capturing-iso-speed\0";
pub const GST_TAG_CAPTURING_METERING_MODE: &[u8] = b"capturing-metering-mode\0";
pub const GST_TAG_CAPTURING_SATURATION: &[u8] = b"capturing-saturation\0";
pub const GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE: &[u8] = b"capturing-scene-capture-type\0";
pub const GST_TAG_CAPTURING_SHARPNESS: &[u8] = b"capturing-sharpness\0";
pub const GST_TAG_CAPTURING_SHUTTER_SPEED: &[u8] = b"capturing-shutter-speed\0";
pub const GST_TAG_CAPTURING_SOURCE: &[u8] = b"capturing-source\0";
pub const GST_TAG_CAPTURING_WHITE_BALANCE: &[u8] = b"capturing-white-balance\0";
pub const GST_TAG_CDDA_CDDB_DISCID: &[u8] = b"discid\0";
pub const GST_TAG_CDDA_CDDB_DISCID_FULL: &[u8] = b"discid-full\0";
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID: &[u8] = b"musicbrainz-discid\0";
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL: &[u8] = b"musicbrainz-discid-full\0";
pub const GST_TAG_CMML_CLIP: &[u8] = b"cmml-clip\0";
pub const GST_TAG_CMML_HEAD: &[u8] = b"cmml-head\0";
pub const GST_TAG_CMML_STREAM: &[u8] = b"cmml-stream\0";
pub const GST_TAG_ID3V2_HEADER_SIZE: c_int = 10;
pub const GST_TAG_IMAGE_HORIZONTAL_PPI: &[u8] = b"image-horizontal-ppi\0";
pub const GST_TAG_IMAGE_VERTICAL_PPI: &[u8] = b"image-vertical-ppi\0";
pub const GST_TAG_MUSICAL_KEY: &[u8] = b"musical-key\0";
pub const GST_TAG_MUSICBRAINZ_ALBUMARTISTID: &[u8] = b"musicbrainz-albumartistid\0";
pub const GST_TAG_MUSICBRAINZ_ALBUMID: &[u8] = b"musicbrainz-albumid\0";
pub const GST_TAG_MUSICBRAINZ_ARTISTID: &[u8] = b"musicbrainz-artistid\0";
pub const GST_TAG_MUSICBRAINZ_RELEASEGROUPID: &[u8] = b"musicbrainz-releasegroupid\0";
pub const GST_TAG_MUSICBRAINZ_RELEASETRACKID: &[u8] = b"musicbrainz-releasetrackid\0";
pub const GST_TAG_MUSICBRAINZ_TRACKID: &[u8] = b"musicbrainz-trackid\0";
pub const GST_TAG_MUSICBRAINZ_TRMID: &[u8] = b"musicbrainz-trmid\0";

// Flags
pub type GstTagLicenseFlags = c_uint;
pub const GST_TAG_LICENSE_PERMITS_REPRODUCTION: GstTagLicenseFlags = 1;
pub const GST_TAG_LICENSE_PERMITS_DISTRIBUTION: GstTagLicenseFlags = 2;
pub const GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: GstTagLicenseFlags = 4;
pub const GST_TAG_LICENSE_PERMITS_SHARING: GstTagLicenseFlags = 8;
pub const GST_TAG_LICENSE_REQUIRES_NOTICE: GstTagLicenseFlags = 256;
pub const GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: GstTagLicenseFlags = 512;
pub const GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: GstTagLicenseFlags = 1024;
pub const GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: GstTagLicenseFlags = 2048;
pub const GST_TAG_LICENSE_REQUIRES_COPYLEFT: GstTagLicenseFlags = 4096;
pub const GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: GstTagLicenseFlags = 8192;
pub const GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: GstTagLicenseFlags = 65536;
pub const GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: GstTagLicenseFlags = 131072;
pub const GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: GstTagLicenseFlags = 16777216;
pub const GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: GstTagLicenseFlags = 33554432;

// Records
#[derive(Copy, Clone)]
#[repr(C)]
pub struct GstTagDemuxClass {
    pub parent_class: gst::GstElementClass,
    pub min_start_size: c_uint,
    pub min_end_size: c_uint,
    pub identify_tag: Option<
        unsafe extern "C" fn(
            *mut GstTagDemux,
            *mut gst::GstBuffer,
            gboolean,
            *mut c_uint,
        ) -> gboolean,
    >,
    pub parse_tag: Option<
        unsafe extern "C" fn(
            *mut GstTagDemux,
            *mut gst::GstBuffer,
            gboolean,
            *mut c_uint,
            *mut *mut gst::GstTagList,
        ) -> GstTagDemuxResult,
    >,
    pub merge_tags: Option<
        unsafe extern "C" fn(
            *mut GstTagDemux,
            *const gst::GstTagList,
            *const gst::GstTagList,
        ) -> *mut gst::GstTagList,
    >,
    pub reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstTagDemuxClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTagDemuxClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .field("min_start_size", &self.min_start_size)
            .field("min_end_size", &self.min_end_size)
            .field("identify_tag", &self.identify_tag)
            .field("parse_tag", &self.parse_tag)
            .field("merge_tags", &self.merge_tags)
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct _GstTagDemuxPrivate {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

pub type GstTagDemuxPrivate = _GstTagDemuxPrivate;

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GstTagMuxClass {
    pub parent_class: gst::GstElementClass,
    pub render_start_tag:
        Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
    pub render_end_tag:
        Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstTagMuxClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTagMuxClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .field("render_start_tag", &self.render_start_tag)
            .field("render_end_tag", &self.render_end_tag)
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct _GstTagMuxPrivate {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

pub type GstTagMuxPrivate = _GstTagMuxPrivate;

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GstTagXmpWriterInterface {
    pub parent: gobject::GTypeInterface,
}

impl ::std::fmt::Debug for GstTagXmpWriterInterface {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTagXmpWriterInterface @ {self:p}"))
            .field("parent", &self.parent)
            .finish()
    }
}

// Classes
#[derive(Copy, Clone)]
#[repr(C)]
pub struct GstTagDemux {
    pub element: gst::GstElement,
    pub priv_: *mut GstTagDemuxPrivate,
    pub reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstTagDemux {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTagDemux @ {self:p}"))
            .field("element", &self.element)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GstTagMux {
    pub element: gst::GstElement,
    pub priv_: *mut GstTagMuxPrivate,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstTagMux {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTagMux @ {self:p}"))
            .field("element", &self.element)
            .finish()
    }
}

// Interfaces
#[repr(C)]
#[allow(dead_code)]
pub struct GstTagXmpWriter {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GstTagXmpWriter {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(f, "GstTagXmpWriter @ {self:p}")
    }
}

#[link(name = "gsttag-1.0")]
extern "C" {

    //=========================================================================
    // GstTagDemuxResult
    //=========================================================================
    pub fn gst_tag_demux_result_get_type() -> GType;

    //=========================================================================
    // GstTagImageType
    //=========================================================================
    pub fn gst_tag_image_type_get_type() -> GType;

    //=========================================================================
    // GstTagLicenseFlags
    //=========================================================================
    pub fn gst_tag_license_flags_get_type() -> GType;

    //=========================================================================
    // GstTagDemux
    //=========================================================================
    pub fn gst_tag_demux_get_type() -> GType;

    //=========================================================================
    // GstTagMux
    //=========================================================================
    pub fn gst_tag_mux_get_type() -> GType;

    //=========================================================================
    // GstTagXmpWriter
    //=========================================================================
    pub fn gst_tag_xmp_writer_get_type() -> GType;
    pub fn gst_tag_xmp_writer_add_all_schemas(config: *mut GstTagXmpWriter);
    pub fn gst_tag_xmp_writer_add_schema(config: *mut GstTagXmpWriter, schema: *const c_char);
    pub fn gst_tag_xmp_writer_has_schema(
        config: *mut GstTagXmpWriter,
        schema: *const c_char,
    ) -> gboolean;
    pub fn gst_tag_xmp_writer_remove_all_schemas(config: *mut GstTagXmpWriter);
    pub fn gst_tag_xmp_writer_remove_schema(config: *mut GstTagXmpWriter, schema: *const c_char);
    pub fn gst_tag_xmp_writer_tag_list_to_xmp_buffer(
        config: *mut GstTagXmpWriter,
        taglist: *const gst::GstTagList,
        read_only: gboolean,
    ) -> *mut gst::GstBuffer;

    //=========================================================================
    // Other functions
    //=========================================================================
    pub fn gst_tag_check_language_code(lang_code: *const c_char) -> gboolean;
    pub fn gst_tag_freeform_string_to_utf8(
        data: *const c_char,
        size: c_int,
        env_vars: *mut *const c_char,
    ) -> *mut c_char;
    pub fn gst_tag_from_id3_tag(id3_tag: *const c_char) -> *const c_char;
    pub fn gst_tag_from_id3_user_tag(
        type_: *const c_char,
        id3_user_tag: *const c_char,
    ) -> *const c_char;
    pub fn gst_tag_from_vorbis_tag(vorbis_tag: *const c_char) -> *const c_char;
    pub fn gst_tag_get_id3v2_tag_size(buffer: *mut gst::GstBuffer) -> c_uint;
    pub fn gst_tag_get_language_code_iso_639_1(lang_code: *const c_char) -> *const c_char;
    pub fn gst_tag_get_language_code_iso_639_2B(lang_code: *const c_char) -> *const c_char;
    pub fn gst_tag_get_language_code_iso_639_2T(lang_code: *const c_char) -> *const c_char;
    pub fn gst_tag_get_language_codes() -> *mut *mut c_char;
    pub fn gst_tag_get_language_name(language_code: *const c_char) -> *const c_char;
    pub fn gst_tag_get_license_description(license_ref: *const c_char) -> *const c_char;
    pub fn gst_tag_get_license_flags(license_ref: *const c_char) -> GstTagLicenseFlags;
    pub fn gst_tag_get_license_jurisdiction(license_ref: *const c_char) -> *const c_char;
    pub fn gst_tag_get_license_nick(license_ref: *const c_char) -> *const c_char;
    pub fn gst_tag_get_license_title(license_ref: *const c_char) -> *const c_char;
    pub fn gst_tag_get_license_version(license_ref: *const c_char) -> *const c_char;
    pub fn gst_tag_get_licenses() -> *mut *mut c_char;
    pub fn gst_tag_id3_genre_count() -> c_uint;
    pub fn gst_tag_id3_genre_get(id: c_uint) -> *const c_char;
    pub fn gst_tag_image_data_to_image_sample(
        image_data: *const u8,
        image_data_len: c_uint,
        image_type: GstTagImageType,
    ) -> *mut gst::GstSample;
    pub fn gst_tag_list_add_id3_image(
        tag_list: *mut gst::GstTagList,
        image_data: *const u8,
        image_data_len: c_uint,
        id3_picture_type: c_uint,
    ) -> gboolean;
    pub fn gst_tag_list_from_exif_buffer(
        buffer: *mut gst::GstBuffer,
        byte_order: c_int,
        base_offset: u32,
    ) -> *mut gst::GstTagList;
    pub fn gst_tag_list_from_exif_buffer_with_tiff_header(
        buffer: *mut gst::GstBuffer,
    ) -> *mut gst::GstTagList;
    pub fn gst_tag_list_from_id3v2_tag(buffer: *mut gst::GstBuffer) -> *mut gst::GstTagList;
    pub fn gst_tag_list_from_vorbiscomment(
        data: *const u8,
        size: size_t,
        id_data: *const u8,
        id_data_length: c_uint,
        vendor_string: *mut *mut c_char,
    ) -> *mut gst::GstTagList;
    pub fn gst_tag_list_from_vorbiscomment_buffer(
        buffer: *mut gst::GstBuffer,
        id_data: *const u8,
        id_data_length: c_uint,
        vendor_string: *mut *mut c_char,
    ) -> *mut gst::GstTagList;
    pub fn gst_tag_list_from_xmp_buffer(buffer: *mut gst::GstBuffer) -> *mut gst::GstTagList;
    pub fn gst_tag_list_new_from_id3v1(data: *const [u8; 128]) -> *mut gst::GstTagList;
    pub fn gst_tag_list_to_exif_buffer(
        taglist: *const gst::GstTagList,
        byte_order: c_int,
        base_offset: u32,
    ) -> *mut gst::GstBuffer;
    pub fn gst_tag_list_to_exif_buffer_with_tiff_header(
        taglist: *const gst::GstTagList,
    ) -> *mut gst::GstBuffer;
    pub fn gst_tag_list_to_vorbiscomment_buffer(
        list: *const gst::GstTagList,
        id_data: *const u8,
        id_data_length: c_uint,
        vendor_string: *const c_char,
    ) -> *mut gst::GstBuffer;
    pub fn gst_tag_list_to_xmp_buffer(
        list: *const gst::GstTagList,
        read_only: gboolean,
        schemas: *mut *const c_char,
    ) -> *mut gst::GstBuffer;
    pub fn gst_tag_parse_extended_comment(
        ext_comment: *const c_char,
        key: *mut *mut c_char,
        lang: *mut *mut c_char,
        value: *mut *mut c_char,
        fail_if_no_key: gboolean,
    ) -> gboolean;
    pub fn gst_tag_register_musicbrainz_tags();
    pub fn gst_tag_to_id3_tag(gst_tag: *const c_char) -> *const c_char;
    pub fn gst_tag_to_vorbis_comments(
        list: *const gst::GstTagList,
        tag: *const c_char,
    ) -> *mut glib::GList;
    pub fn gst_tag_to_vorbis_tag(gst_tag: *const c_char) -> *const c_char;
    pub fn gst_tag_xmp_list_schemas() -> *mut *const c_char;
    pub fn gst_vorbis_tag_add(list: *mut gst::GstTagList, tag: *const c_char, value: *const c_char);

}