From 38cdf2cd93ee7ff0bf224a9577f995e354ffb147 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 3 Jul 2008 18:47:28 +0000 Subject: ffmpeg pascal header 64bit compatibility fix. Further headers will follow. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1160 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 643 ++++++++++++++++++----------------- Game/Code/lib/ffmpeg/avformat.pas | 363 ++++++++++---------- Game/Code/lib/ffmpeg/avio.pas | 227 +++++++------ Game/Code/lib/ffmpeg/avutil.pas | 23 +- Game/Code/lib/ffmpeg/mathematics.pas | 7 +- Game/Code/lib/ffmpeg/opt.pas | 41 +-- Game/Code/lib/ffmpeg/rational.pas | 21 +- Game/Code/lib/ffmpeg/swscale.pas | 64 ++-- 8 files changed, 690 insertions(+), 699 deletions(-) (limited to 'Game/Code/lib/ffmpeg') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 95f1b1d2..e1e9476a 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -44,6 +44,7 @@ unit avcodec; interface uses + ctypes, avutil, rational, opt, @@ -80,9 +81,9 @@ const {$IFEND} const - AV_NOPTS_VALUE: int64 = $8000000000000000; + AV_NOPTS_VALUE: cint64 = $8000000000000000; AV_TIME_BASE = 1000000; - AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); + AV_TIME_BASE_Q : TAVRational = (num: 1; den: AV_TIME_BASE); (** * Identifies the syntax and semantics of the bitstream. @@ -369,7 +370,7 @@ type CODEC_TYPE_DATA, CODEC_TYPE_SUBTITLE, CODEC_TYPE_ATTACHMENT, - CODEC_TYPE_NB + CODEC_TYPE_NB ); {** @@ -435,10 +436,10 @@ type PRcOverride = ^TRcOverride; TRcOverride = record {16} - start_frame: integer; - end_frame: integer; - qscale: integer; // if this is 0 then quality_factor will be used instead - quality_factor: single; + start_frame: cint; + end_frame: cint; + qscale: cint; // if this is 0 then quality_factor will be used instead + quality_factor: cfloat; end; const @@ -577,13 +578,13 @@ type (*** id. * - encoding: set by user. * - decoding: set by libavcodec. *) - id: integer; + id: cint; (*** width and height in 1/16 pel * - encoding: set by user. * - decoding: set by libavcodec. *) - width: integer; - height: integer; + width: cint; + height: cint; (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. * - encoding: set by user. @@ -634,7 +635,7 @@ type * - decoding: *) data: array [0..3] of pbyte; - linesize: array [0..3] of integer; + linesize: array [0..3] of cint; (** * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. * This isn't used by libavcodec unless the default get/release_buffer() is used. @@ -647,45 +648,45 @@ type * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. *) - key_frame: integer; + key_frame: cint; (** * Picture type of the frame, see ?_TYPE below. * - encoding: Set by libavcodec. for coded_picture (and set by user for input). * - decoding: Set by libavcodec. *) - pict_type: integer; + pict_type: cint; (** * presentation timestamp in time_base units (time when frame should be shown to user) * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. * - encoding: MUST be set by user. * - decoding: Set by libavcodec. *) - pts: int64; + pts: cint64; (**\ * picture number in bitstream order * - encoding: set by * - decoding: Set by libavcodec. *) - coded_picture_number: integer; + coded_picture_number: cint; (** * picture number in display order * - encoding: set by * - decoding: Set by libavcodec. *) - display_picture_number: integer; + display_picture_number: cint; (** * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) * - encoding: Set by libavcodec. for coded_picture (and set by user for input). * - decoding: Set by libavcodec. *) - quality: integer; + quality: cint; (** * buffer age (1->was last buffer and dint change, 2->..., ...). * Set to INT_MAX if the buffer has not been used yet. * - encoding: unused * - decoding: MUST be set by get_buffer(). *) - age: integer; + age: cint; (** * is this picture used as reference * The values for this are the same as the MpegEncContext.picture_structure @@ -693,7 +694,7 @@ type * - encoding: unused * - decoding: Set by libavcodec. (before get_buffer() call)). *) - reference: integer; + reference: cint; (** * QP table * - encoding: unused @@ -705,7 +706,7 @@ type * - encoding: unused * - decoding: Set by libavcodec. *) - qstride: integer; + qstride: cint; (** * mbskip_table[mb]>=1 if MB didn't change * stride= mb_width = (width+15)>>4 @@ -733,7 +734,7 @@ type * - encoding: Set by user. * - decoding: Set by libavcodec. *) - mb_type: PCardinal; + mb_type: PCuint; (** * log2 of the size of the block which a single vector in motion_val represents: * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) @@ -752,37 +753,37 @@ type * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. * - decoding: unused *) - error: array [0..3] of uint64; + error: array [0..3] of cuint64; (** * type of the buffer (to keep track of who has to deallocate data[*]) * - encoding: Set by the one who allocates it. * - decoding: Set by the one who allocates it. * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. *) - type_: integer; + type_: cint; (** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) * - encoding: unused * - decoding: Set by libavcodec. *) - repeat_pict: integer; + repeat_pict: cint; (** * *) - qscale_type: integer; + qscale_type: cint; (** * The content of the picture is interlaced. * - encoding: Set by user. * - decoding: Set by libavcodec. (default 0) *) - interlaced_frame: integer; + interlaced_frame: cint; (** * If the content is interlaced, is top field displayed first. * - encoding: Set by user. * - decoding: Set by libavcodec. *) - top_field_first: integer; + top_field_first: cint; (** * Pan scan. * - encoding: Set by user. @@ -794,13 +795,13 @@ type * - encoding: ??? (no palette-enabled encoder yet) * - decoding: Set by libavcodec. (default 0). *) - palette_has_changed: integer; + palette_has_changed: cint; (** * codec suggestion on buffer type if != 0 * - encoding: unused * - decoding: Set by libavcodec. (before get_buffer() call)). *) - buffer_hints: integer; + buffer_hints: cint; (** * DCT coefficients * - encoding: unused @@ -1005,13 +1006,13 @@ type TAVPaletteControl = record (* demuxer sets this to 1 to indicate the palette has changed; * decoder resets to 0 *) - palette_changed: integer; + palette_changed: cint; (* 4-byte ARGB palette entries, stored in native byte order; note that * the individual palette components should be on a 8-bit scale; if * the palette data comes from a IBM VGA native format, the component * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cardinal; + palette: array [0..AVPALETTE_COUNT - 1] of cuint; end; {deprecated;} type @@ -1022,9 +1023,9 @@ type // int[4] PQuadIntArray = ^TQuadIntArray; - TQuadIntArray = array[0..3] of integer; + TQuadIntArray = array[0..3] of cint; // int (*func)(struct AVCodecContext *c2, void *arg) - TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): integer; cdecl; + TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; TAVClass = record {12} class_name: pchar; @@ -1054,7 +1055,7 @@ type * - encoding: Set by user; unused for constant quantizer encoding. * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. *) - bit_rate: integer; + bit_rate: cint; (** * number of bits the bitstream is allowed to diverge from the reference. @@ -1062,14 +1063,14 @@ type * - encoding: Set by user; unused for constant quantizer encoding. * - decoding: unused *) - bit_rate_tolerance: integer; + bit_rate_tolerance: cint; (** * CODEC_FLAG_*. * - encoding: Set by user. * - decoding: Set by user. *) - flags: integer; + flags: cint; (** * Some codecs need additional format info. It is stored here. @@ -1079,7 +1080,7 @@ type * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. (FIXME: Is this OK?) *) - sub_id: integer; + sub_id: cint; (** * Motion estimation algorithm used for video coding. @@ -1088,7 +1089,7 @@ type * - encoding: MUST be set by user. * - decoding: unused *) - me_method: integer; + me_method: cint; (** * some codecs need / can use extradata like Huffman tables. @@ -1102,7 +1103,7 @@ type * - decoding: Set/allocated/freed by user. *) extradata: pbyte; - extradata_size: integer; + extradata_size: cint; (** * This is the fundamental unit of time (in seconds) in terms @@ -1122,14 +1123,14 @@ type * Note: For compatibility it is possible to set this instead of * coded_width/height before decoding. *) - width, height: integer; + width, height: cint; (** * the number of pictures in a group of pictures, or 0 for intra_only * - encoding: Set by user. * - decoding: unused *) - gop_size: integer; + gop_size: cint; (** * Pixel format, see PIX_FMT_xxx. @@ -1144,7 +1145,7 @@ type * - encoding: Set by user. * - decoding: unused *) - rate_emu: integer; + rate_emu: cint; (** * If non NULL, 'draw_horiz_band' is called by the libavcodec @@ -1160,11 +1161,11 @@ type *) draw_horiz_band: procedure (s: PAVCodecContext; src: {const} PAVFrame; offset: PQuadIntArray; - y: integer; type_: integer; height: integer); cdecl; + y: cint; type_: cint; height: cint); cdecl; (* audio only *) - sample_rate: integer; ///< samples per second - channels: integer; ///< number of audio channels + sample_rate: cint; ///< samples per second + channels: cint; ///< number of audio channels (** * audio sample format @@ -1177,9 +1178,9 @@ type (** * Samples per packet, initialized when calling 'init'. *) - frame_size: integer; - frame_number: integer; ///< audio or video frame number - real_pict_num: integer; ///< returns the real picture number of previous encoded frame + frame_size: cint; + frame_number: cint; ///< audio or video frame number + real_pict_num: cint; ///< returns the real picture number of previous encoded frame (** * Number of frames the decoded output will be delayed relative to @@ -1187,32 +1188,32 @@ type * - encoding: Set by libavcodec. * - decoding: unused *) - delay: integer; + delay: cint; (* - encoding parameters *) - qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) + qcompress: cfloat; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + qblur: cfloat; ///< amount of qscale smoothing over time (0.0-1.0) (** * minimum quantizer * - encoding: Set by user. * - decoding: unused *) - qmin: integer; + qmin: cint; (** * maximum quantizer * - encoding: Set by user. * - decoding: unused *) - qmax: integer; + qmax: cint; (** * maximum quantizer difference between frames * - encoding: Set by user. * - decoding: unused *) - max_qdiff: integer; + max_qdiff: cint; (** * maximum number of B-frames between non-B-frames @@ -1220,19 +1221,19 @@ type * - encoding: Set by user. * - decoding: unused *) - max_b_frames: integer; + max_b_frames: cint; (** * qscale factor between IP and B-frames * - encoding: Set by user. * - decoding: unused *) - b_quant_factor: single; + b_quant_factor: cfloat; (** obsolete FIXME remove *) - rc_strategy: integer; + rc_strategy: cint; - b_frame_strategy: integer; + b_frame_strategy: cint; (** * hurry up amount @@ -1240,7 +1241,7 @@ type * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header * @deprecated Deprecated in favor of skip_idct and skip_frame. *) - hurry_up: integer; + hurry_up: cint; codec: PAVCodec; @@ -1248,10 +1249,10 @@ type {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 (* unused, FIXME remove*) - rtp_mode: integer; + rtp_mode: cint; {$IFEND} - rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) + rtp_payload_size: cint; (* The size of the RTP payload: the coder will *) (* do it's best to deliver a chunk with size *) (* below rtp_payload_size, the chunk will start *) (* with a start code on some codecs like H.263 *) @@ -1266,24 +1267,24 @@ type (* mb_nb contains the number of macroblocks *) (* encoded in the RTP payload *) rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; - size: integer; mb_nb: integer); cdecl; + size: cint; mb_nb: cint); cdecl; (* statistics, used for 2-pass encoding *) - mv_bits: integer; - header_bits: integer; - i_tex_bits: integer; - p_tex_bits: integer; - i_count: integer; - p_count: integer; - skip_count: integer; - misc_bits: integer; + mv_bits: cint; + header_bits: cint; + i_tex_bits: cint; + p_tex_bits: cint; + i_count: cint; + p_count: cint; + skip_count: cint; + misc_bits: cint; (** * number of bits used for the previously encoded frame * - encoding: Set by libavcodec. * - decoding: unused *) - frame_bits: integer; + frame_bits: cint; (** * Private data of the user, can be used to carry app specific stuff. @@ -1309,35 +1310,35 @@ type * - encoding: Set by user, if not then the default based on codec_id will be used. * - decoding: Set by user, will be converted to uppercase by libavcodec during init. *) - codec_tag: cardinal; // можно array [0..3] of char - тогда видно FOURCC + codec_tag: cuint; (** * Work around bugs in encoders which sometimes cannot be detected automatically. * - encoding: Set by user * - decoding: Set by user *) - workaround_bugs: integer; + workaround_bugs: cint; (** * luma single coefficient elimination threshold * - encoding: Set by user. * - decoding: unused *) - luma_elim_threshold: integer; + luma_elim_threshold: cint; (** * chroma single coeff elimination threshold * - encoding: Set by user. * - decoding: unused *) - chroma_elim_threshold: integer; + chroma_elim_threshold: cint; (** * strictly follow the standard (MPEG4, ...). * - encoding: Set by user. * - decoding: unused *) - strict_std_compliance: integer; + strict_std_compliance: cint; (** * qscale offset between IP and B-frames @@ -1346,7 +1347,7 @@ type * - encoding: Set by user. * - decoding: unused *) - b_quant_offset: single; + b_quant_offset: cfloat; (** * Error resilience; higher values will detect more errors but may @@ -1354,7 +1355,7 @@ type * - encoding: unused * - decoding: Set by user. *) - error_resilience: integer; + error_resilience: cint; (** * Called at the beginning of each frame to get a buffer for it. @@ -1364,7 +1365,7 @@ type * - encoding: unused * - decoding: Set by libavcodec., user can override. *) - get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + get_buffer: function (c: PAVCodecContext; pic: PAVFrame): cint; cdecl; (** * Called to release buffers which were allocated with get_buffer. @@ -1380,15 +1381,15 @@ type * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. *) - has_b_frames: integer; + has_b_frames: cint; (** * number of bytes per packet if constant and known or 0 * Used by some WAV based audio codecs. *) - block_align: integer; + block_align: cint; - parse_only: integer; (* - decoding only: if true, only parsing is done + parse_only: cint; (* - decoding only: if true, only parsing is done (function avcodec_parse_frame()). The frame data is returned. Only MPEG codecs support this now. *) @@ -1397,7 +1398,7 @@ type * - encoding: Set by user. * - decoding: unused *) - mpeg_quant: integer; + mpeg_quant: cint; (** * pass1 encoding statistics output buffer @@ -1420,10 +1421,10 @@ type * - encoding: Set by user. * - decoding: unused *) - rc_qsquish: single; + rc_qsquish: cfloat; - rc_qmod_amp: single; - rc_qmod_freq: integer; + rc_qmod_amp: cfloat; + rc_qmod_freq: cint; (** * ratecontrol override, see RcOverride @@ -1431,7 +1432,7 @@ type * - decoding: unused *) rc_override: PRcOverride; - rc_override_count: integer; + rc_override_count: cint; (** * rate control equation @@ -1445,22 +1446,22 @@ type * - encoding: Set by user. * - decoding: unused *) - rc_max_rate: integer; + rc_max_rate: cint; (** * minimum bitrate * - encoding: Set by user. * - decoding: unused *) - rc_min_rate: integer; + rc_min_rate: cint; (** * decoder bitstream buffer size * - encoding: Set by user. * - decoding: unused *) - rc_buffer_size: integer; - rc_buffer_aggressivity: single; + rc_buffer_size: cint; + rc_buffer_aggressivity: cfloat; (** * qscale factor between P and I-frames @@ -1469,67 +1470,67 @@ type * - encoding: Set by user. * - decoding: unused *) - i_quant_factor: single; + i_quant_factor: cfloat; (** * qscale offset between P and I-frames * - encoding: Set by user. * - decoding: unused *) - i_quant_offset: single; + i_quant_offset: cfloat; (** * initial complexity for pass1 ratecontrol * - encoding: Set by user. * - decoding: unused *) - rc_initial_cplx: single; + rc_initial_cplx: cfloat; (** * DCT algorithm, see FF_DCT_* below * - encoding: Set by user. * - decoding: unused *) - dct_algo: integer; + dct_algo: cint; (** * luminance masking (0-> disabled) * - encoding: Set by user. * - decoding: unused *) - lumi_masking: single; + lumi_masking: cfloat; (** * temporary complexity masking (0-> disabled) * - encoding: Set by user. * - decoding: unused *) - temporal_cplx_masking: single; + temporal_cplx_masking: cfloat; (** * spatial complexity masking (0-> disabled) * - encoding: Set by user. * - decoding: unused *) - spatial_cplx_masking: single; + spatial_cplx_masking: cfloat; (** * p block masking (0-> disabled) * - encoding: Set by user. * - decoding: unused *) - p_masking: single; + p_masking: cfloat; (** * darkness masking (0-> disabled) * - encoding: Set by user. * - decoding: unused *) - dark_masking: single; + dark_masking: cfloat; {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 (* for binary compatibility *) - unused: integer; + unused: cint; {$IFEND} (** @@ -1537,28 +1538,28 @@ type * - encoding: Set by user. * - decoding: Set by user. *) - idct_algo: integer; + idct_algo: cint; (** * slice count * - encoding: Set by libavcodec. * - decoding: Set by user (or 0). *) - slice_count: integer; + slice_count: cint; (** * slice offsets in the frame in bytes * - encoding: Set/allocated by libavcodec. * - decoding: Set/allocated by user (or NULL). *) - slice_offset: Pinteger; + slice_offset: PCint; (** * error concealment flags * - encoding: unused * - decoding: Set by user. *) - error_concealment: integer; + error_concealment: cint; (** * dsp_mask could be add used to disable unwanted CPU features @@ -1568,21 +1569,21 @@ type * (Dangerous: Usable in case of misdetection, improper usage however will * result into program crash.) *) - dsp_mask: cardinal; + dsp_mask: cuint; (** * bits per sample/pixel from the demuxer (needed for huffyuv). * - encoding: Set by libavcodec. * - decoding: Set by user. *) - bits_per_sample: integer; + bits_per_sample: cint; (** * prediction method (needed for huffyuv) * - encoding: Set by user. * - decoding: unused *) - prediction_method: integer; + prediction_method: cint; (** * sample aspect ratio (0 if unknown) @@ -1604,103 +1605,103 @@ type * - encoding: Set by user. * - decoding: Set by user. *) - debug: integer; + debug: cint; (** * debug * - encoding: Set by user. * - decoding: Set by user. *) - debug_mv: integer; + debug_mv: cint; (** * error * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. * - decoding: unused *) - error: array [0..3] of uint64; + error: array [0..3] of cuint64; (** * minimum MB quantizer * - encoding: unused * - decoding: unused *) - mb_qmin: integer; + mb_qmin: cint; (** * maximum MB quantizer * - encoding: unused * - decoding: unused *) - mb_qmax: integer; + mb_qmax: cint; (** * motion estimation comparison function * - encoding: Set by user. * - decoding: unused *) - me_cmp: integer; + me_cmp: cint; (** * subpixel motion estimation comparison function * - encoding: Set by user. * - decoding: unused *) - me_sub_cmp: integer; + me_sub_cmp: cint; (** * macroblock comparison function (not supported yet) * - encoding: Set by user. * - decoding: unused *) - mb_cmp: integer; + mb_cmp: cint; (** * interlaced DCT comparison function * - encoding: Set by user. * - decoding: unused *) - ildct_cmp: integer; + ildct_cmp: cint; (** * ME diamond size & shape * - encoding: Set by user. * - decoding: unused *) - dia_size: integer; + dia_size: cint; (** * amount of previous MV predictors (2a+1 x 2a+1 square) * - encoding: Set by user. * - decoding: unused *) - last_predictor_count: integer; + last_predictor_count: cint; (** * prepass for motion estimation * - encoding: Set by user. * - decoding: unused *) - pre_me: integer; + pre_me: cint; (** * motion estimation prepass comparison function * - encoding: Set by user. * - decoding: unused *) - me_pre_cmp: integer; + me_pre_cmp: cint; (** * ME prepass diamond size & shape * - encoding: Set by user. * - decoding: unused *) - pre_dia_size: integer; + pre_dia_size: cint; (** * subpel ME quality * - encoding: Set by user. * - decoding: unused *) - me_subpel_quality: integer; + me_subpel_quality: cint; (** * callback to negotiate the pixelFormat @@ -1721,7 +1722,7 @@ type * - encoding: unused * - decoding: Set by decoder. *) - dtg_active_format: integer; + dtg_active_format: cint; (** * maximum motion estimation search range in subpel units @@ -1730,21 +1731,21 @@ type * - encoding: Set by user. * - decoding: unused *) - me_range: integer; + me_range: cint; (** * intra quantizer bias * - encoding: Set by user. * - decoding: unused *) - intra_quant_bias: integer; + intra_quant_bias: cint; (** * inter quantizer bias * - encoding: Set by user. * - decoding: unused *) - inter_quant_bias: integer; + inter_quant_bias: cint; (** * color table ID @@ -1752,13 +1753,13 @@ type * - decoding: Which clrtable should be used for 8bit RGB images. * Tables have to be stored somewhere. FIXME *) - color_table_id: integer; + color_table_id: cint; (** * internal_buffer count * Don't touch, used by libavcodec default_get_buffer(). *) - internal_buffer_count: integer; + internal_buffer_count: cint; (** * internal_buffers @@ -1772,21 +1773,21 @@ type * - encoding: Set by user. * - decoding: unused *) - global_quality: integer; + global_quality: cint; (** * coder type * - encoding: Set by user. * - decoding: unused *) - coder_type: integer; + coder_type: cint; (** * context model * - encoding: Set by user. * - decoding: unused *) - context_model: integer; + context_model: cint; { (** @@ -1794,7 +1795,7 @@ type * - encoding: unused * - decoding: Set by user. *) - realloc: function (s: PAVCodecContext; buf: Pbyte; buf_size: integer): Pbyte; cdecl; + realloc: function (s: PAVCodecContext; buf: Pbyte; buf_size: cint): Pbyte; cdecl; } (** @@ -1802,21 +1803,21 @@ type * - encoding: unused * - decoding: Set by user. *) - slice_flags: integer; + slice_flags: cint; (** * XVideo Motion Acceleration * - encoding: forbidden * - decoding: set by decoder *) - xvmc_acceleration: integer; + xvmc_acceleration: cint; (** * macroblock decision mode * - encoding: Set by user. * - decoding: unused *) - mb_decision: integer; + mb_decision: cint; (** * custom intra quantization matrix @@ -1838,7 +1839,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; //cardinal; + stream_codec_tag: array [0..3] of char; //cuint; (** * scene change detection threshold @@ -1846,21 +1847,21 @@ type * - encoding: Set by user. * - decoding: unused *) - scenechange_threshold: integer; + scenechange_threshold: cint; (** * minimum Lagrange multipler * - encoding: Set by user. * - decoding: unused *) - lmin: integer; + lmin: cint; (** * maximum Lagrange multipler * - encoding: Set by user. * - decoding: unused *) - lmax: integer; + lmax: cint; (** * palette control structure @@ -1874,7 +1875,7 @@ type * - encoding: Set by user. * - decoding: unused *) - noise_reduction: integer; + noise_reduction: cint; (** * Called at the beginning of a frame to get cr buffer for it. @@ -1885,49 +1886,49 @@ type * - encoding: unused * - decoding: Set by libavcodec., user can override *) - reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): cint; cdecl; (** * Number of bits which should be loaded into the rc buffer before decoding starts. * - encoding: Set by user. * - decoding: unused *) - rc_initial_buffer_occupancy: integer; + rc_initial_buffer_occupancy: cint; (** * * - encoding: Set by user. * - decoding: unused *) - inter_threshold: integer; + inter_threshold: cint; (** * CODEC_FLAG2_* * - encoding: Set by user. * - decoding: Set by user. *) - flags2: integer; + flags2: cint; (** * Simulates errors in the bitstream to test error concealment. * - encoding: Set by user. * - decoding: unused *) - error_rate: integer; + error_rate: cint; (** * MP3 antialias algorithm, see FF_AA_* below. * - encoding: unused * - decoding: Set by user. *) - antialias_algo: integer; + antialias_algo: cint; (** * quantizer noise shaping * - encoding: Set by user. * - decoding: unused *) - quantizer_noise_shaping: integer; + quantizer_noise_shaping: cint; (** * thread count @@ -1935,7 +1936,7 @@ type * - encoding: Set by user. * - decoding: Set by user. *) - thread_count: integer; + thread_count: cint; (** * The codec may call this to execute several independent things. @@ -1946,7 +1947,7 @@ type * - encoding: Set by libavcodec, user can override. * - decoding: Set by libavcodec, user can override. *) - execute: function (c: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; + execute: function (c: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: PCint; count: cint): cint; cdecl; (** * thread opaque @@ -1963,63 +1964,63 @@ type * - encoding: Set by user. * - decoding: unused *) - me_threshold: integer; + me_threshold: cint; (** * Macroblock threshold below which the user specified macroblock types will be used. * - encoding: Set by user. * - decoding: unused *) - mb_threshold: integer; + mb_threshold: cint; (** * precision of the intra DC coefficient - 8 * - encoding: Set by user. * - decoding: unused *) - intra_dc_precision: integer; + intra_dc_precision: cint; (** * noise vs. sse weight for the nsse comparsion function * - encoding: Set by user. * - decoding: unused *) - nsse_weight: integer; + nsse_weight: cint; (** * Number of macroblock rows at the top which are skipped. * - encoding: unused * - decoding: Set by user. *) - skip_top: integer; + skip_top: cint; (** * Number of macroblock rows at the bottom which are skipped. * - encoding: unused * - decoding: Set by user. *) - skip_bottom: integer; + skip_bottom: cint; (** * profile * - encoding: Set by user. * - decoding: Set by libavcodec. *) - profile: integer; + profile: cint; (** * level * - encoding: Set by user. * - decoding: Set by libavcodec. *) - level: integer; + level: cint; (** * low resolution decoding, 1-> 1/2 size, 2->1/4 size * - encoding: unused * - decoding: Set by user. *) - lowres: integer; + lowres: cint; (** * Bitstream width / height, may be different from width/height if lowres @@ -2027,35 +2028,35 @@ type * - encoding: unused * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. *) - coded_width, coded_height: integer; + coded_width, coded_height: cint; (** * frame skip threshold * - encoding: Set by user. * - decoding: unused *) - frame_skip_threshold: integer; + frame_skip_threshold: cint; (** * frame skip factor * - encoding: Set by user. * - decoding: unused *) - frame_skip_factor: integer; + frame_skip_factor: cint; (** * frame skip exponent * - encoding: Set by user. * - decoding: unused *) - frame_skip_exp: integer; + frame_skip_exp: cint; (** * frame skip comparison function * - encoding: Set by user. * - decoding: unused *) - frame_skip_cmp: integer; + frame_skip_cmp: cint; (** * Border processing masking, raises the quantizer for mbs on the borders @@ -2063,28 +2064,28 @@ type * - encoding: Set by user. * - decoding: unused *) - border_masking: single; + border_masking: cfloat; (** * minimum MB lagrange multipler * - encoding: Set by user. * - decoding: unused *) - mb_lmin: integer; + mb_lmin: cint; (** * maximum MB lagrange multipler * - encoding: Set by user. * - decoding: unused *) - mb_lmax: integer; + mb_lmax: cint; (** * * - encoding: Set by user. * - decoding: unused *) - me_penalty_compensation: integer; + me_penalty_compensation: cint; (** * @@ -2112,14 +2113,14 @@ type * - encoding: Set by user. * - decoding: unused *) - bidir_refine: integer; + bidir_refine: cint; (** * * - encoding: Set by user. * - decoding: unused *) - brd_scale: integer; + brd_scale: cint; (** * constant rate factor - quality-based VBR - values ~correspond to qps @@ -2127,9 +2128,9 @@ type * - decoding: unused *) {$IF LIBAVCODEC_VERSION >= 51021000} // 51.21.0 - crf: single; + crf: cfloat; {$ELSE} - crf: integer; + crf: cint; {$IFEND} (** @@ -2137,49 +2138,49 @@ type * - encoding: Set by user. * - decoding: unused *) - cqp: integer; + cqp: cint; (** * minimum GOP size * - encoding: Set by user. * - decoding: unused *) - keyint_min: integer; + keyint_min: cint; (** * number of reference frames * - encoding: Set by user. * - decoding: unused *) - refs: integer; + refs: cint; (** * chroma qp offset from luma * - encoding: Set by user. * - decoding: unused *) - chromaoffset: integer; + chromaoffset: cint; (** * Influences how often B-frames are used. * - encoding: Set by user. * - decoding: unused *) - bframebias: integer; + bframebias: cint; (** * trellis RD quantization * - encoding: Set by user. * - decoding: unused *) - trellis: integer; + trellis: cint; (** * Reduce fluctuations in qp (before curve compression). * - encoding: Set by user. * - decoding: unused *) - complexityblur: single; + complexityblur: cfloat; (** * in-loop deblocking filter alphac0 parameter @@ -2187,7 +2188,7 @@ type * - encoding: Set by user. * - decoding: unused *) - deblockalpha: integer; + deblockalpha: cint; (** * in-loop deblocking filter beta parameter @@ -2195,35 +2196,35 @@ type * - encoding: Set by user. * - decoding: unused *) - deblockbeta: integer; + deblockbeta: cint; (** * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 * - encoding: Set by user. * - decoding: unused *) - partitions: integer; + partitions: cint; (** * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal) * - encoding: Set by user. * - decoding: unused *) - directpred: integer; + directpred: cint; (** * Audio cutoff bandwidth (0 means "automatic") * - encoding: Set by user. * - decoding: unused *) - cutoff: integer; + cutoff: cint; (** * Multiplied by qscale for each frame and added to scene_change_score. * - encoding: Set by user. * - decoding: unused *) - scenechange_factor: integer; + scenechange_factor: cint; (** * @@ -2231,65 +2232,65 @@ type * - encoding: Set by user. * - decoding: unused *) - mv0_threshold: integer; + mv0_threshold: cint; (** * Adjusts sensitivity of b_frame_strategy 1. * - encoding: Set by user. * - decoding: unused *) - b_sensitivity: integer; + b_sensitivity: cint; (** * - encoding: Set by user. * - decoding: unused *) - compression_level: integer; + compression_level: cint; (** * Sets whether to use LPC mode - used by FLAC encoder. * - encoding: Set by user. * - decoding: unused *) - use_lpc: integer; + use_lpc: cint; (** * LPC coefficient precision - used by FLAC encoder * - encoding: Set by user. * - decoding: unused *) - lpc_coeff_precision: integer; + lpc_coeff_precision: cint; (** * - encoding: Set by user. * - decoding: unused *) - min_prediction_order: integer; + min_prediction_order: cint; (** * - encoding: Set by user. * - decoding: unused *) - max_prediction_order: integer; + max_prediction_order: cint; (** * search method for selecting prediction order * - encoding: Set by user. * - decoding: unused *) - prediction_order_method: integer; + prediction_order_method: cint; (** * - encoding: Set by user. * - decoding: unused *) - min_partition_order: integer; + min_partition_order: cint; (** * - encoding: Set by user. * - decoding: unused *) - max_partition_order: integer; + max_partition_order: cint; {$IF LIBAVCODEC_VERSION >= 51026000} // 51.26.0 (** @@ -2297,7 +2298,7 @@ type * - encoding: Set by user. * - decoding: unused *) - timecode_frame_start: int64; + timecode_frame_start: cint64; {$IFEND} {$IF LIBAVCODEC_VERSION >= 51042000} // 51.42.0 @@ -2306,7 +2307,7 @@ type * - encoding: unused * - decoding: Set by user. *) - request_channels: integer; + request_channels: cint; {$IFEND} {$IF LIBAVCODEC_VERSION > 51049000} // > 51.49.0 @@ -2316,7 +2317,7 @@ type * - encoding: unused * - decoding: Set by user. *) - drc_scale: Single; + drc_scale: cfloat; {$IFEND} end; @@ -2327,17 +2328,17 @@ type name: pchar; type_: TCodecType; id: TCodecID; - priv_data_size: integer; - init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) - encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; - close: function (avctx: PAVCodecContext): integer; cdecl; - decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; - buf: {const} pchar; buf_size: integer): integer; cdecl; + 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; + close: function (avctx: PAVCodecContext): cint; cdecl; + decode: function (avctx: PAVCodecContext; outdata: pointer; var outdata_size: cint; + buf: {const} pchar; buf_size: cint): cint; cdecl; (** * Codec capabilities. * see CODEC_CAP_* *) - capabilities: integer; + capabilities: cint; next: PAVCodec; (** * Flush buffers. @@ -2354,7 +2355,7 @@ type long_name: {const} PChar; {$IFEND} {$IF LIBAVCODEC_VERSION >= 51056000} // 51.56.0 - supported_samplerates: {const} PInteger; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + supported_samplerates: {const} PCint; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 {$IFEND} end; @@ -2365,7 +2366,7 @@ type PAVPicture = ^TAVPicture; TAVPicture = record data: array [0..3] of pchar; - linesize: array [0..3] of integer; ///< number of bytes per line + linesize: array [0..3] of cint; ///< number of bytes per line end; type @@ -2376,17 +2377,17 @@ type w: word; h: word; nb_colors: word; - linesize: integer; - rgba_palette: PCardinal; + linesize: cint; + rgba_palette: PCuint; bitmap: pchar; end; PAVSubtitle = ^TAVSubtitle; TAVSubtitle = record {20} format: word; (* 0 = graphics *) - start_display_time: cardinal; (* relative to packet pts, in ms *) - end_display_time: cardinal; (* relative to packet pts, in ms *) - num_rects: cardinal; + start_display_time: cuint; (* relative to packet pts, in ms *) + end_display_time: cuint; (* relative to packet pts, in ms *) + num_rects: cuint; rects: PAVSubtitleRect; end; @@ -2397,27 +2398,27 @@ type PAVResampleContext = pointer; PImgReSampleContext = pointer; -function audio_resample_init (output_channels: integer; input_channels: integer; - output_rate: integer; input_rate: integer): PReSampleContext; +function audio_resample_init (output_channels: cint; input_channels: cint; + output_rate: cint; input_rate: cint): PReSampleContext; cdecl; external av__codec; -function audio_resample (s: PReSampleContext; output: PSmallint; input: PSmallint; nb_samples: integer): integer; +function audio_resample (s: PReSampleContext; output: PSmallint; input: PSmallint; nb_samples: cint): cint; cdecl; external av__codec; procedure audio_resample_close (s: PReSampleContext); cdecl; external av__codec; -function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; - log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; +function av_resample_init (out_rate: cint; in_rate: cint; filter_length: cint; + log2_phase_count: cint; linear: cint; cutoff: cdouble): PAVResampleContext; cdecl; external av__codec; -function av_resample (c: PAVResampleContext; dst: PSmallint; src: PSmallint; consumed: PInteger; - src_size: integer; dst_size: integer; update_ctx: integer): integer; +function av_resample (c: PAVResampleContext; dst: PSmallint; src: PSmallint; var consumed: cint; + src_size: cint; dst_size: cint; update_ctx: cint): cint; cdecl; external av__codec; -procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; - compensation_distance: integer); +procedure av_resample_compensate (c: PAVResampleContext; sample_delta: cint; + compensation_distance: cint); cdecl; external av__codec; procedure av_resample_close (c: PAVResampleContext); @@ -2430,19 +2431,19 @@ procedure av_resample_close (c: PAVResampleContext); (** * @deprecated Use the software scaler (swscale) instead. *) -function img_resample_init (output_width: integer; output_height: integer; - input_width: integer; input_height: integer): PImgReSampleContext; +function img_resample_init (output_width: cint; output_height: cint; + input_width: cint; input_height: cint): PImgReSampleContext; cdecl; external av__codec; deprecated; (** * @deprecated Use the software scaler (swscale) instead. *) -function img_resample_full_init (owidth: integer; oheight: integer; - iwidth: integer; iheight: integer; - topBand: integer; bottomBand: integer; - leftBand: integer; rightBand: integer; - padtop: integer; padbottom: integer; - padleft: integer; padright: integer): PImgReSampleContext; +function img_resample_full_init (owidth: cint; oheight: cint; + iwidth: cint; iheight: cint; + topBand: cint; bottomBand: cint; + leftBand: cint; rightBand: cint; + padtop: cint; padbottom: cint; + padleft: cint; padright: cint): PImgReSampleContext; cdecl; external av__codec; deprecated; (** @@ -2469,7 +2470,7 @@ procedure img_resample_close (s: PImgReSampleContext); * @return Zero if successful, a negative value if not. *) function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; + width: cint; height: cint): cint; cdecl; external av__codec; (** @@ -2497,12 +2498,12 @@ procedure avpicture_free (picture: PAVPicture); * @return size of the image data in bytes *) function avpicture_fill (picture: PAVPicture; ptr: pointer; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer; - dest: pchar; dest_size: integer): integer; + width: cint; height: cint; + dest: pchar; dest_size: cint): cint; cdecl; external av__codec; (** @@ -2514,22 +2515,22 @@ function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; * @param height the height of the image * @return Image data size in bytes *) -function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; +function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; -procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); +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; cdecl; external av__codec; -procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); +procedure avcodec_set_dimensions(s: PAVCodecContext; width: cint; height: cint); cdecl; external av__codec; function avcodec_get_pix_fmt(name: {const} pchar): TAVPixelFormat; cdecl; external av__codec; -function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; +function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cuint; cdecl; external av__codec; const @@ -2558,7 +2559,7 @@ const * @return Combination of flags informing you what kind of losses will occur. *) function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; - has_alpha: integer): integer; + has_alpha: cint): cint; cdecl; external av__codec; (** @@ -2583,8 +2584,8 @@ function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAV * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. * @return The best pixel format to convert to or -1 if none was found. *) -function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; - has_alpha: integer; loss_ptr: pinteger): integer; +function avcodec_find_best_pix_fmt (pix_fmt_mask: cint; src_pix_fmt: TAVPixelFormat; + has_alpha: cint; loss_ptr: PCint): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 @@ -2598,7 +2599,7 @@ function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixel * 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: integer; pix_fmt: integer); +procedure avcodec_pix_fmt_string (buf: PChar; buf_size: cint; pix_fmt: cint); cdecl; external av__codec; {$IFEND} @@ -2612,7 +2613,7 @@ const *) function img_get_alpha_info (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; + width: cint; height: cint): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 @@ -2622,14 +2623,14 @@ function img_get_alpha_info (src: {const} PAVPicture; *) function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; src: {const} PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; + width: cint; height: cint): cint; cdecl; external av__codec; deprecated; {$IFEND} (* deinterlace a picture *) (* deinterlace - if not supported return -1 *) function avpicture_deinterlace (dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; {* external high level API *} @@ -2647,11 +2648,11 @@ function av_codec_next(c: PAVCodec): PAVCodec; {$IFEND} (* returns LIBAVCODEC_VERSION_INT constant *) -function avcodec_version (): cardinal; +function avcodec_version (): cuint; cdecl; external av__codec; (* returns LIBAVCODEC_BUILD constant *) -function avcodec_build (): cardinal; +function avcodec_build (): cuint; cdecl; external av__codec; (** @@ -2701,7 +2702,7 @@ function avcodec_find_decoder(id: TCodecID): PAVCodec; *) function avcodec_find_decoder_by_name (name: pchar): PAVCodec; cdecl; external av__codec; -procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); +procedure avcodec_string(buf: pchar; buf_size: cint; enc: PAVCodecContext; encode: cint); cdecl; external av__codec; (** @@ -2754,13 +2755,13 @@ procedure avcodec_get_frame_defaults (pic: PAVFrame); function avcodec_alloc_frame(): PAVFrame; cdecl; external av__codec; -function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; +function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): cint; cdecl; external av__codec; procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); cdecl; external av__codec; -function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; +function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): cint; cdecl; external av__codec; -procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); +procedure avcodec_align_dimensions(s: PAVCodecContext; width: PCint; height: PCint); cdecl; external av__codec; (** @@ -2771,18 +2772,18 @@ procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: * @param[in] h Height of the picture. * @return Zero if valid, a negative value if invalid. *) -function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; +function avcodec_check_dimensions (av_log_ctx: pointer; w: cuint; h: cuint): cint; cdecl; external av__codec; function avcodec_default_get_format(s: PAVCodecContext; fmt: {const} PAVPixelFormat): TAVPixelFormat; cdecl; external av__codec; -function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; +function avcodec_thread_init (s: PAVCodecContext; thread_count: cint): cint; cdecl; external av__codec; procedure avcodec_thread_free (s: PAVCodecContext); cdecl; external av__codec; -function avcodec_thread_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: Pinteger; count: integer): integer; +function avcodec_thread_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; var ret: cint; count: cint): cint; cdecl; external av__codec; -function avcodec_default_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: Pinteger; count: integer): integer; +function avcodec_default_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; var ret: cint; count: cint): cint; cdecl; external av__codec; //FIXME func typedef @@ -2813,15 +2814,15 @@ function avcodec_default_execute (s: PAVCodecContext; func: TExecuteFunc; arg: P * @return zero on success, a negative value on error * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder *) -function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; +function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): cint; cdecl; external av__codec; (** * @deprecated Use avcodec_decode_audio2() instead. *) function avcodec_decode_audio (avctx: PAVCodecContext; samples: PSmallint; - var frame_size_ptr: integer; - buf: {const} pchar; buf_size: integer): integer; + var frame_size_ptr: cint; + buf: {const} pchar; buf_size: cint): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 @@ -2862,8 +2863,8 @@ function avcodec_decode_audio (avctx: PAVCodecContext; samples: PSmallint; * used or zero if no frame could be decompressed. *) function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; - var frame_size_ptr : integer; - buf: {const} pchar; buf_size: integer): integer; + var frame_size_ptr : cint; + buf: {const} pchar; buf_size: cint): cint; cdecl; external av__codec; {$IFEND} @@ -2899,20 +2900,20 @@ function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; * used or zero if no frame could be decompressed. *) function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; - var got_picture_ptr: integer; - buf: {const} PByte; buf_size: integer): integer; + var got_picture_ptr: cint; + buf: {const} PChar; buf_size: cint): cint; cdecl; external av__codec; (* Decode a subtitle message. Return -1 if error, otherwise return the * number of bytes used. If no subtitle could be decompressed, * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; - var got_sub_ptr: integer; - buf: {const} pchar; buf_size: integer): integer; + var got_sub_ptr: cint; + buf: {const} pchar; buf_size: cint): cint; cdecl; external av__codec; function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; - data_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; + data_size_ptr: PCint; + buf: pchar; buf_size: cint): cint; cdecl; external av__codec; (** @@ -2936,7 +2937,7 @@ function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; * of bytes used to encode the data read from the input buffer. *) function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; samples: {const} PSmallint): integer; + buf_size: cint; samples: {const} PSmallint): cint; cdecl; external av__codec; (** @@ -2955,13 +2956,13 @@ function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; * of bytes used from the input buffer. *) function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; pict: PAVFrame): integer; + buf_size: cint; pict: PAVFrame): cint; cdecl; external av__codec; function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; - buf_size: integer; sub: {const} PAVSubtitle): integer; + buf_size: cint; sub: {const} PAVSubtitle): cint; cdecl; external av__codec; -function avcodec_close (avctx: PAVCodecContext): integer; +function avcodec_close (avctx: PAVCodecContext): cint; cdecl; external av__codec; procedure avcodec_register_all (); @@ -2984,7 +2985,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: integer): char; +function av_get_pict_type_char (pict_type: cint): char; cdecl; external av__codec; (** @@ -2993,7 +2994,7 @@ function av_get_pict_type_char (pict_type: integer): char; * @param[in] codec_id the codec * @return Number of bits per sample or zero if unknown for the given codec. *) -function av_get_bits_per_sample (codec_id: TCodecID): integer; +function av_get_bits_per_sample (codec_id: TCodecID): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 @@ -3003,7 +3004,7 @@ function av_get_bits_per_sample (codec_id: TCodecID): integer; * @param[in] sample_fmt the sample format * @return Number of bits per sample or zero if unknown for the given sample format. *) -function av_get_bits_per_sample_format(sample_fmt: TSampleFormat): integer; +function av_get_bits_per_sample_format(sample_fmt: TSampleFormat): cint; cdecl; external av__codec; {$IFEND} @@ -3019,45 +3020,45 @@ type TAVCodecParserContext = record priv_data: pointer; parser: PAVCodecParser; - frame_offset: int64; (* offset of the current frame *) - cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) - next_frame_offset: int64; (* offset of the next frame *) + frame_offset: cint64; (* offset of the current frame *) + cur_offset: cint64; (* current offset (incremented by each av_parser_parse()) *) + next_frame_offset: cint64; (* offset of the next frame *) (* video info *) - pict_type: integer; (* XXX: put it back in AVCodecContext *) - repeat_pict: integer; (* XXX: put it back in AVCodecContext *) - pts: int64; (* pts of the current frame *) - dts: int64; (* dts of the current frame *) + pict_type: cint; (* XXX: put it back in AVCodecContext *) + repeat_pict: cint; (* XXX: put it back in AVCodecContext *) + pts: cint64; (* pts of the current frame *) + dts: cint64; (* dts of the current frame *) (* private data *) - last_pts: int64; - last_dts: int64; - fetch_timestamp: integer; + last_pts: cint64; + last_dts: cint64; + fetch_timestamp: cint; - cur_frame_start_index: integer; - cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_start_index: cint; + cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of cint64; + cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of cint64; + cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of cint64; - flags: integer; + flags: cint; {$IF LIBAVCODEC_VERSION >= 51040003} // 51.40.3 - offset: int64; ///< byte offset from starting packet start + offset: cint64; ///< byte offset from starting packet start {$IFEND} {$IF LIBAVCODEC_VERSION >= 51057001} // 51.57.1 - cur_frame_end: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_end: array [0..AV_PARSER_PTS_NB - 1] of cint64; {$IFEND} end; TAVCodecParser = record - codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) - priv_data_size: integer; - parser_init: function (s: PAVCodecParserContext): integer; cdecl; + codec_ids: array [0..4] of cint; (* several codec IDs are permitted *) + priv_data_size: cint; + parser_init: function (s: PAVCodecParserContext): cint; cdecl; parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: {const} PPointer; poutbuf_size: PInteger; - buf: {const} pchar; buf_size: integer): integer; cdecl; + poutbuf: {const} PPointer; poutbuf_size: PCint; + buf: {const} pchar; buf_size: cint): cint; cdecl; parser_close: procedure (s: PAVCodecParserContext); cdecl; split: function (avctx: PAVCodecContext; buf: {const} pchar; - buf_size: integer): integer; cdecl; + buf_size: cint): cint; cdecl; next: PAVCodecParser; end; @@ -3077,19 +3078,19 @@ function av_parser_next(c: PAVCodecParser): PAVCodecParser; procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; external av__codec; -function av_parser_init (codec_id: integer): PAVCodecParserContext; +function av_parser_init (codec_id: cint): PAVCodecParserContext; cdecl; external av__codec; function av_parser_parse (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: pinteger; - buf: {const} pchar; buf_size: integer; - pts: int64; dts: int64): integer; + poutbuf: PPointer; poutbuf_size: PCint; + buf: {const} pchar; buf_size: cint; + pts: cint64; dts: cint64): cint; cdecl; external av__codec; function av_parser_change (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: {const} pchar; buf_size: integer; keyframe: integer): integer; + poutbuf: PPointer; poutbuf_size: PCint; + buf: {const} pchar; buf_size: cint; keyframe: cint): cint; cdecl; external av__codec; procedure av_parser_close (s: PAVCodecParserContext); cdecl; external av__codec; @@ -3107,11 +3108,11 @@ type TAVBitStreamFilter = record name: pchar; - priv_data_size: integer; + priv_data_size: cint; filter: function (bsfc: PAVBitStreamFilterContext; avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; + poutbuf: PPointer; poutbuf_size: PCint; + buf: PByte; buf_size: cint; keyframe: cint): cint; cdecl; {$IF LIBAVCODEC_VERSION >= 51043000} // 51.43.0 close: procedure (bsfc: PAVBitStreamFilterContext); {$IFEND} @@ -3126,8 +3127,8 @@ function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; + poutbuf: PPointer; poutbuf_size: PCint; + buf: PByte; buf_size: cint; keyframe: cint): cint; cdecl; external av__codec; procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); cdecl; external av__codec; @@ -3145,7 +3146,7 @@ function av_bitstream_filter_next(f: PAVBitStreamFilter): PAVBitStreamFilter; * * @see av_realloc *) -procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); +procedure av_fast_realloc (ptr: pointer; size: PCuint; min_size: cuint); cdecl; external av__codec; @@ -3173,12 +3174,12 @@ procedure av_free_static (); * @deprecated. Code which uses av_mallocz_static is broken/misdesigned * and should correctly use static arrays *) -procedure av_mallocz_static(size: cardinal); +procedure av_mallocz_static(size: cuint); cdecl; external av__codec; deprecated; {av_malloc_attrib av_alloc_size(1)} {$IFEND} {$IF LIBAVCODEC_VERSION < 51035000} // 51.35.0 -procedure av_realloc_static(ptr: pointer; size: Cardinal); +procedure av_realloc_static(ptr: pointer; size: cuint); cdecl; external av__codec; {$IFEND} @@ -3187,21 +3188,21 @@ procedure av_realloc_static(ptr: pointer; size: Cardinal); * Copy image 'src' to 'dst'. *) procedure av_picture_copy(dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: integer; width: integer; height: integer); + pix_fmt: cint; width: cint; height: cint); cdecl; external av__codec; (** * Crop image top and left side. *) function av_picture_crop(dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: integer; top_band: integer; left_band: integer): integer; + pix_fmt: cint; top_band: cint; left_band: cint): cint; cdecl; external av__codec; (** * Pad image. *) -function av_picture_pad(dst: PAVPicture; src: {const} PAVPicture; height: integer; width: integer; pix_fmt: integer; - padtop: integer; padbottom: integer; padleft: integer; padright: integer; color: PInteger): integer; +function av_picture_pad(dst: PAVPicture; src: {const} PAVPicture; height: cint; width: cint; pix_fmt: cint; + padtop: cint; padbottom: cint; padleft: cint; padright: cint; color: PCint): cint; cdecl; external av__codec; {$IFEND} @@ -3210,26 +3211,26 @@ function av_picture_pad(dst: PAVPicture; src: {const} PAVPicture; height: intege * @deprecated Use the software scaler (swscale) instead. *) procedure img_copy (dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer); + pix_fmt: TAVPixelFormat; width: cint; height: cint); cdecl; external av__codec; deprecated; (** * @deprecated Use the software scaler (swscale) instead. *) function img_crop (dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; + pix_fmt: TAVPixelFormat; top_band, left_band: cint): cint; cdecl; external av__codec; deprecated; (** * @deprecated Use the software scaler (swscale) instead. *) -function img_pad (dst: PAVPicture; src: {const} PAVPicture; height, width: integer; - pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; - color: PInteger): integer; +function img_pad (dst: PAVPicture; src: {const} PAVPicture; height, width: cint; + pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: cint; + color: PCint): cint; cdecl; external av__codec; deprecated; {$IFEND} -function av_xiphlacing(s: PByte; v: Cardinal): Cardinal; +function av_xiphlacing(s: PByte; v: cuint): cuint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 @@ -3244,7 +3245,7 @@ function av_xiphlacing(s: PByte; v: Cardinal): Cardinal; * @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: PInteger; height_ptr: PInteger; str: {const} PChar): integer; +function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {const} PChar): cint; cdecl; external av__codec; (** @@ -3256,7 +3257,7 @@ function av_parse_video_frame_size(width_ptr: PInteger; height_ptr: PInteger; st * @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): integer; +function av_parse_video_frame_rate(frame_rate: PAVRational; str: {const} PChar): cint; cdecl; external av__codec; {$IFEND} diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index a63510a1..1f132392 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -18,9 +18,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. - * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT - * in the source codes *) +(* + * This is a part of Pascal porting of ffmpeg. + * Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * For Mac OS X, some modifications were made by The Creative CAT in the source codes. + *) (* * Conversion of libavformat/avformat.h @@ -47,6 +49,7 @@ unit avformat; interface uses + ctypes, avcodec, avutil, avio, @@ -98,32 +101,32 @@ type * the terms dts and pts/cts to mean something different, these timestamps * must be converted to true pts/dts before they are stored in AVPacket. *) - pts: int64; + pts: cint64; (** * Decompression time stamp in time_base units. * This is the time at which the packet is decompressed. * Can be AV_NOPTS_VALUE if it is not stored in the file. *) - dts: int64; - data: PByte; - size: integer; - stream_index: integer; - flags: integer; - duration: integer; ///< presentation duration in time_base units (0 if not available) + dts: cint64; + data: PChar; + size: cint; + stream_index: cint; + flags: cint; + duration: cint; ///< presentation duration in time_base units (0 if not available) destruct: procedure (p: PAVPacket); cdecl; priv: pointer; - pos: int64; ///< byte position in stream, -1 if unknown + pos: cint64; ///< byte position in stream, -1 if unknown end; const PKT_FLAG_KEY = $0001; -procedure av_destruct_packet_nofree (var pkt: TAVPacket); +procedure av_destruct_packet_nofree(var pkt: TAVPacket); cdecl; external av__format; (** * Default packet destructor. *) -procedure av_destruct_packet (var pkt: TAVPacket); +procedure av_destruct_packet(var pkt: TAVPacket); cdecl; external av__format; (** @@ -131,7 +134,7 @@ procedure av_destruct_packet (var pkt: TAVPacket); * * @param pkt packet *) -procedure av_init_packet (var pkt: TAVPacket); +procedure av_init_packet(var pkt: TAVPacket); {$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2 cdecl; external av__format; {$IFEND} @@ -143,7 +146,7 @@ procedure av_init_packet (var pkt: TAVPacket); * @param size wanted payload size * @return 0 if OK. AVERROR_xxx otherwise. *) -function av_new_packet(var pkt: TAVPacket; size: integer): integer; +function av_new_packet(var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** @@ -153,14 +156,14 @@ function av_new_packet(var pkt: TAVPacket; size: integer): integer; * @param size wanted payload size * @return >0 (read size) if OK. AVERROR_xxx otherwise. *) -function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; +function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated *) -function av_dup_packet (pkt: PAVPacket): integer; +function av_dup_packet(pkt: PAVPacket): cint; cdecl; external av__format; (** @@ -168,7 +171,7 @@ function av_dup_packet (pkt: PAVPacket): integer; * * @param pkt packet to free *) -procedure av_free_packet (pkt: PAVPacket); {$IFDEF HasInline}inline;{$ENDIF} +procedure av_free_packet(pkt: PAVPacket); {$IFDEF HasInline}inline;{$ENDIF} (*************************************************) (* fractional numbers for exact pts handling *) @@ -181,7 +184,7 @@ type *) PAVFrac = ^TAVFrac; TAVFrac = record - val, num, den: int64; + val, num, den: cint64; end; {deprecated} (*************************************************) @@ -192,7 +195,7 @@ type TAVProbeData = record filename: pchar; buf: pchar; - buf_size: integer; + buf_size: cint; end; const @@ -267,9 +270,9 @@ type PAVChapter = ^TAVChapter; TAVChapter = record - id: integer; ///< Unique id to identify the chapter + id: cint; ///< Unique id to identify the chapter time_base: TAVRational; ///< Timebase in which the start/end timestamps are specified - start, end_: int64; ///< chapter start/end time in time_base units + start, end_: cint64; ///< chapter start/end time in time_base units title: PChar; ///< chapter title end; TAVChapterArray = array[0..(MaxInt div SizeOf(TAVChapter))-1] of TAVChapter; @@ -277,15 +280,15 @@ type TAVFormatParameters = record time_base: TAVRational; - sample_rate: integer; - channels: integer; - width: integer; - height: integer; + sample_rate: cint; + channels: cint; + width: cint; + height: cint; pix_fmt: TAVPixelFormat; {$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0 image_format: PAVImageFormat; {$IFEND} - channel: integer; (* used to select dv channel *) + 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) *) {$IFEND} @@ -317,18 +320,18 @@ type mime_type: pchar; extensions: pchar; (*< comma separated filename extensions *) (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; + priv_data_size: cint; (* output support *) audio_codec: TCodecID; (* default audio codec *) video_codec: TCodecID; (* default video codec *) - write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; - write_trailer: function (c: PAVFormatContext): integer; cdecl; + write_header: function (c: PAVFormatContext): cint; cdecl; + write_packet: function (c: PAVFormatContext; pkt: PAVPacket): cint; cdecl; + write_trailer: function (c: PAVFormatContext): cint; cdecl; (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) - flags: integer; + flags: cint; (* currently only used to set pixel format if not YUV420P *) - set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; - interleave_packet: function (s: PAVFormatContext; out_: PAVPacket; in_: PAVPacket; flush: integer): integer; cdecl; + set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): cint; cdecl; + interleave_packet: function (s: PAVFormatContext; out_: PAVPacket; in_: PAVPacket; flush: cint): cint; cdecl; {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 (** @@ -355,25 +358,25 @@ type *) long_name: pchar; (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; + priv_data_size: cint; (** * Tell if a given file has a chance of being parsed by this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes * big so you do not have to check for that unless you need more. *) - read_probe: function (p: PAVProbeData): integer; cdecl; + read_probe: function (p: PAVProbeData): cint; cdecl; (* read the format header and initialize the AVFormatContext structure. Return 0 if OK. 'ap' if non NULL contains additionnal paramters. Only used in raw format right now. 'av_new_stream' should be called to create new streams. *) - read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; + read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): cint; cdecl; (* read one packet and put it in 'pkt'. pts and flags are also set. 'av_new_stream' can be called only if the flag AVFMTCTX_NOHEADER is used. *) - read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; + read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; (* close the stream. The AVFormatContext and AVStreams are not freed by this function *) - read_close: function (c: PAVFormatContext): integer; cdecl; + read_close: function (c: PAVFormatContext): cint; cdecl; (** * seek to a given timestamp relative to the frames in * stream component stream_index @@ -382,28 +385,28 @@ type * match is available * @return >= 0 on success (but not necessarily the new offset) *) - read_seek: function (c: PAVFormatContext; stream_index: integer; - timestamp: int64; flags: integer): integer; cdecl; + read_seek: function (c: PAVFormatContext; stream_index: cint; + timestamp: cint64; flags: cint): cint; cdecl; (** * gets the next timestamp in stream[stream_index].time_base units. * @return the timestamp or AV_NOPTS_VALUE if an error occurred *) - read_timestamp: function (s: PAVFormatContext; stream_index: integer; - pos: pint64; pos_limit: int64): int64; cdecl; + read_timestamp: function (s: PAVFormatContext; stream_index: cint; + pos: pint64; pos_limit: cint64): cint64; cdecl; (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) - flags: integer; + flags: cint; (* 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; (* general purpose read only value that the format can use *) - value: integer; + value: cint; (* start/resume playing - only meaningful if using a network based format (RTSP) *) - read_play: function (c: PAVFormatContext): integer; cdecl; + read_play: function (c: PAVFormatContext): cint; cdecl; (* pause playing - only meaningful if using a network based format (RTSP) *) - read_pause: function (c: PAVFormatContext): integer; cdecl; + read_pause: function (c: PAVFormatContext): cint; cdecl; {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 codec_tag: {const} PPAVCodecTag; @@ -421,14 +424,14 @@ type ); TAVIndexEntry = record - pos: int64; - timestamp: int64; + pos: cint64; + timestamp: cint64; { Delphi doesn't support bitfields -> use flags_size instead int flags:2; int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). } - flags_size: cardinal; // 0..1: flags, 2..31: size - min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) + flags_size: cint; // 0..1: flags, 2..31: size + min_distance: cint; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) end; (** @@ -439,8 +442,8 @@ type * sizeof(AVStream) must not be used outside libav*. *) TAVStream = record - index: integer; (* stream index in AVFormatContext *) - id: integer; (* format specific stream id *) + index: cint; (* stream index in AVFormatContext *) + id: cint; (* format specific stream id *) codec: PAVCodecContext; (* codec context *) (** * Real base frame rate of the stream. @@ -454,9 +457,9 @@ type priv_data: pointer; (* internal data used in av_find_stream_info() *) - first_dts: int64; + first_dts: cint64; {$IF LIBAVFORMAT_VERSION_MAJOR < 52} - codec_info_nb_frames: integer; + codec_info_nb_frames: cint; {$IFEND} (** encoding: PTS generation when outputing stream *) @@ -468,14 +471,14 @@ type * identically 1. *) time_base: TAVRational; - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) + pts_wrap_bits: cint; (* number of bits in pts (used for wrapping control) *) (* ffmpeg.c private use *) - stream_copy: integer; (**< if set, just copy stream *) + stream_copy: cint; (**< if set, just copy stream *) discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed //FIXME move stuff to a flags field? (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame * MN:dunno if thats the right place, for it *) - quality: single; + quality: cfloat; (** * Decoding: pts of the first frame of the stream, in stream time base. * Only set this if you are absolutely 100% sure that the value you set @@ -484,13 +487,13 @@ type * @note The ASF header does NOT contain a correct start_time the ASF * demuxer must NOT set this. *) - start_time: int64; + start_time: cint64; (** * Decoding: duration of the stream, in stream time base. * If a source file does not specify a duration, but does specify * a bitrate, this value will be estimates from bit rate and file size. *) - duration: int64; + duration: cint64; language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) @@ -498,26 +501,26 @@ type need_parsing: TAVStreamParseType; parser: PAVCodecParserContext; - cur_dts: int64; - last_IP_duration: integer; - last_IP_pts: int64; + cur_dts: cint64; + last_IP_duration: cint; + last_IP_pts: cint64; (* av_seek_frame() support *) index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) - nb_index_entries: integer; - index_entries_allocated_size: cardinal; + nb_index_entries: cint; + index_entries_allocated_size: cuint; - nb_frames: int64; ///< number of frames in this stream if known or 0 + nb_frames: cint64; ///< number of frames in this stream if known or 0 {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 - pts_buffer: array [0..MAX_REORDER_DELAY] of int64; + pts_buffer: array [0..MAX_REORDER_DELAY] of cint64; {$IFEND} - + {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0 filename: PChar; (**< source filename of the stream *) {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52008000} // 52.8.0 - disposition: integer; (**< AV_DISPOSITION_* bitfield *) + disposition: cint; (**< AV_DISPOSITION_* bitfield *) {$IFEND} end; @@ -541,21 +544,21 @@ type pb: TByteIOContext; {$IFEND} - nb_streams: cardinal; + nb_streams: cuint; streams: array [0..MAX_STREAMS - 1] of PAVStream; filename: array [0..1023] of char; (* input or output filename *) (* stream info *) - timestamp: int64; + 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; - year: integer; (* ID3 year, 0 if none *) - track: integer; (* track number, 0 if none *) + year: cint; (* ID3 year, 0 if none *) + track: cint; (* track number, 0 if none *) genre: array [0..31] of char; (* ID3 genre *) - ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) + ctx_flags: cint; (* format specific flags, see AVFMTCTX_xx *) (* private data for pts handling (do not modify directly) *) (* This buffer is only needed when packets were already buffered but not decoded, for example to get the codec parameters in mpeg @@ -565,56 +568,56 @@ type (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. NEVER set this value directly: it is deduced from the AVStream values. *) - start_time: int64; + start_time: cint64; (* decoding: duration of the stream, in AV_TIME_BASE fractional seconds. NEVER set this value directly: it is deduced from the AVStream values. *) - duration: int64; + duration: cint64; (* decoding: total file size. 0 if unknown *) - file_size: int64; + file_size: cint64; (* decoding: total stream bitrate in bit/s, 0 if not available. Never set it directly if the file_size and the duration are known as ffmpeg can compute it automatically. *) - bit_rate: integer; + bit_rate: cint; (* av_read_frame() support *) cur_st: PAVStream; cur_ptr: pbyte; - cur_len: integer; + cur_len: cint; cur_pkt: TAVPacket; (* av_seek_frame() support *) - data_offset: int64; (* offset of the first packet *) - index_built: integer; + data_offset: cint64; (* offset of the first packet *) + index_built: cint; - mux_rate: integer; - packet_size: integer; - preload: integer; - max_delay: integer; + mux_rate: cint; + packet_size: cint; + preload: cint; + max_delay: cint; (* number of times to loop output in formats that support it *) - loop_output: integer; + loop_output: cint; - flags: integer; - loop_input: integer; + flags: cint; + loop_input: cint; {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 (* decoding: size of data to probe; encoding unused *) - probesize: cardinal; + probesize: cuint; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 51009000} // 51.9.0 (** * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() *) - max_analyze_duration: integer; + max_analyze_duration: cint; key: pbyte; - keylen : integer; + keylen : cint; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0 - nb_programs: cardinal; + nb_programs: cuint; programs: PPAVProgram; {$IFEND} @@ -647,7 +650,7 @@ type * muxing : unused * demuxing: set by user *) - max_index_size: cardinal; + max_index_size: cuint; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52009000} // 52.9.0 @@ -655,11 +658,11 @@ type * Maximum amount of memory in bytes to use for buffering frames * obtained from real-time capture devices. *) - max_picture_buffer: cardinal; + max_picture_buffer: cuint; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52014000} // 52.14.0 - nb_chapters: cardinal; + nb_chapters: cuint; chapters: PAVChapterArray; {$IFEND} @@ -667,7 +670,7 @@ type (** * Flags to enable debuging. *) - debug: integer; + debug: cint; {$IFEND} end; @@ -678,10 +681,10 @@ type * sizeof(AVProgram) must not be used outside libav*. *) TAVProgram = record - id : integer; + id : cint; provider_name : PChar; ///< Network name for DVB streams name : PChar; ///< Service name for DVB streams - flags : integer; + 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; @@ -701,9 +704,9 @@ type (* still image support *) TAVImageInfo = record pix_fmt: TAVPixelFormat; (* requested pixel format *) - width: integer; (* requested width *) - height: integer; (* requested height *) - interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) + width: cint; (* requested width *) + height: cint; (* requested height *) + interleaved: cint; (* image is interleaved (e.g. interleaved GIF) *) pict: TAVPicture; (* returned allocated image *) end; {deprecated} @@ -711,34 +714,34 @@ type name: pchar; extensions: pchar; (* tell if a given file has a chance of being parsing by this format *) - img_probe: function (d: PAVProbeData): integer; cdecl; + img_probe: function (d: PAVProbeData): cint; cdecl; (* read a whole image. 'alloc_cb' is called when the image size is known so that the caller can allocate the image. If 'allo_cb' returns non zero, then the parsing is aborted. Return '0' if OK. *) - img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; + img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): cint; cdecl; (* write the image *) - supported_pixel_formats: integer; (* mask of supported formats for output *) - img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; - flags: integer; + supported_pixel_formats: cint; (* mask of supported formats for output *) + img_write: function (b: PByteIOContext; i: PAVImageInfo): cint; cdecl; + flags: cint; next: PAVImageFormat; end; {deprecated} -procedure av_register_image_format (img_fmt: PAVImageFormat); +procedure av_register_image_format(img_fmt: PAVImageFormat); cdecl; external av__format; deprecated; -function av_probe_image_format (pd: PAVProbeData): 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: pchar): PAVImageFormat; cdecl; external av__format; deprecated; -function av_read_image (pb: PByteIOContext; filename: pchar; +function av_read_image(pb: PByteIOContext; filename: pchar; fmt: PAVImageFormat; - alloc_cb: pointer; opaque: pointer): integer; + alloc_cb: pointer; opaque: pointer): cint; cdecl; external av__format; deprecated; -function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; +function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): cint; cdecl; external av__format; deprecated; {$IFEND} @@ -764,13 +767,13 @@ function av_guess_image2_codec(filename: {const} PChar): TCodecID; (* modules *) (* utils.c *) -procedure av_register_input_format (format: PAVInputFormat); +procedure av_register_input_format(format: PAVInputFormat); cdecl; external av__format; -procedure av_register_output_format (format: PAVOutputFormat); +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: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; cdecl; external av__format; function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; @@ -792,7 +795,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: integer); +procedure av_hex_dump(f: PAVFile; buf: pchar; size: cint); cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0 @@ -808,7 +811,7 @@ procedure av_hex_dump (f: PAVFile; buf: pchar; size: integer); * * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log *) -procedure av_hex_dump_log(avcl: Pointer; level: integer; buf: PChar; size: integer); +procedure av_hex_dump_log(avcl: Pointer; level: cint; buf: PChar; size: cint); cdecl; external av__format; {$IFEND} @@ -819,7 +822,7 @@ procedure av_hex_dump_log(avcl: Pointer; level: integer; buf: PChar; size: integ * @param pkt packet to dump * @param dump_payload true if the payload must be displayed too *) -procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: integer); +procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: cint); cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0 @@ -833,18 +836,18 @@ procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: integer); * @param pkt packet to dump * @param dump_payload true if the payload must be displayed too *) -procedure av_pkt_dump_log(avcl: Pointer; level: integer; pkt: PAVPacket; dump_payload: integer); +procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_payload: cint); cdecl; external av__format; {$IFEND} -procedure av_register_all (); +procedure av_register_all(); cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 (** codec tag <-> codec id *) -function av_codec_get_id(var tags: PAVCodecTag; tag: cardinal): TCodecID; +function av_codec_get_id(var tags: PAVCodecTag; tag: cuint): TCodecID; cdecl; external av__format; -function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cardinal; +function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cuint; cdecl; external av__format; {$IFEND} @@ -853,7 +856,7 @@ function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cardinal; (** * finds AVInputFormat based on input format's short name. *) -function av_find_input_format (short_name: pchar): PAVInputFormat; +function av_find_input_format(short_name: pchar): PAVInputFormat; cdecl; external av__format; (** @@ -862,16 +865,16 @@ function av_find_input_format (short_name: pchar): PAVInputFormat; * @param is_opened whether the file is already opened, determines whether * demuxers with or without AVFMT_NOFILE are probed *) -function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; +function av_probe_input_format(pd: PAVProbeData; is_opened: cint): PAVInputFormat; cdecl; external av__format; (** * Allocates all the structures needed to read an input stream. * This does not open the needed codecs for decoding the stream[s]. *) -function av_open_input_stream (ic_ptr: PAVFormatContext; +function av_open_input_stream(ic_ptr: PAVFormatContext; pb: PByteIOContext; filename: pchar; - fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + fmt: PAVInputFormat; ap: PAVFormatParameters): cint; cdecl; external av__format; (** @@ -885,9 +888,9 @@ function av_open_input_stream (ic_ptr: PAVFormatContext; * @param ap additional parameters needed when opening the file (NULL if default) * @return 0 if OK. AVERROR_xxx otherwise. *) -function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; - fmt: PAVInputFormat; buf_size: integer; - ap: PAVFormatParameters): integer; +function av_open_input_file(var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: cint; + ap: PAVFormatParameters): cint; cdecl; external av__format; (** @@ -895,7 +898,7 @@ function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; * Can be freed with av_free() but do not forget to free everything you * explicitly allocated as well! *) -function av_alloc_format_context (): PAVFormatContext; +function av_alloc_format_context(): PAVFormatContext; cdecl; external av__format; (** @@ -910,7 +913,7 @@ function av_alloc_format_context (): PAVFormatContext; * @return >=0 if OK. AVERROR_xxx if error. * @todo Let user decide somehow what information is needed so we do not waste time getting stuff the user does not need. *) -function av_find_stream_info (ic: PAVFormatContext): integer; +function av_find_stream_info(ic: PAVFormatContext): cint; cdecl; external av__format; (** @@ -923,7 +926,7 @@ function av_find_stream_info (ic: PAVFormatContext): integer; * @param pkt is filled * @return 0 if OK. AVERROR_xxx if error. *) -function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; +function av_read_packet(s: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; external av__format; (** @@ -932,7 +935,7 @@ function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of + * exactly one frame. For audio, it contains an cint number of * frames if each frame has a known fixed size (e.g. PCM or ADPCM * data). If the audio frames have a variable size (e.g. MPEG audio), * then it contains one frame. @@ -945,7 +948,7 @@ function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; * * @return 0 if OK, < 0 if error or end of file. *) -function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) +function av_read_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; external av__format; (** @@ -959,14 +962,14 @@ function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CA * @param flags flags which select direction and seeking mode * @return >= 0 on success *) -function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; +function av_seek_frame(s: PAVFormatContext; stream_index: cint; timestamp: cint64; flags: cint): cint; cdecl; external av__format; (** * start playing a network based stream (e.g. RTSP stream) at the * current position *) -function av_read_play (s: PAVFormatContext): integer; +function av_read_play(s: PAVFormatContext): cint; cdecl; external av__format; (** @@ -974,7 +977,7 @@ function av_read_play (s: PAVFormatContext): integer; * * Use av_read_play() to resume it. *) -function av_read_pause (s: PAVFormatContext): integer; +function av_read_pause(s: PAVFormatContext): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 @@ -991,7 +994,7 @@ procedure av_close_input_stream(s: PAVFormatContext); * * @param s media file handle *) -procedure av_close_input_file (s: PAVFormatContext); +procedure av_close_input_file(s: PAVFormatContext); cdecl; external av__format; (** @@ -1004,10 +1007,10 @@ procedure av_close_input_file (s: PAVFormatContext); * @param s media file handle * @param id file format dependent stream id *) -function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; +function av_new_stream(s: PAVFormatContext; id: cint): PAVStream; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0 -function av_new_program(s: PAVFormatContext; id: integer): PAVProgram; +function av_new_program(s: PAVFormatContext; id: cint): PAVProgram; cdecl; external av__format; {$IFEND} @@ -1025,7 +1028,7 @@ function av_new_program(s: PAVFormatContext; id: integer): PAVProgram; * * @return AVChapter or NULL if error. *) -function ff_new_chapter(s: PAVFormatContext; id: integer; time_base: TAVRational; start, end_: int64; title: {const} Pchar): PAVChapter; +function ff_new_chapter(s: PAVFormatContext; id: cint; time_base: TAVRational; start, end_: cint64; title: {const} Pchar): PAVChapter; cdecl; external av__format; {$IFEND} @@ -1038,8 +1041,8 @@ function ff_new_chapter(s: PAVFormatContext; id: integer; time_base: TAVRational * @param pts_num numerator to convert to seconds (MPEG: 1) * @param pts_den denominator to convert to seconds (MPEG: 90000) *) -procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; - pts_num: integer; pts_den: integer); +procedure av_set_pts_info(s: PAVStream; pts_wrap_bits: cint; + pts_num: cint; pts_den: cint); cdecl; external av__format; const @@ -1047,7 +1050,7 @@ const AVSEEK_FLAG_BYTE = 2; ///< seeking based on position in bytes AVSEEK_FLAG_ANY = 4; ///< seek to any frame, even non keyframes -function av_find_default_stream_index (s: PAVFormatContext): integer; +function av_find_default_stream_index(s: PAVFormatContext): cint; cdecl; external av__format; (** @@ -1058,7 +1061,7 @@ function av_find_default_stream_index (s: PAVFormatContext): integer; * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise * @return < 0 if no such timestamp could be found *) -function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; +function av_index_search_timestamp(st: PAVStream; timestamp: cint64; flags: cint): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 @@ -1069,7 +1072,7 @@ function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: inte * This function is not part of the public API and should only be called * by demuxers. *) -procedure ff_reduce_index(s: PAVFormatContext; stream_index: integer); +procedure ff_reduce_index(s: PAVFormatContext; stream_index: cint); cdecl; external av__format; {$IFEND} @@ -1078,8 +1081,8 @@ procedure ff_reduce_index(s: PAVFormatContext; stream_index: integer); * * @param timestamp timestamp in the timebase of the given stream *) -function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; - distance: integer; flags: integer): integer; +function av_add_index_entry(st: PAVStream; pos: cint64; timestamp: cint64; + distance: cint; flags: cint): cint; cdecl; external av__format; (** @@ -1088,8 +1091,8 @@ function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; * @param target_ts target timestamp in the time base of the given stream * @param stream_index stream number *) -function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; - target_ts: int64; flags: integer): integer; +function av_seek_frame_binary(s: PAVFormatContext; stream_index: cint; + target_ts: cint64; flags: cint): cint; cdecl; external av__format; @@ -1101,14 +1104,14 @@ function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; * @param timestamp new dts expressed in time_base of param ref_st * @param ref_st reference stream giving time_base of param timestamp *) -procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; - timestamp: int64); +procedure av_update_cur_dts(s: PAVFormatContext; ref_st: PAVStream; + timestamp: cint64); cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51007000} // 51.7.0 type TReadTimestampFunc = function (pavfc: PAVFormatContext; - arg2: integer; arg3: Pint64; arg4: int64): int64; cdecl; + arg2: cint; arg3: Pint64; arg4: cint64): cint64; cdecl; (** * Does a binary search using read_timestamp(). @@ -1116,14 +1119,14 @@ type * @param target_ts target timestamp in the time base of the given stream * @param stream_index stream number *) -function av_gen_search(s: PAVFormatContext; stream_index: integer; target_ts: int64; - pos_min: int64; pos_max: int64; pos_limit: int64; ts_min: int64; ts_max: int64; - flags: integer; ts_ret: Pint64; read_timestamp: TReadTimestampFunc): int64; +function av_gen_search(s: PAVFormatContext; stream_index: cint; target_ts: cint64; + pos_min: cint64; pos_max: cint64; pos_limit: cint64; ts_min: cint64; ts_max: cint64; + flags: cint; ts_ret: Pint64; read_timestamp: TReadTimestampFunc): cint64; cdecl; external av__format; {$IFEND} (* media file output *) -function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; +function av_set_parameters(s: PAVFormatContext; ap: PAVFormatParameters): cint; cdecl; external av__format; (** @@ -1133,7 +1136,7 @@ function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integ * @param s media file handle * @return 0 if OK. AVERROR_xxx if error. *) -function av_write_header (s: PAVFormatContext): integer; +function av_write_header(s: PAVFormatContext): cint; cdecl; external av__format; (** @@ -1147,8 +1150,8 @@ function av_write_header (s: PAVFormatContext): integer; * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. *) -function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) +function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; + cdecl; external av__format; (** * Writes a packet to an output media file ensuring correct interleaving. @@ -1164,8 +1167,8 @@ function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. *) -function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) +function av_interleaved_write_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; + cdecl; external av__format; (** * Interleave a packet per DTS in an output media file. @@ -1182,7 +1185,7 @@ function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): i * < 0 if an error occurred *) function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; - pkt: PAVPacket; flush: integer): integer; + pkt: PAVPacket; flush: cint): cint; cdecl; external av__format; (** @@ -1192,25 +1195,25 @@ function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; * @param s media file handle * @return 0 if OK. AVERROR_xxx if error. *) -function av_write_trailer(s: pAVFormatContext): integer; +function av_write_trailer(s: pAVFormatContext): cint; cdecl; external av__format; -procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; - is_output: integer); +procedure dump_format(ic: PAVFormatContext; index: cint; url: pchar; + is_output: cint); cdecl; external av__format; (** * parses width and height out of string str. * @deprecated Use av_parse_video_frame_size instead. *) -function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; +function parse_image_size(width_ptr: PCint; height_ptr: PCint; str: pchar): cint; cdecl; external av__format; deprecated; (** * Converts frame rate from string to a fraction. * @deprecated Use av_parse_video_frame_rate instead. *) -function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; +function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; arg: pchar): cint; cdecl; external av__format; deprecated; (** @@ -1239,23 +1242,23 @@ function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: * not zero \p datestr is interpreted as a duration, otherwise as a * date. *) -function parse_date(datestr: pchar; duration: integer): int64; +function parse_date(datestr: pchar; duration: cint): cint64; cdecl; external av__format; -function av_gettime (): int64; +function av_gettime(): cint64; cdecl; external av__format; (* ffm specific for ffserver *) const FFM_PACKET_SIZE = 4096; -function ffm_read_write_index (fd: integer): int64; +function ffm_read_write_index(fd: cint): cint64; cdecl; external av__format; -procedure ffm_write_write_index(fd: integer; pos: int64); +procedure ffm_write_write_index(fd: cint; pos: cint64); cdecl; external av__format; -procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); +procedure ffm_set_write_index(s: PAVFormatContext; pos: cint64; file_size: cint64); cdecl; external av__format; (** @@ -1264,7 +1267,7 @@ procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. * Return 1 if found. *) -function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; +function find_info_tag(arg: pchar; arg_size: cint; tag1: pchar; info: pchar): cint; cdecl; external av__format; (** @@ -1279,8 +1282,8 @@ function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar) * @param number frame number * @return 0 if OK, -1 if format error. *) -function av_get_frame_filename(buf: pchar; buf_size: integer; - path: pchar; number: integer): integer; +function av_get_frame_filename(buf: pchar; buf_size: cint; + path: pchar; number: cint): cint; cdecl; external av__format {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 name 'get_frame_filename' @@ -1292,7 +1295,7 @@ function av_get_frame_filename(buf: pchar; buf_size: integer; * @param filename possible numbered sequence string * @return 1 if a valid numbered sequence string, 0 otherwise. *) -function av_filename_number_test(filename: pchar): integer; +function av_filename_number_test(filename: pchar): cint; cdecl; external av__format {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 name 'filename_number_test' @@ -1313,14 +1316,14 @@ function av_filename_number_test(filename: pchar): integer; * @param size the size of the buffer * @return 0 if OK. AVERROR_xxx if error. *) -function avf_sdp_create(ac: PPAVFormatContext; n_files: integer; buff: PChar; size: integer): integer; +function avf_sdp_create(ac: PPAVFormatContext; n_files: cint; buff: PChar; size: cint): cint; cdecl; external av__format; {$IFEND} implementation {$IF LIBAVFORMAT_VERSION < 51012002} // 51.12.2 -procedure av_init_packet (var pkt: TAVPacket); +procedure av_init_packet(var pkt: TAVPacket); begin with pkt do begin pts := AV_NOPTS_VALUE; @@ -1334,7 +1337,7 @@ begin end; {$IFEND} -procedure av_free_packet (pkt: PAVPacket); +procedure av_free_packet(pkt: PAVPacket); begin if ((pkt <> nil) and (@pkt^.destruct <> nil)) then pkt^.destruct(pkt); diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 4a7d3a3b..7df28122 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -43,6 +43,7 @@ unit avio; interface uses + ctypes, avutil, avcodec, UConfig; @@ -50,7 +51,7 @@ uses (* output byte stream handling *) type - TOffset = int64; + TOffset = cint64; (* unbuffered I/O *) @@ -67,7 +68,7 @@ const AVSEEK_SIZE = $10000; type - TURLInterruptCB = function (): integer; cdecl; + TURLInterruptCB = function (): cint; cdecl; type PURLProtocol = ^TURLProtocol; @@ -85,9 +86,9 @@ type av_class: {const} PAVClass; ///< information for av_log(). Set by url_open(). {$IFEND} prot: PURLProtocol; - flags: integer; - is_streamed: integer; (**< true if streamed (no seek possible), default = false *) - max_packet_size: integer; (**< if non zero, the stream is packetized with this max packet size *) + flags: cint; + 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 *) end; @@ -95,28 +96,28 @@ type PURLPollEntry = ^TURLPollEntry; TURLPollEntry = record handle: PURLContext; - events: integer; - revents: integer; + events: cint; + revents: cint; end; TURLProtocol = record - name: pchar; - url_open: function (h: PURLContext; filename: {const} pchar; flags: integer): integer; cdecl; - url_read: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; - url_write: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; - url_seek: function (h: PURLContext; pos: TOffset; whence: integer): TOffset; cdecl; - url_close: function (h: PURLContext): integer; cdecl; + 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; + url_close: function (h: PURLContext): cint; cdecl; next: PURLProtocol; {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0 - url_read_play: function (h: PURLContext): integer; - url_read_pause: function (h: PURLContext): integer; + url_read_play: function (h: PURLContext): cint; + url_read_pause: function (h: PURLContext): cint; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 - url_read_pause: function (h: PURLContext; pause: integer): integer; cdecl; + 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: integer; timestamp: int64; flags: integer): TOffset; cdecl; + stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; {$IFEND} end; @@ -129,48 +130,48 @@ type *) PByteIOContext = ^TByteIOContext; TByteIOContext = record - buffer: pchar; - buffer_size: integer; - buf_ptr: pchar; - buf_end: pchar; + buffer: PChar; + buffer_size: cint; + buf_ptr: PChar; + buf_end: PChar; opaque: pointer; - read_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; - write_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; - seek: function (opaque: pointer; offset: TOffset; whence: integer): TOffset; cdecl; + 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 *) - must_flush: integer; (* true if the next seek should flush *) - eof_reached: integer; (* true if eof reached *) - write_flag: integer; (* true if open for writing *) - is_streamed: integer; - max_packet_size: integer; - checksum: longword; - checksum_ptr: pchar; - update_checksum: function (checksum: Longword; buf: {const} pchar; size: cardinal): Longword; cdecl; - error: integer; ///< contains the error code or 0 if no error happened + 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; + 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): integer; cdecl; - read_pause: function(opaque: Pointer): integer; cdecl; + read_play: function(opaque: Pointer): cint; cdecl; + read_pause: function(opaque: Pointer): cint; cdecl; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 - read_pause: function(opaque: Pointer; pause: integer): integer; cdecl; + read_pause: function(opaque: Pointer; pause: cint): cint; cdecl; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 read_seek: function(opaque: Pointer; - stream_index: integer; timestamp: int64; flags: integer): TOffset; cdecl; + stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; {$IFEND} end; -function url_open(h: PPointer; filename: {const} pchar; flags: integer): integer; +function url_open(h: PPointer; filename: {const} PChar; flags: cint): cint; cdecl; external av__format; -function url_read (h: PURLContext; buf: pchar; size: integer): integer; +function url_read (h: PURLContext; buf: PChar; size: cint): cint; cdecl; external av__format; -function url_write (h: PURLContext; buf: pchar; size: integer): integer; +function url_write (h: PURLContext; buf: PChar; size: cint): cint; cdecl; external av__format; -function url_seek (h: PURLContext; pos: TOffset; whence: integer): TOffset; +function url_seek (h: PURLContext; pos: TOffset; whence: cint): TOffset; cdecl; external av__format; -function url_close (h: PURLContext): integer; +function url_close (h: PURLContext): cint; cdecl; external av__format; -function url_exist(filename: {const} pchar): integer; +function url_exist(filename: {const} PChar): cint; cdecl; external av__format; function url_filesize (h: PURLContext): TOffset; cdecl; external av__format; @@ -183,9 +184,9 @@ function url_filesize (h: PURLContext): TOffset; * @param h file handle * @return maximum packet size in bytes *) -function url_get_max_packet_size(h: PURLContext): integer; +function url_get_max_packet_size(h: PURLContext): cint; cdecl; external av__format; -procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); +procedure url_get_filename(h: PURLContext; buf: PChar; buf_size: cint); cdecl; external av__format; (** @@ -198,7 +199,7 @@ procedure url_set_interrupt_cb (interrupt_cb: TURLInterruptCB); cdecl; external av__format; (* not implemented *) -function url_poll(poll_table: PURLPollEntry; n: integer; timeout: integer): integer; +function url_poll(poll_table: PURLPollEntry; n: cint; timeout: cint): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 @@ -207,7 +208,7 @@ function url_poll(poll_table: PURLPollEntry; n: integer; timeout: integer): inte * protocol (e.g. MMS). * @param pause 1 for pause, 0 for resume *) -function av_url_read_pause(h: PURLContext; pause: integer): integer; +function av_url_read_pause(h: PURLContext; pause: cint): cint; cdecl; external av__format; {$IFEND} @@ -230,7 +231,7 @@ function av_url_read_pause(h: PURLContext; pause: integer): integer; * @see AVInputFormat::read_seek *) function av_url_read_seek(h: PURLContext; - stream_index: integer; timestamp: int64; flags: integer): TOffset; + stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; external av__format; {$IFEND} @@ -245,26 +246,26 @@ function av_protocol_next(p: PURLProtocol): PURLProtocol; cdecl; external av__format; {$IFEND} -function register_protocol (protocol: PURLProtocol): integer; +function register_protocol (protocol: PURLProtocol): cint; cdecl; external av__format; type - TReadWriteFunc = function (opaque: Pointer; buf: PChar; buf_size: integer): integer; cdecl; - TSeekFunc = function (opaque: Pointer; offset: TOffset; whence: integer): TOffset; cdecl; + TReadWriteFunc = function (opaque: Pointer; buf: PChar; buf_size: cint): cint; cdecl; + TSeekFunc = function (opaque: Pointer; offset: TOffset; whence: cint): TOffset; cdecl; function init_put_byte(s: PByteIOContext; - buffer: pchar; - buffer_size: integer; write_flag: integer; + buffer: PChar; + buffer_size: cint; write_flag: cint; opaque: pointer; read_packet: TReadWriteFunc; write_packet: TReadWriteFunc; - seek: TSeekFunc): integer; + seek: TSeekFunc): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 function av_alloc_put_byte( buffer: PChar; - buffer_size: integer; - write_flag: integer; + buffer_size: cint; + write_flag: cint; opaque: Pointer; read_packet: TReadWriteFunc; write_packet: TReadWriteFunc; @@ -272,37 +273,37 @@ function av_alloc_put_byte( cdecl; external av__format; {$IFEND} -procedure put_byte(s: PByteIOContext; b: integer); +procedure put_byte(s: PByteIOContext; b: cint); cdecl; external av__format; -procedure put_buffer (s: PByteIOContext; buf: {const} pchar; size: integer); +procedure put_buffer (s: PByteIOContext; buf: {const} PChar; size: cint); cdecl; external av__format; -procedure put_le64(s: PByteIOContext; val: int64); +procedure put_le64(s: PByteIOContext; val: cuint64); cdecl; external av__format; -procedure put_be64(s: PByteIOContext; val: int64); +procedure put_be64(s: PByteIOContext; val: cuint64); cdecl; external av__format; -procedure put_le32(s: PByteIOContext; val: cardinal); +procedure put_le32(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_be32(s: PByteIOContext; val: cardinal); +procedure put_be32(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_le24(s: PByteIOContext; val: cardinal); +procedure put_le24(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_be24(s: PByteIOContext; val: cardinal); +procedure put_be24(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_le16(s: PByteIOContext; val: cardinal); +procedure put_le16(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure put_be16(s: PByteIOContext; val: cardinal); +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} PChar); cdecl; external av__format; -procedure put_strz(s: PByteIOContext; buf: {const} pchar); +procedure put_strz(s: PByteIOContext; buf: {const} PChar); cdecl; external av__format; (** * fseek() equivalent for ByteIOContext. * @return new position or AVERROR. *) -function url_fseek(s: PByteIOContext; offset: TOffset; whence: integer): TOffset; +function url_fseek(s: PByteIOContext; offset: TOffset; whence: cint): TOffset; cdecl; external av__format; (** @@ -330,35 +331,35 @@ function url_fsize(s: PByteIOContext): TOffset; * feof() equivalent for ByteIOContext. * @return non zero if and only if end of file *) -function url_feof(s: PByteIOContext): integer; +function url_feof(s: PByteIOContext): cint; cdecl; external av__format; -function url_ferror(s: PByteIOContext): integer; +function url_ferror(s: PByteIOContext): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 -function av_url_read_fpause(h: PByteIOContext; pause: integer): integer; +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: integer; timestamp: int64; flags: integer): TOffset; + stream_index: cint; timestamp: cint64; flags: cint): TOffset; cdecl; external av__format; {$IFEND} const URL_EOF = -1; (** @note return URL_EOF (-1) if EOF *) -function url_fgetc(s: PByteIOContext): integer; +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): integer; +function url_fprintf(s: PByteIOContext; fmt: {const} PChar; 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: integer): PChar; +function url_fgets(s: PByteIOContext; buf: PChar; buf_size: cint): PChar; cdecl; external av__format; procedure put_flush_packet (s: PByteIOContext); @@ -369,7 +370,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: integer): integer; +function get_buffer(s: PByteIOContext; buf: PChar; size: cint): cint; cdecl; external av__format; (** @@ -378,51 +379,51 @@ function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; * returned. * @returns number of bytes read or AVERROR *) -function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; +function get_partial_buffer(s: PByteIOContext; buf: PChar; size: cint): cint; cdecl; external av__format; (** @note return 0 if EOF, so you cannot use it if EOF handling is necessary *) -function get_byte(s: PByteIOContext): integer; +function get_byte(s: PByteIOContext): cint; cdecl; external av__format; -function get_le24(s: PByteIOContext): cardinal; +function get_le24(s: PByteIOContext): cuint; cdecl; external av__format; -function get_le32(s: PByteIOContext): cardinal; +function get_le32(s: PByteIOContext): cuint; cdecl; external av__format; -function get_le64(s: PByteIOContext): uint64; +function get_le64(s: PByteIOContext): cuint64; cdecl; external av__format; -function get_le16(s: PByteIOContext): cardinal; +function get_le16(s: PByteIOContext): cuint; cdecl; external av__format; -function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; +function get_strz(s: PByteIOContext; buf: PChar; maxlen: cint): PChar; cdecl; external av__format; -function get_be16(s: PByteIOContext): cardinal; +function get_be16(s: PByteIOContext): cuint; cdecl; external av__format; -function get_be24(s: PByteIOContext): cardinal; +function get_be24(s: PByteIOContext): cuint; cdecl; external av__format; -function get_be32(s: PByteIOContext): cardinal; +function get_be32(s: PByteIOContext): cuint; cdecl; external av__format; -function get_be64(s: PByteIOContext): uint64; +function get_be64(s: PByteIOContext): cuint64; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 -function ff_get_v(bc: PByteIOContext): uint64; +function ff_get_v(bc: PByteIOContext): cuint64; cdecl; external av__format; {$IFEND} -function url_is_streamed(s: PByteIOContext): integer; {$IFDEF HasInline}inline;{$ENDIF} +function url_is_streamed(s: PByteIOContext): cint; {$IFDEF HasInline}inline;{$ENDIF} (** @note when opened as read/write, the buffers are only used for writing *) {$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 -function url_fdopen (var s: PByteIOContext; h: PURLContext): integer; +function url_fdopen (var s: PByteIOContext; h: PURLContext): cint; {$ELSE} -function url_fdopen (s: PByteIOContext; h: PURLContext): integer; +function url_fdopen (s: PByteIOContext; h: PURLContext): cint; {$IFEND} cdecl; external av__format; (** @warning must be called before any I/O *) -function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; +function url_setbufsize (s: PByteIOContext; buf_size: cint): cint; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51015000} // 51.15.0 @@ -430,19 +431,19 @@ function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; * @note Will drop any data currently in the buffer without transmitting it. * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY * to set up the buffer for writing. *) -function url_resetbuf(s: PByteIOContext; flags: integer): integer; +function url_resetbuf(s: PByteIOContext; flags: cint): cint; cdecl; external av__format; {$IFEND} (** @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: integer): integer; +function url_fopen(var s: PByteIOContext; filename: {const} PChar; flags: cint): cint; {$ELSE} -function url_fopen(s: PByteIOContext; filename: {const} pchar; flags: integer): integer; +function url_fopen(s: PByteIOContext; filename: {const} PChar; flags: cint): cint; {$IFEND} cdecl; external av__format; -function url_fclose(s: PByteIOContext): integer; +function url_fclose(s: PByteIOContext): cint; cdecl; external av__format; function url_fileno(s: PByteIOContext): PURLContext; cdecl; external av__format; @@ -455,18 +456,18 @@ function url_fileno(s: PByteIOContext): PURLContext; * @param s buffered file handle * @return maximum packet size in bytes *) -function url_fget_max_packet_size (s: PByteIOContext): integer; +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: integer; flags: integer): integer; +function url_open_buf(var s: PByteIOContext; buf: PChar; buf_size: cint; flags: cint): cint; {$ELSE} -function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; +function url_open_buf(s: PByteIOContext; buf: PChar; buf_size: cint; flags: cint): cint; {$IFEND} cdecl; external av__format; (** return the written or read size *) -function url_close_buf(s: PByteIOContext): integer; +function url_close_buf(s: PByteIOContext): cint; cdecl; external av__format; (** @@ -476,9 +477,9 @@ function url_close_buf(s: PByteIOContext): integer; * @return zero if no error. *) {$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 -function url_open_dyn_buf(var s: PByteIOContext): integer; +function url_open_dyn_buf(var s: PByteIOContext): cint; {$ELSE} -function url_open_dyn_buf(s: PByteIOContext): integer; +function url_open_dyn_buf(s: PByteIOContext): cint; {$IFEND} cdecl; external av__format; @@ -492,9 +493,9 @@ function url_open_dyn_buf(s: PByteIOContext): integer; * @return zero if no error. *) {$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 -function url_open_dyn_packet_buf(var s: PByteIOContext; max_packet_size: integer): integer; +function url_open_dyn_packet_buf(var s: PByteIOContext; max_packet_size: cint): cint; {$ELSE} -function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; +function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: cint): cint; {$IFEND} cdecl; external av__format; @@ -505,29 +506,29 @@ function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): i * @param pbuffer pointer to a byte buffer * @return the length of the byte buffer *) -function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; +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: longword; buf: {const} PChar; len: cardinal): longword; +function ff_crc04C11DB7_update(checksum: culong; buf: {const} PChar; len: cuint): culong; cdecl; external av__format; {$IFEND} -function get_checksum(s: PByteIOContext): cardinal; +function get_checksum(s: PByteIOContext): culong; cdecl; external av__format; -procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); +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): integer; +function udp_set_remote_url(h: PURLContext; uri: {const} PChar): cint; cdecl; external av__format; -function udp_get_local_port(h: PURLContext): integer; +function udp_get_local_port(h: PURLContext): cint; cdecl; external av__format; -function udp_get_file_handle(h: PURLContext): integer; +function udp_get_file_handle(h: PURLContext): cint; cdecl; external av__format; implementation -function url_is_streamed(s: PByteIOContext): integer; +function url_is_streamed(s: PByteIOContext): cint; begin Result := s^.is_streamed; end; diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 4e9990e3..b7c8989c 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -52,6 +52,7 @@ unit avutil; interface uses + ctypes, mathematics, rational, UConfig; @@ -82,14 +83,6 @@ const {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} {$IFEND} - -{$IFDEF FPC} -{$IF FPC_VERSION_INT < 2002000} // < 2.2.0 -type - uint64 = QWord; -{$IFEND} -{$ENDIF} - type (** * Pixel format. Notes: @@ -193,7 +186,7 @@ function MKTAG(a,b,c,d: char): integer; * it. * @see av_mallocz() *) -function av_malloc (size: cardinal): pointer; +function av_malloc(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** @@ -208,7 +201,7 @@ function av_malloc (size: cardinal): pointer; * reallocate or the function is used to free the memory block. * @see av_fast_realloc() *) -function av_realloc (ptr: pointer; size: cardinal): pointer; +function av_realloc(ptr: pointer; size: cuint): pointer; cdecl; external av__util; {av_alloc_size(2)} (** @@ -219,7 +212,7 @@ function av_realloc (ptr: pointer; size: cardinal): pointer; * @note It is recommended that you use av_freep() instead. * @see av_freep() *) -procedure av_free (ptr: pointer); +procedure av_free(ptr: pointer); cdecl; external av__util; (** @@ -231,7 +224,7 @@ procedure av_free (ptr: pointer); * it. * @see av_malloc() *) -function av_mallocz (size: cardinal): pointer; +function av_mallocz(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** @@ -240,7 +233,7 @@ function av_mallocz (size: cardinal): 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: PChar): PChar; cdecl; external av__util; {av_malloc_attrib} (** @@ -300,9 +293,9 @@ const AV_LOG_DEBUG = 48; {$IFEND} -function av_log_get_level(): integer; +function av_log_get_level(): cint; cdecl; external av__util; -procedure av_log_set_level(level: integer); +procedure av_log_set_level(level: cint); cdecl; external av__util; diff --git a/Game/Code/lib/ffmpeg/mathematics.pas b/Game/Code/lib/ffmpeg/mathematics.pas index ede9530f..331178e1 100644 --- a/Game/Code/lib/ffmpeg/mathematics.pas +++ b/Game/Code/lib/ffmpeg/mathematics.pas @@ -38,6 +38,7 @@ unit mathematics; interface uses + ctypes, rational, UConfig; @@ -54,20 +55,20 @@ type * rescale a 64bit integer with rounding to nearest. * a simple a*b/c isn't possible as it can overflow *) -function av_rescale (a, b, c: int64): int64; +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 *) -function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; +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. *) -function av_rescale_q (a: int64; bq, cq: TAVRational): int64; +function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; cdecl; external av__util; {av_const} implementation diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index 2f9f2c0e..cba2a3c8 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -40,6 +40,7 @@ unit opt; interface uses + ctypes, rational, UConfig; @@ -70,65 +71,65 @@ type *) PAVOption = ^TAVOption; TAVOption = record - name: pchar; + name: {const} PChar; (** * short English help text * @todo What about other languages? *) - help: pchar; - offset: integer; ///< offset to context structure where the parsed value should be stored + help: {const} PChar; + offset: cint; ///< offset to context structure where the parsed value should be stored type_: TAVOptionType; - default_val: double; - min: double; - max: double; + default_val: cdouble; + min: cdouble; + max: cdouble; - flags: integer; + flags: cint; //FIXME think about enc-audio, ... style flags - unit_: pchar; + unit_: {const} PChar; end; {$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 -function av_find_opt (obj: Pointer; {const} name: PChar; {const} unit_: PChar; mask: integer; flags: integer): {const} PAVOption; +function av_find_opt (obj: Pointer; {const} name: {const} PChar; {const} unit_: PChar; mask: cint; flags: cint): {const} PAVOption; cdecl; external av__codec; {$IFEND} -function av_set_string (obj: pointer; name: pchar; val: pchar): PAVOption; +function av_set_string (obj: pointer; name: {const} pchar; val: {const} pchar): PAVOption; cdecl; external av__codec; -function av_set_double (obj: pointer; name: pchar; n: double): PAVOption; +function av_set_double (obj: pointer; name: {const} pchar; n: cdouble): PAVOption; cdecl; external av__codec; -function av_set_q (obj: pointer; name: pchar; n: TAVRational): PAVOption; +function av_set_q (obj: pointer; name: {const} pchar; n: TAVRational): PAVOption; cdecl; external av__codec; -function av_set_int (obj: pointer; name: pchar; n: int64): PAVOption; +function av_set_int (obj: pointer; name: {const} pchar; n: cint64): PAVOption; cdecl; external av__codec; -function av_get_double (obj: pointer; name: pchar; o_out: PPointer): double; +function av_get_double (obj: pointer; name: {const} pchar; var o_out: PAVOption): cdouble; cdecl; external av__codec; -function av_get_q (obj: pointer; name: pchar; o_out: PPointer): TAVRational; +function av_get_q (obj: pointer; name: {const} pchar; var o_out: PAVOption): TAVRational; cdecl; external av__codec; -function av_get_int (obj: pointer; name: pchar; o_out: PPointer): int64; +function av_get_int (obj: pointer; name: {const} pchar; var o_out: {const} PAVOption): cint64; cdecl; external av__codec; -function av_get_string (obj: pointer; name: pchar; o_out: PPOinter; buf: pchar; buf_len: integer): pchar; +function av_get_string (obj: pointer; name: {const} pchar; var o_out: {const} PAVOption; buf: pchar; buf_len: cint): pchar; cdecl; external av__codec; -function av_next_option (obj: pointer; last: PAVOption): PAVOption; +function av_next_option (obj: pointer; last: {const} PAVOption): PAVOption; cdecl; external av__codec; -function av_opt_show (obj: pointer; av_log_obj: pointer): integer; +function av_opt_show (obj: pointer; av_log_obj: pointer): cint; cdecl; external av__codec; procedure av_opt_set_defaults (s: pointer); cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 -procedure av_opt_set_defaults2 (s: Pointer; mask: integer; flags: integer); +procedure av_opt_set_defaults2 (s: Pointer; mask: cint; flags: cint); cdecl; external av__codec; {$IFEND} diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index aca690d1..ed571f41 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -42,6 +42,7 @@ unit rational; interface uses + ctypes, UConfig; type @@ -50,8 +51,8 @@ type *) PAVRational = ^TAVRational; TAVRational = record - num: integer; ///< numerator - den: integer; ///< denominator + num: cint; ///< numerator + den: cint; ///< denominator end; (** @@ -60,14 +61,14 @@ type * @param b second rational * @return 0 if a==b, 1 if a>b and -1 if a 0) then Result := (tmp shr 63) or 1 @@ -141,7 +142,7 @@ begin Result := 0 end; -function av_q2d(a: TAVRational): double; +function av_q2d(a: TAVRational): cdouble; begin Result := a.num / a.den; end; diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index 0d7831bc..fce18f3f 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -63,12 +63,12 @@ const {$IFEND} type - TQuadIntArray = array[0..3] of integer; + TQuadIntArray = array[0..3] of cint; PQuadIntArray = ^TQuadIntArray; - TIntArray = array[0..0] of integer; - PIntArray = ^TIntArray; - TPByteArray = array[0..0] of Pbyte; - PPByteArray = ^TPByteArray; + TCintArray = array[0..0] of cint; + PCintArray = ^TCintArray; + TPUint8Array = array[0..0] of PCuint8; + PPUint8Array = ^TPUint8Array; const {* values for the flags, the stuff on the command line is different *} @@ -122,8 +122,8 @@ type // coeffs cannot be shared between vectors PSwsVector = ^TSwsVector; TSwsVector = record - coeff: Pdouble; - length: integer; + coeff: PCdouble; + length: cint; end; // vectors can be shared @@ -137,16 +137,6 @@ type PSwsContext = ^TSwsContext; TSwsContext = record - av_class: Pointer; - swScale: Pointer; - srxW,srcH, dstH: integer; - chrSrcW, chrSrcH, chrDstW, chrDstH: integer; - lumXInc, chrXInc, lumYInc, chrYInc: integer; - dstFormat, srcFormat, origDstFormat, origSrcFormat: integer; - chrSrcHSubSample, chrSrcVSubSample, chrIntHSubSample, chrIntVSubSample: integer; - chrDstHSubSample, chrDstVSubSample: integer; - vChrDrop, sliceDir: integer; - param: array[0..1] of double; {internal structure} end; @@ -154,31 +144,31 @@ type procedure sws_freeContext(swsContext: PSwsContext); cdecl; external sw__scale; -function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; +function sws_getContext(srcW: cint; srcH: cint; srcFormat: cint; dstW: cint; dstH: cint; dstFormat: cint; flags: cint; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; -function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; - dst: PPByteArray; dstStride: PIntArray): integer; +function sws_scale(context: PSwsContext; src: PPUint8Array; srcStride: PCintArray; srcSliceY: cint; srcSliceH: cint; + dst: PPUint8Array; dstStride: PCintArray): cint; cdecl; external sw__scale; -function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; - srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; +function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PCintArray; srcSliceY: cint; + srcSliceH: cint; dst: PPByteArray; dstStride: PCintArray): cint; cdecl; external sw__scale; deprecated; -function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadIntArray; srcRange: integer; table: PQuadIntArray; dstRange: integer; - brightness: integer; contrast: integer; saturation: integer): integer; +function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadIntArray; srcRange: cint; table: PQuadIntArray; dstRange: cint; + brightness: cint; contrast: cint; saturation: cint): cint; cdecl; external sw__scale; -function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadIntArray; var srcRange: integer; var table: PQuadIntArray; var dstRange: integer; - var brightness: integer; var contrast: integer; var saturation: integer): integer; +function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadIntArray; var srcRange: cint; var table: PQuadIntArray; var dstRange: cint; + var brightness: cint; var contrast: cint; var saturation: cint): cint; cdecl; external sw__scale; -function sws_getGaussianVec(variance: double; quality: double): PSwsVector; +function sws_getGaussianVec(variance: cdouble; quality: cdouble): PSwsVector; cdecl; external sw__scale; -function sws_getConstVec(c: double; length: integer): PSwsVector; +function sws_getConstVec(c: cdouble; length: cint): PSwsVector; cdecl; external sw__scale; function sws_getIdentityVec: PSwsVector; cdecl; external sw__scale; -procedure sws_scaleVec(a: PSwsVector; scalar: double); +procedure sws_scaleVec(a: PSwsVector; scalar: cdouble); cdecl; external sw__scale; -procedure sws_normalizeVec(a: PSwsVector; height: double); +procedure sws_normalizeVec(a: PSwsVector; height: cdouble); cdecl; external sw__scale; procedure sws_convVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; @@ -186,7 +176,7 @@ procedure sws_addVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; procedure sws_subVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; -procedure sws_shiftVec(a: PSwsVector; shift: integer); +procedure sws_shiftVec(a: PSwsVector; shift: cint); cdecl; external sw__scale; function sws_cloneVec(a: PSwsVector): PSwsVector; cdecl; external sw__scale; @@ -196,16 +186,16 @@ procedure sws_printVec(a: PSwsVector); procedure sws_freeVec(a: PSwsVector); cdecl; external sw__scale; -function sws_getDefaultFilter(lumaGBlur: single; chromaGBlur: single; lumaSarpen: single; chromaSharpen: single; chromaHShift: single; - chromaVShift: single; verbose: integer): PSwsFilter; +function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat; lumaSarpen: cfloat; chromaSharpen: cfloat; chromaHShift: cfloat; + chromaVShift: cfloat; verbose: cint): PSwsFilter; cdecl; external sw__scale; procedure sws_freeFilter(filter: PSwsFilter); cdecl; external sw__scale; function sws_getCachedContext(context: PSwsContext; - srcW: integer; srcH: integer; srcFormat: integer; - dstW: integer; dstH: integer; dstFormat: integer; flags: integer; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; + srcW: cint; srcH: cint; srcFormat: cint; + dstW: cint; dstH: cint; dstFormat: cint; flags: cint; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; implementation -- cgit v1.2.3