diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2015-10-07 18:34:15 +0200 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2015-10-07 18:34:15 +0200 |
| commit | 40628c3d1a1c336363ccec9a9b610284f2aebe74 (patch) | |
| tree | 6ea88a908df5ee5afe72896b88386dff46d3ad89 | |
| parent | f688182f1a18f8b02cafdffc868d21b13c2779aa (diff) | |
| download | vdr-plugin-rpihddevice-40628c3d1a1c336363ccec9a9b610284f2aebe74.tar.gz vdr-plugin-rpihddevice-40628c3d1a1c336363ccec9a9b610284f2aebe74.tar.bz2 | |
added plugin options to specify video and osd layers
| -rw-r--r-- | HISTORY | 2 | ||||
| -rw-r--r-- | omx.c | 16 | ||||
| -rw-r--r-- | omx.h | 3 | ||||
| -rw-r--r-- | omxdevice.c | 7 | ||||
| -rw-r--r-- | omxdevice.h | 4 | ||||
| -rw-r--r-- | ovgosd.c | 11 | ||||
| -rw-r--r-- | ovgosd.h | 2 | ||||
| -rw-r--r-- | rpihddevice.c | 4 | ||||
| -rw-r--r-- | setup.c | 20 | ||||
| -rw-r--r-- | setup.h | 12 |
10 files changed, 63 insertions, 18 deletions
@@ -1,6 +1,8 @@ VDR Plugin 'rpihddevice' Revision History ----------------------------------------- +- new: + - added plugin options to specify video and osd layers - fixed: - treat zero as valid PTS value - perform save / restore region direct on pixmaps for accelerated OSDs @@ -454,7 +454,7 @@ cOmx::~cOmx() delete m_portEvents; } -int cOmx::Init(void) +int cOmx::Init(int layer) { m_client = ilclient_init(); if (m_client == NULL) @@ -529,6 +529,7 @@ int cOmx::Init(void) ilclient_change_component_state(m_comp[eVideoFx], OMX_StateIdle); ilclient_change_component_state(m_comp[eAudioRender], OMX_StateIdle); + SetDisplayLayer(layer); SetClockLatencyTarget(); SetBufferStallThreshold(20000); SetClockReference(cOmx::eClockRefVideo); @@ -1214,6 +1215,19 @@ void cOmx::SetDisplayRegion(int x, int y, int width, int height) ELOG("failed to set display region!"); } +void cOmx::SetDisplayLayer(int layer) +{ + OMX_CONFIG_DISPLAYREGIONTYPE region; + OMX_INIT_STRUCT(region); + region.nPortIndex = 90; + region.layer = layer; + region.set = (OMX_DISPLAYSETTYPE)(OMX_DISPLAY_SET_LAYER); + + if (OMX_SetConfig(ILC_GET_HANDLE(m_comp[eVideoRender]), + OMX_IndexConfigDisplayRegion, ®ion) != OMX_ErrorNone) + ELOG("failed to set display region!"); +} + OMX_BUFFERHEADERTYPE* cOmx::GetAudioBuffer(int64_t pts) { Lock(); @@ -26,7 +26,7 @@ public: cOmx(); virtual ~cOmx(); - int Init(void); + int Init(int layer); int DeInit(void); void SetBufferStallCallback(void (*onBufferStall)(void*), void* data); @@ -87,6 +87,7 @@ public: void SetDisplayMode(bool letterbox, bool noaspect); void SetDisplayRegion(int x, int y, int width, int height); + void SetDisplayLayer(int layer); OMX_BUFFERHEADERTYPE* GetAudioBuffer(int64_t pts = OMX_INVALID_PTS); OMX_BUFFERHEADERTYPE* GetVideoBuffer(int64_t pts = OMX_INVALID_PTS); diff --git a/omxdevice.c b/omxdevice.c index 34b9588..c5df12a 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -37,7 +37,7 @@ const uchar cOmxDevice::PesVideoHeader[14] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; -cOmxDevice::cOmxDevice(void (*onPrimaryDevice)(void)) : +cOmxDevice::cOmxDevice(void (*onPrimaryDevice)(void), int layer) : cDevice(), m_onPrimaryDevice(onPrimaryDevice), m_omx(new cOmx()), @@ -56,7 +56,8 @@ cOmxDevice::cOmxDevice(void (*onPrimaryDevice)(void)) : m_trickRequest(0), m_audioPts(0), m_videoPts(0), - m_lastStc(0) + m_lastStc(0), + m_layer(layer) { } @@ -72,7 +73,7 @@ cOmxDevice::~cOmxDevice() int cOmxDevice::Init(void) { - if (m_omx->Init() < 0) + if (m_omx->Init(m_layer) < 0) { ELOG("failed to initialize OMX!"); return -1; diff --git a/omxdevice.h b/omxdevice.h index 9343a69..ed69639 100644 --- a/omxdevice.h +++ b/omxdevice.h @@ -20,7 +20,7 @@ class cOmxDevice : cDevice public: - cOmxDevice(void (*onPrimaryDevice)(void)); + cOmxDevice(void (*onPrimaryDevice)(void), int layer); virtual ~cOmxDevice(); virtual int Init(void); @@ -181,6 +181,8 @@ private: int64_t m_videoPts; int64_t m_lastStc; + + int m_layer; }; #endif @@ -1644,8 +1644,8 @@ class cOvgThread : public cThread { public: - cOvgThread() : - cThread("ovgthread"), m_wait(new cCondWait()), m_stalled(false) + cOvgThread(int layer) : cThread("ovgthread"), + m_wait(new cCondWait()), m_stalled(false), m_layer(layer) { for (int i = 0; i < OVG_MAX_OSDIMAGES; i++) m_images[i].used = false; @@ -1822,7 +1822,7 @@ protected: VC_RECT_T dstRect = { 0, 0, egl.window.width, egl.window.height }; egl.window.element = vc_dispmanx_element_add( - update, display, 2 /*layer*/, &dstRect, 0, &srcRect, + update, display, m_layer, &dstRect, 0, &srcRect, DISPMANX_PROTECTION_NONE, 0, 0, (DISPMANX_TRANSFORM_T)0); vc_dispmanx_update_submit_sync(update); @@ -1929,6 +1929,7 @@ private: std::queue<cOvgCmd*> m_commands; cCondWait *m_wait; bool m_stalled; + int m_layer; tOvgImageRef m_images[OVG_MAX_OSDIMAGES]; @@ -2701,12 +2702,12 @@ private: cRpiOsdProvider* cRpiOsdProvider::s_instance = 0; -cRpiOsdProvider::cRpiOsdProvider() : +cRpiOsdProvider::cRpiOsdProvider(int layer) : cOsdProvider(), m_ovg(0) { DLOG("new cOsdProvider()"); - m_ovg = new cOvgThread(); + m_ovg = new cOvgThread(layer); s_instance = this; } @@ -16,7 +16,7 @@ class cRpiOsdProvider : public cOsdProvider public: - cRpiOsdProvider(); + cRpiOsdProvider(int layer); ~cRpiOsdProvider(); static void ResetOsd(bool cleanup = false); diff --git a/rpihddevice.c b/rpihddevice.c index aef1a48..ca85a34 100644 --- a/rpihddevice.c +++ b/rpihddevice.c @@ -25,7 +25,7 @@ private: static void OnPrimaryDevice(void) { if (cRpiSetup::HasOsd()) - new cRpiOsdProvider(); + new cRpiOsdProvider(cRpiSetup::OsdLayer()); } public: @@ -65,7 +65,7 @@ bool cPluginRpiHdDevice::Initialize(void) if (!cRpiSetup::IsVideoCodecSupported(cVideoCodec::eMPEG2)) DLOG("MPEG2 video decoder not enabled!"); - m_device = new cOmxDevice(&OnPrimaryDevice); + m_device = new cOmxDevice(&OnPrimaryDevice, cRpiSetup::VideoLayer()); if (m_device) return !m_device->Init(); @@ -332,24 +332,38 @@ void cRpiSetup::Set(AudioParameters audio, VideoParameters video, bool cRpiSetup::ProcessArgs(int argc, char *argv[]) { static struct option long_options[] = { - { "disable-osd", no_argument, NULL, 'd' }, + { "disable-osd", no_argument, NULL, 'd' }, + { "video-layer", required_argument, NULL, 'v' }, + { "osd-layer", required_argument, NULL, 'o' }, }; int c; - while ((c = getopt_long(argc, argv, "d", long_options, NULL)) != -1) + while ((c = getopt_long(argc, argv, "do:v:", long_options, NULL)) != -1) { switch (c) { case 'd': m_plugin.hasOsd = false; break; + case 'o': + m_plugin.osdLayer = atoi(optarg); + break; + case 'v': + m_plugin.videoLayer = atoi(optarg); + break; default: return false; } } + DBG("dispmanx layers: video=%d, osd=%d (%s)", + m_plugin.videoLayer, m_plugin.osdLayer, + m_plugin.hasOsd ? "enabled" : "disabled"); + return true; } const char *cRpiSetup::CommandLineHelp(void) { - return " -d, --disable-osd disable OSD\n"; + return " -d, --disable-osd disable OSD\n" + " -v, --video-layer dispmanx layer for video (default 0)\n" + " -o, --osd-layer dispmanx layer for OSD (default 2)\n"; } @@ -61,9 +61,11 @@ public: struct PluginParameters { PluginParameters() : - hasOsd(true) { } + hasOsd(true), videoLayer(0), osdLayer(2) { } bool hasOsd; + int videoLayer; + int osdLayer; }; static bool HwInit(void); @@ -121,6 +123,14 @@ public: return GetInstance()->m_plugin.hasOsd; } + static int VideoLayer(void) { + return GetInstance()->m_plugin.videoLayer; + } + + static int OsdLayer(void) { + return GetInstance()->m_plugin.osdLayer; + } + static void SetHDMIChannelMapping(bool passthrough, int channels); static cRpiSetup* GetInstance(void); |
