Changeset 9827

Show
Ignore:
Timestamp:
02/27/09 21:16:08 (5 years ago)
Author:
robert
Message:

Introduced osg::AudioStream? class to help manage audio streams coming in from movie reading plugins

Location:
OpenSceneGraph/trunk
Files:
2 added
2 removed
9 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/ImageStream

    r8990 r9827  
    1616 
    1717#include <osg/Image> 
     18#include <osg/AudioStream> 
    1819 
    1920namespace osg { 
     
    8788        virtual void setVolume(float) {} 
    8889        virtual float getVolume() const { return 0.0f; } 
     90 
     91 
     92        typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams; 
     93        void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; } 
     94        AudioStreams& getAudioStreams() { return _audioStreams; } 
     95        const AudioStreams& getAudioStreams() const { return _audioStreams; } 
    8996         
    9097 
     
    96103        StreamStatus    _status; 
    97104        LoopingMode     _loopingMode; 
     105         
     106        AudioStreams    _audioStreams; 
    98107}; 
    99108 
  • OpenSceneGraph/trunk/src/osg/CMakeLists.txt

    r9671 r9827  
    2626    ${HEADER_PATH}/ArgumentParser 
    2727    ${HEADER_PATH}/Array 
     28    ${HEADER_PATH}/AudioStream 
    2829    ${HEADER_PATH}/AutoTransform 
    2930    ${HEADER_PATH}/Billboard 
     
    194195    ArgumentParser.cpp 
    195196    Array.cpp 
     197    AudioStream.cpp 
    196198    AutoTransform.cpp 
    197199    Billboard.cpp 
  • OpenSceneGraph/trunk/src/osg/ImageStream.cpp

    r8915 r9827  
    3333    Image(image,copyop), 
    3434    _status(image._status), 
    35     _loopingMode(image._loopingMode) 
     35    _loopingMode(image._loopingMode), 
     36    _audioStreams(image._audioStreams) 
    3637{ 
    3738} 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/CMakeLists.txt

    r9818 r9827  
    2121 
    2222SET(TARGET_H 
    23     AudioSinkInterface.hpp 
    2423    BoundedMessageQueue.hpp 
    2524    FFmpegClocks.hpp 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp

    r9826 r9827  
    5757        m_frequency = m_context->sample_rate; 
    5858        m_nb_channels = m_context->channels; 
    59         m_sample_format = FFmpegSampleFormat(m_context->sample_fmt); 
     59        m_sample_format = osg::AudioStream::SampleFormat(m_context->sample_fmt); 
    6060 
    6161        // Check stream sanity 
     
    200200    switch (sampleFormat()) 
    201201    { 
    202     case SAMPLE_FORMAT_U8: 
     202    case osg::AudioStream::SAMPLE_FORMAT_U8: 
    203203        sample_size *= 1; 
    204204        break; 
    205205 
    206     case SAMPLE_FORMAT_S16: 
     206    case osg::AudioStream::SAMPLE_FORMAT_S16: 
    207207        sample_size *= 2; 
    208208        break; 
    209209 
    210     case SAMPLE_FORMAT_S24: 
     210    case osg::AudioStream::SAMPLE_FORMAT_S24: 
    211211        sample_size *= 3; 
    212212        break; 
    213213 
    214     case SAMPLE_FORMAT_S32: 
     214    case osg::AudioStream::SAMPLE_FORMAT_S32: 
    215215        sample_size *= 4; 
    216216        break; 
    217217 
    218     case SAMPLE_FORMAT_F32: 
     218    case osg::AudioStream::SAMPLE_FORMAT_F32: 
    219219        sample_size *= 4; 
    220220        break; 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp

    r9826 r9827  
    77#include "FFmpegClocks.hpp" 
    88#include "FFmpegPacket.hpp" 
    9 #include "FFmpegSampleFormat.hpp" 
    109 
    11 #include "AudioSinkInterface.hpp" 
     10#include <osg/AudioStream> 
     11 
    1212#include "BoundedMessageQueue.hpp" 
     13 
    1314 
    1415 
     
    3738    int frequency() const; 
    3839    int nbChannels() const; 
    39     FFmpegSampleFormat sampleFormat() const; 
     40    osg::AudioStream::SampleFormat sampleFormat() const; 
    4041 
    4142private: 
     
    6465    int                    m_frequency; 
    6566    int                    m_nb_channels; 
    66     FFmpegSampleFormat    m_sample_format; 
     67    osg::AudioStream::SampleFormat    m_sample_format; 
    6768 
    6869    SinkPtr                m_audio_sink; 
     
    9495 
    9596 
    96 inline FFmpegSampleFormat FFmpegDecoderAudio::sampleFormat() const 
     97inline osg::AudioStream::SampleFormat FFmpegDecoderAudio::sampleFormat() const 
    9798{ 
    9899    return m_sample_format; 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp

    r9816 r9827  
    33#define HEADER_GUARD_FFMPEG_HEADERS_H 
    44 
     5 
    56extern "C" 
    67{ 
    78#define __STDC_CONSTANT_MACROS 
     9#include <stdint.h> 
    810#include <avcodec.h> 
    911#include <avformat.h> 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp

    r9826 r9827  
    128128 
    129129 
    130 void FFmpegImageStream::fillAudioBuffer(void * const buffer, const size_t size) 
     130void FFmpegImageStream::consumeAudioBuffer(void * const buffer, const size_t size) 
    131131{  
    132132    m_decoder->audio_decoder().fillBuffer(buffer, size); 
     
    184184 
    185185 
    186 FFmpegSampleFormat FFmpegImageStream::audioSampleFormat() const  
     186osg::AudioStream::SampleFormat FFmpegImageStream::audioSampleFormat() const  
    187187{  
    188188    return m_decoder->audio_decoder().sampleFormat();  
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp

    r9826 r9827  
    88#include <OpenThreads/Thread> 
    99 
    10 #include "AudioSinkInterface.hpp" 
    11 #include "FFmpegSampleFormat.hpp" 
    12  
    13  
    1410 
    1511#ifdef _WIN32 
     
    1915    #define OSGFFMPEG_EXPORT_API  __declspec(dllexport) 
    2016    #else 
    21     #define OSGFFMPEG_EXPORT_API  __declspec(dllimport) 
     17    #define OSGFFMPEG_EXPORT_API  __declspec(dllimport); 
    2218    #endif 
    2319#else 
     
    5652        virtual void setAudioSink(osg::AudioSinkInterface* audio_sink); 
    5753         
    58         void fillAudioBuffer(void * const buffer, const size_t size); 
     54        void consumeAudioBuffer(void * const buffer, const size_t size); 
     55         
     56        bool audioStream() const; 
     57        int audioFrequency() const; 
     58        int audioNbChannels() const; 
     59        osg::AudioStream::SampleFormat audioSampleFormat() const; 
    5960 
    6061        double duration() const; 
     
    6465        double videoFrameRate() const; 
    6566 
    66         bool audioStream() const; 
    67         int audioFrequency() const; 
    68         int audioNbChannels() const; 
    69         FFmpegSampleFormat audioSampleFormat() const; 
    7067 
    7168    private: