OSDN Git Service

Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 9 Jun 2011 02:47:19 +0000 (04:47 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 9 Jun 2011 02:47:19 +0000 (04:47 +0200)
* qatar/master:
  crypto: Use av_freep instead of av_free
  lavf: don't try to free private options if priv_data is NULL.
  swscale: fix types of assembly arguments.
  swscale: move two macros that are only used once into caller.
  swscale: remove unused function.
  options: Add missing braces around struct initializer.
  mov: Remove leftover crufty debug statement with references to a local file.
  dvbsubdec: Fix compilation of debug code.
  Remove all uses of now deprecated metadata functions.
  Move metadata API from lavf to lavu.

Conflicts:
doc/APIchanges
libavformat/aiffdec.c
libavformat/asfdec.c
libavformat/avformat.h
libavformat/avidec.c
libavformat/cafdec.c
libavformat/matroskaenc.c
libavformat/mov.c
libavformat/mp3enc.c
libavformat/wtv.c
libavutil/avutil.h
libavutil/internal.h
libswscale/swscale.c
libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
61 files changed:
1  2 
doc/APIchanges
ffmpeg.c
ffprobe.c
ffserver.c
libavcodec/dvbsubdec.c
libavformat/aiffdec.c
libavformat/apetag.c
libavformat/applehttp.c
libavformat/asfdec.c
libavformat/asfenc.c
libavformat/avformat.h
libavformat/avidec.c
libavformat/avienc.c
libavformat/cafdec.c
libavformat/ffmetadec.c
libavformat/ffmetaenc.c
libavformat/flacenc.c
libavformat/flvdec.c
libavformat/flvenc.c
libavformat/id3v1.c
libavformat/id3v2.c
libavformat/iff.c
libavformat/matroskadec.c
libavformat/matroskaenc.c
libavformat/metadata.c
libavformat/metadata.h
libavformat/mov.c
libavformat/movenc.c
libavformat/mp3dec.c
libavformat/mp3enc.c
libavformat/mpc.c
libavformat/mpegts.c
libavformat/mpegtsenc.c
libavformat/nsvdec.c
libavformat/nutdec.c
libavformat/nutenc.c
libavformat/oggdec.h
libavformat/oggenc.c
libavformat/options.c
libavformat/r3d.c
libavformat/rmdec.c
libavformat/rmenc.c
libavformat/rpl.c
libavformat/rtpdec_asf.c
libavformat/rtsp.c
libavformat/sauce.c
libavformat/sdp.c
libavformat/soxdec.c
libavformat/soxenc.c
libavformat/tta.c
libavformat/tty.c
libavformat/utils.c
libavformat/vorbiscomment.c
libavformat/vorbiscomment.h
libavformat/vqf.c
libavformat/wc3movie.c
libavformat/wv.c
libavutil/avutil.h
libavutil/internal.h
libswscale/swscale.c
libswscale/x86/swscale_template.c

diff --cc doc/APIchanges
@@@ -13,43 -13,11 +13,48 @@@ libavutil:   2011-04-1
  
  API changes, most recent first:
  
 +2011-06-06 - xxxxxx - lavfi 2.14.0 - AVFilterBufferRefAudioProps
 +  Remove AVFilterBufferRefAudioProps.size, and use nb_samples in
 +  avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in
 +  place of size.
 +
 +2011-06-06 - xxxxxx - lavu 51.6.0 - av_samples_alloc()
 +  Switch nb_channels and nb_samples parameters order in
 +  av_samples_alloc().
 +
 +2011-06-06 - xxxxxx - lavu 51.5.0 - av_samples_*
 +  Change the data layout created by av_samples_fill_arrays() and
 +  av_samples_alloc().
 +
 +2011-06-06 - xxxxxx - lavfi 2.13.0 - vsrc_buffer.h
 +  Make av_vsrc_buffer_add_video_buffer_ref() accepts an additional
 +  flags parameter in input.
 +
 +2011-06-03 - xxxxxx - lavfi 2.12.0 - avfilter_link_free()
 +  Add avfilter_link_free() function.
 +
 +2011-05-28 - xxxxxx - lavu 51.3.0 - pixdesc.h
 +  Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
 +  avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
 +
 +2011-05-22 - xxxxxx - lavf 53.2.0 - avformat.h
 +  Introduce avformat_alloc_output_context2() and deprecate
 +  avformat_alloc_output_context().
 +
 +2011-05-22 - xxxxxx - lavfi 2.10.0 - vsrc_buffer.h
 +  Make libavfilter/vsrc_buffer.h public.
 +
 +2011-05-XX - XXXXXX - lavfi 2.8.0 - avcodec.h
 +  Add av_vsrc_buffer_add_frame() to libavfilter/avcodec.h.
 +
 +2011-05-XX - XXXXXX - lavfi 2.6.0 - avcodec.h
 +  Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
 +
+ 2011-06-xx - xxxxxxx - lavu 51.5.0 - AVMetadata
+   Move AVMetadata from lavf to lavu and rename it to
+   AVDictionary -- new installed header dict.h.
+   All av_metadata_* functions renamed to av_dict_*.
  2011-06-07 - a6703fa - lavu 51.4.0 - av_get_bytes_per_sample()
    Add av_get_bytes_per_sample() in libavutil/samplefmt.h.
    Deprecate av_get_bits_per_sample_fmt().
diff --cc ffmpeg.c
Simple merge
diff --cc ffprobe.c
Simple merge
diff --cc ffserver.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -644,11 -633,7 +650,11 @@@ typedef struct AVProgram 
      enum AVDiscard discard;        ///< selects which program to discard and which to feed to the caller
      unsigned int   *stream_index;
      unsigned int   nb_stream_indexes;
-     AVMetadata *metadata;
+     AVDictionary *metadata;
 +
 +    int program_num;
 +    int pmt_pid;
 +    int pcr_pid;
  } AVProgram;
  
  #define AVFMTCTX_NOHEADER      0x0001 /**< signal that no header is present
