~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/src/video/shm_sink.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2012 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2012-2013 Savoir-Faire Linux Inc.
3
3
 *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
4
4
 *
5
5
 *  Portions derived from GStreamer:
36
36
#ifndef SHM_SINK_H_
37
37
#define SHM_SINK_H_
38
38
 
 
39
#include "noncopyable.h"
 
40
#include "video_provider.h"
 
41
#include "video_base.h"
 
42
 
39
43
#include <string>
40
44
#include <vector>
41
 
#include "noncopyable.h"
42
45
 
43
46
class SHMHeader;
 
47
 
44
48
namespace sfl_video {
45
 
    class VideoProvider;
 
49
 
 
50
class SHMSink : public VideoFramePassiveReader
 
51
{
 
52
public:
 
53
    SHMSink(const std::string &shm_name = "");
 
54
    std::string openedName() const { return opened_name_; }
 
55
    ~SHMSink();
 
56
 
 
57
    bool start();
 
58
    bool stop();
 
59
 
 
60
    bool resize_area(size_t desired_length);
 
61
 
 
62
    void render(const std::vector<unsigned char> &data);
 
63
    void render_frame(VideoFrame& src);
 
64
    void render_callback(VideoProvider &provider, size_t bytes);
 
65
 
 
66
    // as VideoFramePassiveReader
 
67
    void update(Observable<std::shared_ptr<VideoFrame> >*, std::shared_ptr<VideoFrame> &);
 
68
 
 
69
private:
 
70
    NON_COPYABLE(SHMSink);
 
71
 
 
72
    void shm_lock();
 
73
    void shm_unlock();
 
74
    std::string shm_name_;
 
75
    int fd_;
 
76
    SHMHeader *shm_area_;
 
77
    size_t shm_area_len_;
 
78
    std::string opened_name_;
 
79
};
 
80
 
46
81
}
47
82
 
48
 
class SHMSink {
49
 
    public:
50
 
        SHMSink(const std::string &shm_name = "");
51
 
        std::string openedName() const { return opened_name_; }
52
 
        ~SHMSink();
53
 
 
54
 
        bool start();
55
 
        bool stop();
56
 
 
57
 
        bool resize_area(size_t desired_length);
58
 
 
59
 
        void render(const std::vector<unsigned char> &data);
60
 
        void render_callback(sfl_video::VideoProvider &provider, size_t bytes);
61
 
 
62
 
    private:
63
 
        NON_COPYABLE(SHMSink);
64
 
 
65
 
        void shm_lock();
66
 
        void shm_unlock();
67
 
        std::string shm_name_;
68
 
        int fd_;
69
 
        SHMHeader *shm_area_;
70
 
        size_t shm_area_len_;
71
 
        std::string opened_name_;
72
 
};
73
 
 
74
83
#endif // SHM_SINK_H_