~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/src/audio/codecs/audiocodecfactory.h

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
3
3
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
4
4
 *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
5
5
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
16
16
 *
17
17
 *  You should have received a copy of the GNU General Public License
18
18
 *  along with this program; if not, write to the Free Software
19
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
20
20
 *
21
21
 *  Additional permission under GNU GPL version 3 section 7:
22
22
 *
45
45
 * @brief Handle audio codecs, load them in memory
46
46
 */
47
47
 
48
 
/** Maps a pointer on an audiocodec object to a payload */
49
 
typedef std::map<int, sfl::Codec*> CodecsMap;
50
 
 
51
48
class AudioCodecFactory {
52
49
    public:
53
50
        AudioCodecFactory();
62
59
         */
63
60
        std::string getCodecName(int payload) const;
64
61
 
65
 
        std::vector<int32_t > getAudioCodecList() const;
 
62
        std::vector<int32_t > getCodecList() const;
66
63
        /**
67
64
         * Get the codec object associated with the payload
68
65
         * @param payload The payload looked for
69
66
         * @return AudioCodec* A pointer on a AudioCodec object
70
67
         */
71
 
        sfl::Codec* getCodec(int payload) const;
 
68
        sfl::AudioCodec* getCodec(int payload) const;
72
69
 
73
70
        /**
74
71
         * Set the default codecs order.
100
97
         * Instantiate a codec, used in AudioRTP to get an instance of Codec per call
101
98
         * @param CodecHandlePointer    The map containing the pointer on the object and the pointer on the handle function
102
99
         */
103
 
        sfl::Codec* instantiateCodec(int payload) const;
 
100
        sfl::AudioCodec* instantiateCodec(int payload) const;
104
101
 
105
102
        /**
106
103
         * For a given codec, return its specification
119
116
        bool isCodecLoaded(int payload) const;
120
117
 
121
118
    private:
 
119
        /** Maps a pointer on an audiocodec object to a payload */
 
120
        typedef std::map<int, sfl::AudioCodec*> AudioCodecsMap;
 
121
 
122
122
        /** Enable us to keep the handle pointer on the codec dynamicaly loaded so that we could destroy when we dont need it anymore */
123
 
        typedef std::pair<sfl::Codec* , void*> CodecHandlePointer;
124
 
 
 
123
        typedef std::pair<sfl::AudioCodec*, void*> AudioCodecHandlePointer;
125
124
 
126
125
        /**
127
126
         * Scan the installation directory ( --prefix configure option )
128
127
         * And load the dynamic library
129
128
         * @return std::vector<AudioCodec*> The list of the codec object successfully loaded in memory
130
129
         */
131
 
        std::vector<sfl::Codec *> scanCodecDirectory();
 
130
        std::vector<sfl::AudioCodec *> scanCodecDirectory();
132
131
 
133
132
        /**
134
133
         * Load a codec
135
134
         * @param std::string   The path of the shared ( dynamic ) library.
136
135
         * @return AudioCodec*  the pointer of the object loaded.
137
136
         */
138
 
        sfl::Codec* loadCodec(const std::string &path);
 
137
        sfl::AudioCodec* loadCodec(const std::string &path);
139
138
 
140
139
        /**
141
140
         * Unload a codec
142
 
         * @param CodecHandlePointer    The map containing the pointer on the object and the pointer on the handle function
 
141
         * @param AudioCodecHandlePointer The map containing the pointer on the object and the pointer on the handle function
143
142
         */
144
 
        void unloadCodec(CodecHandlePointer);
 
143
        void unloadCodec(AudioCodecHandlePointer &ptr);
145
144
 
146
145
        /**
147
146
         * Check if the files found in searched directories seems valid
163
162
        /**
164
163
         * Map the payload of a codec and the object associated ( AudioCodec * )
165
164
         */
166
 
        CodecsMap codecsMap_;
 
165
        AudioCodecsMap codecsMap_;
167
166
 
168
167
        /**
169
168
         * Vector containing a default order for the codecs
179
178
         * Vector containing pairs
180
179
         * Pair between pointer on function handle and pointer on audiocodec object
181
180
         */
182
 
        std::vector< CodecHandlePointer > codecInMemory_;
 
181
        std::vector<AudioCodecHandlePointer> codecInMemory_;
183
182
};
184
183
 
185
184
#endif // __CODEC_DESCRIPTOR_H__