Merge commit '57231e4d5b467833fb289439cd35a92513bb55c1'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Dec 2012 14:53:56 +0000 (15:53 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Dec 2012 14:54:18 +0000 (15:54 +0100)
* commit '57231e4d5b467833fb289439cd35a92513bb55c1':
  tak: demuxer, parser, and decoder

Not merged as requested by Author and Maintainer of tak in FFmpeg.
I just merged a few typo fixes and minor cosmetic improvments.

Conflicts:
Changelog
libavcodec/Makefile
libavcodec/allcodecs.c
libavcodec/avcodec.h
libavcodec/tak.c
libavcodec/tak.h
libavcodec/tak_parser.c
libavcodec/takdec.c
libavcodec/version.h
libavformat/takdec.c
libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/avcodec.h
libavcodec/tak.c
libavcodec/tak.h
libavcodec/tak_parser.c
libavcodec/utils.c

@@@ -431,15 -405,9 +431,16 @@@ enum AVCodecID 
      AV_CODEC_ID_RALF,
      AV_CODEC_ID_IAC,
      AV_CODEC_ID_ILBC,
 -    AV_CODEC_ID_OPUS,
 +    AV_CODEC_ID_OPUS_DEPRECATED,
      AV_CODEC_ID_COMFORT_NOISE,
 -    AV_CODEC_ID_TAK,
++    AV_CODEC_ID_TAK_DEPRECATED,
 +    AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
 +    AV_CODEC_ID_8SVX_RAW    = MKBETAG('8','S','V','X'),
 +    AV_CODEC_ID_SONIC       = MKBETAG('S','O','N','C'),
 +    AV_CODEC_ID_SONIC_LS    = MKBETAG('S','O','N','L'),
 +    AV_CODEC_ID_PAF_AUDIO   = MKBETAG('P','A','F','A'),
 +    AV_CODEC_ID_OPUS        = MKBETAG('O','P','U','S'),
 +    AV_CODEC_ID_TAK         = MKBETAG('t','B','a','K'),
  
      /* subtitle codecs */
      AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
- #include "tak.h"
+ #include "libavutil/bswap.h"
  #include "libavutil/crc.h"
  #include "libavutil/intreadwrite.h"
- #include "libavutil/bswap.h"
+ #include "tak.h"
  
 +static const int64_t tak_channel_layouts[] = {
 +    0,
 +    AV_CH_FRONT_LEFT,
 +    AV_CH_FRONT_RIGHT,
 +    AV_CH_FRONT_CENTER,
 +    AV_CH_LOW_FREQUENCY,
 +    AV_CH_BACK_LEFT,
 +    AV_CH_BACK_RIGHT,
 +    AV_CH_FRONT_LEFT_OF_CENTER,
 +    AV_CH_FRONT_RIGHT_OF_CENTER,
 +    AV_CH_BACK_CENTER,
 +    AV_CH_SIDE_LEFT,
 +    AV_CH_SIDE_RIGHT,
 +    AV_CH_TOP_CENTER,
 +    AV_CH_TOP_FRONT_LEFT,
 +    AV_CH_TOP_FRONT_CENTER,
 +    AV_CH_TOP_FRONT_RIGHT,
 +    AV_CH_TOP_BACK_LEFT,
 +    AV_CH_TOP_BACK_CENTER,
 +    AV_CH_TOP_BACK_RIGHT,
 +};
 +
  static const uint16_t frame_duration_type_quants[] = {
      3, 4, 6, 8, 4096, 8192, 16384, 512, 1024, 2048,
  };
  #include "get_bits.h"
  #include "avcodec.h"
  
- #define TAK_FORMAT_DATA_TYPE_BITS    3
- #define TAK_FORMAT_SAMPLE_RATE_BITS  18
- #define TAK_FORMAT_BPS_BITS          5
- #define TAK_FORMAT_CHANNEL_BITS      4
- #define TAK_FORMAT_VALID_BITS        5
- #define TAK_FORMAT_CH_LAYOUT_BITS    6
- #define TAK_SIZE_FRAME_DURATION_BITS 4
- #define TAK_SIZE_SAMPLES_NUM_BITS    35
- #define TAK_LAST_FRAME_POS_BITS      40
- #define TAK_LAST_FRAME_SIZE_BITS     24
- #define TAK_ENCODER_CODEC_BITS       6
- #define TAK_ENCODER_PROFILE_BITS     4
- #define TAK_ENCODER_VERSION_BITS     24
- #define TAK_SAMPLE_RATE_MIN          6000
- #define TAK_CHANNELS_MIN             1
- #define TAK_BPS_MIN                  8
- #define TAK_FRAME_HEADER_FLAGS_BITS         3
- #define TAK_FRAME_HEADER_SYNC_ID            0xA0FF
- #define TAK_FRAME_HEADER_SYNC_ID_BITS       16
- #define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS  14
- #define TAK_FRAME_HEADER_NO_BITS            21
- #define TAK_FRAME_DURATION_QUANT_SHIFT      5
- #define TAK_CRC24_BITS                      24
 -#define TAK_FORMAT_DATA_TYPE_BITS               3
++#define TAK_FORMAT_DATA_TYPE_BITS              3
+ #define TAK_FORMAT_SAMPLE_RATE_BITS            18
 -#define TAK_FORMAT_BPS_BITS                     5
 -#define TAK_FORMAT_CHANNEL_BITS                 4
 -#define TAK_FORMAT_VALID_BITS                   5
 -#define TAK_FORMAT_CH_LAYOUT_BITS               6
 -#define TAK_SIZE_FRAME_DURATION_BITS            4
++#define TAK_FORMAT_BPS_BITS                    5
++#define TAK_FORMAT_CHANNEL_BITS                4
++#define TAK_FORMAT_VALID_BITS                  5
++#define TAK_FORMAT_CH_LAYOUT_BITS              6
++#define TAK_SIZE_FRAME_DURATION_BITS           4
+ #define TAK_SIZE_SAMPLES_NUM_BITS              35
+ #define TAK_LAST_FRAME_POS_BITS                40
+ #define TAK_LAST_FRAME_SIZE_BITS               24
 -#define TAK_ENCODER_CODEC_BITS                  6
 -#define TAK_ENCODER_PROFILE_BITS                4
++#define TAK_ENCODER_CODEC_BITS                 6
++#define TAK_ENCODER_PROFILE_BITS               4
+ #define TAK_ENCODER_VERSION_BITS               24
 -#define TAK_SAMPLE_RATE_MIN                  6000
 -#define TAK_CHANNELS_MIN                        1
 -#define TAK_BPS_MIN                             8
 -#define TAK_FRAME_HEADER_FLAGS_BITS             3
 -#define TAK_FRAME_HEADER_SYNC_ID           0xA0FF
++#define TAK_SAMPLE_RATE_MIN                    6000
++#define TAK_CHANNELS_MIN                       1
++#define TAK_BPS_MIN                            8
++#define TAK_FRAME_HEADER_FLAGS_BITS            3
++#define TAK_FRAME_HEADER_SYNC_ID               0xA0FF
+ #define TAK_FRAME_HEADER_SYNC_ID_BITS          16
+ #define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS     14
+ #define TAK_FRAME_HEADER_NO_BITS               21
 -#define TAK_FRAME_DURATION_QUANT_SHIFT          5
++#define TAK_FRAME_DURATION_QUANT_SHIFT         5
+ #define TAK_CRC24_BITS                         24
  
 +#define TAK_MAX_CHANNELS                  ( 1 << TAK_FORMAT_CHANNEL_BITS )
  
 -#define TAK_FRAME_FLAG_IS_LAST                0x1
 -#define TAK_FRAME_FLAG_HAS_INFO               0x2
 -#define TAK_FRAME_FLAG_HAS_METADATA           0x4
 +#define TAK_MIN_FRAME_HEADER_BITS         ( TAK_FRAME_HEADER_SYNC_ID_BITS + \
 +                                            TAK_FRAME_HEADER_FLAGS_BITS   + \
 +                                            TAK_FRAME_HEADER_NO_BITS      + \
 +                                            TAK_CRC24_BITS )
  
 -#define TAK_MAX_CHANNELS               (1 << TAK_FORMAT_CHANNEL_BITS)
 +#define TAK_MIN_FRAME_HEADER_LAST_BITS    ( TAK_MIN_FRAME_HEADER_BITS + 2 + \
 +                                            TAK_FRAME_HEADER_SAMPLE_COUNT_BITS )
  
 -#define TAK_MIN_FRAME_HEADER_BITS      (TAK_FRAME_HEADER_SYNC_ID_BITS + \
 -                                        TAK_FRAME_HEADER_FLAGS_BITS   + \
 -                                        TAK_FRAME_HEADER_NO_BITS      + \
 -                                        TAK_CRC24_BITS)
 +#define TAK_ENCODER_BITS         ( TAK_ENCODER_CODEC_BITS        + \
 +                                   TAK_ENCODER_PROFILE_BITS )
  
 -#define TAK_MIN_FRAME_HEADER_LAST_BITS (TAK_MIN_FRAME_HEADER_BITS + 2 + \
 -                                        TAK_FRAME_HEADER_SAMPLE_COUNT_BITS)
 +#define TAK_SIZE_BITS            ( TAK_SIZE_SAMPLES_NUM_BITS     + \
 +                                   TAK_SIZE_FRAME_DURATION_BITS )
  
 -#define TAK_ENCODER_BITS               (TAK_ENCODER_CODEC_BITS + \
 -                                        TAK_ENCODER_PROFILE_BITS)
 +#define TAK_FORMAT_BITS          ( TAK_FORMAT_DATA_TYPE_BITS     + \
 +                                   TAK_FORMAT_SAMPLE_RATE_BITS   + \
 +                                   TAK_FORMAT_BPS_BITS           + \
 +                                   TAK_FORMAT_CHANNEL_BITS + 1   + \
 +                                   TAK_FORMAT_VALID_BITS   + 1   + \
 +                                   TAK_FORMAT_CH_LAYOUT_BITS     * \
 +                                   TAK_MAX_CHANNELS )
  
 -#define TAK_SIZE_BITS                  (TAK_SIZE_SAMPLES_NUM_BITS + \
 -                                        TAK_SIZE_FRAME_DURATION_BITS)
 +#define TAK_STREAMINFO_BITS      ( TAK_ENCODER_BITS              + \
 +                                   TAK_SIZE_BITS                 + \
 +                                   TAK_FORMAT_BITS )
  
 -#define TAK_FORMAT_BITS                (TAK_FORMAT_DATA_TYPE_BITS   + \
 -                                        TAK_FORMAT_SAMPLE_RATE_BITS + \
 -                                        TAK_FORMAT_BPS_BITS         + \
 -                                        TAK_FORMAT_CHANNEL_BITS + 1 + \
 -                                        TAK_FORMAT_VALID_BITS   + 1 + \
 -                                        TAK_FORMAT_CH_LAYOUT_BITS   * \
 -                                        TAK_MAX_CHANNELS)
 +#define TAK_MAX_FRAME_HEADER_BITS  ( TAK_MIN_FRAME_HEADER_LAST_BITS + \
 +                                     TAK_STREAMINFO_BITS + 31 )
  
 -#define TAK_STREAMINFO_BITS            (TAK_ENCODER_BITS + \
 -                                        TAK_SIZE_BITS    + \
 -                                        TAK_FORMAT_BITS)
 -
 -#define TAK_MAX_FRAME_HEADER_BITS      (TAK_MIN_FRAME_HEADER_LAST_BITS + \
 -                                        TAK_STREAMINFO_BITS + 31)
 -
 -#define TAK_STREAMINFO_BYTES           ((TAK_STREAMINFO_BITS       + 7) / 8)
 -#define TAK_MAX_FRAME_HEADER_BYTES     ((TAK_MAX_FRAME_HEADER_BITS + 7) / 8)
 -#define TAK_MIN_FRAME_HEADER_BYTES     ((TAK_MIN_FRAME_HEADER_BITS + 7) / 8)
 -
 -enum TAKCodecType {
 -    TAK_CODEC_MONO_STEREO  = 2,
 -    TAK_CODEC_MULTICHANNEL = 4
 -};
 +#define TAK_STREAMINFO_BYTES        (( TAK_STREAMINFO_BITS + 7 ) / 8)
 +#define TAK_MAX_FRAME_HEADER_BYTES  (( TAK_MAX_FRAME_HEADER_BITS + 7 ) / 8)
 +#define TAK_MIN_FRAME_HEADER_BYTES  (( TAK_MIN_FRAME_HEADER_BITS + 7 ) / 8)
  
  enum TAKMetaDataType {
      TAK_METADATA_END = 0,
@@@ -140,11 -153,12 +142,11 @@@ void avpriv_tak_parse_streaminfo(GetBit
  
  /**
   * Validate and decode a frame header.
-  * @param      avctx AVCodecContext to use as av_log() context
-  * @param[in]  gb    GetBitContext from which to read frame header
-  * @param[out] s     frame information
+  * @param      avctx             AVCodecContext to use as av_log() context
+  * @param[in]  gb                GetBitContext from which to read frame header
+  * @param[out] s                 frame information
 - * @param      log_level_offset  log level offset, can be used to silence
 - *                               error messages.
 - * @return non-zero on error, 0 if OK
 + * @param      log_level_offset  log level offset. can be used to silence error messages.
 + * @return non-zero on error, 0 if ok
   */
  int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
                                 TAKStreamInfo *s, int log_level_offset);
Simple merge
@@@ -1910,17 -1468,6 +1910,18 @@@ av_cold int avcodec_close(AVCodecContex
      return 0;
  }
  
 +static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
 +{
 +    switch(id){
 +        //This is for future deprecatec codec ids, its empty since
 +        //last major bump but will fill up again over time, please don't remove it
 +//         case AV_CODEC_ID_UTVIDEO_DEPRECATED: return AV_CODEC_ID_UTVIDEO;
 +        case AV_CODEC_ID_OPUS_DEPRECATED: return AV_CODEC_ID_OPUS;
++        case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK;
 +        default                         : return id;
 +    }
 +}
 +
  static AVCodec *find_encdec(enum AVCodecID id, int encoder)
  {
      AVCodec *p, *experimental = NULL;