diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-06-14 18:24:43 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-06-14 18:24:43 +0000 |
commit | 68b29a08bc21b15b923b3430fbc41baedba73883 (patch) | |
tree | 23005644b6e4ec95914fd9e51c23735715f1ec5f /Game/Code/lib/ffmpeg | |
parent | bcec80f4bc1a7b299f37b49d463494d6817f4496 (diff) | |
download | usdx-68b29a08bc21b15b923b3430fbc41baedba73883.tar.gz usdx-68b29a08bc21b15b923b3430fbc41baedba73883.tar.xz usdx-68b29a08bc21b15b923b3430fbc41baedba73883.zip |
Removed some "const" parameter modifiers for external function declarations. Pascal has no equivalent to C's "pointer to constant type" const modifier. E.g. "const char* cstr" is not equivalent to "const cstr: PChar". This is because the first is a variable pointer to a constant type and the latter is a constant pointer to a variable type. This means contrary to the C version, in the incorrect pascal version the string can be changed. So it is like a false friend in this example, although "cstr: PChar" is not correct either, as the string can be changed too.
Also note that "var myvar: TMyType" is always passed as reference (a pointer is used for this, so it is equivalent to "myvar: PMyType"). This also normally applies to "const myvar: TMyType". But not if the type-size is < 4byte or the function is declared as stdcall or cdecl. In these cases the variable is passed on the stack and not as a pointer. So NEVER replace a C declaration "const my_type_t* my_var" with "const my_var: TMy_type" as it might fail. Use the var modifier instead.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1148 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/lib/ffmpeg/avcodec.pas | 68 | ||||
-rw-r--r-- | Game/Code/lib/ffmpeg/avformat.pas | 2 | ||||
-rw-r--r-- | Game/Code/lib/ffmpeg/avio.pas | 24 |
3 files changed, 47 insertions, 47 deletions
diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 9de520c4..42bc4d9e 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -1146,7 +1146,7 @@ type * @param offset offset into the AVFrame.data from which the slice should be read *) draw_horiz_band: procedure (s: PAVCodecContext; - {const} src: PAVFrame; offset: PQuadIntArray; + src: {const} PAVFrame; offset: PQuadIntArray; y: integer; type_: integer; height: integer); cdecl; (* audio only *) @@ -1425,7 +1425,7 @@ type * - encoding: Set by user * - decoding: unused *) - rc_eq: pchar; {const char*} + rc_eq: {const} pchar; (** * maximum bitrate @@ -1698,7 +1698,7 @@ type * - encoding: unused * - decoding: Set by user, if not set the native format will be chosen. *) - get_format: function (s: PAVCodecContext; {const} fmt: PAVPixelFormat): TAVPixelFormat; cdecl; + get_format: function (s: PAVCodecContext; fmt: {const} PAVPixelFormat): TAVPixelFormat; cdecl; (** * DTG active format information (additional aspect ratio @@ -2319,7 +2319,7 @@ type 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; - {const} buf: pchar; buf_size: integer): integer; cdecl; + buf: {const} pchar; buf_size: integer): integer; cdecl; (** * Codec capabilities. * see CODEC_CAP_* @@ -2331,17 +2331,17 @@ type * Will be called when seeking *) flush: procedure (avctx: PAVCodecContext); cdecl; - {const} supported_framerates: PAVRational; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} - {const} pix_fmts: PAVPixelFormat; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + supported_framerates: {const} PAVRational; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + pix_fmts: {const} PAVPixelFormat; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 {$IF LIBAVCODEC_VERSION >= 51055000} // 51.55.0 (** * Descriptive name for the codec, meant to be more human readable than \p name. * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. *) - {const} long_name: PChar; + long_name: {const} PChar; {$IFEND} {$IF LIBAVCODEC_VERSION >= 51056000} // 51.56.0 - {const} supported_samplerates: PInteger; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + supported_samplerates: {const} PInteger; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 {$IFEND} end; @@ -2435,7 +2435,7 @@ function img_resample_full_init (owidth: integer; oheight: integer; (** * @deprecated Use the software scaler (swscale) instead. *) -procedure img_resample (s: PImgReSampleContext; output: PAVPicture; {const} input: PAVPicture); +procedure img_resample (s: PImgReSampleContext; output: PAVPicture; input: {const} PAVPicture); cdecl; external av__codec; deprecated; (** @@ -2487,7 +2487,7 @@ function avpicture_fill (picture: PAVPicture; ptr: pointer; pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; cdecl; external av__codec; -function avpicture_layout ({const} src: PAVPicture; pix_fmt: TAVPixelFormat; +function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: integer; height: integer; dest: pchar; dest_size: integer): integer; cdecl; external av__codec; @@ -2513,7 +2513,7 @@ function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); cdecl; external av__codec; -function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; +function avcodec_get_pix_fmt(name: {const} pchar): TAVPixelFormat; cdecl; external av__codec; function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; @@ -2597,7 +2597,7 @@ const * Tell if an image really has transparent alpha values. * @return ored mask of FF_ALPHA_xxx constants *) -function img_get_alpha_info ({const} src: PAVPicture; +function img_get_alpha_info (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; cdecl; external av__codec; @@ -2608,14 +2608,14 @@ function img_get_alpha_info ({const} src: PAVPicture; * @deprecated Use the software scaler (swscale) instead. *) function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; - const src: PAVPicture; pix_fmt: TAVPixelFormat; + src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; cdecl; external av__codec; deprecated; {$IFEND} (* deinterlace a picture *) (* deinterlace - if not supported return -1 *) -function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; +function avpicture_deinterlace (dst: PAVPicture; src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; cdecl; external av__codec; @@ -2760,7 +2760,7 @@ procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: *) function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; cdecl; external av__codec; -function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; +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; @@ -2808,7 +2808,7 @@ function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; *) function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; var frame_size_ptr: integer; - {const} buf: pchar; buf_size: integer): integer; + buf: {const} pchar; buf_size: integer): integer; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 @@ -2850,7 +2850,7 @@ function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; *) function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; var frame_size_ptr : integer; - {const} buf: pchar; buf_size: integer): integer; + buf: {const} pchar; buf_size: integer): integer; cdecl; external av__codec; {$IFEND} @@ -2887,7 +2887,7 @@ function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; *) function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; var got_picture_ptr: integer; - {const} buf: PByte; buf_size: integer): integer; + buf: {const} PByte; buf_size: integer): integer; cdecl; external av__codec; (* Decode a subtitle message. Return -1 if error, otherwise return the @@ -2895,7 +2895,7 @@ function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; var got_sub_ptr: integer; - {const} buf: pchar; buf_size: integer): integer; + buf: {const} pchar; buf_size: integer): integer; cdecl; external av__codec; function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: pinteger; @@ -2923,7 +2923,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; {const} samples: PWord): integer; + buf_size: integer; samples: {const} PWord): integer; cdecl; external av__codec; (** @@ -2945,7 +2945,7 @@ function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; buf_size: integer; pict: PAVFrame): integer; cdecl; external av__codec; function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; - buf_size: integer; {const} sub: PAVSubtitle): integer; + buf_size: integer; sub: {const} PAVSubtitle): integer; cdecl; external av__codec; function avcodec_close (avctx: PAVCodecContext): integer; @@ -3040,10 +3040,10 @@ type priv_data_size: integer; parser_init: function (s: PAVCodecParserContext): integer; cdecl; parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; - {const} poutbuf: PPointer; poutbuf_size: PInteger; - {const} buf: pchar; buf_size: integer): integer; cdecl; + poutbuf: {const} PPointer; poutbuf_size: PInteger; + buf: {const} pchar; buf_size: integer): integer; cdecl; parser_close: procedure (s: PAVCodecParserContext); cdecl; - split: function (avctx: PAVCodecContext; {const} buf: pchar; + split: function (avctx: PAVCodecContext; buf: {const} pchar; buf_size: integer): integer; cdecl; next: PAVCodecParser; end; @@ -3070,13 +3070,13 @@ function av_parser_init (codec_id: integer): PAVCodecParserContext; function av_parser_parse (s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: pinteger; - const buf: pchar; buf_size: integer; + buf: {const} pchar; buf_size: integer; pts: int64; dts: int64): integer; cdecl; external av__codec; function av_parser_change (s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer; keyframe: integer): integer; + buf: {const} pchar; buf_size: integer; keyframe: integer): integer; cdecl; external av__codec; procedure av_parser_close (s: PAVCodecParserContext); cdecl; external av__codec; @@ -3173,21 +3173,21 @@ procedure av_realloc_static(ptr: pointer; size: Cardinal); (** * Copy image 'src' to 'dst'. *) -procedure av_picture_copy(dst: PAVPicture; {const} src: PAVPicture; +procedure av_picture_copy(dst: PAVPicture; src: {const} PAVPicture; pix_fmt: integer; width: integer; height: integer); cdecl; external av__codec; (** * Crop image top and left side. *) -function av_picture_crop(dst: PAVPicture; {const} src: PAVPicture; +function av_picture_crop(dst: PAVPicture; src: {const} PAVPicture; pix_fmt: integer; top_band: integer; left_band: integer): integer; cdecl; external av__codec; (** * Pad image. *) -function av_picture_pad(dst: PAVPicture; {const} src: PAVPicture; height: integer; width: integer; pix_fmt: integer; +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; cdecl; external av__codec; {$IFEND} @@ -3196,21 +3196,21 @@ function av_picture_pad(dst: PAVPicture; {const} src: PAVPicture; height: intege (** * @deprecated Use the software scaler (swscale) instead. *) -procedure img_copy (dst: PAVPicture; const src: PAVPicture; +procedure img_copy (dst: PAVPicture; src: {const} PAVPicture; pix_fmt: TAVPixelFormat; width: integer; height: integer); cdecl; external av__codec; deprecated; (** * @deprecated Use the software scaler (swscale) instead. *) -function img_crop (dst: PAVPicture; const src: PAVPicture; +function img_crop (dst: PAVPicture; src: {const} PAVPicture; pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; cdecl; external av__codec; deprecated; (** * @deprecated Use the software scaler (swscale) instead. *) -function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; +function img_pad (dst: PAVPicture; src: {const} PAVPicture; height, width: integer; pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; color: PInteger): integer; cdecl; external av__codec; deprecated; @@ -3231,7 +3231,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; {const} str: PChar): integer; +function av_parse_video_frame_size(width_ptr: PInteger; height_ptr: PInteger; str: {const} PChar): integer; cdecl; external av__codec; (** @@ -3243,7 +3243,7 @@ function av_parse_video_frame_size(width_ptr: PInteger; height_ptr: PInteger; {c * @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; {const} str: PChar): integer; +function av_parse_video_frame_rate(frame_rate: PAVRational; str: {const} PChar): integer; cdecl; external av__codec; {$IFEND} diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 4095ddc6..730a64e4 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -744,7 +744,7 @@ function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; cdecl; external av__format; {$IFEND} -function av_guess_image2_codec({const} filename: PChar): TCodecID; +function av_guess_image2_codec(filename: {const} PChar): TCodecID; cdecl; external av__format; (* XXX: use automatic init with either ELF sections or C file parser *) diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 745725b7..4a7d3a3b 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -101,7 +101,7 @@ type TURLProtocol = record name: pchar; - url_open: function (h: PURLContext; {const} filename: pchar; flags: integer): integer; cdecl; + 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; @@ -145,7 +145,7 @@ type max_packet_size: integer; checksum: longword; checksum_ptr: pchar; - update_checksum: function (checksum: Longword; {const} buf: pchar; size: cardinal): Longword; cdecl; + update_checksum: function (checksum: Longword; buf: {const} pchar; size: cardinal): Longword; cdecl; error: integer; ///< 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; @@ -160,7 +160,7 @@ type {$IFEND} end; -function url_open(h: PPointer; {const} filename: pchar; flags: integer): integer; +function url_open(h: PPointer; filename: {const} pchar; flags: integer): integer; cdecl; external av__format; function url_read (h: PURLContext; buf: pchar; size: integer): integer; cdecl; external av__format; @@ -170,7 +170,7 @@ function url_seek (h: PURLContext; pos: TOffset; whence: integer): TOffset; cdecl; external av__format; function url_close (h: PURLContext): integer; cdecl; external av__format; -function url_exist(const filename: pchar): integer; +function url_exist(filename: {const} pchar): integer; cdecl; external av__format; function url_filesize (h: PURLContext): TOffset; cdecl; external av__format; @@ -274,7 +274,7 @@ function av_alloc_put_byte( procedure put_byte(s: PByteIOContext; b: integer); cdecl; external av__format; -procedure put_buffer (s: PByteIOContext; {const} buf: pchar; size: integer); +procedure put_buffer (s: PByteIOContext; buf: {const} pchar; size: integer); cdecl; external av__format; procedure put_le64(s: PByteIOContext; val: int64); cdecl; external av__format; @@ -292,10 +292,10 @@ procedure put_le16(s: PByteIOContext; val: cardinal); cdecl; external av__format; procedure put_be16(s: PByteIOContext; val: cardinal); cdecl; external av__format; -procedure put_tag(s: PByteIOContext; {const} tag: pchar); +procedure put_tag(s: PByteIOContext; tag: {const} pchar); cdecl; external av__format; -procedure put_strz(s: PByteIOContext; {const} buf: pchar); +procedure put_strz(s: PByteIOContext; buf: {const} pchar); cdecl; external av__format; (** @@ -353,7 +353,7 @@ function url_fgetc(s: PByteIOContext): integer; cdecl; external av__format; (** @warning currently size is limited *) -function url_fprintf(s: PByteIOContext; {const} fmt: PChar; args: array of const): integer; +function url_fprintf(s: PByteIOContext; fmt: {const} PChar; args: array of const): integer; cdecl; external av__format; (** @note unlike fgets, the EOL character is not returned and a whole @@ -437,9 +437,9 @@ function url_resetbuf(s: PByteIOContext; flags: integer): integer; (** @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; const filename: pchar; flags: integer): integer; +function url_fopen(var s: PByteIOContext; filename: {const} pchar; flags: integer): integer; {$ELSE} -function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; +function url_fopen(s: PByteIOContext; filename: {const} pchar; flags: integer): integer; {$IFEND} cdecl; external av__format; function url_fclose(s: PByteIOContext): integer; @@ -509,7 +509,7 @@ function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; cdecl; external av__format; {$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 -function ff_crc04C11DB7_update(checksum: longword; {const} buf: PChar; len: cardinal): longword; +function ff_crc04C11DB7_update(checksum: longword; buf: {const} PChar; len: cardinal): longword; cdecl; external av__format; {$IFEND} function get_checksum(s: PByteIOContext): cardinal; @@ -518,7 +518,7 @@ procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cdecl; external av__format; (* udp.c *) -function udp_set_remote_url(h: PURLContext; {const} uri: pchar): integer; +function udp_set_remote_url(h: PURLContext; uri: {const} pchar): integer; cdecl; external av__format; function udp_get_local_port(h: PURLContext): integer; cdecl; external av__format; |