diff options
| author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-06-20 08:53:36 +0300 | 
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-06-20 08:53:36 +0300 | 
| commit | c1138d9e30a3426a1d734c1de28218102bcb05d4 (patch) | |
| tree | ac73959ce506b4a21c26edc3cc1503223ff446b4 /kms++util/inc | |
| parent | 33c98598a79b8cd15ded9c91b0bc580fe1ed6fb9 (diff) | |
| parent | 6f5d1817fdb305b9f63a5e8abfbcf46da41d3245 (diff) | |
Merge V4L2 related work
Diffstat (limited to 'kms++util/inc')
| -rw-r--r-- | kms++util/inc/kms++util/kms++util.h | 1 | ||||
| -rw-r--r-- | kms++util/inc/kms++util/resourcemanager.h | 27 | ||||
| -rw-r--r-- | kms++util/inc/kms++util/videodevice.h | 86 | 
3 files changed, 114 insertions, 0 deletions
| diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h index ca3c406..10a1f0a 100644 --- a/kms++util/inc/kms++util/kms++util.h +++ b/kms++util/inc/kms++util/kms++util.h @@ -8,6 +8,7 @@  #include <kms++util/extcpuframebuffer.h>  #include <kms++util/stopwatch.h>  #include <kms++util/opts.h> +#include <kms++util/resourcemanager.h>  #include <cstdio>  #include <cstdlib> diff --git a/kms++util/inc/kms++util/resourcemanager.h b/kms++util/inc/kms++util/resourcemanager.h new file mode 100644 index 0000000..92e7b93 --- /dev/null +++ b/kms++util/inc/kms++util/resourcemanager.h @@ -0,0 +1,27 @@ +#include <kms++/kms++.h> +#include <vector> +#include <string> + +namespace kms { + +class ResourceManager +{ +public: +	ResourceManager(Card& card); + +	void reset(); + +	Connector* reserve_connector(const std::string& name = ""); +	Crtc* reserve_crtc(Connector* conn); +	Plane* reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format = PixelFormat::Undefined); +	Plane* reserve_primary_plane(Crtc* crtc, PixelFormat format = PixelFormat::Undefined); +	Plane* reserve_overlay_plane(Crtc* crtc, PixelFormat format = PixelFormat::Undefined); + +private: +	Card& m_card; +	std::vector<Connector*> m_reserved_connectors; +	std::vector<Crtc*> m_reserved_crtcs; +	std::vector<Plane*> m_reserved_planes; +}; + +} diff --git a/kms++util/inc/kms++util/videodevice.h b/kms++util/inc/kms++util/videodevice.h new file mode 100644 index 0000000..68e2b01 --- /dev/null +++ b/kms++util/inc/kms++util/videodevice.h @@ -0,0 +1,86 @@ +#pragma once + +#include <string> +#include <kms++/kms++.h> + +class VideoStreamer; + +class VideoDevice +{ +public: +	struct VideoFrameSize +	{ +		uint32_t min_w, max_w, step_w; +		uint32_t min_h, max_h, step_h; +	}; + +	VideoDevice(const std::string& dev); +	VideoDevice(int fd); +	~VideoDevice(); + +	VideoDevice(const VideoDevice& other) = delete; +	VideoDevice& operator=(const VideoDevice& other) = delete; + +	VideoStreamer* get_capture_streamer(); +	VideoStreamer* get_output_streamer(); + +	std::vector<std::tuple<uint32_t, uint32_t>> get_discrete_frame_sizes(kms::PixelFormat fmt); +	VideoFrameSize get_frame_sizes(kms::PixelFormat fmt); + +	int fd() const { return m_fd; } +	bool has_capture() const { return m_has_capture; } +	bool has_output() const { return m_has_output; } +	bool has_m2m() const { return m_has_m2m; } + +	static std::vector<std::string> get_capture_devices(); +	static std::vector<std::string> get_m2m_devices(); + +private: +	int m_fd; + +	bool m_has_capture; +	bool m_has_mplane_capture; + +	bool m_has_output; +	bool m_has_mplane_output; + +	bool m_has_m2m; +	bool m_has_mplane_m2m; + +	std::vector<kms::DumbFramebuffer*> m_capture_fbs; +	std::vector<kms::DumbFramebuffer*> m_output_fbs; + +	VideoStreamer* m_capture_streamer; +	VideoStreamer* m_output_streamer; +}; + +class VideoStreamer +{ +public: +	enum class StreamerType { +		CaptureSingle, +		CaptureMulti, +		OutputSingle, +		OutputMulti, +	}; + +	VideoStreamer(int fd, StreamerType type); + +	std::vector<std::string> get_ports(); +	void set_port(uint32_t index); + +	std::vector<kms::PixelFormat> get_formats(); +	void set_format(kms::PixelFormat fmt, uint32_t width, uint32_t height); +	void set_queue_size(uint32_t queue_size); +	void queue(kms::DumbFramebuffer* fb); +	kms::DumbFramebuffer* dequeue(); +	void stream_on(); +	void stream_off(); + +	int fd() const { return m_fd; } + +private: +	int m_fd; +	StreamerType m_type; +	std::vector<kms::DumbFramebuffer*> m_fbs; +}; | 