@@@ -25,7 -25,7 +25,8 @@@
  #include <strings.h>
  #include "libavutil/intreadwrite.h"
  #include "libavutil/bswap.h"
 +#include "libavutil/opt.h"
+ #include "libavutil/dict.h"
  #include "avformat.h"
  #include "avi.h"
  #include "dv.h"
Simple merge
@@@ -185,9 -186,9 +186,9 @@@ static void read_info_chunk(AVFormatCon
      for (i = 0; i < nb_entries; i++) {
          char key[32];
          char value[1024];
 -        avio_get_str(pb, INT_MAX, key,   sizeof(key));
 -        avio_get_str(pb, INT_MAX, value, sizeof(value));
 +        get_strz(pb, key, sizeof(key));
 +        get_strz(pb, value, sizeof(value));
-         av_metadata_set2(&s->metadata, key, value, 0);
+         av_dict_set(&s->metadata, key, value, 0);
      }
  }
  
@@@ -123,10 -124,10 +124,10 @@@ static int read_tag(uint8_t *line, AVDi
  
  static int read_header(AVFormatContext *s, AVFormatParameters *ap)
  {
-     AVMetadata **m = &s->metadata;
+     AVDictionary **m = &s->metadata;
      uint8_t line[1024];
  
 -    while(!s->pb->eof_reached) {
 +    while(!url_feof(s->pb)) {
          get_line(s->pb, line, sizeof(line));
  
          if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -28,8 -29,8 +28,9 @@@
   * http://wiki.multimedia.cx/index.php?title=IFF
   */
  
 +#include "libavcodec/bytestream.h"
  #include "libavutil/intreadwrite.h"
+ #include "libavutil/dict.h"
  #include "avformat.h"
  
  #define ID_8SVX       MKTAG('8','S','V','X')
Simple merge
@@@ -586,27 -587,25 +587,27 @@@ static int mkv_write_tracks(AVFormatCon
                  // XXX: interlace flag?
                  put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width);
                  put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height);
 -                if ((tag = av_dict_get(s->metadata, "stereo_mode", NULL, 0))) {
 -                    uint8_t stereo_fmt = atoi(tag->value);
 -                    int valid_fmt = 0;
 -
 -                    switch (mkv->mode) {
 -                    case MODE_WEBM:
 -                        if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM
 -                            || stereo_fmt == MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT)
 -                            valid_fmt = 1;
 -                        break;
 -                    case MODE_MATROSKAv2:
 -                        if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL)
 -                            valid_fmt = 1;
 -                        break;
 -                    }
 -
 -                    if (valid_fmt)
 -                        put_ebml_uint (pb, MATROSKA_ID_VIDEOSTEREOMODE, stereo_fmt);
 +
-                 if ((tag = av_metadata_get(st->metadata, "stereo_mode", NULL, 0)) ||
-                     (tag = av_metadata_get( s->metadata, "stereo_mode", NULL, 0))) {
++                if ((tag = av_dict_get(st->metadata, "stereo_mode", NULL, 0)) ||
++                    (tag = av_dict_get( s->metadata, "stereo_mode", NULL, 0))) {
 +                    // save stereo mode flag
 +                    uint64_t st_mode = MATROSKA_VIDEO_STEREO_MODE_COUNT;
 +
 +                    for (j=0; j<MATROSKA_VIDEO_STEREO_MODE_COUNT; j++)
 +                        if (!strcmp(tag->value, matroska_video_stereo_mode[j])){
 +                            st_mode = j;
 +                            break;
 +                        }
 +
 +                    if ((mkv->mode == MODE_WEBM && st_mode > 3 && st_mode != 11)
 +                        || st_mode >= MATROSKA_VIDEO_STEREO_MODE_COUNT) {
 +                        av_log(s, AV_LOG_ERROR,
 +                               "The specified stereo mode is not valid.\n");
 +                        return AVERROR(EINVAL);
 +                    } else
 +                        put_ebml_uint(pb, MATROSKA_ID_VIDEOSTEREOMODE, st_mode);
                  }
 +
                  if (st->sample_aspect_ratio.num) {
                      int d_width = codec->width*av_q2d(st->sample_aspect_ratio);
                      put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width);
@@@ -751,8 -750,8 +752,8 @@@ static int mkv_write_tag(AVFormatContex
          put_ebml_uint(s->pb, elementid, uid);
      end_ebml_master(s->pb, targets);
  
-     while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX)))
+     while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
 -        if (strcasecmp(t->key, "title"))
 +        if (strcasecmp(t->key, "title") && strcasecmp(t->key, "stereo_mode"))
              mkv_write_simpletag(s->pb, t);
  
      end_ebml_master(s->pb, tag);
Simple merge
Simple merge
@@@ -84,9 -85,9 +85,9 @@@ static int mov_metadata_track_or_disc_n
  
      avio_rb16(pb); // unknown
      snprintf(buf, sizeof(buf), "%d", avio_rb16(pb));
-     av_metadata_set2(&c->fc->metadata, type, buf, 0);
 -    av_dict_set(&c->fc->metadata, "track", buf, 0);
++    av_dict_set(&c->fc->metadata, type, buf, 0);
  
 -    avio_rb16(pb); // total tracks
 +    avio_rb16(pb); // total tracks/discs
  
      return 0;
  }
