summaryrefslogtreecommitdiff
blob: 918be74369f6301df274a2fd8972c553267e4656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
commit 80989fcd47d33e30336785422ded17f4c607a113
Author: Alexis Ballier <aballier@gentoo.org>
Date:   Thu Feb 14 17:21:50 2013 -0300

    Use av_get_bytes_per_sample in SampleFormatToSampleSize (#38333)
    
    This is more future proof against the addition of sample formats.
    
    Signed-off-by: Sandro Santilli <strk@keybit.net>

diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index 136cc08..83b1d74 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -646,6 +646,9 @@ MediaParserFfmpeg::seekMedia(boost::int64_t offset, int whence)
 boost::uint16_t
 MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
 {
+#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(51,4,0)
+        return av_get_bytes_per_sample(fmt);
+#else
 	switch (fmt)
 	{
 		case AV_SAMPLE_FMT_U8: // unsigned 8 bits
@@ -668,6 +671,7 @@ MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
 		default:
 			return 8; // arbitrary value
 	}
+#endif
 }