[FFmpeg-devel] [PATCH 01/10] add AV_SAMPLE_FMT_DSD and AV_SAMPLE_FMT_DSDP
Peter Ross
pross at xvid.org
Tue May 6 14:37:45 CEST 2014
Signed-off-by: Peter Ross <pross at xvid.org>
---
doc/APIchanges | 3 +++
libavutil/samplefmt.c | 13 ++++++++++---
libavutil/samplefmt.h | 3 +++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 6c5bf45..4f16323 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2012-10-22
API changes, most recent first:
+2014-xx-xx - xxxxxxxx - libavu xx.xx.x
+ Add AV_SAMPLE_FMT_DSD and AV_SAMPLE_FMT_DSDP.
+
2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h
Add av_opt_set_dict2() function.
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index a198698..6667948 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -37,11 +37,13 @@ static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = {
[AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_S32P },
[AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_FLTP },
[AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_DBLP },
+ [AV_SAMPLE_FMT_DSD] = { .name = "dsd", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_DSDP },
[AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_U8 },
[AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1, .altform = AV_SAMPLE_FMT_S16 },
[AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_S32 },
[AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT },
[AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL },
+ [AV_SAMPLE_FMT_DSDP] = { .name = "dsdp", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_DSD },
};
const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
@@ -255,9 +257,14 @@ int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
int planes = planar ? nb_channels : 1;
int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels);
int data_size = nb_samples * block_align;
- int fill_char = (sample_fmt == AV_SAMPLE_FMT_U8 ||
- sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00;
- int i;
+ int fill_char, i;
+
+ if (sample_fmt == AV_SAMPLE_FMT_U8 || sample_fmt == AV_SAMPLE_FMT_U8P)
+ fill_char = 0x80;
+ else if (sample_fmt == AV_SAMPLE_FMT_DSD || sample_fmt == AV_SAMPLE_FMT_DSDP)
+ fill_char = 0x69;
+ else
+ fill_char = 0x00;
offset *= block_align;
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index db17d43..23c5b47 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -60,6 +60,9 @@ enum AVSampleFormat {
AV_SAMPLE_FMT_FLTP, ///< float, planar
AV_SAMPLE_FMT_DBLP, ///< double, planar
+ AV_SAMPLE_FMT_DSD, ///< one-bit audio
+ AV_SAMPLE_FMT_DSDP, ///< one-bit audio, planar
+
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
};
--
1.8.3.2
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140506/d4437ee4/attachment.asc>
More information about the ffmpeg-devel
mailing list