~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#ifndef AUDIORECORDER_H_
32
32
#define AUDIORECORDER_H_
33
33
 
 
34
#include "noncopyable.h"
 
35
 
 
36
#include <thread>
 
37
#include <atomic>
34
38
#include <string>
35
 
#include <pthread.h>
36
 
#include "audiorecord.h"
37
 
#include "noncopyable.h"
38
39
 
39
40
class MainBuffer;
 
41
class AudioRecord;
40
42
 
41
43
class AudioRecorder {
42
44
 
47
49
            return recorderId_;
48
50
        }
49
51
 
 
52
        /**
 
53
         * Set the record to the current audio format.
 
54
         * Should be called before start() at least once.
 
55
         */
 
56
        void init();
 
57
 
 
58
        /**
 
59
         * Call to start recording.
 
60
         */
50
61
        void start();
51
62
 
52
63
    private:
53
64
        NON_COPYABLE(AudioRecorder);
54
65
        void run();
55
 
        static void * runCallback(void *data);
56
66
 
57
67
        static int count_;
58
68
        std::string recorderId_;
59
69
        MainBuffer &mbuffer_;
60
70
        AudioRecord *arecord_;
61
 
        bool running_;
62
 
        pthread_t thread_;
 
71
        std::atomic<bool> running_;
 
72
        std::thread thread_;
63
73
};
64
74
 
65
75
#endif