mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
06fdc7b897
This patch implements a simple Qt-based media player which is actually a graphical user interface for the SDL-based 'avplay' media player from 'libav'. It starts 'avplay' as a child and shows its graphical output in a 'QNitpickerViewWidget'. The widgets for controlling the player state send the according keyboard and mouse input events to 'avplay'. The 'qt_avplay' player supports the following configuration options: <mediafile name="..."/> -> name of the media file to play <framebuffer_filter name="..." ram_quota="..."/> (may appear multiple times) -> name of a framebuffer filter service to filter the video output Fixes #222.
71 lines
1.3 KiB
C++
71 lines
1.3 KiB
C++
/*
|
|
* \brief Input event queue
|
|
* \author Norman Feske
|
|
* \date 2007-10-08
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2007-2012 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _EVENT_QUEUE_H_
|
|
#define _EVENT_QUEUE_H_
|
|
|
|
#include <base/printf.h>
|
|
#include <input/event.h>
|
|
#include <os/ring_buffer.h>
|
|
|
|
/**
|
|
* Input event queue
|
|
*
|
|
* We expect the client to fetch events circa each 10ms. The PS/2 driver queues
|
|
* up to 255 events, which should be enough. Normally, PS/2 generates not more
|
|
* than 16Kbit/s, which would correspond to ca. 66 mouse events per 10ms.
|
|
*/
|
|
class Event_queue
|
|
{
|
|
private:
|
|
|
|
bool _enabled;
|
|
Ring_buffer<Input::Event, 512> _ev_queue;
|
|
|
|
public:
|
|
|
|
Event_queue() : _enabled(false), _ev_queue() { }
|
|
|
|
void enable() { _enabled = true; }
|
|
void disable() { _enabled = false; }
|
|
|
|
void add(Input::Event e)
|
|
{
|
|
if (!_enabled) return;
|
|
|
|
try {
|
|
_ev_queue.add(e);
|
|
} catch (Ring_buffer<Input::Event, 512>::Overflow) {
|
|
PWRN("event buffer overflow");
|
|
}
|
|
}
|
|
|
|
Input::Event get()
|
|
{
|
|
if (_enabled)
|
|
return _ev_queue.get();
|
|
else
|
|
return Input::Event();
|
|
}
|
|
|
|
bool empty()
|
|
{
|
|
if (_enabled)
|
|
return _ev_queue.empty();
|
|
else
|
|
return true;
|
|
}
|
|
};
|
|
|
|
#endif /* _EVENT_QUEUE_H_ */
|