]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add SAMPLE_FMT_DBL.
authorpross <pross@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 19 Aug 2008 10:36:30 +0000 (10:36 +0000)
committerpross <pross@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 19 Aug 2008 10:36:30 +0000 (10:36 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14832 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/audioconvert.c
libavcodec/avcodec.h
libavcodec/utils.c

index 99029af31b2f5d041fe9ad3038c311b418535577..15d56e8502c90792ab7e655ad5ee8f649c646cad 100644 (file)
@@ -39,7 +39,8 @@ static const SampleFmtInfo sample_fmt_info[SAMPLE_FMT_NB] = {
     [SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 },
     [SAMPLE_FMT_S24] = { .name = "s24", .bits = 24 },
     [SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 },
-    [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 }
+    [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 },
+    [SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 },
 };
 
 const char *avcodec_get_sample_fmt_name(int sample_fmt)
@@ -127,18 +128,27 @@ if(ctx->fmt_pair == ofmt + SAMPLE_FMT_NB*ifmt){\
         else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_U8 , (*(uint8_t*)pi - 0x80)<<8)
         else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_U8 , (*(uint8_t*)pi - 0x80)<<24)
         else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_U8 , (*(uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
+        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_U8 , (*(uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
         else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S16, (*(int16_t*)pi>>8) + 0x80)
         else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S16,  *(int16_t*)pi)
         else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S16,  *(int16_t*)pi<<16)
         else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_S16,  *(int16_t*)pi*(1.0 / (1<<15)))
+        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S16,  *(int16_t*)pi*(1.0 / (1<<15)))
         else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S32, (*(int32_t*)pi>>24) + 0x80)
         else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S32,  *(int32_t*)pi>>16)
         else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S32,  *(int32_t*)pi)
         else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_S32,  *(int32_t*)pi*(1.0 / (1<<31)))
+        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S32,  *(int32_t*)pi*(1.0 / (1<<31)))
         else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_FLT, lrintf(*(float*)pi * (1<<7)) + 0x80)
         else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_FLT, lrintf(*(float*)pi * (1<<15)))
         else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_FLT, lrintf(*(float*)pi * (1<<31)))
         else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_FLT, *(float*)pi)
+        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_FLT, *(float*)pi)
+        else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_DBL, lrint(*(double*)pi * (1<<7)) + 0x80)
+        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_DBL, lrint(*(double*)pi * (1<<15)))
+        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_DBL, lrint(*(double*)pi * (1<<31)))
+        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_DBL, *(double*)pi)
+        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(double*)pi)
         else return -1;
     }
     return 0;
index ac13087afcfa6746a912e6c71dfa92d121b73028..0c8494223dbe57a6fac233f1ad83c3486fa93c20 100644 (file)
@@ -30,7 +30,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 51
-#define LIBAVCODEC_VERSION_MINOR 64
+#define LIBAVCODEC_VERSION_MINOR 65
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -348,6 +348,7 @@ enum SampleFormat {
     SAMPLE_FMT_S24,             ///< signed 24 bits @deprecated Deprecated in favor of SAMPLE_FMT_S32
     SAMPLE_FMT_S32,             ///< signed 32 bits
     SAMPLE_FMT_FLT,             ///< float
+    SAMPLE_FMT_DBL,             ///< double
     SAMPLE_FMT_NB               ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
 };
 
index f25a672943dd1e58b7743fdc5108b30769d93675..2d1156c82b57131f33793037c7e2a68b6d4ba907 100644 (file)
@@ -1329,6 +1329,8 @@ int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
     case SAMPLE_FMT_S32:
     case SAMPLE_FMT_FLT:
         return 32;
+    case SAMPLE_FMT_DBL:
+        return 64;
     default:
         return 0;
     }