diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-02-04 17:17:51 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-02-04 17:17:51 +0000 |
commit | e24412a795e205494d0a7420fd582841c1fc1dd4 (patch) | |
tree | 2497a2069fd91e481ffacf6a383c8cce7e7ee764 /src/lib/ffmpeg | |
parent | 29aa8dbd912837a16529f33605e7136cfffeacd1 (diff) | |
download | usdx-e24412a795e205494d0a7420fd582841c1fc1dd4.tar.gz usdx-e24412a795e205494d0a7420fd582841c1fc1dd4.tar.xz usdx-e24412a795e205494d0a7420fd582841c1fc1dd4.zip |
ffmpeg header update
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1581 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/lib/ffmpeg')
-rw-r--r-- | src/lib/ffmpeg/avcodec.pas | 317 | ||||
-rw-r--r-- | src/lib/ffmpeg/avformat.pas | 217 | ||||
-rw-r--r-- | src/lib/ffmpeg/avio.pas | 119 | ||||
-rw-r--r-- | src/lib/ffmpeg/avutil.pas | 89 | ||||
-rw-r--r-- | src/lib/ffmpeg/mathematics.pas | 27 | ||||
-rw-r--r-- | src/lib/ffmpeg/opt.pas | 52 | ||||
-rw-r--r-- | src/lib/ffmpeg/rational.pas | 52 |
7 files changed, 577 insertions, 296 deletions
diff --git a/src/lib/ffmpeg/avcodec.pas b/src/lib/ffmpeg/avcodec.pas index 0954ee06..6039835c 100644 --- a/src/lib/ffmpeg/avcodec.pas +++ b/src/lib/ffmpeg/avcodec.pas @@ -27,7 +27,7 @@ (* * Conversion of libavcodec/avcodec.h * Min. version: 51.16.0, revision 6577, Sat Oct 7 15:30:46 2006 UTC - * Max. version: 52.0.0, revision 15448, Sun Sep 28 19:11:26 2008 UTC + * Max. version: 52.11.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC *) unit avcodec; @@ -51,6 +51,7 @@ uses avutil, rational, opt, + SysUtils, {$IFDEF UNIX} BaseUnix, {$ENDIF} @@ -59,7 +60,7 @@ uses const (* Max. supported version by this header *) LIBAVCODEC_MAX_VERSION_MAJOR = 52; - LIBAVCODEC_MAX_VERSION_MINOR = 0; + LIBAVCODEC_MAX_VERSION_MINOR = 11; LIBAVCODEC_MAX_VERSION_RELEASE = 0; LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -231,6 +232,7 @@ type CODEC_ID_CMV, CODEC_ID_MOTIONPIXELS, CODEC_ID_TGV, + CODEC_ID_TGQ, //* various PCM "codecs" */ CODEC_ID_PCM_S16LE= $10000, @@ -286,6 +288,7 @@ type CODEC_ID_ADPCM_IMA_EA_EACS, CODEC_ID_ADPCM_EA_XAS, CODEC_ID_ADPCM_EA_MAXIS_XA, + CODEC_ID_ADPCM_IMA_ISS, //* AMR */ CODEC_ID_AMR_NB= $12000, @@ -350,6 +353,7 @@ type CODEC_ID_ATRAC3P, CODEC_ID_EAC3, CODEC_ID_SIPR, + CODEC_ID_MP1, //* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= $17000, @@ -403,6 +407,43 @@ type _TSampleFormatArray = array [0 .. MaxInt div SizeOf(TSampleFormat)-1] of TSampleFormat; PSampleFormatArray = ^_TSampleFormatArray; +const + {* Audio channel masks *} + CH_FRONT_LEFT = $00000001; + CH_FRONT_RIGHT = $00000002; + CH_FRONT_CENTER = $00000004; + CH_LOW_FREQUENCY = $00000008; + CH_BACK_LEFT = $00000010; + CH_BACK_RIGHT = $00000020; + CH_FRONT_LEFT_OF_CENTER = $00000040; + CH_FRONT_RIGHT_OF_CENTER = $00000080; + CH_BACK_CENTER = $00000100; + CH_SIDE_LEFT = $00000200; + CH_SIDE_RIGHT = $00000400; + CH_TOP_CENTER = $00000800; + CH_TOP_FRONT_LEFT = $00001000; + CH_TOP_FRONT_CENTER = $00002000; + CH_TOP_FRONT_RIGHT = $00004000; + CH_TOP_BACK_LEFT = $00008000; + CH_TOP_BACK_CENTER = $00010000; + CH_TOP_BACK_RIGHT = $00020000; + CH_STEREO_LEFT = $20000000; ///< Stereo downmix. + CH_STEREO_RIGHT = $40000000; ///< See CH_STEREO_LEFT. + + {* Audio channel convenience macros *} + CH_LAYOUT_MONO = (CH_FRONT_CENTER); + CH_LAYOUT_STEREO = (CH_FRONT_LEFT or CH_FRONT_RIGHT); + CH_LAYOUT_SURROUND = (CH_LAYOUT_STEREO or CH_FRONT_CENTER); + CH_LAYOUT_QUAD = (CH_LAYOUT_STEREO or CH_BACK_LEFT or CH_BACK_RIGHT); + CH_LAYOUT_5POINT0 = (CH_LAYOUT_SURROUND or CH_SIDE_LEFT or CH_SIDE_RIGHT); + CH_LAYOUT_5POINT1 = (CH_LAYOUT_5POINT0 or CH_LOW_FREQUENCY); + CH_LAYOUT_7POINT1 = (CH_LAYOUT_5POINT1 or CH_BACK_LEFT or CH_BACK_RIGHT); + CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_SURROUND or CH_LOW_FREQUENCY or + CH_BACK_LEFT or CH_BACK_RIGHT or + CH_FRONT_LEFT_OF_CENTER or CH_FRONT_RIGHT_OF_CENTER); + CH_LAYOUT_STEREO_DOWNMIX = (CH_STEREO_LEFT or CH_STEREO_RIGHT); + + const {* in bytes *} AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio @@ -559,6 +600,11 @@ const *) CODEC_CAP_SMALL_LAST_FRAME = $0040; + (** + * Codec can export data for HW decoding (VDPAU). + *) + CODEC_CAP_HWACCEL_VDPAU = $0080; + //the following defines may change, don't expect compatibility if you use them MB_TYPE_INTRA4x4 = $001; MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific @@ -850,6 +896,38 @@ type *) bits_per_raw_sample: cint; {$IFEND} + + {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 + (** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by libavcodec. + *) + channel_layout: cint64; + + (** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + *) + request_channel_layout: cint64; + {$IFEND} + + {$IF LIBAVCODEC_VERSION >= 52004000} // 52.4.0 + (** + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + *) + rc_max_available_vbv_use: cfloat; + + (** + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + *) + rc_min_vbv_overflow_use: cfloat; + {$IFEND} end; const @@ -918,21 +996,25 @@ const FF_IDCT_SIMPLEVIS = 18; FF_IDCT_WMV2 = 19; FF_IDCT_FAAN = 20; + FF_IDCT_EA = 21; + FF_IDCT_SIMPLENEON = 22; + FF_IDCT_SIMPLEALPHA = 23; FF_EC_GUESS_MVS = 1; FF_EC_DEBLOCK = 2; - FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) (* lower 16 bits - CPU features *) - FF_MM_MMX = $0001; ///< standard MMX - FF_MM_3DNOW = $0004; ///< AMD 3DNOW - FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext - FF_MM_SSE = $0008; ///< SSE functions - FF_MM_SSE2 = $0010; ///< PIV SSE2 functions - FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt + FF_MM_MMX = $0001; ///< standard MMX + FF_MM_3DNOW = $0004; ///< AMD 3DNOW + FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + FF_MM_SSE = $0008; ///< SSE functions + FF_MM_SSE2 = $0010; ///< PIV SSE2 functions + FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt FF_MM_SSE3 = $0040; ///< Prescott SSE3 functions FF_MM_SSSE3 = $0080; ///< Conroe SSSE3 functions - FF_MM_IWMMXT = $0100; ///< XScale IWMMXT + FF_MM_IWMMXT = $0100; ///< XScale IWMMXT + FF_MM_ALTIVEC = $0001; ///< standard AltiVec FF_PRED_LEFT = 0; FF_PRED_PLANE = 1; @@ -1066,13 +1148,13 @@ type // int (*func)(struct AVCodecContext *c2, void *arg) TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; - TAVClass = record {12} - class_name: pchar; + TAVClass = record + class_name: PAnsiChar; (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function (): pchar; cdecl; + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function(): PAnsiChar; cdecl; option: PAVOption; end; @@ -1334,7 +1416,7 @@ type *) opaque: pointer; - codec_name: array [0..31] of char; + codec_name: array [0..31] of AnsiChar; codec_type: TCodecType; (* see CODEC_TYPE_xxx *) codec_id: TCodecID; (* see CODEC_ID_xxx *) @@ -1451,7 +1533,7 @@ type * - encoding: Set by libavcodec. * - decoding: unused *) - stats_out: pchar; + stats_out: PByteArray; (** * pass2 encoding statistics input buffer @@ -1459,7 +1541,7 @@ type * - encoding: Allocated/set/freed by user. * - decoding: unused *) - stats_in: pchar; + stats_in: PByteArray; (** * ratecontrol qmin qmax limiting method @@ -1485,7 +1567,7 @@ type * - encoding: Set by user * - decoding: unused *) - rc_eq: {const} pchar; + rc_eq: {const} PByteArray; (** * maximum bitrate @@ -1886,7 +1968,7 @@ type * - encoding: unused * - decoding: Set by user, will be converted to uppercase by libavcodec during init. *) - stream_codec_tag: array [0..3] of char; //cuint; + stream_codec_tag: array [0..3] of AnsiChar; //cuint; (** * scene change detection threshold @@ -1994,7 +2076,11 @@ type * - encoding: Set by libavcodec, user can override. * - decoding: Set by libavcodec, user can override. *) + {$IF LIBAVCODEC_VERSION < 52004000} // < 52.4.0 execute: function (c: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: PCint; count: cint): cint; cdecl; + {$ELSE} + execute: function (c: PAVCodecContext; func: TExecuteFunc; arg: Pointer; ret: PCint; count: cint; size: cint): cint; cdecl; + {$IFEND} (** * thread opaque @@ -2197,7 +2283,7 @@ type (** * number of reference frames * - encoding: Set by user. - * - decoding: unused + * - decoding: Set by lavc. *) refs: cint; @@ -2349,13 +2435,16 @@ type {$IFEND} {$IF LIBAVCODEC_VERSION >= 51042000} // 51.42.0 + {$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} (** * Decoder should decode to this many channels if it can (0 for default) * - encoding: unused * - decoding: Set by user. + * @deprecated Deprecated in favor of request_channel_layout. *) request_channels: cint; {$IFEND} + {$IFEND} {$IF LIBAVCODEC_VERSION > 51049000} // > 51.49.0 (** @@ -2382,15 +2471,15 @@ type * AVCodec. *) TAVCodec = record - name: pchar; + name: PAnsiChar; type_: TCodecType; id: TCodecID; priv_data_size: cint; init: function (avctx: PAVCodecContext): cint; cdecl; (* typo corretion by the Creative CAT *) - encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: cint; data: pointer): cint; cdecl; + encode: function (avctx: PAVCodecContext; buf: PByteArray; buf_size: cint; data: pointer): cint; cdecl; close: function (avctx: PAVCodecContext): cint; cdecl; decode: function (avctx: PAVCodecContext; outdata: pointer; var outdata_size: cint; - buf: {const} pchar; buf_size: cint): cint; cdecl; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; (** * Codec capabilities. * see CODEC_CAP_* @@ -2409,7 +2498,7 @@ type * Descriptive name for the codec, meant to be more human readable than \p name. * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. *) - long_name: {const} PChar; + long_name: {const} PAnsiChar; {$IFEND} {$IF LIBAVCODEC_VERSION >= 51056000} // 51.56.0 supported_samplerates: {const} PCint; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 @@ -2417,6 +2506,9 @@ type {$IF LIBAVCODEC_VERSION >= 51062000} // 51.62.0 sample_fmts: {const} PSampleFormatArray; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 + channel_layouts: {const} PCint64; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + {$IFEND} end; (** @@ -2425,30 +2517,81 @@ type *) PAVPicture = ^TAVPicture; TAVPicture = record - data: array [0..3] of pchar; + data: array [0..3] of PByteArray; linesize: array [0..3] of cint; ///< number of bytes per line end; type + TAVSubtitleType = ( + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + (** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + *) + SUBTITLE_TEXT, + + (** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + *) + SUBTITLE_ASS + ); + +type + PPAVSubtitleRect = ^PAVSubtitleRect; PAVSubtitleRect = ^TAVSubtitleRect; + {$IF LIBAVCODEC_VERSION < 52010000} // < 52.10.0 TAVSubtitleRect = record - x: word; - y: word; - w: word; - h: word; - nb_colors: word; + x: cuint16; + y: cuint16; + w: cuint16; + h: cuint16; + nb_colors: cuint16; linesize: cint; - rgba_palette: PCuint; - bitmap: pchar; + rgba_palette: PCuint32; + bitmap: PCuint8; + end; + {$ELSE} + TAVSubtitleRect = record + x: cint; ///< top left corner of pict, undefined when pict is not set + y: cint; ///< top left corner of pict, undefined when pict is not set + w: cint; ///< width of pict, undefined when pict is not set + h: cint; ///< height of pict, undefined when pict is not set + nb_colors: cint; ///< number of colors in pict, undefined when pict is not set + + (** + * data+linesize for the bitmap of this subtitle. + * can be set for text/ass as well once they where rendered + *) + pict: TAVPicture; + type_: TAVSubtitleType; + + text: PAnsiChar; ///< 0 terminated plain UTF-8 text + + (** + * 0 terminated ASS/SSA compatible event line. + * The pressentation of this is unaffected by the other values in this + * struct. + *) + ass: PByteArray; end; + {$IFEND} + PPAVSubtitle = ^PAVSubtitle; PAVSubtitle = ^TAVSubtitle; - TAVSubtitle = record {20} - format: word; (* 0 = graphics *) - start_display_time: cuint; (* relative to packet pts, in ms *) - end_display_time: cuint; (* relative to packet pts, in ms *) + TAVSubtitle = record + format: cuint16; (* 0 = graphics *) + start_display_time: cuint32; (* relative to packet pts, in ms *) + end_display_time: cuint32; (* relative to packet pts, in ms *) num_rects: cuint; + {$IF LIBAVCODEC_VERSION < 52010000} // < 52.10.0 rects: PAVSubtitleRect; + {$ELSE} + rects: PPAVSubtitleRect; + {$IFEND} end; @@ -2563,7 +2706,7 @@ function avpicture_fill (picture: PAVPicture; ptr: pointer; function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: cint; height: cint; - dest: pchar; dest_size: cint): cint; + dest: PByteArray; dest_size: cint): cint; cdecl; external av__codec; (** @@ -2581,13 +2724,13 @@ function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint) procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; var h_shift: cint; var v_shift: cint); cdecl; external av__codec; -function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; +function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): PAnsiChar; cdecl; external av__codec; procedure avcodec_set_dimensions(s: PAVCodecContext; width: cint; height: cint); cdecl; external av__codec; -function avcodec_get_pix_fmt(name: {const} pchar): TAVPixelFormat; +function avcodec_get_pix_fmt(name: {const} PAnsiChar): TAVPixelFormat; cdecl; external av__codec; function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cuint; @@ -2665,7 +2808,7 @@ function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelForm * a negative value to print the corresponding header. * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. *) -procedure avcodec_pix_fmt_string (buf: PChar; buf_size: cint; pix_fmt: cint); +procedure avcodec_pix_fmt_string (buf: PAnsiChar; buf_size: cint; pix_fmt: cint); cdecl; external av__codec; {$IFEND} @@ -2734,7 +2877,12 @@ function avcodec_build(): cuint; procedure avcodec_init(); cdecl; external av__codec; -procedure register_avcodec(format: PAVCodec); +(** + * Register the codec \p codec and initialize libavcodec. + * + * @see avcodec_init() + *) +procedure register_avcodec(codec: PAVCodec); cdecl; external av__codec; (** @@ -2752,7 +2900,7 @@ function avcodec_find_encoder(id: TCodecID): PAVCodec; * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. *) -function avcodec_find_encoder_by_name(name: pchar): PAVCodec; +function avcodec_find_encoder_by_name(name: PAnsiChar): PAVCodec; cdecl; external av__codec; (** @@ -2770,9 +2918,9 @@ function avcodec_find_decoder(id: TCodecID): PAVCodec; * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. *) -function avcodec_find_decoder_by_name(name: pchar): PAVCodec; +function avcodec_find_decoder_by_name(name: PAnsiChar): PAVCodec; cdecl; external av__codec; -procedure avcodec_string(buf: pchar; buf_size: cint; enc: PAVCodecContext; encode: cint); +procedure avcodec_string(buf: PAnsiChar; buf_size: cint; enc: PAVCodecContext; encode: cint); cdecl; external av__codec; (** @@ -2851,10 +2999,23 @@ function avcodec_thread_init(s: PAVCodecContext; thread_count: cint): cint; cdecl; external av__codec; procedure avcodec_thread_free(s: PAVCodecContext); cdecl; external av__codec; + + +{$IF LIBAVCODEC_VERSION < 52004000} // < 52.4.0 function avcodec_thread_execute(s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; var ret: cint; count: cint): cint; cdecl; external av__codec; +{$ELSE} +function avcodec_thread_execute(s: PAVCodecContext; func: TExecuteFunc; arg: Pointer; var ret: cint; count: cint; size: cint): cint; + cdecl; external av__codec; +{$IFEND} + +{$IF LIBAVCODEC_VERSION < 52004000} // < 52.4.0 function avcodec_default_execute(s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; var ret: cint; count: cint): cint; cdecl; external av__codec; +{$ELSE} +function avcodec_default_execute(s: PAVCodecContext; func: TExecuteFunc; arg: Pointer; var ret: cint; count: cint; size: cint): cint; + cdecl; external av__codec; +{$IFEND} //FIXME func typedef (** @@ -2893,7 +3054,7 @@ function avcodec_open(avctx: PAVCodecContext; codec: PAVCodec): cint; *) function avcodec_decode_audio(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; - buf: {const} pchar; buf_size: cint): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; {$IFEND} @@ -2926,6 +3087,9 @@ function avcodec_decode_audio(avctx: PAVCodecContext; samples: PSmallint; * the linesize is not a multiple of 16 then there's no sense in aligning the * start of the buffer to 16. * + * @note Some codecs have a delay between input and output, these need to be + * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames. + * * @param avctx the codec context * @param[out] samples the output buffer * @param[in,out] frame_size_ptr the output buffer size in bytes @@ -2936,7 +3100,7 @@ function avcodec_decode_audio(avctx: PAVCodecContext; samples: PSmallint; *) function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; - buf: {const} pchar; buf_size: cint): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; {$IFEND} @@ -2973,7 +3137,7 @@ function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; *) function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; var got_picture_ptr: cint; - buf: {const} PChar; buf_size: cint): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; (* Decode a subtitle message. Return -1 if error, otherwise return the @@ -2981,11 +3145,11 @@ function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) function avcodec_decode_subtitle(avctx: PAVCodecContext; sub: PAVSubtitle; var got_sub_ptr: cint; - buf: {const} pchar; buf_size: cint): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; function avcodec_parse_frame(avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: PCint; - buf: pchar; buf_size: cint): cint; + buf: PByteArray; buf_size: cint): cint; cdecl; external av__codec; (** @@ -3025,18 +3189,28 @@ function avcodec_encode_audio(avctx: PAVCodecContext; buf: PByte; * @param[in] buf_size the size of the output buffer in bytes * @param[in] pict the input picture to encode * @return On error a negative value is returned, on success zero or the number - * of bytes used from the input buffer. + * of bytes used from the output buffer. *) function avcodec_encode_video(avctx: PAVCodecContext; buf: PByte; buf_size: cint; pict: PAVFrame): cint; cdecl; external av__codec; -function avcodec_encode_subtitle(avctx: PAVCodecContext; buf: pchar; +function avcodec_encode_subtitle(avctx: PAVCodecContext; buf: PByteArray; buf_size: cint; sub: {const} PAVSubtitle): cint; cdecl; external av__codec; function avcodec_close(avctx: PAVCodecContext): cint; cdecl; external av__codec; +(** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see register_avcodec + * @see av_register_codec_parser + * @see av_register_bitstream_filter + *) procedure avcodec_register_all(); cdecl; external av__codec; @@ -3057,7 +3231,7 @@ procedure avcodec_default_free_buffers(s: PAVCodecContext); * @param[in] pict_type the picture type * @return A single character representing the picture type. *) -function av_get_pict_type_char(pict_type: cint): char; +function av_get_pict_type_char(pict_type: cint): AnsiChar; cdecl; external av__codec; (** @@ -3127,9 +3301,9 @@ type parser_init: function(s: PAVCodecParserContext): cint; cdecl; parser_parse: function(s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: {const} PPointer; poutbuf_size: PCint; - buf: {const} pchar; buf_size: cint): cint; cdecl; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; parser_close: procedure(s: PAVCodecParserContext); cdecl; - split: function(avctx: PAVCodecContext; buf: {const} pchar; + split: function(avctx: PAVCodecContext; buf: {const} PByteArray; buf_size: cint): cint; cdecl; next: PAVCodecParser; end; @@ -3156,13 +3330,13 @@ function av_parser_init(codec_id: cint): PAVCodecParserContext; function av_parser_parse(s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: PCint; - buf: {const} pchar; buf_size: cint; + buf: {const} PByteArray; buf_size: cint; pts: cint64; dts: cint64): cint; cdecl; external av__codec; function av_parser_change(s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: PCint; - buf: {const} pchar; buf_size: cint; keyframe: cint): cint; + buf: {const} PByteArray; buf_size: cint; keyframe: cint): cint; cdecl; external av__codec; procedure av_parser_close(s: PAVCodecParserContext); cdecl; external av__codec; @@ -3179,10 +3353,10 @@ type end; TAVBitStreamFilter = record - name: pchar; + name: PAnsiChar; priv_data_size: cint; filter: function(bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; + avctx: PAVCodecContext; args: PByteArray; poutbuf: PPointer; poutbuf_size: PCint; buf: PByte; buf_size: cint; keyframe: cint): cint; cdecl; {$IF LIBAVCODEC_VERSION >= 51043000} // 51.43.0 @@ -3194,11 +3368,11 @@ type procedure av_register_bitstream_filter(bsf: PAVBitStreamFilter); cdecl; external av__codec; -function av_bitstream_filter_init(name: pchar): PAVBitStreamFilterContext; +function av_bitstream_filter_init(name: PAnsiChar): PAVBitStreamFilterContext; cdecl; external av__codec; function av_bitstream_filter_filter(bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; + avctx: PAVCodecContext; args: PByteArray; poutbuf: PPointer; poutbuf_size: PCint; buf: PByte; buf_size: cint; keyframe: cint): cint; cdecl; external av__codec; @@ -3317,7 +3491,7 @@ function av_xiphlacing(s: PByte; v: cuint): cuint; * @param[in,out] height_ptr pointer to the variable which will contain the detected * frame height value *) -function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {const} PChar): cint; +function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {const} PAnsiChar): cint; cdecl; external av__codec; (** @@ -3329,22 +3503,7 @@ function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {co * @param[in,out] frame_rate pointer to the AVRational which will contain the detected * frame rate *) -function av_parse_video_frame_rate(frame_rate: PAVRational; str: {const} PChar): cint; - cdecl; external av__codec; -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 51064000} // 51.64.0 -(** - * Logs a generic warning message about a missing feature. - * @param[in] avc a pointer to an arbitrary struct of which the first field is - * a pointer to an AVClass struct - * @param[in] feature string containing the name of the missing feature - * @param[in] want_sample indicates if samples are wanted which exhibit this feature. - * If \p want_sample is non-zero, additional verbage will be added to the log - * message which tells the user how to report samples to the development - * mailing list. - *) -procedure av_log_missing_feature(avc: Pointer; feature: {const} PChar; want_sample: cint); +function av_parse_video_frame_rate(frame_rate: PAVRational; str: {const} PAnsiChar): cint; cdecl; external av__codec; {$IFEND} diff --git a/src/lib/ffmpeg/avformat.pas b/src/lib/ffmpeg/avformat.pas index c516aea0..62df8a83 100644 --- a/src/lib/ffmpeg/avformat.pas +++ b/src/lib/ffmpeg/avformat.pas @@ -27,7 +27,7 @@ (* * Conversion of libavformat/avformat.h * Min. version: 50.5.0 , revision 6577, Sat Oct 7 15:30:46 2006 UTC - * Max. version: 52.22.1, revision 15441, Sat Sep 27 20:05:12 2008 UTC + * Max. version: 52.25.0, revision 16986, Wed Feb 4 05:56:39 2009 UTC *) unit avformat; @@ -54,13 +54,14 @@ uses avutil, avio, rational, + SysUtils, UConfig; const (* Max. supported version by this header *) LIBAVFORMAT_MAX_VERSION_MAJOR = 52; - LIBAVFORMAT_MAX_VERSION_MINOR = 22; - LIBAVFORMAT_MAX_VERSION_RELEASE = 1; + LIBAVFORMAT_MAX_VERSION_MINOR = 25; + LIBAVFORMAT_MAX_VERSION_RELEASE = 0; LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) + (LIBAVFORMAT_MAX_VERSION_RELEASE * VERSION_RELEASE); @@ -95,6 +96,68 @@ function avformat_version(): cuint; type PAVFile = Pointer; +(* + * Public Metadata API. + * !!WARNING!! This is a work in progress. Don't use outside FFmpeg for now. + * The metadata API allows libavformat to export metadata tags to a client + * application using a sequence of key/value pairs. + * Important concepts to keep in mind: + * 1. Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * 2. Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * 3. A tag whose value is localized for a particular language is appended + * with a dash character ('-') and the ISO 639 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + *) +const + AV_METADATA_MATCH_CASE = 1; + AV_METADATA_IGNORE_SUFFIX = 2; + +type + PAVMetadataTag = ^TAVMetadataTag; + TAVMetadataTag = record + key: PAnsiChar; + value: PAnsiChar; + end; + + PAVMetadata = Pointer; + +{$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1 + +(** + * gets a metadata element with matching key. + * @param prev set to the previous matching element to find the next. + * @param flags allows case as well as suffix insensitive comparisons. + * @return found tag or NULL, changing key or value leads to undefined behavior. + *) +function av_metadata_get(m: PAVMetadata; key: {const} PAnsiChar; + prev: {const} PAVMetadataTag ; flags: cint): PAVMetadataTag; + cdecl; external av__format; + +(** + * sets the given tag in m, overwriting an existing tag. + * @param key tag key to add to m (will be av_strduped). + * @param value tag value to add to m (will be av_strduped). + * @return >= 0 if success otherwise error code that is <0. + *) +function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint; + cdecl; external av__format; + +(** + * Free all the memory allocated for an AVMetadata struct. + *) +procedure av_metadata_free(var m: PAVMetadata); + cdecl; external av__format; + +{$IFEND} + (* packet functions *) type @@ -117,7 +180,7 @@ type * Can be AV_NOPTS_VALUE if it is not stored in the file. *) dts: cint64; - data: PChar; + data: PByteArray; size: cint; stream_index: cint; flags: cint; @@ -126,7 +189,7 @@ type * Equals next_pts - this_pts in presentation order. *) duration: cint; - destruct: procedure (p: PAVPacket); cdecl; + destruct: procedure (p: PAVPacket); cdecl; priv: pointer; pos: cint64; ///< byte position in stream, -1 if unknown @@ -220,7 +283,7 @@ type PAVFrac = ^TAVFrac; TAVFrac = record val, num, den: cint64; - end; {deprecated} + end; (*************************************************) (* input/output formats *) @@ -228,8 +291,8 @@ type type (** This structure contains the data a format has to probe a file. *) TAVProbeData = record - filename: pchar; - buf: pchar; + filename: PAnsiChar; + buf: PByteArray; buf_size: cint; end; @@ -309,7 +372,10 @@ type id: cint; ///< unique ID to identify the chapter time_base: TAVRational; ///< time base in which the start/end timestamps are specified start, end_: cint64; ///< chapter start/end time in time_base units - title: PChar; ///< chapter title + title: PAnsiChar; ///< chapter title + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 + metadata: PAVMetadata; + {$IFEND} end; TAVChapterArray = array[0..(MaxInt div SizeOf(TAVChapter))-1] of TAVChapter; PAVChapterArray = ^TAVChapterArray; @@ -326,9 +392,9 @@ type {$IFEND} channel: cint; (**< Used to select DV channel. *) {$IF LIBAVFORMAT_VERSION_MAJOR < 52} - device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) + device: PAnsiChar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) {$IFEND} - standard: pchar; (**< TV standard, NTSC, PAL, SECAM *) + standard: PAnsiChar; (**< TV standard, NTSC, PAL, SECAM *) { Delphi does not support bit fields -> use bf_flags instead unsigned int mpeg2ts_raw:1; (**< Force raw MPEG-2 transport stream output, if possible. *) unsigned int mpeg2ts_compute_pcr:1; (**< Compute exact PCR for each transport @@ -346,15 +412,15 @@ type end; TAVOutputFormat = record - name: pchar; + name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) - long_name: pchar; - mime_type: pchar; - extensions: pchar; (**< comma-separated filename extensions *) + long_name: PAnsiChar; + mime_type: PAnsiChar; + extensions: PAnsiChar; (**< comma-separated filename extensions *) (** Size of private data so that it can be allocated in the wrapper. *) priv_data_size: cint; (* output support *) @@ -387,13 +453,13 @@ type end; TAVInputFormat = record - name: pchar; + name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) - long_name: pchar; + long_name: PAnsiChar; (** Size of private data so that it can be allocated in the wrapper. *) priv_data_size: cint; (** @@ -435,7 +501,7 @@ type (** If extensions are defined, then no probe is done. You should usually not use extension format guessing because it is not reliable enough *) - extensions: pchar; + extensions: PAnsiChar; (** General purpose read-only value that the format can use. *) value: cint; @@ -533,7 +599,7 @@ type *) duration: cint64; - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) + language: array [0..3] of PAnsiChar; (* ISO 639 3-letter language code (empty string if undefined) *) (* av_read_frame() support *) need_parsing: TAVStreamParseType; @@ -555,7 +621,7 @@ type {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0 - filename: PChar; (**< source filename of the stream *) + filename: PAnsiChar; (**< source filename of the stream *) {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52008000} // 52.8.0 @@ -576,6 +642,17 @@ type *) sample_aspect_ratio: TAVRational; {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 + metadata: PAVMetadata; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1 + {* av_read_frame() support *} + cur_ptr: {const} PCuint8; + cur_len: cint; + cur_pkt: TAVPacket; + {$IFEND} end; (** @@ -600,17 +677,17 @@ type nb_streams: cuint; streams: array [0..MAX_STREAMS - 1] of PAVStream; - filename: array [0..1023] of char; (* input or output filename *) + filename: array [0..1023] of AnsiChar; (* input or output filename *) (* stream info *) timestamp: cint64; - title: array [0..511] of char; - author: array [0..511] of char; - copyright: array [0..511] of char; - comment: array [0..511] of char; - album: array [0..511] of char; + title: array [0..511] of AnsiChar; + author: array [0..511] of AnsiChar; + copyright: array [0..511] of AnsiChar; + comment: array [0..511] of AnsiChar; + album: array [0..511] of AnsiChar; year: cint; (**< ID3 year, 0 if none *) track: cint; (**< track number, 0 if none *) - genre: array [0..31] of char; (**< ID3 genre *) + genre: array [0..31] of AnsiChar; (**< ID3 genre *) ctx_flags: cint; (**< Format-specific flags, see AVFMTCTX_xx *) (* private data for pts handling (do not modify directly). *) @@ -636,9 +713,11 @@ type (* av_read_frame() support *) cur_st: PAVStream; - cur_ptr: pbyte; - cur_len: cint; - cur_pkt: TAVPacket; + {$IF LIBAVFORMAT_VERSION_MAJOR < 53} + cur_ptr_deprecated: pbyte; + cur_len_deprecated: cint; + cur_pkt_deprecated: TAVPacket; + {$IFEND} (* av_seek_frame() support *) data_offset: cint64; (* offset of the first packet *) @@ -740,6 +819,10 @@ type packet_buffer_end: PAVPacketList; {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 + metadata: PAVMetadata; + {$IFEND} end; (** @@ -750,14 +833,17 @@ type *) TAVProgram = record id : cint; - provider_name : PChar; ///< network name for DVB streams - name : PChar; ///< service name for DVB streams + provider_name : PAnsiChar; ///< network name for DVB streams + name : PAnsiChar; ///< service name for DVB streams flags : cint; discard : TAVDiscard; ///< selects which program to discard and which to feed to the caller {$IF LIBAVFORMAT_VERSION >= 51016000} // 51.16.0 stream_index : PCardinal; nb_stream_indexes : PCardinal; {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 + metadata: PAVMetadata; + {$IFEND} end; TAVPacketList = record @@ -779,8 +865,8 @@ type end; {deprecated} TAVImageFormat = record - name: pchar; - extensions: pchar; + name: PAnsiChar; + extensions: PAnsiChar; (* tell if a given file has a chance of being parsing by this format *) img_probe: function (d: PAVProbeData): cint; cdecl; (* read a whole image. 'alloc_cb' is called when the image size is @@ -801,10 +887,10 @@ procedure av_register_image_format(img_fmt: PAVImageFormat); function av_probe_image_format(pd: PAVProbeData): PAVImageFormat; cdecl; external av__format; deprecated; -function guess_image_format(filename: pchar): PAVImageFormat; +function guess_image_format(filename: PAnsiChar): PAVImageFormat; cdecl; external av__format; deprecated; -function av_read_image(pb: PByteIOContext; filename: pchar; +function av_read_image(pb: PByteIOContext; filename: PAnsiChar; fmt: PAVImageFormat; alloc_cb: pointer; opaque: pointer): cint; cdecl; external av__format; deprecated; @@ -828,7 +914,7 @@ function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; cdecl; external av__format; {$IFEND} -function av_guess_image2_codec(filename: {const} PChar): TCodecID; +function av_guess_image2_codec(filename: {const} PAnsiChar): TCodecID; cdecl; external av__format; (* XXX: use automatic init with either ELF sections or C file parser *) @@ -841,21 +927,21 @@ procedure av_register_input_format(format: PAVInputFormat); procedure av_register_output_format(format: PAVOutputFormat); cdecl; external av__format; -function guess_stream_format(short_name: pchar; - filename: pchar; - mime_type: pchar): PAVOutputFormat; +function guess_stream_format(short_name: PAnsiChar; + filename: PAnsiChar; + mime_type: PAnsiChar): PAVOutputFormat; cdecl; external av__format; -function guess_format(short_name: pchar; - filename: pchar; - mime_type: pchar): PAVOutputFormat; +function guess_format(short_name: PAnsiChar; + filename: PAnsiChar; + mime_type: PAnsiChar): PAVOutputFormat; cdecl; external av__format; (** * Guesses the codec ID based upon muxer and filename. *) -function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; +function av_guess_codec(fmt: PAVOutputFormat; short_name: PAnsiChar; + filename: PAnsiChar; mime_type: PAnsiChar; type_: TCodecType): TCodecID; cdecl; external av__format; @@ -868,7 +954,7 @@ function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; * * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log *) -procedure av_hex_dump(f: PAVFile; buf: pchar; size: cint); +procedure av_hex_dump(f: PAVFile; buf: PByteArray; size: cint); cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0 @@ -884,7 +970,7 @@ procedure av_hex_dump(f: PAVFile; buf: pchar; size: cint); * * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log *) -procedure av_hex_dump_log(avcl: Pointer; level: cint; buf: PChar; size: cint); +procedure av_hex_dump_log(avcl: Pointer; level: cint; buf: PByteArray; size: cint); cdecl; external av__format; {$IFEND} @@ -913,6 +999,15 @@ procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_paylo cdecl; external av__format; {$IFEND} +(** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see register_protocol() + *) procedure av_register_all(); cdecl; external av__format; @@ -929,7 +1024,7 @@ function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cuint; (** * Finds AVInputFormat based on the short name of the input format. *) -function av_find_input_format(short_name: pchar): PAVInputFormat; +function av_find_input_format(short_name: PAnsiChar): PAVInputFormat; cdecl; external av__format; (** @@ -946,7 +1041,7 @@ function av_probe_input_format(pd: PAVProbeData; is_opened: cint): PAVInputForma * This does not open the needed codecs for decoding the stream[s]. *) function av_open_input_stream(ic_ptr: PAVFormatContext; - pb: PByteIOContext; filename: pchar; + pb: PByteIOContext; filename: PAnsiChar; fmt: PAVInputFormat; ap: PAVFormatParameters): cint; cdecl; external av__format; @@ -962,7 +1057,7 @@ function av_open_input_stream(ic_ptr: PAVFormatContext; * (NULL if default). * @return 0 if OK, AVERROR_xxx otherwise *) -function av_open_input_file(var ic_ptr: PAVFormatContext; filename: pchar; +function av_open_input_file(var ic_ptr: PAVFormatContext; filename: PAnsiChar; fmt: PAVInputFormat; buf_size: cint; ap: PAVFormatParameters): cint; cdecl; external av__format; @@ -1105,7 +1200,7 @@ function av_new_program(s: PAVFormatContext; id: cint): PAVProgram; * @return AVChapter or NULL on error *) function ff_new_chapter(s: PAVFormatContext; id: cint; time_base: TAVRational; - start, end_: cint64; title: {const} Pchar): PAVChapter; + start, end_: cint64; title: {const} PAnsiChar): PAVChapter; cdecl; external av__format; {$IFEND} @@ -1287,7 +1382,7 @@ function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; function av_write_trailer(s: pAVFormatContext): cint; cdecl; external av__format; -procedure dump_format(ic: PAVFormatContext; index: cint; url: pchar; +procedure dump_format(ic: PAVFormatContext; index: cint; url: PAnsiChar; is_output: cint); cdecl; external av__format; @@ -1296,16 +1391,18 @@ procedure dump_format(ic: PAVFormatContext; index: cint; url: pchar; * @deprecated Use av_parse_video_frame_size instead. *) function parse_image_size(width_ptr: PCint; height_ptr: PCint; - str: pchar): cint; + str: PAnsiChar): cint; cdecl; external av__format; deprecated; +{$IF LIBAVFORMAT_VERSION_MAJOR < 53} (** * Converts frame rate from string to a fraction. * @deprecated Use av_parse_video_frame_rate instead. *) function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; - arg: pchar): cint; + arg: PByteArray): cint; cdecl; external av__format; deprecated; +{$IFEND} (** * Parses \p datestr and returns a corresponding number of microseconds. @@ -1333,7 +1430,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; * not zero \p datestr is interpreted as a duration, otherwise as a * date. *) -function parse_date(datestr: pchar; duration: cint): cint64; +function parse_date(datestr: PAnsiChar; duration: cint): cint64; cdecl; external av__format; (** Gets the current time in microseconds. *) @@ -1359,7 +1456,7 @@ procedure ffm_set_write_index(s: PAVFormatContext; pos: cint64; file_size: cint6 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. * Return 1 if found. *) -function find_info_tag(arg: pchar; arg_size: cint; tag1: pchar; info: pchar): cint; +function find_info_tag(arg: PAnsiChar; arg_size: cint; tag1: PAnsiChar; info: PAnsiChar): cint; cdecl; external av__format; (** @@ -1374,8 +1471,8 @@ function find_info_tag(arg: pchar; arg_size: cint; tag1: pchar; info: pchar): ci * @param number frame number * @return 0 if OK, -1 on format error *) -function av_get_frame_filename(buf: pchar; buf_size: cint; - path: pchar; number: cint): cint; +function av_get_frame_filename(buf: PAnsiChar; buf_size: cint; + path: PAnsiChar; number: cint): cint; cdecl; external av__format {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 name 'get_frame_filename' @@ -1387,7 +1484,7 @@ function av_get_frame_filename(buf: pchar; buf_size: cint; * @param filename possible numbered sequence string * @return 1 if a valid numbered sequence string, 0 otherwise *) -function av_filename_number_test(filename: pchar): cint; +function av_filename_number_test(filename: PAnsiChar): cint; cdecl; external av__format {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 name 'filename_number_test' @@ -1408,7 +1505,7 @@ function av_filename_number_test(filename: pchar): cint; * @param size the size of the buffer * @return 0 if OK, AVERROR_xxx on error *) -function avf_sdp_create(ac: PPAVFormatContext; n_files: cint; buff: PChar; size: cint): cint; +function avf_sdp_create(ac: PPAVFormatContext; n_files: cint; buff: PByteArray; size: cint): cint; cdecl; external av__format; {$IFEND} diff --git a/src/lib/ffmpeg/avio.pas b/src/lib/ffmpeg/avio.pas index 5107a9fb..33778206 100644 --- a/src/lib/ffmpeg/avio.pas +++ b/src/lib/ffmpeg/avio.pas @@ -27,7 +27,7 @@ (* * Conversion of libavformat/avio.h - * revision 15120, Sun Aug 31 07:39:47 2008 UTC + * revision 16100, Sat Dec 13 13:39:13 2008 UTC *) unit avio; @@ -48,13 +48,9 @@ uses ctypes, avutil, avcodec, + SysUtils, UConfig; -(* output byte stream handling *) - -type - TOffset = cint64; - (* unbuffered I/O *) const @@ -92,7 +88,7 @@ type is_streamed: cint; (**< true if streamed (no seek possible), default = false *) max_packet_size: cint; (**< if non zero, the stream is packetized with this max packet size *) priv_data: pointer; - filename: PChar; (**< specified filename *) + filename: PAnsiChar; (**< specified filename *) end; PPURLContext = ^PURLContext; @@ -104,11 +100,11 @@ type end; TURLProtocol = record - name: PChar; - url_open: function (h: PURLContext; filename: {const} PChar; flags: cint): cint; cdecl; - url_read: function (h: PURLContext; buf: PChar; size: cint): cint; cdecl; - url_write: function (h: PURLContext; buf: PChar; size: cint): cint; cdecl; - url_seek: function (h: PURLContext; pos: TOffset; whence: cint): TOffset; cdecl; + name: PAnsiChar; + url_open: function (h: PURLContext; filename: {const} PAnsiChar; flags: cint): cint; cdecl; + url_read: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; + url_write: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; + url_seek: function (h: PURLContext; pos: cint64; whence: cint): cint64; cdecl; url_close: function (h: PURLContext): cint; cdecl; next: PURLProtocol; {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0 @@ -119,8 +115,8 @@ type url_read_pause: function (h: PURLContext; pause: cint): cint; cdecl; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 - url_read_seek: function (h: PURLContext; - stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; + url_read_seek: function (h: PURLContext; stream_index: cint; + timestamp: cint64; flags: cint): cint64; cdecl; {$IFEND} end; @@ -133,23 +129,23 @@ type *) PByteIOContext = ^TByteIOContext; TByteIOContext = record - buffer: PChar; + buffer: PByteArray; buffer_size: cint; - buf_ptr: PChar; - buf_end: PChar; + buf_ptr: PByteArray; + buf_end: PByteArray; opaque: pointer; - read_packet: function (opaque: pointer; buf: PChar; buf_size: cint): cint; cdecl; - write_packet: function (opaque: pointer; buf: PChar; buf_size: cint): cint; cdecl; - seek: function (opaque: pointer; offset: TOffset; whence: cint): TOffset; cdecl; - pos: TOffset; (* position in the file of the current buffer *) + read_packet: function (opaque: pointer; buf: PByteArray; buf_size: cint): cint; cdecl; + write_packet: function (opaque: pointer; buf: PByteArray; buf_size: cint): cint; cdecl; + seek: function (opaque: pointer; offset: cint64; whence: cint): cint64; cdecl; + pos: cint64; (* position in the file of the current buffer *) must_flush: cint; (* true if the next seek should flush *) eof_reached: cint; (* true if eof reached *) write_flag: cint; (* true if open for writing *) is_streamed: cint; max_packet_size: cint; checksum: culong; - checksum_ptr: PCuchar; - update_checksum: function (checksum: culong; buf: {const} PChar; size: cuint): culong; cdecl; + checksum_ptr: PByteArray; + update_checksum: function (checksum: culong; buf: {const} PByteArray; size: cuint): culong; cdecl; error: cint; ///< contains the error code or 0 if no error happened {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0 read_play: function(opaque: Pointer): cint; cdecl; @@ -159,30 +155,30 @@ type read_pause: function(opaque: Pointer; pause: cint): cint; cdecl; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 - read_seek: function(opaque: Pointer; - stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; + read_seek: function(opaque: Pointer; stream_index: cint; + timestamp: cint64; flags: cint): cint64; cdecl; {$IFEND} end; {$IF LIBAVFORMAT_VERSION >= 52021000} // 52.21.0 function url_open_protocol(puc: PPURLContext; up: PURLProtocol; - filename: {const} PChar; flags: cint): cint; + filename: {const} PAnsiChar; flags: cint): cint; cdecl; external av__format; {$IFEND} -function url_open(h: PPointer; filename: {const} PChar; flags: cint): cint; +function url_open(h: PPointer; filename: {const} PAnsiChar; flags: cint): cint; cdecl; external av__format; -function url_read (h: PURLContext; buf: PChar; size: cint): cint; +function url_read (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; -function url_write (h: PURLContext; buf: PChar; size: cint): cint; +function url_write (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; -function url_seek (h: PURLContext; pos: TOffset; whence: cint): TOffset; +function url_seek (h: PURLContext; pos: cint64; whence: cint): cint64; cdecl; external av__format; function url_close (h: PURLContext): cint; cdecl; external av__format; -function url_exist(filename: {const} PChar): cint; +function url_exist(filename: {const} PAnsiChar): cint; cdecl; external av__format; -function url_filesize (h: PURLContext): TOffset; +function url_filesize (h: PURLContext): cint64; cdecl; external av__format; (** @@ -195,7 +191,7 @@ function url_filesize (h: PURLContext): TOffset; *) function url_get_max_packet_size(h: PURLContext): cint; cdecl; external av__format; -procedure url_get_filename(h: PURLContext; buf: PChar; buf_size: cint); +procedure url_get_filename(h: PURLContext; buf: PAnsiChar; buf_size: cint); cdecl; external av__format; (** @@ -239,8 +235,8 @@ function av_url_read_pause(h: PURLContext; pause: cint): cint; * @return >= 0 on success * @see AVInputFormat::read_seek *) -function av_url_read_seek(h: PURLContext; - stream_index: cint; timestamp: cint64; flags: cint): TOffset; +function av_url_read_seek(h: PURLContext; stream_index: cint; + timestamp: cint64; flags: cint): cint64; cdecl; external av__format; {$IFEND} @@ -259,11 +255,11 @@ function register_protocol (protocol: PURLProtocol): cint; cdecl; external av__format; type - TReadWriteFunc = function (opaque: Pointer; buf: PChar; buf_size: cint): cint; cdecl; - TSeekFunc = function (opaque: Pointer; offset: TOffset; whence: cint): TOffset; cdecl; + TReadWriteFunc = function (opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl; + TSeekFunc = function (opaque: Pointer; offset: cint64; whence: cint): cint64; cdecl; function init_put_byte(s: PByteIOContext; - buffer: PChar; + buffer: PByteArray; buffer_size: cint; write_flag: cint; opaque: pointer; read_packet: TReadWriteFunc; @@ -272,7 +268,7 @@ function init_put_byte(s: PByteIOContext; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 function av_alloc_put_byte( - buffer: PChar; + buffer: PByteArray; buffer_size: cint; write_flag: cint; opaque: Pointer; @@ -284,7 +280,7 @@ function av_alloc_put_byte( procedure put_byte(s: PByteIOContext; b: cint); cdecl; external av__format; -procedure put_buffer (s: PByteIOContext; buf: {const} PChar; size: cint); +procedure put_buffer (s: PByteIOContext; buf: {const} PByteArray; size: cint); cdecl; external av__format; procedure put_le64(s: PByteIOContext; val: cuint64); cdecl; external av__format; @@ -302,38 +298,38 @@ procedure put_le16(s: PByteIOContext; val: cuint); cdecl; external av__format; procedure put_be16(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_tag(s: PByteIOContext; tag: {const} PChar); +procedure put_tag(s: PByteIOContext; tag: {const} PAnsiChar); cdecl; external av__format; -procedure put_strz(s: PByteIOContext; buf: {const} PChar); +procedure put_strz(s: PByteIOContext; buf: {const} PAnsiChar); cdecl; external av__format; (** * fseek() equivalent for ByteIOContext. * @return new position or AVERROR. *) -function url_fseek(s: PByteIOContext; offset: TOffset; whence: cint): TOffset; +function url_fseek(s: PByteIOContext; offset: cint64; whence: cint): cint64; cdecl; external av__format; (** * Skip given number of bytes forward. * @param offset number of bytes *) -procedure url_fskip(s: PByteIOContext; offset: TOffset); +procedure url_fskip(s: PByteIOContext; offset: cint64); cdecl; external av__format; (** * ftell() equivalent for ByteIOContext. * @return position or AVERROR. *) -function url_ftell(s: PByteIOContext): TOffset; +function url_ftell(s: PByteIOContext): cint64; cdecl; external av__format; (** * Gets the filesize. * @return filesize or AVERROR *) -function url_fsize(s: PByteIOContext): TOffset; +function url_fsize(s: PByteIOContext): cint64; cdecl; external av__format; (** @@ -351,8 +347,8 @@ function av_url_read_fpause(h: PByteIOContext; pause: cint): cint; cdecl; external av__format; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 -function av_url_read_fseek(h: PByteIOContext; - stream_index: cint; timestamp: cint64; flags: cint): TOffset; +function av_url_read_fseek(h: PByteIOContext; stream_index: cint; + timestamp: cint64; flags: cint): cint64; cdecl; external av__format; {$IFEND} @@ -363,12 +359,12 @@ function url_fgetc(s: PByteIOContext): cint; cdecl; external av__format; (** @warning currently size is limited *) -function url_fprintf(s: PByteIOContext; fmt: {const} PChar; args: array of const): cint; +function url_fprintf(s: PByteIOContext; fmt: {const} PAnsiChar; args: array of const): cint; cdecl; external av__format; (** @note unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF *) -function url_fgets(s: PByteIOContext; buf: PChar; buf_size: cint): PChar; +function url_fgets(s: PByteIOContext; buf: PAnsiChar; buf_size: cint): PAnsiChar; cdecl; external av__format; procedure put_flush_packet (s: PByteIOContext); @@ -379,7 +375,7 @@ procedure put_flush_packet (s: PByteIOContext); * Reads size bytes from ByteIOContext into buf. * @returns number of bytes read or AVERROR *) -function get_buffer(s: PByteIOContext; buf: PChar; size: cint): cint; +function get_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; (** @@ -388,7 +384,7 @@ function get_buffer(s: PByteIOContext; buf: PChar; size: cint): cint; * returned. * @returns number of bytes read or AVERROR *) -function get_partial_buffer(s: PByteIOContext; buf: PChar; size: cint): cint; +function get_partial_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; (** @note return 0 if EOF, so you cannot use it if EOF handling is @@ -404,7 +400,7 @@ function get_le64(s: PByteIOContext): cuint64; function get_le16(s: PByteIOContext): cuint; cdecl; external av__format; -function get_strz(s: PByteIOContext; buf: PChar; maxlen: cint): PChar; +function get_strz(s: PByteIOContext; buf: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; external av__format; function get_be16(s: PByteIOContext): cuint; cdecl; external av__format; @@ -447,9 +443,9 @@ function url_resetbuf(s: PByteIOContext; flags: cint): cint; (** @note when opened as read/write, the buffers are only used for writing *) {$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 -function url_fopen(var s: PByteIOContext; filename: {const} PChar; flags: cint): cint; +function url_fopen(var s: PByteIOContext; filename: {const} PAnsiChar; flags: cint): cint; {$ELSE} -function url_fopen(s: PByteIOContext; filename: {const} PChar; flags: cint): cint; +function url_fopen(s: PByteIOContext; filename: {const} PAnsiChar; flags: cint): cint; {$IFEND} cdecl; external av__format; function url_fclose(s: PByteIOContext): cint; @@ -469,9 +465,9 @@ function url_fget_max_packet_size (s: PByteIOContext): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 -function url_open_buf(var s: PByteIOContext; buf: PChar; buf_size: cint; flags: cint): cint; +function url_open_buf(var s: PByteIOContext; buf: PAnsiChar; buf_size: cint; flags: cint): cint; {$ELSE} -function url_open_buf(s: PByteIOContext; buf: PChar; buf_size: cint; flags: cint): cint; +function url_open_buf(s: PByteIOContext; buf: PAnsiChar; buf_size: cint; flags: cint): cint; {$IFEND} cdecl; external av__format; @@ -519,16 +515,19 @@ function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 -function ff_crc04C11DB7_update(checksum: culong; buf: {const} PChar; len: cuint): culong; +function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray; + len: cuint): culong; cdecl; external av__format; {$IFEND} function get_checksum(s: PByteIOContext): culong; cdecl; external av__format; -procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: culong); +procedure init_checksum(s: PByteIOContext; + update_checksum: pointer; + checksum: culong); cdecl; external av__format; (* udp.c *) -function udp_set_remote_url(h: PURLContext; uri: {const} PChar): cint; +function udp_set_remote_url(h: PURLContext; uri: {const} PAnsiChar): cint; cdecl; external av__format; function udp_get_local_port(h: PURLContext): cint; cdecl; external av__format; diff --git a/src/lib/ffmpeg/avutil.pas b/src/lib/ffmpeg/avutil.pas index b4fae422..6de35f1b 100644 --- a/src/lib/ffmpeg/avutil.pas +++ b/src/lib/ffmpeg/avutil.pas @@ -29,13 +29,13 @@ * * libavutil/avutil.h: * Min. version: 49.0.1, revision 6577, Sat Oct 7 15:30:46 2006 UTC - * Max. version: 49.11.0, revision 15415, Thu Sep 25 19:23:13 2008 UTC + * Max. version: 49.14.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC * * libavutil/mem.h: - * revision 15120, Sun Aug 31 07:39:47 2008 UTC + * revision 16590, Tue Jan 13 23:44:16 2009 UTC * * libavutil/log.h: - * revision 15120, Sun Aug 31 07:39:47 2008 UTC + * revision 16571, Tue Jan 13 00:14:43 2009 UTC *) unit avutil; @@ -63,7 +63,7 @@ uses const (* Max. supported version by this header *) LIBAVUTIL_MAX_VERSION_MAJOR = 49; - LIBAVUTIL_MAX_VERSION_MINOR = 11; + LIBAVUTIL_MAX_VERSION_MINOR = 14; LIBAVUTIL_MAX_VERSION_RELEASE = 0; LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -98,15 +98,15 @@ type (** * Pixel format. Notes: * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA + * 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. + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. * * 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] and, is 1024 bytes long (256 4-byte entries) and is + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is * also endian-specific). Note also that the individual RGB palette * components stored in AVFrame.data[1] should be in the range 0..255. @@ -117,48 +117,53 @@ type PAVPixelFormat = ^TAVPixelFormat; TAVPixelFormat = ( PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness + PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness + PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 PIX_FMT_GRAY8, ///< Y , 8bpp PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness + PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness + PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 + PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness + PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian - PIX_FMT_YUV440P, ///< Planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) - PIX_FMT_YUVJ440P, ///< Planar YUV 4:4:0 full scale (jpeg) - PIX_FMT_YUVA420P, ///< Planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG) + PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 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 ); @@ -185,7 +190,7 @@ const (* common.h *) -function MKTAG(a,b,c,d: char): integer; +function MKTAG(a,b,c,d: AnsiChar): integer; (* mem.h *) @@ -244,7 +249,7 @@ function av_mallocz(size: cuint): pointer; * @return Pointer to a newly allocated string containing a * copy of \p s or NULL if it cannot be allocated. *) -function av_strdup({const} s: PChar): PChar; +function av_strdup({const} s: PAnsiChar): PAnsiChar; cdecl; external av__util; {av_malloc_attrib} (** @@ -312,7 +317,7 @@ procedure av_log_set_level(level: cint); implementation -function MKTAG(a,b,c,d: char): integer; +function MKTAG(a,b,c,d: AnsiChar): integer; begin Result := (ord(a) or (ord(b) shl 8) or (ord(c) shl 16) or (ord(d) shl 24)); end; diff --git a/src/lib/ffmpeg/mathematics.pas b/src/lib/ffmpeg/mathematics.pas index 606d9189..fb57ccea 100644 --- a/src/lib/ffmpeg/mathematics.pas +++ b/src/lib/ffmpeg/mathematics.pas @@ -26,7 +26,7 @@ (* * Conversion of libavutil/mathematics.h - * revision 15120, Sun Aug 31 07:39:47 2008 UTC + * revision 16844, Wed Jan 28 08:50:10 2009 UTC *) unit mathematics; @@ -55,29 +55,34 @@ const type TAVRounding = ( - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5 ///< round to nearest and halfway cases away from zero + AV_ROUND_ZERO = 0, ///< Round toward zero + AV_ROUND_INF = 1, ///< Round away from zero + AV_ROUND_DOWN = 2, ///< Round toward -infinity + AV_ROUND_UP = 3, ///< Round toward +infinity + AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero ); +{$IF LIBAVUTIL_VERSION >= 49013000} // 49.13.0 +function av_gcd(a: cint64; b: cint64): cint64; + cdecl; external av__util; {av_const} +{$IFEND} + (** - * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow + * Rescales a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. *) function av_rescale (a, b, c: cint64): cint64; cdecl; external av__util; {av_const} (** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow + * Rescales a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. *) function av_rescale_rnd (a, b, c: cint64; enum: TAVRounding): cint64; cdecl; external av__util; {av_const} (** - * rescale a 64bit integer by 2 rational numbers. + * Rescales a 64-bit integer by 2 rational numbers. *) function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; cdecl; external av__util; {av_const} diff --git a/src/lib/ffmpeg/opt.pas b/src/lib/ffmpeg/opt.pas index e734aa9f..833dc247 100644 --- a/src/lib/ffmpeg/opt.pas +++ b/src/lib/ffmpeg/opt.pas @@ -27,7 +27,7 @@ (* * Conversion of libavcodec/opt.h - * revision 15120, Sun Aug 31 07:39:47 2008 UTC + * revision 16912, Sun Feb 1 02:00:19 2009 UTC *) unit opt; @@ -74,13 +74,13 @@ type *) PAVOption = ^TAVOption; TAVOption = record - name: {const} PChar; + name: {const} PAnsiChar; (** * short English help text * @todo What about other languages? *) - help: {const} PChar; + help: {const} PAnsiChar; (** * The offset relative to the context structure where the option @@ -104,7 +104,7 @@ type * options and corresponding named constants share the same * unit. May be NULL. *) - unit_: {const} PChar; + unit_: {const} PAnsiChar; end; {$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 @@ -114,24 +114,39 @@ type * for which it is the case that opt->flags & mask == flags). * * @param[in] obj a pointer to a struct whose first element is a - * pointer to an #AVClass + * pointer to an AVClass * @param[in] name the name of the option to look for * @param[in] unit the unit of the option to look for, or any if NULL * @return a pointer to the option found, or NULL if no option * has been found *) -function av_find_opt(obj: Pointer; {const} name: {const} PChar; {const} unit_: PChar; mask: cint; flags: cint): {const} PAVOption; +function av_find_opt(obj: Pointer; {const} name: {const} PAnsiChar; {const} unit_: PAnsiChar; mask: cint; flags: cint): {const} PAVOption; cdecl; external av__codec; {$IFEND} +{$IF LIBAVCODEC_VERSION_MAJOR < 53} + (** * @see av_set_string2() *) -function av_set_string(obj: pointer; name: {const} pchar; val: {const} pchar): {const} PAVOption; +function av_set_string(obj: pointer; name: {const} PAnsiChar; val: {const} PAnsiChar): {const} PAVOption; cdecl; external av__codec; deprecated; {$IF LIBAVCODEC_VERSION >= 51059000} // 51.59.0 (** + * @return a pointer to the AVOption corresponding to the field set or + * NULL if no matching AVOption exists, or if the value \p val is not + * valid + * @see av_set_string3() + *) +function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint): {const} PAVOption; + cdecl; external av__codec; deprecated; +{$IFEND} + +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52007000} // 52.7.0 +(** * Sets the field of obj with the given name to value. * * @param[in] obj A struct whose first element is a pointer to an @@ -147,36 +162,37 @@ function av_set_string(obj: pointer; name: {const} pchar; val: {const} pchar): { * scalars or named flags separated by '+' or '-'. Prefixing a flag * with '+' causes it to be set without affecting the other flags; * similarly, '-' unsets a flag. - * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value \p val is not - * valid + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found * @param alloc when 1 then the old value will be av_freed() and the * new av_strduped() * when 0 then no av_free() nor av_strdup() will be used + * @return 0 if the value has been set, an AVERROR* error code if no + * matching option exists, or if the value \p val is not valid *) -function av_set_string2(obj: Pointer; name: {const} PChar; val: {const} PChar; alloc: cint): {const} PAVOption; +function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; cdecl; external av__codec; {$IFEND} -function av_set_double(obj: pointer; name: {const} pchar; n: cdouble): PAVOption; +function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption; cdecl; external av__codec; -function av_set_q(obj: pointer; name: {const} pchar; n: TAVRational): PAVOption; +function av_set_q(obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption; cdecl; external av__codec; -function av_set_int(obj: pointer; name: {const} pchar; n: cint64): PAVOption; +function av_set_int(obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption; cdecl; external av__codec; -function av_get_double(obj: pointer; name: {const} pchar; var o_out: PAVOption): cdouble; +function av_get_double(obj: pointer; name: {const} PAnsiChar; var o_out: PAVOption): cdouble; cdecl; external av__codec; -function av_get_q(obj: pointer; name: {const} pchar; var o_out: PAVOption): TAVRational; +function av_get_q(obj: pointer; name: {const} PAnsiChar; var o_out: PAVOption): TAVRational; cdecl; external av__codec; -function av_get_int(obj: pointer; name: {const} pchar; var o_out: {const} PAVOption): cint64; +function av_get_int(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cint64; cdecl; external av__codec; -function av_get_string(obj: pointer; name: {const} pchar; var o_out: {const} PAVOption; buf: pchar; buf_len: cint): pchar; +function av_get_string(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar; cdecl; external av__codec; function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption; diff --git a/src/lib/ffmpeg/rational.pas b/src/lib/ffmpeg/rational.pas index 02d594ff..6762aa26 100644 --- a/src/lib/ffmpeg/rational.pas +++ b/src/lib/ffmpeg/rational.pas @@ -1,5 +1,5 @@ (* - * Rational numbers + * rational numbers * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * * This library is free software; you can redistribute it and/or @@ -27,7 +27,7 @@ (* * Conversion of libavutil/rational.h - * revision 15415, Thu Sep 25 19:23:13 2008 UTC + * revision 16912, Sun Feb 1 02:00:19 2009 UTC *) unit rational; @@ -49,9 +49,9 @@ uses UConfig; type -(* - * Rational number num/den. - *) + (* + * rational number numerator/denominator + *) PAVRational = ^TAVRational; TAVRational = record num: cint; ///< numerator @@ -62,65 +62,65 @@ type PAVRationalArray = ^TAVRationalArray; (** - * Compare two rationals. + * Compares two rationals. * @param a first rational * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if a<b. + * @return 0 if a==b, 1 if a>b and -1 if a<b *) function av_cmp_q(a: TAVRational; b: TAVRational): cint; {$IFDEF HasInline}inline;{$ENDIF} (** - * Rational to double conversion. + * Converts rational to double. * @param a rational to convert * @return (double) a *) function av_q2d(a: TAVRational): cdouble; {$IFDEF HasInline}inline;{$ENDIF} (** - * Reduce a fraction. + * Reduces a fraction. * This is useful for framerate calculations. - * @param dst_nom destination numerator + * @param dst_num destination numerator * @param dst_den destination denominator - * @param nom source numerator + * @param num source numerator * @param den source denominator - * @param max the maximum allowed for dst_nom & dst_den + * @param max the maximum allowed for dst_num & dst_den * @return 1 if exact, 0 otherwise *) -function av_reduce(dst_nom: PCint; dst_den: PCint; nom: cint64; den: cint64; max: cint64): cint; +function av_reduce(dst_num: PCint; dst_den: PCint; num: cint64; den: cint64; max: cint64): cint; cdecl; external av__util; (** * Multiplies two rationals. - * @param b first rational. - * @param c second rational. - * @return b*c. + * @param b first rational + * @param c second rational + * @return b*c *) function av_mul_q(b: TAVRational; c: TAVRational): TAVRational; cdecl; external av__util; {av_const} (** * Divides one rational by another. - * @param b first rational. - * @param c second rational. - * @return b/c. + * @param b first rational + * @param c second rational + * @return b/c *) function av_div_q(b: TAVRational; c: TAVRational): TAVRational; cdecl; external av__util; {av_const} (** * Adds two rationals. - * @param b first rational. - * @param c second rational. - * @return b+c. + * @param b first rational + * @param c second rational + * @return b+c *) function av_add_q(b: TAVRational; c: TAVRational): TAVRational; cdecl; external av__util; {av_const} (** * Subtracts one rational from another. - * @param b first rational. - * @param c second rational. - * @return b-c. + * @param b first rational + * @param c second rational + * @return b-c *) function av_sub_q(b: TAVRational; c: TAVRational): TAVRational; cdecl; external av__util; {av_const} @@ -129,7 +129,7 @@ function av_sub_q(b: TAVRational; c: TAVRational): TAVRational; * Converts a double precision floating point number to a rational. * @param d double to convert * @param max the maximum allowed numerator and denominator - * @return (AVRational) d. + * @return (AVRational) d *) function av_d2q(d: cdouble; max: cint): TAVRational; cdecl; external av__util; {av_const} |