~oxalin/lightspark/buildnaudioplugin

« back to all changes in this revision

Viewing changes to backends/interfaces/audio/IAudioPlugin.h

  • Committer: Alessandro
  • Date: 2010-09-06 19:31:31 UTC
  • mfrom: (911.13.93)
  • Revision ID: git-v1:9f6175895e49dc81d39f6f99e66e2adc5a82bdb3
Merge branch 'master' of http://github.com/Oxalin/lightspark

Conflicts:
        CMakeLists.txt
        scripting/flashnet.cpp

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
    Lightspark, a free flash player implementation
 
3
 
 
4
    Copyright (C) 2009,2010  Alessandro Pignotti (a.pignotti@sssup.it)
 
5
    Copyright (C) 2010 Alexandre Demers (papouta@hotmail.com)
 
6
 
 
7
    This program is free software: you can redistribute it and/or modify
 
8
    it under the terms of the GNU Lesser General Public License as published by
 
9
    the Free Software Foundation, either version 3 of the License, or
 
10
    (at your option) any later version.
 
11
 
 
12
    This program is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
    GNU Lesser General Public License for more details.
 
16
 
 
17
    You should have received a copy of the GNU Lesser General Public License
 
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
**************************************************************************/
 
20
 
 
21
#ifndef IAUDIOPLUGIN_H
 
22
#define IAUDIOPLUGIN_H
 
23
 
 
24
#include "../../../compat.h"
 
25
#include "../../decoder.h"
 
26
#include "../IPlugin.h"
 
27
#include <iostream>
 
28
 
 
29
using namespace std;
 
30
 
 
31
class AudioStream
 
32
{
 
33
  protected:
 
34
        AudioStream(lightspark::AudioDecoder *dec = NULL, bool initPause = false);
 
35
 
 
36
  public:
 
37
        lightspark::AudioDecoder *decoder;
 
38
        bool pause;     //Indicates whether the stream is paused as a result of pauseStream being called
 
39
        virtual bool paused() = 0;      //Is the stream paused? (corked)
 
40
        virtual uint32_t getPlayedTime() = 0;
 
41
        virtual void fill() = 0;
 
42
        virtual ~AudioStream() {};
 
43
};
 
44
 
 
45
/**********************
 
46
Abstract class for audio plugin implementation
 
47
***********************/
 
48
class IAudioPlugin : public IPlugin
 
49
{
 
50
protected:
 
51
        string playbackDeviceName;
 
52
        string captureDeviceName;
 
53
        vector<string *> playbackDevicesList;
 
54
        vector<string *> captureDevicesList;
 
55
        list<AudioStream *> streams;
 
56
        typedef list<AudioStream *>::iterator stream_iterator;
 
57
        volatile bool contextReady;
 
58
        volatile bool noServer;
 
59
        bool stopped;
 
60
        IAudioPlugin ( string plugin_name, string backend_name, bool init_stopped = false );
 
61
 
 
62
public:
 
63
        enum DEVICE_TYPES { PLAYBACK, CAPTURE };
 
64
        virtual vector<string *> *get_devicesList ( DEVICE_TYPES desiredType );
 
65
        virtual void set_device ( string desiredDevice, DEVICE_TYPES desiredType ) = 0;
 
66
        virtual string get_device ( DEVICE_TYPES desiredType );
 
67
        virtual AudioStream *createStream ( lightspark::AudioDecoder *decoder ) = 0;
 
68
        virtual void freeStream ( AudioStream *audioStream ) = 0;
 
69
        virtual void pauseStream( AudioStream *audioStream ) = 0;       //Pause the stream (stops time from running, cork)
 
70
        virtual void resumeStream( AudioStream *audioStream ) = 0;      //Resume the stream (restart time, uncork)
 
71
        virtual bool isTimingAvailable() const = 0;
 
72
        virtual ~IAudioPlugin();
 
73
};
 
74
 
 
75
#endif
 
76