diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2015-12-10 10:08:54 +0100 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2015-12-10 10:08:54 +0100 |
| commit | a5d2f886741aa552c1df2b733a473059a5c20d57 (patch) | |
| tree | 7e2afe671897c5f77ab7aa1d6e96f2d801de08b9 | |
| parent | 82bf95285ba316e9b9aea455df4f186f823aaa9c (diff) | |
| download | vdr-plugin-rpihddevice-a5d2f886741aa552c1df2b733a473059a5c20d57.tar.gz vdr-plugin-rpihddevice-a5d2f886741aa552c1df2b733a473059a5c20d57.tar.bz2 | |
report pixel aspect ratio
| -rw-r--r-- | omx.c | 24 | ||||
| -rw-r--r-- | omx.h | 1 | ||||
| -rw-r--r-- | omxdevice.c | 6 | ||||
| -rw-r--r-- | tools.h | 4 |
4 files changed, 32 insertions, 3 deletions
@@ -290,6 +290,13 @@ void cOmx::HandlePortSettingsChanged(unsigned int portId) &portdef) != OMX_ErrorNone) ELOG("failed to get video decoder port format!"); + OMX_CONFIG_POINTTYPE pixelAspect; + OMX_INIT_STRUCT(pixelAspect); + pixelAspect.nPortIndex = 131; + if (OMX_GetParameter(ILC_GET_HANDLE(m_comp[eVideoDecoder]), OMX_IndexParamBrcmPixelAspectRatio, + &pixelAspect) != OMX_ErrorNone) + ELOG("failed to get pixel aspect ratio!"); + OMX_CONFIG_INTERLACETYPE interlace; OMX_INIT_STRUCT(interlace); interlace.nPortIndex = 131; @@ -299,6 +306,8 @@ void cOmx::HandlePortSettingsChanged(unsigned int portId) m_videoFrameFormat.width = portdef.format.video.nFrameWidth; m_videoFrameFormat.height = portdef.format.video.nFrameHeight; + m_videoFrameFormat.pixelWidth = pixelAspect.nX; + m_videoFrameFormat.pixelHeight = pixelAspect.nY; m_videoFrameFormat.scanMode = interlace.eMode == OMX_InterlaceProgressive ? cScanMode::eProgressive : interlace.eMode == OMX_InterlaceFieldSingleUpperFirst ? cScanMode::eTopFieldFirst : @@ -1195,6 +1204,21 @@ void cOmx::SetDisplayMode(bool fill, bool noaspect) ELOG("failed to set display region!"); } +void cOmx::SetPixelAspectRatio(int width, int height) +{ + OMX_CONFIG_DISPLAYREGIONTYPE region; + OMX_INIT_STRUCT(region); + region.nPortIndex = 90; + region.set = (OMX_DISPLAYSETTYPE)(OMX_DISPLAY_SET_PIXEL); + + region.pixel_x = width; + region.pixel_y = height; + + if (OMX_SetConfig(ILC_GET_HANDLE(m_comp[eVideoRender]), + OMX_IndexConfigDisplayRegion, ®ion) != OMX_ErrorNone) + ELOG("failed to set pixel apect ratio!"); +} + void cOmx::SetDisplayRegion(int x, int y, int width, int height) { OMX_CONFIG_DISPLAYREGIONTYPE region; @@ -86,6 +86,7 @@ public: } void SetDisplayMode(bool letterbox, bool noaspect); + void SetPixelAspectRatio(int width, int height); void SetDisplayRegion(int x, int y, int width, int height); void SetDisplay(int display, int layer); diff --git a/omxdevice.c b/omxdevice.c index 270deac..2771ec5 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -672,8 +672,10 @@ void cOmxDevice::HandleStreamStart() DBG("HandleStreamStart()"); const cVideoFrameFormat *format = m_omx->GetVideoFrameFormat(); - DLOG("video stream started %dx%d@%d%s", format->width, format->height, - format->frameRate, format->Interlaced() ? "i" : "p"); + DLOG("video stream started %dx%d@%d%s PAR(%d:%d)", + format->width, format->height, format->frameRate, + format->Interlaced() ? "i" : "p", + format->pixelWidth, format->pixelHeight); cRpiDisplay::SetVideoFormat(format); } @@ -186,12 +186,14 @@ class cVideoFrameFormat public: cVideoFrameFormat() : width(0), height(0), frameRate(0), - scanMode(cScanMode::eProgressive) { }; + scanMode(cScanMode::eProgressive), pixelWidth(0), pixelHeight(0) { }; int width; int height; int frameRate; cScanMode::eMode scanMode; + int pixelWidth; + int pixelHeight; bool Interlaced(void) const { return cScanMode::Interlaced(scanMode); |
