From ad56bc83540ddddd204e8cf03a41c2ac1aff54db Mon Sep 17 00:00:00 2001
From: brian-ch <brian-ch@b956fd51-792f-4845-bead-9b4dfca2ff2c>
Date: Wed, 25 Dec 2013 17:12:29 +0000
Subject: fixes in avcodec, and update avutil

git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3055 b956fd51-792f-4845-bead-9b4dfca2ff2c
---
 src/lib/ffmpeg-2.1/avcodec.pas | 231 +++++++++++++++++++++--------------------
 src/lib/ffmpeg-2.1/avutil.pas  |   5 +
 2 files changed, 121 insertions(+), 115 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/ffmpeg-2.1/avcodec.pas b/src/lib/ffmpeg-2.1/avcodec.pas
index 8bfbe6bb..264c9672 100644
--- a/src/lib/ffmpeg-2.1/avcodec.pas
+++ b/src/lib/ffmpeg-2.1/avcodec.pas
@@ -693,6 +693,7 @@ const
  * @see avcodec_get_descriptor()
  *)
 type
+  PAVCodecDescriptor = ^TAVCodecDescriptor;
   TAVCodecDescriptor = record
     id: TAVCodecID;
     type_: TAVMediaType;
@@ -1533,8 +1534,6 @@ const
   FF_DECODE_ERROR_MISSING_REFERENCE = 2;
 }
 
