summaryrefslogtreecommitdiffstats
path: root/libavcodec/dvaudio.h
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-01-27 14:37:09 +0100
committerPaul B Mahol <onemda@gmail.com>2016-01-28 10:31:41 +0100
commit2edd47582b4db2b89b821d6e809d5a4671487b0e (patch)
treeec849b104845a3959b4252ed98aaff3050b7f107 /libavcodec/dvaudio.h
parent27f1ea5097da5aa3a3bffdc5f06e915a89f51c6a (diff)
downloadffmpeg-streaming-2edd47582b4db2b89b821d6e809d5a4671487b0e.zip
ffmpeg-streaming-2edd47582b4db2b89b821d6e809d5a4671487b0e.tar.gz
avcodec: add dvaudio parser
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/dvaudio.h')
-rw-r--r--libavcodec/dvaudio.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/libavcodec/dvaudio.h b/libavcodec/dvaudio.h
new file mode 100644
index 0000000..e4d0df1
--- /dev/null
+++ b/libavcodec/dvaudio.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static inline int dv_get_audio_sample_count(const uint8_t *buffer, int dsf)
+{
+ int samples = buffer[0] & 0x3f; /* samples in this frame - min samples */
+
+ switch ((buffer[3] >> 3) & 0x07) {
+ case 0:
+ return samples + (dsf ? 1896 : 1580);
+ case 1:
+ return samples + (dsf ? 1742 : 1452);
+ case 2:
+ default:
+ return samples + (dsf ? 1264 : 1053);
+ }
+}
OpenPOWER on IntegriCloud