Merge commit '1c5805521c3e406886341d752ebf38f8d41e1d13'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Nov 2012 13:05:41 +0000 (14:05 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Nov 2012 13:05:41 +0000 (14:05 +0100)
* commit '1c5805521c3e406886341d752ebf38f8d41e1d13':
  PGS subtitles: Set AVSubtitle pts value
  configure: Refactor CPPFLAGS settings for glibc/uclibc
  configure: add basic support for ARM AArch64
  build: set -U__STRICT_ANSI__ for newlib

Conflicts:
configure
libavcodec/pgssubdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
libavcodec/pgssubdec.c

diff --cc configure
+++ b/configure
  
  # Deal with common $arch aliases
  case "$arch" in
 -    arm*)
+     aarch64|arm64)
+         arch="aarch64"
+     ;;
 +    arm*|iPad*)
          arch="arm"
      ;;
      mips*|IP*)
@@@ -3187,13 -2883,11 +3200,12 @@@ case $target_os i
              emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
          SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
          enable dos_paths
 +        enable_weak os2threads
          ;;
      gnu/kfreebsd)
-         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
+         add_cppflags -D_BSD_SOURCE
          ;;
      gnu)
-         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
          ;;
      qnx)
          add_cppflags -D_QNX_SOURCE
@@@ -3249,13 -2945,9 +3263,14 @@@ elif check_header _mingw.h; the
          "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
              (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
          die "ERROR: MinGW runtime version must be >= 3.15."
 +    if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
 +            __MINGW64_VERSION_MAJOR < 3"; then
 +        add_compat msvcrt/snprintf.o
 +        add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
 +    fi
  elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
      libc_type=newlib
+     add_cppflags -U__STRICT_ANSI__
  elif check_func_headers stdlib.h _get_doserrno; then
      libc_type=msvcrt
      add_compat strtod.o strtod=avpriv_strtod
@@@ -41,17 -40,13 +41,18 @@@ enum SegmentType 
      DISPLAY_SEGMENT      = 0x80,
  };
  
 -typedef struct PGSSubPresentation {
 +typedef struct PGSSubPictureReference {
      int x;
      int y;
 -    int id_number;
 -    int object_number;
 -    uint8_t composition_flag;
 +    int picture_id;
 +    int composition;
 +} PGSSubPictureReference;
 +
 +typedef struct PGSSubPresentation {
 +    int                    id_number;
 +    int                    object_count;
 +    PGSSubPictureReference *objects;
+     int64_t pts;
  } PGSSubPresentation;
  
  typedef struct PGSSubPicture {
  } PGSSubPicture;
  
  typedef struct PGSSubContext {
 +    AVClass *class;
      PGSSubPresentation presentation;
      uint32_t           clut[256];
 -    PGSSubPicture      picture;
 +    PGSSubPicture      pictures[UINT16_MAX];
-     int64_t            pts;
 +    int forced_subs_only;
  } PGSSubContext;
  
  static av_cold int init_decoder(AVCodecContext *avctx)
@@@ -293,17 -270,21 +293,20 @@@ static void parse_palette_segment(AVCod
   * @param buf pointer to the packet to process
   * @param buf_size size of packet to process
   * @todo TODO: Implement cropping
 - * @todo TODO: Implement forcing of subtitles
   */
  static void parse_presentation_segment(AVCodecContext *avctx,
-                                        const uint8_t *buf, int buf_size)
+                                        const uint8_t *buf, int buf_size,
+                                        int64_t pts)
  {
      PGSSubContext *ctx = avctx->priv_data;
  
      int w = bytestream_get_be16(&buf);
      int h = bytestream_get_be16(&buf);
  
 +    uint16_t object_index;
 +
+     ctx->presentation.pts = pts;
      av_dlog(avctx, "Video Dimensions %dx%d\n",
              w, h);
      if (av_image_check_size(w, h, 0, avctx) >= 0)
@@@ -394,15 -361,13 +397,15 @@@ static int display_end_segment(AVCodecC
       *      not been cleared by a subsequent empty display command.
       */
  
-     pts = ctx->pts != AV_NOPTS_VALUE ? ctx->pts : sub->pts;
++    pts = ctx->presentation.pts != AV_NOPTS_VALUE ? ctx->presentation.pts : sub->pts;
      memset(sub, 0, sizeof(*sub));
 -    sub->pts = ctx->presentation.pts;
 +    sub->pts = pts;
-     ctx->pts = AV_NOPTS_VALUE;
++    ctx->presentation.pts = AV_NOPTS_VALUE;
  
 -    // Blank if last object_number was 0.
 -    // Note that this may be wrong for more complex subtitles.
 -    if (!ctx->presentation.object_number)
 +    // Blank if last object_count was 0.
 +    if (!ctx->presentation.object_count)
          return 1;
 +
      sub->start_display_time = 0;
      sub->end_display_time   = 20000;
      sub->format             = 0;
@@@ -493,8 -452,7 +496,7 @@@ static int decode(AVCodecContext *avctx
              parse_picture_segment(avctx, buf, segment_length);
              break;
          case PRESENTATION_SEGMENT:
-             parse_presentation_segment(avctx, buf, segment_length);
-             ctx->pts = sub->pts;
 -            parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
++            parse_presentation_segment(avctx, buf, segment_length, sub->pts);
              break;
          case WINDOW_SEGMENT:
              /*