~ubuntu-branches/ubuntu/maverick/gnash/maverick

« back to all changes in this revision

Viewing changes to libmedia/VideoInput.h

  • Committer: Bazaar Package Importer
  • Author(s): Sindhudweep Narayan Sarkar
  • Date: 2009-10-07 00:06:10 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20091007000610-mj9rwqe774gizn1j
Tags: 0.8.6-0ubuntu1
new upstream release 0.8.6 (LP: #435897)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// VideoInput.h: Video input base class.
 
2
// 
 
3
//   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 
4
// 
 
5
// This program is free software; you can redistribute it and/or modify
 
6
// it under the terms of the GNU General Public License as published by
 
7
// the Free Software Foundation; either version 3 of the License, or
 
8
// (at your option) any later version.
 
9
// 
 
10
// This program is distributed in the hope that it will be useful,
 
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
// GNU General Public License for more details.
 
14
//
 
15
// You should have received a copy of the GNU General Public License
 
16
// along with this program; if not, write to the Free Software
 
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 
 
19
#ifndef GNASH_VIDEOINPUT_H
 
20
#define GNASH_VIDEOINPUT_H
 
21
 
 
22
#include <boost/cstdint.hpp> // for C99 int types
 
23
#include <string>
 
24
#include <vector>
 
25
#include <ostream>
 
26
#include <cstdio>
 
27
#include <map>
 
28
 
 
29
#include "dsodefs.h" //DSOEXPORT
 
30
 
 
31
namespace gnash {
 
32
namespace media {
 
33
 
 
34
/// This is the interface for video input devices.
 
35
//
 
36
/// Each VideoInput should represent exactly one webcam (or similar device).
 
37
//
 
38
/// The interface for querying the camera is provisionally done, but needs
 
39
/// more testing of how it actually works. Most of the values are faked. 
 
40
//
 
41
/// TODO: separate the process of finding cameras from this class.
 
42
///       It could be implemented as a static method. The available cameras
 
43
///       and all created VideoInput objects should be stored in a
 
44
///       MediaHandler, mapped by an index for retrieval by ActionScript.
 
45
//
 
46
/// TODO: design a useful interface for starting, stopping and attaching
 
47
///       the video data. VideoInputGst has some functionality here, but it
 
48
///       is not generic enough, relying on too many gst-specific
 
49
///       implementation details.
 
50
class VideoInput {
 
51
 
 
52
public:
 
53
 
 
54
    DSOEXPORT VideoInput() {}
 
55
 
 
56
    // virtual classes need a virtual destructor !
 
57
    virtual ~VideoInput() {}
 
58
       
 
59
    /// Return the current activity level of the webcam
 
60
    //
 
61
    /// @return     A double specifying the amount of motion currently
 
62
    ///             detected by the camera.
 
63
    virtual double activityLevel() const = 0;
 
64
    
 
65
    /// The maximum available bandwidth for outgoing connections
 
66
    //
 
67
    /// TODO: see if this should really be here.
 
68
    virtual size_t bandwidth() const = 0;
 
69
    
 
70
    /// Set the bandwidth for outgoing connections.
 
71
    virtual void setBandwidth(size_t bandwidth) = 0;
 
72
 
 
73
    /// The current frame rate of the webcam
 
74
    //
 
75
    /// @return     A double specifying the webcam's current FPS
 
76
    virtual double currentFPS() const = 0;
 
77
    
 
78
    /// The maximum FPS rate of the webcam
 
79
    //
 
80
    /// @return     A double specifying the webcam's maximum FPS
 
81
    virtual double fps() const = 0;
 
82
 
 
83
    /// Return the height of the webcam's frame
 
84
    virtual size_t height() const = 0;
 
85
    
 
86
    /// Return the width of the webcam's frame
 
87
    virtual size_t width() const = 0;
 
88
    
 
89
    /// The index of the camera
 
90
    virtual size_t index() const = 0;
 
91
    
 
92
    /// Request a native mode most closely matching the passed variables.
 
93
    //
 
94
    /// @param width            The required width
 
95
    /// @param height           The required height
 
96
    /// @param fps              The required frame rate
 
97
    /// @param favorArea        How to match the requested mode.
 
98
    virtual void requestMode(size_t width, size_t height, double fps,
 
99
            bool favorArea) = 0;
 
100
 
 
101
    /// Set the amount of motion required before notifying the core
 
102
    virtual void setMotionLevel(int m) = 0;
 
103
 
 
104
    /// Return the current motionLevel setting
 
105
    virtual int motionLevel() const = 0;
 
106
    
 
107
    /// Set time without motion in milliseconds before core is notified
 
108
    virtual void setMotionTimeout(int m) = 0;
 
109
 
 
110
    /// Return the current motionTimeout setting.
 
111
    virtual int motionTimeout() const = 0;
 
112
    
 
113
    virtual void mute(bool m) = 0;
 
114
    virtual bool muted() const = 0;
 
115
    
 
116
    /// Return the name of this webcam
 
117
    //
 
118
    /// @return     a string specifying the name of the webcam.
 
119
    virtual const std::string& name() const = 0;
 
120
 
 
121
    /// Set the quality of the webcam
 
122
    virtual void setQuality(int q) = 0;
 
123
 
 
124
    /// Return the current quality of the webcam
 
125
    virtual int quality() const = 0;
 
126
 
 
127
};
 
128
 
 
129
    
 
130
} // media namespace 
 
131
} // gnash namespace
 
132
 
 
133
#endif