Simple merge
Simple merge
  #include "libavutil/avstring.h"
  #include "libavutil/intreadwrite.h"
  #include "libavutil/opt.h"
 +#include "libavcodec/mpegaudio.h"
 +#include "libavcodec/mpegaudiodata.h"
 +#include "libavcodec/mpegaudiodecheader.h"
 +#include "libavformat/avio_internal.h"
+ #include "libavutil/dict.h"
  
  static int id3v1_set_string(AVFormatContext *s, const char *key,
                              uint8_t *buf, int buf_size)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
  #include <string.h>
  #include "libavutil/avstring.h"
  #include "libavutil/base64.h"
+ #include "libavutil/dict.h"
  #include "libavutil/parseutils.h"
  #include "libavcodec/xiph.h"
 +#include "libavcodec/mpeg4audio.h"
  #include "avformat.h"
  #include "internal.h"
  #include "avc.h"
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -25,8 -25,8 +25,9 @@@
  #include "avio_internal.h"
  #include "internal.h"
  #include "libavcodec/internal.h"
 +#include "libavcodec/raw.h"
  #include "libavutil/opt.h"
+ #include "libavutil/dict.h"
  #include "metadata.h"
  #include "id3v2.h"
  #include "libavutil/avstring.h"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -40,7 -40,7 +40,7 @@@
  #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
  
  #define LIBAVUTIL_VERSION_MAJOR 51
- #define LIBAVUTIL_VERSION_MINOR  7
 -#define LIBAVUTIL_VERSION_MINOR  5
