|
vdr-plugin-softhddevice-drm-gles 1.4.0
|
Some helper functions to convert and blit buffers. More...
#include <libavutil/imgutils.h>#include <libswscale/swscale.h>#include <sys/mman.h>#include <drm_fourcc.h>#include "buf2rgb.h"#include "logger.h"#include "drmbuffer.h"
Go to the source code of this file.
Macros | |
| #define | OPAQUE 0xff |
| #define | TRANSPARENT 0x00 |
| #define | UNMULTIPLY(color, alpha) ((0xff * color) / alpha) |
| #define | BLEND(back, front, alpha) ((front * alpha) + (back * (255 - alpha))) / 255 |
Functions | |
| enum AVPixelFormat | DrmFormatToAVFormat (cDrmBuffer *buf) |
| Convert a DRM format to a ffmpeg AV format. More... | |
| uint8_t * | BufToRgb (cDrmBuffer *buf, int *size, int dstW, int dstH, enum AVPixelFormat dstPixFmt) |
| Convert a DRM buffer to rgb format image. More... | |
| uint8_t * | ScaleRgb24 (uint8_t *src, int *size, int srcW, int srcH, int dstW, int dstH) |
| Scale an image. More... | |
| void | AlphaBlend (uint8_t *result, uint8_t *front, uint8_t *back, const unsigned int width, const unsigned int height) |
| Blend two images. More... | |
| int | BlitVideo (uint8_t *dst, uint8_t *src, int dstW, int dstH, int dstX, int dstY, int srcW, int srcH) |
| Blit the video on black background. More... | |
| void | PrintStreamData (const uint8_t *data, int size) |
| Print raw stream data. More... | |
Some helper functions to convert and blit buffers.
AGPLv3
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
Definition in file buf2rgb.cpp.
| #define BLEND | ( | back, | |
| front, | |||
| alpha | |||
| ) | ((front * alpha) + (back * (255 - alpha))) / 255 |
Definition at line 35 of file buf2rgb.cpp.
| #define OPAQUE 0xff |
Definition at line 32 of file buf2rgb.cpp.
| #define TRANSPARENT 0x00 |
Definition at line 33 of file buf2rgb.cpp.
| #define UNMULTIPLY | ( | color, | |
| alpha | |||
| ) | ((0xff * color) / alpha) |
Definition at line 34 of file buf2rgb.cpp.
| void AlphaBlend | ( | uint8_t * | result, |
| uint8_t * | front, | ||
| uint8_t * | back, | ||
| const unsigned int | width, | ||
| const unsigned int | height | ||
| ) |
Blend two images.
Both, front and back image data have to be same size front is the OSD (ARGB) back is the video (RGB) result is RGB
| [out] | result | pointer to the resulting image data |
| [in] | front | pointer to the upper image data |
| [in] | back | pointer to the lower image data |
| [in] | width | image width |
| [in] | height | image height |
Definition at line 203 of file buf2rgb.cpp.
References BLEND, OPAQUE, TRANSPARENT, and UNMULTIPLY.
Referenced by cSoftHdDevice::GrabImage().
| int BlitVideo | ( | uint8_t * | dst, |
| uint8_t * | src, | ||
| int | dstW, | ||
| int | dstH, | ||
| int | dstX, | ||
| int | dstY, | ||
| int | srcW, | ||
| int | srcH | ||
| ) |
Blit the video on black background.
| [in] | dst | pointer to the destination video |
| [in] | src | pointer to the source video |
| [in] | dstW | destination width of the image |
| [in] | dstH | destination height of the image |
| [in] | dstX | x offset of the (already scaled) video on the image |
| [in] | dstY | y offset of the (already scaled) video on the image |
| [in] | srcW | source video width |
| [in] | srcH | source video height |
Definition at line 264 of file buf2rgb.cpp.
References L_GRAB, and LOGDEBUG2.
Referenced by cSoftHdDevice::GrabImage().
| uint8_t * BufToRgb | ( | cDrmBuffer * | buf, |
| int * | size, | ||
| int | dstW, | ||
| int | dstH, | ||
| enum AVPixelFormat | dstPixFmt | ||
| ) |
Convert a DRM buffer to rgb format image.
Conversion is done with ffmpegs swscale
| [in] | buf | pointer to the source drm buffer struct |
| [out] | size | size of the return data |
| [in] | dstW | width of the returned image |
| [in] | dstH | height of the returned image |
| [in] | dstPixFmt | pixel format of the returned image |
Definition at line 74 of file buf2rgb.cpp.
References DrmFormatToAVFormat(), cDrmBuffer::Height(), L_GRAB, LOGDEBUG2, LOGERROR, cDrmBuffer::NumPlanes(), cDrmBuffer::Offset(), cDrmBuffer::Pitch(), cDrmBuffer::Plane(), cDrmBuffer::Size(), and cDrmBuffer::Width().
Referenced by cVideoRender::ConvertOsdBufToRgb(), cVideoRender::ConvertPipBufToRgb(), and cVideoRender::ConvertVideoBufToRgb().
| enum AVPixelFormat DrmFormatToAVFormat | ( | cDrmBuffer * | buf | ) |
Convert a DRM format to a ffmpeg AV format.
Definition at line 44 of file buf2rgb.cpp.
References cDrmBuffer::PixFmt().
Referenced by BufToRgb().
| void PrintStreamData | ( | const uint8_t * | data, |
| int | size | ||
| ) |
Print raw stream data.
| data | pointer to stream data |
| size | data size |
Definition at line 288 of file buf2rgb.cpp.
References LOGDEBUG.
| uint8_t * ScaleRgb24 | ( | uint8_t * | src, |
| int * | size, | ||
| int | srcW, | ||
| int | srcH, | ||
| int | dstW, | ||
| int | dstH | ||
| ) |
Scale an image.
Conversion is done with ffmpegs swscale
| [in] | src | pointer to the source data |
| [out] | size | size of the return data |
| [in] | srcW | source width |
| [in] | srcH | source height |
| [in] | dstW | width of the returned image |
| [in] | dstH | height of the returned image |
Definition at line 152 of file buf2rgb.cpp.
References L_GRAB, LOGDEBUG2, and LOGERROR.
Referenced by cSoftHdDevice::GrabImage().