-type
-  PAVCodecContext = ^TAVCodecContext;
 
 { This is removed in avcodec.h. For the time being (2013) only commented
 (**
@@ -1962,39 +1961,39 @@ type
  * The position of these field in the structure is not part of the ABI,
  * they should not be accessed directly outside libavcodec.
  *)
-function  av_frame_get_best_effort_timestamp(frame: {const} PAVFrame): cint64;
+function  av_frame_get_best_effort_timestamp(frame: {const PAVFrame): cint64;
   cdecl; external av__codec;
 procedure av_frame_set_best_effort_timestamp(frame: PAVFrame; val: cint64);
   cdecl; external av__codec;
-function  av_frame_get_pkt_duration         (frame: {const} PAVFrame): cint64;
+function  av_frame_get_pkt_duration         (frame: {const PAVFrame): cint64;
   cdecl; external av__codec;
 procedure av_frame_get_pkt_duration         (frame: PAVFrame; val: cint64);
   cdecl; external av__codec;
-function  av_frame_get_pkt_pos              (frame: {const} PAVFrame): cint64;
+function  av_frame_get_pkt_pos              (frame: {const PAVFrame): cint64;
   cdecl; external av__codec;
 procedure av_frame_get_pkt_pos              (frame: PAVFrame; val: cint64);
   cdecl; external av__codec;
-function  av_frame_get_channel_layout       (frame: {const} PAVFrame): cint64;
+function  av_frame_get_channel_layout       (frame: {const PAVFrame): cint64;
   cdecl; external av__codec;
 procedure av_frame_get_channel_layout       (frame: PAVFrame; val: cint64);
   cdecl; external av__codec;
-function  av_frame_get_channels             (frame: {const} PAVFrame): cint;
+function  av_frame_get_channels             (frame: {const PAVFrame): cint;
   cdecl; external av__codec;
 procedure av_frame_set_channels             (frame: PAVFrame; val: cint);
   cdecl; external av__codec;
-function  av_frame_get_sample_rate          (frame: {const} PAVFrame): cint;
+function  av_frame_get_sample_rate          (frame: {const PAVFrame): cint;
   cdecl; external av__codec;
 procedure av_frame_set_sample_rate          (frame: PAVFrame; val: cint);
   cdecl; external av__codec;
-function  av_frame_get_metadata             (frame: {const} PAVFrame): PAVDictionary;
+function  av_frame_get_metadata             (frame: {const PAVFrame): PAVDictionary;
   cdecl; external av__codec;
 procedure av_frame_set_metadata             (frame: PAVFrame; val: PAVDictionary);
   cdecl; external av__codec;
-function  av_frame_get_decode_error_flags   (frame: {const} PAVFrame): cint;
+function  av_frame_get_decode_error_flags   (frame: {const PAVFrame): cint;
   cdecl; external av__codec;
 procedure av_frame_set_decode_error_flags   (frame: PAVFrame; val: cint);
   cdecl; external av__codec;
-function  av_frame_get_pkt_size(frame: {const} PAVFrame): cint;
+function  av_frame_get_pkt_size(frame: {const PAVFrame): cint;
   cdecl; external av__codec;
 procedure av_frame_set_pkt_size(frame: PAVFrame; val: cint);
   cdecl; external av__codec;
@@ -2004,6 +2003,7 @@ type
   TAVCodecInternal = record
   end;
   PAVCodecInternal = ^TAVCodecInternal;
+  PAVCodecContext = ^TAVCodecContext;
 
   PAVClass = ^TAVClass;
 
@@ -3563,21 +3563,6 @@ type
     sub_charenc_mode: cint;
   end; {TAVCodecContext}
 
-const
-  FF_SUB_CHARENC_MODE_DO_NOTHING  = -1;  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
-  FF_SUB_CHARENC_MODE_AUTOMATIC   = 0;   ///< libavcodec will select the mode itself
-  FF_SUB_CHARENC_MODE_PRE_DECODER = 1;   ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
-
-  function  av_codec_get_pkt_timebase(avctx: {const} PAVCodecContext): TAVRational;
-  procedure av_codec_set_pkt_timebase(avctx: {const} PAVCodecContext; val: TAVRational);
-
-  function  av_codec_get_codec_descriptor(avctx: {const} PAVCodecContext): PAVCodecDescriptor;
-  procedure av_codec_set_codec_descriptor(avctx: {const} PAVCodecContext; desc: {const} PAVCodecDescriptor);
-
-  function  av_codec_get_lowres(avctx: {const} PAVCodecContext): cint;
-  procedure av_codec_set_lowres(avctx: PAVCodecContext; val: cint);
-
-type
   (**
    * AVProfile.
    *)
@@ -3587,8 +3572,79 @@ type
     name: {const} PAnsiChar; ///< short name for the profile
   end; {TAVProfile}
 
+  TAVSubtitleType = (
+    SUBTITLE_NONE,
+
+    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
+
+    (**
+     * Plain text, the text field must be set by the decoder and is
+     * authoritative. ass and pict fields may contain approximations.
+     *)
+    SUBTITLE_TEXT,
+
+    (**
+     * Formatted text, the ass field must be set by the decoder and is
+     * authoritative. pict and text fields may contain approximations.
+     *)
+    SUBTITLE_ASS
+  ); {TAVSubtitleType}
+
+  (**
+   * @defgroup lavc_picture AVPicture
+   *
+   * Functions for working with AVPicture
+   * @{
+   *)
+
+  (**
+   * four components are given, that's all.
+   * the last component is alpha
+   *)
+    PAVPicture = ^TAVPicture;
+    TAVPicture = record
+      data: array [0..AV_NUM_DATA_POINTERS - 1] of PByteArray;
+      linesize: array [0..AV_NUM_DATA_POINTERS - 1] of cint;       ///< number of bytes per line
+    end; {TAVPicture}
+
+  PPAVSubtitleRect = ^PAVSubtitleRect;
+  PAVSubtitleRect = ^TAVSubtitleRect;
+  TAVSubtitleRect = record
+    x: cint;        ///< top left corner  of pict, undefined when pict is not set
+    y: cint;        ///< top left corner  of pict, undefined when pict is not set
+    w: cint;        ///< width            of pict, undefined when pict is not set
+    h: cint;        ///< height           of pict, undefined when pict is not set
+    nb_colors: cint; ///< number of colors in pict, undefined when pict is not set
+
+    (**
+     * data+linesize for the bitmap of this subtitle.
+     * can be set for text/ass as well once they where rendered
+     *)
+    pict: TAVPicture;
+    type_: TAVSubtitleType;
+
+    text: PAnsiChar;                     ///< 0 terminated plain UTF-8 text
+
+    (**
+     * 0 terminated ASS/SSA compatible event line.
+     * The presentation of this is unaffected by the other values in this
+     * struct.
+     *)
+    ass: PAnsiChar;
+
+    flags: cint;
+  end; {TAVSubtitleRect}
+
+  PPAVSubtitle = ^PAVSubtitle;
+  PAVSubtitle = ^TAVSubtitle;
   TAVSubtitle = record
-  end;
+    format: cuint16; (* 0 = graphics *)
+    start_display_time: cuint32; (* relative to packet pts, in ms *)
+    end_display_time: cuint32; (* relative to packet pts, in ms *)
+    num_rects: cuint;
+    rects: PPAVSubtitleRect;
+    pts: cint64;     ///< Same as packet pts, in AV_TIME_BASE
+  end; {TAVSubtitle}
 
 (**
  * AVCodec.
@@ -3779,87 +3835,32 @@ type
     priv_data_size: cint;
   end; {TAVHWAccel}
 
-(**
- * @defgroup lavc_picture AVPicture
- *
- * Functions for working with AVPicture
- * @{
- *)
-
-(**
- * four components are given, that's all.
- * the last component is alpha
- *)
-  PAVPicture = ^TAVPicture;
-  TAVPicture = record
-    data: array [0..AV_NUM_DATA_POINTERS - 1] of PByteArray;
-    linesize: array [0..AV_NUM_DATA_POINTERS - 1] of cint;       ///< number of bytes per line
-  end; {TAVPicture}
-
-/**
- * @}
- */
-
 const
-  AV_SUBTITLE_FLAG_FORCED = $00000001;
-
-type
-  TAVSubtitleType = (
-    SUBTITLE_NONE,
-
-    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
-
-    (**
-     * Plain text, the text field must be set by the decoder and is
-     * authoritative. ass and pict fields may contain approximations.
-     *)
-    SUBTITLE_TEXT,
-
-    (**
-     * Formatted text, the ass field must be set by the decoder and is
-     * authoritative. pict and text fields may contain approximations.
-     *)
-    SUBTITLE_ASS
-  ); {TAVSubtitleType}
-
-  PPAVSubtitleRect = ^PAVSubtitleRect;
-  PAVSubtitleRect = ^TAVSubtitleRect;
-  TAVSubtitleRect = record
-    x: cint;        ///< top left corner  of pict, undefined when pict is not set
-    y: cint;        ///< top left corner  of pict, undefined when pict is not set
-    w: cint;        ///< width            of pict, undefined when pict is not set
-    h: cint;        ///< height           of pict, undefined when pict is not set
-    nb_colors: cint; ///< number of colors in pict, undefined when pict is not set
+  FF_SUB_CHARENC_MODE_DO_NOTHING  = -1;  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
+  FF_SUB_CHARENC_MODE_AUTOMATIC   = 0;   ///< libavcodec will select the mode itself
+  FF_SUB_CHARENC_MODE_PRE_DECODER = 1;   ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
 
-    (**
-     * data+linesize for the bitmap of this subtitle.
-     * can be set for text/ass as well once they where rendered
-     *)
-    pict: TAVPicture;
-    type_: TAVSubtitleType;
+  function  av_codec_get_pkt_timebase(avctx: {const} PAVCodecContext): TAVRational;
+    cdecl; external av__codec;
+  procedure av_codec_set_pkt_timebase(avctx: {const} PAVCodecContext; val: TAVRational);
+    cdecl; external av__codec;
 
-    text: PAnsiChar;                     ///< 0 terminated plain UTF-8 text
+  function  av_codec_get_codec_descriptor(avctx: {const} PAVCodecContext): PAVCodecDescriptor;
+    cdecl; external av__codec;
+  procedure av_codec_set_codec_descriptor(avctx: {const} PAVCodecContext; desc: {const} PAVCodecDescriptor);
+    cdecl; external av__codec;
 
-    (**
-     * 0 terminated ASS/SSA compatible event line.
-     * The presentation of this is unaffected by the other values in this
-     * struct.
-     *)
-    ass: PAnsiChar;
+  function  av_codec_get_lowres(avctx: {const} PAVCodecContext): cint;
+    cdecl; external av__codec;
+  procedure av_codec_set_lowres(avctx: PAVCodecContext; val: cint);
+    cdecl; external av__codec;
 
-    flags: cint;
-  end; {TAVSubtitleRect}
+(**
+ * @
+ *)
 
-  PPAVSubtitle = ^PAVSubtitle;
-  PAVSubtitle = ^TAVSubtitle;
-  TAVSubtitle = record
-    format: cuint16; (* 0 = graphics *)
-    start_display_time: cuint32; (* relative to packet pts, in ms *)
-    end_display_time: cuint32; (* relative to packet pts, in ms *)
-    num_rects: cuint;
-    rects: PPAVSubtitleRect;
-    pts: cint64;     ///< Same as packet pts, in AV_TIME_BASE
-  end; {TAVSubtitle}
+const
+  AV_SUBTITLE_FLAG_FORCED = $00000001;
 
 (**
  * If c is NULL, returns the first registered codec,
@@ -4208,7 +4209,7 @@ function av_grow_packet(pkt: PAVPacket; grow_by: cint): cint;
  *
  * @return 0 on success, a negative AVERROR on error
  *)
-function av_packet_from_data(pkt: PAVPacket; data: Puint8; size: cint): cint;
+function av_packet_from_data(pkt: PAVPacket; data: PByte; size: cint): cint;
   cdecl; external av__codec;
 
 (*
@@ -4284,14 +4285,14 @@ function av_packet_merge_side_data(pkt: PAVPacket): cint;
 function av_packet_split_side_data(pkt: PAVPacket): cint;
   cdecl; external av__codec;
 
-/**
- * @}
- */
+(**
+ * @
+ *)
 
-/**
+(**
  * @addtogroup lavc_decoding
- * @{
- */
+ * @
+ *)
 
 (**
  * Find a registered decoder with a matching codec ID.
@@ -4539,10 +4540,10 @@ function avcodec_decode_subtitle2(avctx: PAVCodecContext; sub: PAVSubtitle;
                           avpkt: PAVPacket): cint;
   cdecl; external av__codec;
 
-/**
+(**
  * @defgroup lavc_parsing Frame parsing
- * @{
- */
+ * @
+ *)
 
 type
   TAVPictureStructure = (
@@ -5270,7 +5271,7 @@ function avcodec_find_best_pix_fmt_of_list(pix_fmt_list: PAVPixelFormat;
  * @return The best pixel format to convert to or -1 if none was found.
  *)
 function avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1: TAVPixelFormat; dst_pix_fmt2: TAVPixelFormat;
-                                        src_pix_fmt: TAVPixelFormat; has_alpha: cint; loss_ptr: Pcint)): TAVPixelFormat;
+                                        src_pix_fmt: TAVPixelFormat; has_alpha: cint; loss_ptr: Pcint): TAVPixelFormat;
   cdecl; external av__codec;
 
 {$IFDEF AV_HAVE_INCOMPATIBLE_LIBAV_ABI}
@@ -5294,7 +5295,7 @@ function avcodec_default_get_format(s: PAVCodecContext; fmt: {const} PAVPixelFor
 procedure avcodec_set_dimensions(s: PAVCodecContext; width: cint; height: cint);
   cdecl; external av__codec;
 
- * Put a string representing the codec tag codec_tag in buf.
+(* Put a string representing the codec tag codec_tag in buf.
  *
  * @param buf_size size in bytes of buf
  * @return the length of the string that would have been generated if
@@ -5394,7 +5395,7 @@ function av_get_exact_bits_per_sample(codec_id: TAVCodecID): cint;
  * @return             frame duration, in samples, if known. 0 if not able to
  *                     determine.
  *)
-function av_get_audio_frame_duration(avctx: PAVCodecContext, frame_bytes: cint): cint;
+function av_get_audio_frame_duration(avctx: PAVCodecContext; frame_bytes: cint): cint;
   cdecl; external av__codec;
 
 type
diff --git a/src/lib/ffmpeg-2.1/avutil.pas b/src/lib/ffmpeg-2.1/avutil.pas
index 9be506f8..5ce5141b 100644
--- a/src/lib/ffmpeg-2.1/avutil.pas
+++ b/src/lib/ffmpeg-2.1/avutil.pas
@@ -231,6 +231,11 @@ function av_int_list_length({const} list: pointer; term: cuint64): cuint;
 
 {$INCLUDE libavutil/samplefmt.pas}
 
+{$INCLUDE libavutil/buffer.pas}
+
+{$INCLUDE libavutil/frame.pas}
+
+
 (* libavutil/common.h *) // until now MKTAG and MKBETAG is all from common.h KMS 19/5/2010
 
 (**
-- 
cgit v1.2.3