Show
Ignore:
Timestamp:
03/03/09 17:51:01 (6 years ago)
Author:
robert
Message:

Introduce FFmpegAudioStream implementation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp

    r9827 r9847  
    11 
    22#include "FFmpegImageStream.hpp" 
     3#include "FFmpegAudioStream.hpp" 
    34 
    45#include <OpenThreads/ScopedLock> 
    56#include <osg/Notify> 
    6  
    7 #include "FFmpegDecoder.hpp" 
    8 #include "MessageQueue.hpp" 
    97 
    108#include <memory> 
     
    4543 
    4644    delete m_commands; 
    47     delete m_decoder; 
    4845} 
    4946 
     
    6461    m_decoder->video_decoder().setUserData(this); 
    6562    m_decoder->video_decoder().setPublishCallback(publishNewFrame); 
     63     
     64    if (m_decoder->audio_decoder().validContext()) 
     65    { 
     66        osg::notify(osg::NOTICE)<<"Attaching FFmpegAudioStream"<<std::endl; 
     67     
     68        getAudioStreams().push_back(new FFmpegAudioStream(m_decoder.get())); 
     69    } 
    6670 
    6771    _status = PAUSED; 
     
    121125 
    122126 
    123  
    124 void FFmpegImageStream::setAudioSink(osg::AudioSinkInterface* audio_sink) 
    125 {  
    126     m_decoder->audio_decoder().setAudioSink(audio_sink);  
    127 } 
    128  
    129  
    130 void FFmpegImageStream::consumeAudioBuffer(void * const buffer, const size_t size) 
    131 {  
    132     m_decoder->audio_decoder().fillBuffer(buffer, size); 
    133 } 
    134  
    135  
    136  
    137127double FFmpegImageStream::duration() const 
    138128{  
     
    160150    return m_decoder->video_decoder().frameRate();  
    161151} 
    162  
    163  
    164  
    165 bool FFmpegImageStream::audioStream() const  
    166 {  
    167     return m_decoder->audio_decoder().validContext();  
    168 } 
    169  
    170  
    171  
    172 int FFmpegImageStream::audioFrequency() const  
    173 {  
    174     return m_decoder->audio_decoder().frequency();  
    175 } 
    176  
    177  
    178  
    179 int FFmpegImageStream::audioNbChannels() const  
    180 {  
    181     return m_decoder->audio_decoder().nbChannels(); 
    182 } 
    183  
    184  
    185  
    186 osg::AudioStream::SampleFormat FFmpegImageStream::audioSampleFormat() const  
    187 {  
    188     return m_decoder->audio_decoder().sampleFormat();  
    189 } 
    190  
    191152 
    192153