diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/ffmpeg-0.10/avio.pas | 23 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/avutil.pas | 38 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/cpu.pas | 2 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/dict.pas | 7 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/log.pas | 35 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/mem.pas | 4 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/opt.pas | 16 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/pixfmt.pas | 75 | ||||
-rw-r--r-- | src/lib/ffmpeg-0.10/libavutil/samplefmt.pas | 93 |
9 files changed, 213 insertions, 80 deletions
diff --git a/src/lib/ffmpeg-0.10/avio.pas b/src/lib/ffmpeg-0.10/avio.pas index 9cdc1520..c2060c60 100644 --- a/src/lib/ffmpeg-0.10/avio.pas +++ b/src/lib/ffmpeg-0.10/avio.pas @@ -897,12 +897,29 @@ begin end; {$ENDIF} -{$IFDEF UNIX} +(** + * For SEEK_CUR on Windows + * values taken from stdio.h of C + *) +{$IFNDEF SEEK_SET} +const + SEEK_SET = 0; +{$ENDIF} + +{$IFNDEF SEEK_CUR} +const + SEEK_CUR = 1; +{$ENDIF} + +{$IFNDEF SEEK_END} +const + SEEK_END = 2; +{$ENDIF} + function avio_tell(s: PAVIOContext): cint64; {$IFDEF HasInline}inline;{$ENDIF} begin Result := avio_seek(s, 0, SEEK_CUR); end; -{$ELSE} -{$ENDIF} + end. diff --git a/src/lib/ffmpeg-0.10/avutil.pas b/src/lib/ffmpeg-0.10/avutil.pas index 0d9235e0..8da705df 100644 --- a/src/lib/ffmpeg-0.10/avutil.pas +++ b/src/lib/ffmpeg-0.10/avutil.pas @@ -116,7 +116,7 @@ type * Return a string describing the media_type enum, NULL if media_type * is unknown. *) -function av_get_media_type_string(media_type: TAVMediaType): Pchar; +function av_get_media_type_string(media_type: TAVMediaType): PAnsiChar; cdecl; external av__util; const @@ -177,14 +177,13 @@ type * @param[in] pict_type the picture type @return a single character * representing the picture type, '?' if pict_type is unknown *) -function av_get_picture_type_char(pict_type: TAVPictureType): Pchar; +function av_get_picture_type_char(pict_type: TAVPictureType): PAnsiChar; cdecl; external av__util; (** * Return x default pointer in case p is NULL. *) -function av_x_if_null(p: {const} pointer; x: {const} pointer): pointer; - cdecl; external av__util; +function av_x_if_null(p: {const} pointer; x: {const} pointer): pointer; {$IFDEF HasInline}inline;{$ENDIF} {$INCLUDE libavutil/cpu.pas} @@ -206,35 +205,38 @@ function av_x_if_null(p: {const} pointer; x: {const} pointer): pointer; (* libavutil/common.h *) // until now MKTAG and MKBETAG is all from common.h KMS 19/5/2010 -function MKTAG (a, b, c, d: AnsiChar): integer; -function MKBETAG(a, b, c, d: AnsiChar): integer; +(** + * MKTAG and MKBETAG are usually used to convert a magic string to an enumeration index. + * In Pascal this can probably not be used and the functions could be removed. + * KMS 8/6/2012 + *) +function MKTAG (a, b, c, d: AnsiChar): integer; {$IFDEF HasInline}inline;{$ENDIF} +function MKBETAG(a, b, c, d: AnsiChar): integer; {$IFDEF HasInline}inline;{$ENDIF} implementation -(* To Be Implemented, March 2012 KMS *) -//function av_x_if_null(p: {const} pointer; x: {const} pointer): pointer; -//begin -// If p = Nil Then -// Result := p -// Else -// Result := x; -// //return (void *)(intptr_t)(p ? p : x); -//end; +function av_x_if_null(p: {const} pointer; x: {const} pointer): pointer; {$IFDEF HasInline}inline;{$ENDIF} +begin + if p = nil then + Result := x + else + Result := p; +end; (* libavutil/common.h *) -function MKTAG(a, b, c, d: AnsiChar): integer; +function MKTAG(a, b, c, d: AnsiChar): integer; {$IFDEF HasInline}inline;{$ENDIF} begin Result := (ord(a) or (ord(b) shl 8) or (ord(c) shl 16) or (ord(d) shl 24)); end; -function MKBETAG(a, b, c, d: AnsiChar): integer; +function MKBETAG(a, b, c, d: AnsiChar): integer; {$IFDEF HasInline}inline;{$ENDIF} begin Result := (ord(d) or (ord(c) shl 8) or (ord(b) shl 16) or (ord(a) shl 24)); end; type - Psize_t = ^size_t; + Psize_t = ^size_t; function av_size_mult(a: size_t; b: size_t; r: Psize_t): size_t; cdecl; external av__util; diff --git a/src/lib/ffmpeg-0.10/libavutil/cpu.pas b/src/lib/ffmpeg-0.10/libavutil/cpu.pas index 79c4fc92..c28441bf 100644 --- a/src/lib/ffmpeg-0.10/libavutil/cpu.pas +++ b/src/lib/ffmpeg-0.10/libavutil/cpu.pas @@ -47,6 +47,8 @@ const AV_CPU_FLAG_SSE4 = $0100; ///< Penryn SSE4.1 functions AV_CPU_FLAG_SSE42 = $0200; ///< Nehalem SSE4.2 functions AV_CPU_FLAG_AVX = $4000; ///< AVX functions: requires OS support even if YMM registers aren't used + AV_CPU_FLAG_XOP = $0400; ///< Bulldozer XOP functions + AV_CPU_FLAG_FMA4 = $0800; ///< Bulldozer FMA4 functions AV_CPU_FLAG_IWMMXT = $0100; ///< XScale IWMMXT AV_CPU_FLAG_ALTIVEC = $0001; ///< standard diff --git a/src/lib/ffmpeg-0.10/libavutil/dict.pas b/src/lib/ffmpeg-0.10/libavutil/dict.pas index ff4fa02b..aa52861e 100644 --- a/src/lib/ffmpeg-0.10/libavutil/dict.pas +++ b/src/lib/ffmpeg-0.10/libavutil/dict.pas @@ -27,11 +27,12 @@ const AV_DICT_MATCH_CASE = 1; AV_DICT_IGNORE_SUFFIX = 2; AV_DICT_DONT_STRDUP_KEY = 4; (**< Take ownership of a key that's been - allocated with av_malloc() and children. *) - + allocated with av_malloc() and children. *) AV_DICT_DONT_STRDUP_VAL = 8; (**< Take ownership of a value that's been - allocated with av_malloc() and chilren. *) + allocated with av_malloc() and chilren. *) AV_DICT_DONT_OVERWRITE = 16; (**< Don't overwrite existing entries. *) + AV_DICT_APPEND = 32; (**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. *) type PAVDictionaryEntry = ^TAVDictionaryEntry; diff --git a/src/lib/ffmpeg-0.10/libavutil/log.pas b/src/lib/ffmpeg-0.10/libavutil/log.pas index bd4aa22e..955d078a 100644 --- a/src/lib/ffmpeg-0.10/libavutil/log.pas +++ b/src/lib/ffmpeg-0.10/libavutil/log.pas @@ -77,13 +77,21 @@ type parent_log_context_offset: cint; (** - * A function for extended searching, e.g. in possible - * children objects. + * Return next AVOptions-enabled child or NULL *) - opt_find: function(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar; - opt_flags: cint; search_flags: cint): PAVOption; cdecl; - end; + child_next: function (obj: pointer; prev: pointer): pointer; cdecl; + (** + * Return an AVClass corresponding to next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + *) + function child_class_next (prev: {const} PAVClass): {const} PAVClass; cdecl; + +end; const AV_LOG_QUIET = -8; @@ -136,11 +144,7 @@ const *) {** to be translated if needed -#ifdef __GNUC__ -void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -#else -void av_log(void*, int level, const char *fmt, ...); -#endif +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); **} type @@ -162,6 +166,17 @@ function av_default_item_name (ctx: pointer): PAnsiChar; cdecl; external av__util; (** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formated line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + *) +procedure av_log_format_line(ptr: pointer; level: cint; fmt: {const} PAnsiChar; vl: va_list; + line: PAnsiChar; line_size: cint; print_prefix: Pcint); + cdecl; external av__util; + +(** * av_dlog macros * Useful to print debug messages that shouldn't get compiled in normally. *) diff --git a/src/lib/ffmpeg-0.10/libavutil/mem.pas b/src/lib/ffmpeg-0.10/libavutil/mem.pas index d163d9df..d59b9a46 100644 --- a/src/lib/ffmpeg-0.10/libavutil/mem.pas +++ b/src/lib/ffmpeg-0.10/libavutil/mem.pas @@ -64,7 +64,7 @@ function av_realloc(ptr: pointer; size: size_t): pointer; * - It frees the input block in case of failure, thus avoiding the memory * leak with the classic "buf = realloc(buf); if (!buf) return -1;". *) -function av_realloc_f(ptr: pointer; nelem: size_t; size: size_t): pointer; +function av_realloc_f(ptr: pointer; nelem: size_t; elsize: size_t): pointer; cdecl; external av__util; (** @@ -135,9 +135,7 @@ procedure av_dynarray_add(tab_ptr: pointer; nb_ptr: PCint; elem: pointer); * Multiply two size_t values checking for overflow. * @return 0 if success, AVERROR(EINVAL) if overflow. *) -{ available only in 0.8.5 - 0.8.10 //static inline int av_size_mult(size_t a, size_t b, size_t *r) -} { size_t t = a * b; /* Hack inspired from glibc: only try the division if nelem and elsize diff --git a/src/lib/ffmpeg-0.10/libavutil/opt.pas b/src/lib/ffmpeg-0.10/libavutil/opt.pas index 16bf0f26..f2c258de 100644 --- a/src/lib/ffmpeg-0.10/libavutil/opt.pas +++ b/src/lib/ffmpeg-0.10/libavutil/opt.pas @@ -23,13 +23,14 @@ * - Changes and updates by the UltraStar Deluxe Team * * Conversion of libavutil/opt.h - * avutil version 51.9.1 + * avutil version 51.34.101 * *) type TAVOptionType = ( - FF_OPT_TYPE_FLAGS, +{$IFDEF FF_API_OLD_AVOPTIONS} + FF_OPT_TYPE_FLAGS = 0, FF_OPT_TYPE_INT, FF_OPT_TYPE_INT64, FF_OPT_TYPE_DOUBLE, @@ -38,6 +39,17 @@ type FF_OPT_TYPE_RATIONAL, FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length FF_OPT_TYPE_CONST = 128 +{$ELSE} + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128 +{$ENDIF} ); const diff --git a/src/lib/ffmpeg-0.10/libavutil/pixfmt.pas b/src/lib/ffmpeg-0.10/libavutil/pixfmt.pas index 552d4474..5e8a547d 100644 --- a/src/lib/ffmpeg-0.10/libavutil/pixfmt.pas +++ b/src/lib/ffmpeg-0.10/libavutil/pixfmt.pas @@ -19,7 +19,7 @@ * - Changes and updates by the UltraStar Deluxe Team * * Conversion of libavutil/pixfmt.h - * avutil version 51.9.1 + * avutil version 51.34.101 * *) @@ -32,12 +32,14 @@ type (** * Pixel format. Notes: * + * @note * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA * color is put together as: * (A << 24) | (R << 16) | (G << 8) | B * This is stored as BGRA on little-endian CPU architectures and ARGB on * big-endian CPUs. * + * @par * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is @@ -47,13 +49,15 @@ type * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. * + * @par * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like * for pal8. This palette is filled in automatically by the function * allocating the picture. * - * Note, make sure that all newly added big endian formats have pix_fmt&1==1 - * and that all newly added little endian formats have pix_fmt&1==0 - * this allows simpler detection of big vs little endian. + * @note + * make sure that all newly added big endian formats have pix_fmt&1==1 + * and that all newly added little endian formats have pix_fmt&1==0 + * this allows simpler detection of big vs little endian. *) PAVPixelFormat = ^TAVPixelFormat; @@ -143,24 +147,55 @@ type PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + +{$IFDEF AV_PIX_FMT_ABI_GIT_MASTER} + PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian + PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian + PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian + PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian + PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian + PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + +{$IFNDEF AV_PIX_FMT_ABI_GIT_MASTER} + PIX_FMT_RGBA64BE = $123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + PIX_FMT_0RGB = $123 + 4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... + PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... + PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... + PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions ); const PIX_FMT_Y400A = PIX_FMT_GRAY8A; + PIX_FMT_GBR24P = PIX_FMT_GBRP; -{$ifdef WORDS_BIGENDIAN} +{$IFDEF WORDS_BIGENDIAN} PIX_FMT_RGB32 = PIX_FMT_ARGB; PIX_FMT_RGB32_1 = PIX_FMT_RGBA; PIX_FMT_BGR32 = PIX_FMT_ABGR; PIX_FMT_BGR32_1 = PIX_FMT_BGRA; + PIX_FMT_0RGB32 = PIX_FMT_0RGB; + PIX_FMT_0BGR32 = PIX_FMT_0BGR; PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; PIX_FMT_RGB48 = PIX_FMT_RGB48BE; @@ -173,6 +208,7 @@ const PIX_FMT_BGR444 = PIX_FMT_BGR444BE; PIX_FMT_YUV420P9 = PIX_FMT_YUV420P9BE; + PIX_FMT_YUV422P9 = PIX_FMT_YUV422P9BE; PIX_FMT_YUV444P9 = PIX_FMT_YUV444P9BE; PIX_FMT_YUV420P10 = PIX_FMT_YUV420P10BE; PIX_FMT_YUV422P10 = PIX_FMT_YUV422P10BE; @@ -180,11 +216,19 @@ const PIX_FMT_YUV420P16 = PIX_FMT_YUV420P16BE; PIX_FMT_YUV422P16 = PIX_FMT_YUV422P16BE; PIX_FMT_YUV444P16 = PIX_FMT_YUV444P16BE; -{$else} + + PIX_FMT_RGBA64 = PIX_FMT_RGBA64BE; + PIX_FMT_BGRA64 = PIX_FMT_BGRA64BE; + PIX_FMT_GBRP9 = PIX_FMT_GBRP9BE; + PIX_FMT_GBRP10 = PIX_FMT_GBRP10BE; + PIX_FMT_GBRP16 = PIX_FMT_GBRP16BE; +{$ELSE} PIX_FMT_RGB32 = PIX_FMT_BGRA; PIX_FMT_RGB32_1 = PIX_FMT_ABGR; PIX_FMT_BGR32 = PIX_FMT_RGBA; PIX_FMT_BGR32_1 = PIX_FMT_ARGB; + PIX_FMT_0RGB32 = PIX_FMT_BGR0; + PIX_FMT_0BGR32 = PIX_FMT_RGB0; PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; PIX_FMT_RGB48 = PIX_FMT_RGB48LE; @@ -197,6 +241,7 @@ const PIX_FMT_BGR444 = PIX_FMT_BGR444LE; PIX_FMT_YUV420P9 = PIX_FMT_YUV420P9LE; + PIX_FMT_YUV422P9 = PIX_FMT_YUV422P9LE; PIX_FMT_YUV444P9 = PIX_FMT_YUV444P9LE; PIX_FMT_YUV420P10 = PIX_FMT_YUV420P10LE; PIX_FMT_YUV422P10 = PIX_FMT_YUV422P10LE; @@ -204,4 +249,10 @@ const PIX_FMT_YUV420P16 = PIX_FMT_YUV420P16LE; PIX_FMT_YUV422P16 = PIX_FMT_YUV422P16LE; PIX_FMT_YUV444P16 = PIX_FMT_YUV444P16LE; + + PIX_FMT_RGBA64 = PIX_FMT_RGBA64LE; + PIX_FMT_BGRA64 = PIX_FMT_BGRA64LE; + PIX_FMT_GBRP9 = PIX_FMT_GBRP9LE; + PIX_FMT_GBRP10 = PIX_FMT_GBRP10LE; + PIX_FMT_GBRP16 = PIX_FMT_GBRP16LE; {$ENDIF} diff --git a/src/lib/ffmpeg-0.10/libavutil/samplefmt.pas b/src/lib/ffmpeg-0.10/libavutil/samplefmt.pas index 3335fa2d..1ba6c5a6 100644 --- a/src/lib/ffmpeg-0.10/libavutil/samplefmt.pas +++ b/src/lib/ffmpeg-0.10/libavutil/samplefmt.pas @@ -19,7 +19,7 @@ * This is a part of the Pascal port of ffmpeg. * * Conversion of libavutil/samplefmt.h - * avutil version 50.43.0 + * avutil version 51.34.101 * *) @@ -34,6 +34,13 @@ type AV_SAMPLE_FMT_S32, ///< signed 32 bits AV_SAMPLE_FMT_FLT, ///< float AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically ); TAVSampleFormatArray = array [0 .. MaxInt div SizeOf(TAVSampleFormat) - 1] of TAVSampleFormat; @@ -54,6 +61,15 @@ function av_get_sample_fmt(name: {const} PAnsiChar): TAVSampleFormat; cdecl; external av__util; (** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + *) +function av_get_alt_sample_fmt(sample_fmt: TAVSampleFormat; planar: cint): TAVSampleFormat; + cdecl; external av__util; + +(** * Generate a string corresponding to the sample format with * sample_fmt, or a header if sample_fmt is negative. * @@ -91,48 +107,67 @@ type OctArrayOfcint = array[0..7] of cint; (** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + *) +function av_sample_fmt_is_planar(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +(** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @return required buffer size, or negative error code on failure + *) +function av_samples_get_buffer_size(linesize: Pcint; nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** * Fill channel data pointers and linesizes for samples with sample * format sample_fmt. * * The pointers array is filled with the pointers to the samples data: - * for planar, set the start point of each plane's data within the buffer, + * for planar, set the start point of each channel's data within the buffer, * for packed, set the start point of the entire buffer only. * - * The linesize array is filled with the aligned size of each samples - * plane, that is linesize[i] will contain the linesize of the plane i, - * and will be zero for all the unused planes. All linesize values are - * equal. + * The linesize array is filled with the aligned size of each channel's data + * buffer for planar layout, or the aligned size of the buffer for all channels + * for packed layout. * - * @param pointers array to be filled with the pointer for each plane, may be NULL - * @param linesizes array to be filled with the linesize, may be NULL - * @param buf the pointer to a buffer containing the samples - * @param nb_samples the number of samples in a single channel - * @param planar 1 if the samples layout is planar, 0 if it is packed - * @param nb_channels the number of channels - * @return the total size of the buffer, a negative - * error code in case of failure + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (1 = no alignment required) + * @return 0 on success or a negative error code on failure *) -function av_samples_fill_arrays(pointers: OctArrayOfPcuint8; linesizes: OctArrayOfcint; +function av_samples_fill_arrays(audio_data: pointer; linesize: Pcint; buf: Pcuint8; nb_channels: cint; nb_samples: cint; - sample_fmt: TAVSampleFormat; planar: cint; align: cint): cint; + sample_fmt: TAVSampleFormat; align: cint): cint; cdecl; external av__util; (** - * Allocate a samples buffer for nb_samples samples, and - * fill pointers and linesizes accordingly. - * The allocated samples buffer has to be freed by using - * av_freep(&pointers[0]). + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) * - * @param nb_channels number of audio channels - * @param nb_samples number of samples per channel - * @param planar 1 if the samples layout is planar, 0 if packed, - * @param align the value to use for buffer size alignment - * @return the size in bytes required for the samples buffer, a negative - * error code in case of failure + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s) + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (1 = no alignment required) + * @return 0 on success or a negative error code on failure * @see av_samples_fill_arrays() *) -function av_samples_alloc(pointers: OctArrayOfPcuint8; linesizes: OctArrayOfcint; +function av_samples_alloc(audio_data: pointer; linesize: Pcint; nb_channels: cint; nb_channels: cint; nb_samples: cint; - sample_fmt: TAVSampleFormat; planar: cint; - align: cint): cint; + sample_fmt: TAVSampleFormat; align: cint): cint; cdecl; external av__util; |