@@ -6,6 +6,7 @@ package ffmpeg
66#include <libavcodec/avcodec.h>
77#include <libavcodec/bsf.h>
88#include <libavfilter/avfilter.h>
9+ #include <libavutil/uuid.h>
910
1011// Forward declarations for iteration functions
1112extern const AVCodec *av_codec_iterate(void **opaque);
@@ -187,3 +188,107 @@ type AVAdler = uint32
187188// AVCRC is a typedef alias for uint32_t in FFmpeg.
188189// This represents a CRC (Cyclic Redundancy Check) value.
189190type AVCRC = uint32
191+
192+ // AVUUID is a typedef to a 16-byte array in FFmpeg (uint8_t[16]).
193+ // This represents a UUID as an opaque sequence of 16 unsigned bytes.
194+ // Binary representation of a UUID per IETF RFC 4122.
195+ type AVUUID = [16 ]uint8
196+
197+ // --- Manual UUID function wrappers (arrays need pointer conversion in CGO) ---
198+
199+ // AVUuidParse parses a string representation of a UUID formatted according to IETF RFC 4122
200+ // into an AVUUID. The parsing is case-insensitive. The string must be 37
201+ // characters long, including the terminating NUL character.
202+ //
203+ // Example string representation: "2fceebd0-7017-433d-bafb-d073a7116696"
204+ //
205+ // @param[in] in String representation of a UUID
206+ // @param[out] uu AVUUID
207+ // @return A non-zero value in case of an error.
208+ func AVUuidParse (in * CStr , uu * AVUUID ) (int , error ) {
209+ var tmpin * C.char
210+ if in != nil {
211+ tmpin = in .ptr
212+ }
213+ ret := C .av_uuid_parse (tmpin , (* C .uint8_t )(unsafe .Pointer (& uu [0 ])))
214+ return int (ret ), WrapErr (int (ret ))
215+ }
216+
217+ // AVUuidUrnParse parses a URN representation of a UUID, as specified at IETF RFC 4122,
218+ // into an AVUUID. The parsing is case-insensitive. The string must be 46
219+ // characters long, including the terminating NUL character.
220+ //
221+ // Example string representation: "urn:uuid:2fceebd0-7017-433d-bafb-d073a7116696"
222+ //
223+ // @param[in] in URN UUID
224+ // @param[out] uu AVUUID
225+ // @return A non-zero value in case of an error.
226+ func AVUuidUrnParse (in * CStr , uu * AVUUID ) (int , error ) {
227+ var tmpin * C.char
228+ if in != nil {
229+ tmpin = in .ptr
230+ }
231+ ret := C .av_uuid_urn_parse (tmpin , (* C .uint8_t )(unsafe .Pointer (& uu [0 ])))
232+ return int (ret ), WrapErr (int (ret ))
233+ }
234+
235+ // AVUuidParseRange parses a string representation of a UUID formatted according to IETF RFC 4122
236+ // into an AVUUID. The parsing is case-insensitive.
237+ //
238+ // @param[in] inStart Pointer to the first character of the string representation
239+ // @param[in] inEnd Pointer to the character after the last character of the
240+ // string representation. That memory location is never
241+ // accessed. It is an error if `inEnd - inStart != 36`.
242+ // @param[out] uu AVUUID
243+ // @return A non-zero value in case of an error.
244+ func AVUuidParseRange (inStart * CStr , inEnd * CStr , uu * AVUUID ) (int , error ) {
245+ var tmpinStart * C.char
246+ if inStart != nil {
247+ tmpinStart = inStart .ptr
248+ }
249+ var tmpinEnd * C.char
250+ if inEnd != nil {
251+ tmpinEnd = inEnd .ptr
252+ }
253+ ret := C .av_uuid_parse_range (tmpinStart , tmpinEnd , (* C .uint8_t )(unsafe .Pointer (& uu [0 ])))
254+ return int (ret ), WrapErr (int (ret ))
255+ }
256+
257+ // AVUuidUnparse serializes a AVUUID into a string representation according to IETF RFC 4122.
258+ // The string is lowercase and always 37 characters long, including the terminating NUL character.
259+ //
260+ // @param[in] uu AVUUID
261+ // @param[out] out Pointer to an array of no less than 37 characters.
262+ func AVUuidUnparse (uu * AVUUID , out * CStr ) {
263+ var tmpout * C.char
264+ if out != nil {
265+ tmpout = out .ptr
266+ }
267+ C .av_uuid_unparse ((* C .uint8_t )(unsafe .Pointer (& uu [0 ])), tmpout )
268+ }
269+
270+ // AVUuidEqual compares two UUIDs for equality.
271+ //
272+ // @param[in] uu1 AVUUID
273+ // @param[in] uu2 AVUUID
274+ // @return Nonzero if uu1 and uu2 are equal, 0 otherwise.
275+ func AVUuidEqual (uu1 * AVUUID , uu2 * AVUUID ) (int , error ) {
276+ ret := C .av_uuid_equal ((* C .uint8_t )(unsafe .Pointer (& uu1 [0 ])), (* C .uint8_t )(unsafe .Pointer (& uu2 [0 ])))
277+ return int (ret ), WrapErr (int (ret ))
278+ }
279+
280+ // AVUuidCopy copies the bytes of src into dest.
281+ //
282+ // @param[out] dest AVUUID
283+ // @param[in] src AVUUID
284+ func AVUuidCopy (dest * AVUUID , src * AVUUID ) {
285+ C .av_uuid_copy ((* C .uint8_t )(unsafe .Pointer (& dest [0 ])), (* C .uint8_t )(unsafe .Pointer (& src [0 ])))
286+ }
287+
288+ // AVUuidNil sets a UUID to the nil UUID, i.e. a UUID with have all
289+ // its 128 bits set to zero.
290+ //
291+ // @param[out] uu AVUUID
292+ func AVUuidNil (uu * AVUUID ) {
293+ C .av_uuid_nil ((* C .uint8_t )(unsafe .Pointer (& uu [0 ])))
294+ }
0 commit comments