root/OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp @ 9847

Revision 9847, 1.4 kB (checked in by robert, 5 years ago)

Introduce FFmpegAudioStream implementation

RevLine 
[9847]1
2#include "FFmpegAudioStream.hpp"
3
4#include <OpenThreads/ScopedLock>
5#include <osg/Notify>
6
7#include "FFmpegDecoder.hpp"
8#include "MessageQueue.hpp"
9
10#include <memory>
11
12
13
14namespace osgFFmpeg {
15
16
17
18FFmpegAudioStream::FFmpegAudioStream(FFmpegDecoder* decoder):
19    m_decoder(decoder)
20{
21}
22
23
24
25FFmpegAudioStream::FFmpegAudioStream(const FFmpegAudioStream & audio, const osg::CopyOp & copyop) :
26    osg::AudioStream(audio, copyop)
27{
28}
29
30FFmpegAudioStream::~FFmpegAudioStream()
31{
32}
33
34void FFmpegAudioStream::setAudioSink(osg::AudioSink* audio_sink)
35{
36    osg::notify(osg::NOTICE)<<"FFmpegAudioStream::setAudioSink( "<<audio_sink<<")"<<std::endl;
37    m_decoder->audio_decoder().setAudioSink(audio_sink);
38}
39
40
41void FFmpegAudioStream::consumeAudioBuffer(void * const buffer, const size_t size)
42{
43    m_decoder->audio_decoder().fillBuffer(buffer, size);
44}
45
46double FFmpegAudioStream::duration() const
47{
48    return m_decoder->duration();
49}
50
51
52bool FFmpegAudioStream::audioStream() const 
53{
54    return m_decoder->audio_decoder().validContext();
55}
56
57
58
59int FFmpegAudioStream::audioFrequency() const 
60{
61    return m_decoder->audio_decoder().frequency();
62}
63
64
65
66int FFmpegAudioStream::audioNbChannels() const 
67{
68    return m_decoder->audio_decoder().nbChannels();
69}
70
71
72
73osg::AudioStream::SampleFormat FFmpegAudioStream::audioSampleFormat() const 
74{
75    return m_decoder->audio_decoder().sampleFormat();
76}
77
78
79} // namespace osgFFmpeg
Note: See TracBrowser for help on using the browser.