++#define LIBAVUTIL_VERSION_MINOR  8
  #define LIBAVUTIL_VERSION_MICRO  0
  
  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
  #include "config.h"
  #include "attributes.h"
  #include "timer.h"
 +#include "cpu.h"
+ #include "dict.h"
+ struct AVDictionary {
+     int count;
+     AVDictionaryEntry *elems;
+ };
  
  #ifndef attribute_align_arg
  #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
@@@ -380,40 -285,13 +380,14 @@@ yuv2NBPS(10, LE, 0)
  yuv2NBPS(16, BE, 1);
  yuv2NBPS(16, LE, 0);
  
- static inline void yuv2yuvX16_c(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                 const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize,
-                                 const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW,
-                                 enum PixelFormat dstFormat)
- {
-     if (isNBPS(dstFormat)) {
-         const int depth = av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1+1;
-         yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize,
-                               chrFilter, chrUSrc, chrVSrc, chrFilterSize,
-                               alpSrc,
-                               dest, uDest, vDest, aDest,
-                               dstW, chrDstW, isBE(dstFormat), depth);
-     } else {
-         if (isBE(dstFormat)) {
-             yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize,
-                                    chrFilter, chrUSrc, chrVSrc, chrFilterSize,
-                                    alpSrc,
-                                    dest, uDest, vDest, aDest,
-                                    dstW, chrDstW, 1, 16);
-         } else {
-             yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize,
-                                    chrFilter, chrUSrc, chrVSrc, chrFilterSize,
-                                    alpSrc,
-                                    dest, uDest, vDest, aDest,
-                                    dstW, chrDstW, 0, 16);
-         }
-     }
- }
- static void yuv2yuvX_c(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                const int16_t *chrFilter, const int16_t **chrUSrc,
-                                const int16_t **chrVSrc, int chrFilterSize,
-                                const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW,
-                                const uint8_t *lumDither, const uint8_t *chrDither)
+ static inline void yuv2yuvX_c(SwsContext *c, const int16_t *lumFilter,
+                               const int16_t **lumSrc, int lumFilterSize,
+                               const int16_t *chrFilter, const int16_t **chrUSrc,
+                               const int16_t **chrVSrc,
+                               int chrFilterSize, const int16_t **alpSrc,
+                               uint8_t *dest, uint8_t *uDest, uint8_t *vDest,
 -                              uint8_t *aDest, int dstW, int chrDstW)
++                              uint8_t *aDest, int dstW, int chrDstW,
++                              const uint8_t *lumDither, const uint8_t *chrDither)
  {
      //FIXME Optimize (just quickly written not optimized..)
      int i;
@@@ -248,12 -217,25 +228,26 @@@ static inline void RENAME(yuv2yuv1_ar)(
  
      while (p--) {
          if (dst[p]) {
 +            int i;
 +            for(i=0; i<8; i++) c->dither16[i] = i<2 ? lumDither[i] : chrDither[i];
              __asm__ volatile(
-                 YSCALEYUV2YV121_ACCURATE
+                 "mov %2, %%"REG_a"                    \n\t"
 -                "pcmpeqw %%mm7, %%mm7                 \n\t"
 -                "psrlw                 $15, %%mm7     \n\t"
 -                "psllw                  $6, %%mm7     \n\t"
++                "movq               0(%3), %%mm6      \n\t"
++                "movq               8(%3), %%mm7      \n\t"
+                 ".p2align                4            \n\t" /* FIXME Unroll? */
+                 "1:                                   \n\t"
+                 "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"
+                 "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"
 -                "paddsw             %%mm7, %%mm0      \n\t"
++                "paddsw             %%mm6, %%mm0      \n\t"
+                 "paddsw             %%mm7, %%mm1      \n\t"
+                 "psraw                 $7, %%mm0      \n\t"
+                 "psraw                 $7, %%mm1      \n\t"
+                 "packuswb           %%mm1, %%mm0      \n\t"
+                 MOVNTQ(%%mm0, (%1, %%REGa))
+                 "add                   $8, %%"REG_a"  \n\t"
+                 "jnc                   1b             \n\t"
                  :: "r" (src[p]), "r" (dst[p] + counter[p]),
 -                   "g" (-counter[p])
 +                   "g" (-counter[p]), "r"(c->dither16)
                  : "%"REG_a
              );
          }