aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native/libav/ffmpeg_tool.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-08-26 10:09:33 +0200
committerSven Gothel <[email protected]>2013-08-26 10:09:33 +0200
commit248256fc8eee90f8d11f66d4b5dba8ad296653a1 (patch)
tree7550ea3c019384d56940ad6103c43b827caaba59 /src/jogl/native/libav/ffmpeg_tool.h
parente28a3b39e1e8caf3f6cf3bfe82efdaae818a6c7b (diff)
libav/ffmpeg: version9: Add libavresample support ; Proper AudioFormat negotiation w/ AudioSink; Misc
- Add libavresample support - Resample if avail && (!AV_SAMPLE_FMT_S16 || !prefSampleRate || !sinkSupported) - Resample to: prefSampleRate (if set), AV_SAMPLE_FMT_S16 and min(channelCount, maxChannelCount) - Proper AudioFormat negotiation w/ AudioSink; - Utilize AudioSink's 'isSupported(AudioFormat)' - Misc - use 'av_get_bytes_per_sample(fmt)' always, don't assume 2
Diffstat (limited to 'src/jogl/native/libav/ffmpeg_tool.h')
-rw-r--r--src/jogl/native/libav/ffmpeg_tool.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/jogl/native/libav/ffmpeg_tool.h b/src/jogl/native/libav/ffmpeg_tool.h
index 783746378..0a65723fe 100644
--- a/src/jogl/native/libav/ffmpeg_tool.h
+++ b/src/jogl/native/libav/ffmpeg_tool.h
@@ -43,6 +43,15 @@
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
+#include <libavutil/avutil.h>
+#if LIBAVCODEC_VERSION_MAJOR >= 54
+#include <libavresample/avresample.h>
+#endif
+
+#ifndef LIBAVRESAMPLE_VERSION_MAJOR
+#define LIBAVRESAMPLE_VERSION_MAJOR 0
+typedef void* AVAudioResampleContext;
+#endif
#include <stdarg.h>
#include <stdio.h>
@@ -85,6 +94,12 @@ typedef void (APIENTRYP PFNGLFINISH) (void);
/** Since 55.0.0 */
#define AV_HAS_API_REFCOUNTED_FRAMES(pAV) (AV_VERSION_MAJOR(pAV->avcodecVersion) >= 55)
+/** Since 54.0.0.1 */
+#define AV_HAS_API_AVRESAMPLE(pAV) (AV_VERSION_MAJOR(pAV->avresampleVersion) >= 1)
+
+#define MAX_INT(a,b) ( (a >= b) ? a : b )
+#define MIN_INT(a,b) ( (a <= b) ? a : b )
+
static inline float my_av_q2f(AVRational a){
return a.num / (float) a.den;
}
@@ -112,6 +127,7 @@ typedef struct {
uint32_t avcodecVersion;
uint32_t avformatVersion;
uint32_t avutilVersion;
+ uint32_t avresampleVersion;
int32_t useRefCountedFrames;
@@ -144,10 +160,16 @@ typedef struct {
NIOBuffer_t* pANIOBuffers;
int32_t aFrameCount;
int32_t aFrameCurrent;
- int32_t aSampleRate;
- int32_t aChannels;
int32_t aFrameSize; // in samples per channel!
enum AVSampleFormat aSampleFmt; // native decoder fmt
+ int32_t aSampleRate;
+ int32_t aChannels;
+ int32_t aSinkSupport; // supported by AudioSink
+ AVAudioResampleContext *aResampleCtx;
+ uint8_t* aResampleBuffer;
+ enum AVSampleFormat aSampleFmtOut; // out fmt
+ int32_t aChannelsOut;
+ int32_t aSampleRateOut;
int32_t aPTS; // msec - overall last audio PTS
PTSStats aPTSStats;
int32_t aFramesPerVideoFrame; // is 'snooped'