Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-04-12 14:10:09 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-04-15 01:33:55 +0300
commit21acc4db5fa3f11997b2a27f03e87eac4d69e088 (patch)
tree21400c16abb3ad15d3aa738f79c94dc4ed239691
parentc8ed93efcf4d52babb7dd1d2dec6c564bbda6da5 (diff)
avcodec: Add bits_per_raw_sample to AVCodecParameters
The bits_per_raw_sample represents the number of bits of precision per sample. The field is added at the logical place, not at the end as the code was just recently added This fixes the regression about losing the audio sample precision information The change in the fate test checksum un-does the change from the merge Previous version reviewed by: wm4 <nfxjfg@googlemail.com> Previous version reviewed by: Dominik 'Rathann' Mierzejewski <dominik@greysector.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/avcodec.h24
-rw-r--r--libavcodec/utils.c2
-rw-r--r--libavcodec/version.h2
-rw-r--r--tests/ref/lavf/ffm2
4 files changed, 28 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b3655c5799..9e6169f608 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3832,9 +3832,33 @@ typedef struct AVCodecParameters {
*/
int64_t bit_rate;
+ /**
+ * The number of bits per sample in the codedwords.
+ *
+ * This is basically the bitrate per sample. It is mandatory for a bunch of
+ * formats to actually decode them. It's the number of bits for one sample in
+ * the actual coded bitstream.
+ *
+ * This could be for example 4 for ADPCM
+ * For PCM formats this matches bits_per_raw_sample
+ * Can be 0
+ */
int bits_per_coded_sample;
/**
+ * This is the number of valid bits in each output sample. If the
+ * sample format has more bits, the least significant bits are additional
+ * padding bits, which are always 0. Use right shifts to reduce the sample
+ * to its actual size. For example, audio formats with 24 bit samples will
+ * have bits_per_raw_sample set to 24, and format set to AV_SAMPLEFMT_S32.
+ * To get the original sample use "(uint32_t)sample >> 8"."
+ *
+ * For ADPCM this might be 12 or 16 or similar
+ * Can be 0
+ */
+ int bits_per_raw_sample;
+
+ /**
* Codec-specific bitstream restrictions that the stream conforms to.
*/
int profile;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c1f8e22948..e0edce3d70 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3771,6 +3771,7 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
par->bit_rate = codec->bit_rate;
par->bits_per_coded_sample = codec->bits_per_coded_sample;
+ par->bits_per_raw_sample = codec->bits_per_raw_sample;
par->profile = codec->profile;
par->level = codec->level;
@@ -3824,6 +3825,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
codec->bit_rate = par->bit_rate;
codec->bits_per_coded_sample = par->bits_per_coded_sample;
+ codec->bits_per_raw_sample = par->bits_per_raw_sample;
codec->profile = par->profile;
codec->level = par->level;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1438e2e8db..8f0522b5d5 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 34
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index e45ef08a24..c4d7e1f807 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-79674a5219d00e1d2221a29157b35eb4 *./tests/data/lavf/lavf.ffm
+e63c16b5f0ad5015304fc4009fdb33ca *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0x000e23ae