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

« back to all changes in this revision

Viewing changes to daemon/src/audio/ringbuffer.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-19 21:46:37 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120519214637-la8rbrford5kj6m3
Tags: 1.1.0-1
* New upstream release 
  - Fixes "FTBFS with libccrtp-dev/2.0.2 from experimental" (Closes: #663282)
* NEW Maintainer: Debian VoIP Team - Thanks Francois for your work.
  - (Closes: #665789: O: sflphone -- SIP and IAX2 compatible VoIP phone)
* Added Build-Depends: libdbus-c++-bin
* Add gcc47-fixes.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#define __RING_BUFFER__
24
24
 
25
25
#include <fstream>
26
 
#include "../call.h"
 
26
#include <map>
27
27
#include "noncopyable.h"
28
28
 
29
29
typedef std::map<std::string, int> ReadPointer;
34
34
         * Constructor
35
35
         * @param size  Size of the buffer to create
36
36
         */
37
 
        RingBuffer(int size, const std::string &call_id = Call::DEFAULT_ID);
 
37
        RingBuffer(int size, const std::string &call_id);
38
38
 
39
39
        /**
40
40
         * Destructor
41
41
         */
42
42
        ~RingBuffer();
43
43
 
44
 
        std::string getBufferId() {
 
44
        std::string getBufferId() const {
45
45
            return buffer_id_;
46
46
        }
47
47
 
48
48
        /**
49
49
         * Reset the counters to 0 for this read pointer
50
50
         */
51
 
        void flush(const std::string &call_id = Call::DEFAULT_ID);
 
51
        void flush(const std::string &call_id);
52
52
 
53
53
        void flushAll();
54
54
 
55
55
        /**
56
56
         * Get read pointer coresponding to this call
57
57
         */
58
 
        int getReadPointer(const std::string &call_id = Call::DEFAULT_ID);
 
58
        int getReadPointer(const std::string &call_id);
59
59
 
60
60
        /**
61
61
         * Get the whole readpointer list for this ringbuffer
72
72
        /**
73
73
         * Move readpointer forward by pointer_value
74
74
         */
75
 
        void storeReadPointer(int pointer_value, const std::string &call_id = Call::DEFAULT_ID);
 
75
        void storeReadPointer(int pointer_value, const std::string &call_id);
76
76
 
77
77
        /**
78
78
         * Add a new readpointer for this ringbuffer
79
79
         */
80
 
        void createReadPointer(const std::string &call_id = Call::DEFAULT_ID);
 
80
        void createReadPointer(const std::string &call_id);
81
81
 
82
82
        /**
83
83
         * Remove a readpointer for this ringbuffer
84
84
         */
85
 
        void removeReadPointer(const std::string &call_id = Call::DEFAULT_ID);
 
85
        void removeReadPointer(const std::string &call_id);
86
86
 
87
87
        /**
88
88
         * Test if readpointer coresponding to this call is still active
102
102
         * To get how much space is available in the buffer to read in
103
103
         * @return int The available size
104
104
         */
105
 
        int AvailForGet(const std::string &call_id = Call::DEFAULT_ID);
 
105
        int AvailForGet(const std::string &call_id);
106
106
 
107
107
        /**
108
108
         * Get data in the ring buffer
110
110
         * @param toCopy Number of bytes to copy
111
111
         * @return int Number of bytes copied
112
112
         */
113
 
        int Get(void* buffer, int toCopy, const std::string &call_id = Call::DEFAULT_ID);
 
113
        int Get(void* buffer, int toCopy, const std::string &call_id);
114
114
 
115
115
        /**
116
116
         * Discard data from the buffer
117
117
         * @param toDiscard Number of bytes to discard
118
118
         * @return int Number of bytes discarded
119
119
         */
120
 
        int Discard(int toDiscard, const std::string &call_id = Call::DEFAULT_ID);
 
120
        int Discard(int toDiscard, const std::string &call_id);
121
121
 
122
122
        /**
123
123
         * Total length of the ring buffer
125
125
         */
126
126
        int putLen();
127
127
 
128
 
        int getLen(const std::string &call_id = Call::DEFAULT_ID);
 
128
        int getLen(const std::string &call_id);
129
129
 
130
130
        /**
131
131
         * Debug function print mEnd, mStart, mBufferSize
142
142
        /** Data */
143
143
        unsigned char *buffer_;
144
144
 
145
 
        ReadPointer   readpointer_;
 
145
        ReadPointer readpointer_;
146
146
        std::string buffer_id_;
147
147
 
148
 
    public:
149
 
 
150
148
        friend class MainBufferTest;
151
149
 
 
150
    public:
 
151
 
152
152
        std::fstream *buffer_input_rec;
153
153
        std::fstream *buffer_output_rec;
154
154