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

Revision 13041, 1.3 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
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    // detact the audio sink first to avoid destrction order issues.
33    setAudioSink(0);
34}
35
36void FFmpegAudioStream::setAudioSink(osg::AudioSink* audio_sink)
37{
38    OSG_NOTICE<<"FFmpegAudioStream::setAudioSink( "<<audio_sink<<")"<<std::endl;
39    m_decoder->audio_decoder().setAudioSink(audio_sink);
40}
41
42
43void FFmpegAudioStream::consumeAudioBuffer(void * const buffer, const size_t size)
44{
45    m_decoder->audio_decoder().fillBuffer(buffer, size);
46}
47
48double FFmpegAudioStream::duration() const
49{
50    return m_decoder->duration();
51}
52
53
54
55int FFmpegAudioStream::audioFrequency() const
56{
57    return m_decoder->audio_decoder().frequency();
58}
59
60
61
62int FFmpegAudioStream::audioNbChannels() const
63{
64    return m_decoder->audio_decoder().nbChannels();
65}
66
67
68
69osg::AudioStream::SampleFormat FFmpegAudioStream::audioSampleFormat() const
70{
71    return m_decoder->audio_decoder().sampleFormat();
72}
73
74
75} // namespace osgFFmpeg
Note: See TracBrowser for help on using the browser.