Visuals - Screen Management - Screenrecorder

Enable the ability to record the screen while onroad.

Credit goes to Neokii!

https: //github.com/neokii
Co-Authored-By: neokii <3665951+neokii@users.noreply.github.com>
This commit is contained in:
FrogAi 2024-06-08 14:49:10 -07:00
parent 8186a03997
commit b503a0236c
29 changed files with 10326 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,89 @@
#pragma once
#include <iostream>
#include <queue>
#include <mutex>
template <class T>
class BlockingQueue
{
public:
std::deque<T> content;
size_t capacity;
std::mutex mutex;
std::condition_variable not_empty;
std::condition_variable not_full;
BlockingQueue(const BlockingQueue &) = delete;
BlockingQueue(BlockingQueue &&) = delete;
BlockingQueue &operator = (const BlockingQueue &) = delete;
BlockingQueue &operator = (BlockingQueue &&) = delete;
public:
BlockingQueue(size_t capacity): capacity(capacity) {}
void clear() {
{
std::unique_lock<std::mutex> lk(mutex);
content.clear();
}
not_full.notify_one();
}
void push(T &&item) {
{
std::unique_lock<std::mutex> lk(mutex);
not_full.wait(lk, [this]() { return content.size() < capacity; });
content.push_back(std::move(item));
}
not_empty.notify_one();
}
bool try_push(T &&item) {
{
std::unique_lock<std::mutex> lk(mutex);
if (content.size() == capacity)
return false;
content.push_back(std::move(item));
}
not_empty.notify_one();
return true;
}
void pop(T &item) {
{
std::unique_lock<std::mutex> lk(mutex);
not_empty.wait(lk, [this]() { return !content.empty(); });
item = std::move(content.front());
content.pop_front();
}
not_full.notify_one();
}
bool pop_wait_for(T &item, std::chrono::milliseconds duration) {
{
std::unique_lock<std::mutex> lk(mutex);
if(not_empty.wait_for(lk, duration, [this]() { return !content.empty(); })) {
item = std::move(content.front());
content.pop_front();
}
else {
return false;
}
}
not_full.notify_one();
return true;
}
bool try_pop(T &item) {
{
std::unique_lock<std::mutex> lk(mutex);
if (content.empty())
return false;
item = std::move(content.front());
content.pop_front();
}
not_full.notify_one();
return true;
}
};

View File

@ -0,0 +1,699 @@
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include "selfdrive/frogpilot/screenrecorder/omx_encoder.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cassert>
#include <cstdlib>
#include <cstdio>
#include <OMX_Component.h>
#include <OMX_IndexExt.h>
#include <OMX_QCOMExtns.h>
#include <OMX_VideoExt.h>
#include "libyuv.h"
#include "msm_media_info.h"
#include "common/swaglog.h"
#include "common/util.h"
using namespace libyuv;
LIBYUV_API
int ABGRToNV12(const uint8_t* src_abgr,
int src_stride_abgr,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_uv,
int dst_stride_uv,
int width,
int height) {
int y;
int halfwidth = (width + 1) >> 1;
void (*ABGRToUVRow)(const uint8_t* src_abgr0, int src_stride_abgr,
uint8_t* dst_u, uint8_t* dst_v, int width) =
ABGRToUVRow_C;
void (*ABGRToYRow)(const uint8_t* src_abgr, uint8_t* dst_y, int width) =
ABGRToYRow_C;
void (*MergeUVRow_)(const uint8_t* src_u, const uint8_t* src_v,
uint8_t* dst_uv, int width) = MergeUVRow_C;
if (!src_abgr || !dst_y || !dst_uv || width <= 0 || height == 0) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_abgr = src_abgr + (height - 1) * src_stride_abgr;
src_stride_abgr = -src_stride_abgr;
}
#if defined(HAS_ABGRTOYROW_SSSE3) && defined(HAS_ABGRTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
ABGRToUVRow = ABGRToUVRow_Any_SSSE3;
ABGRToYRow = ABGRToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) {
ABGRToUVRow = ABGRToUVRow_SSSE3;
ABGRToYRow = ABGRToYRow_SSSE3;
}
}
#endif
#if defined(HAS_ABGRTOYROW_AVX2) && defined(HAS_ABGRTOUVROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
ABGRToUVRow = ABGRToUVRow_Any_AVX2;
ABGRToYRow = ABGRToYRow_Any_AVX2;
if (IS_ALIGNED(width, 32)) {
ABGRToUVRow = ABGRToUVRow_AVX2;
ABGRToYRow = ABGRToYRow_AVX2;
}
}
#endif
#if defined(HAS_ABGRTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
ABGRToYRow = ABGRToYRow_Any_NEON;
if (IS_ALIGNED(width, 8)) {
ABGRToYRow = ABGRToYRow_NEON;
}
}
#endif
#if defined(HAS_ABGRTOUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
ABGRToUVRow = ABGRToUVRow_Any_NEON;
if (IS_ALIGNED(width, 16)) {
ABGRToUVRow = ABGRToUVRow_NEON;
}
}
#endif
#if defined(HAS_ABGRTOYROW_MMI) && defined(HAS_ABGRTOUVROW_MMI)
if (TestCpuFlag(kCpuHasMMI)) {
ABGRToYRow = ABGRToYRow_Any_MMI;
ABGRToUVRow = ABGRToUVRow_Any_MMI;
if (IS_ALIGNED(width, 8)) {
ABGRToYRow = ABGRToYRow_MMI;
}
if (IS_ALIGNED(width, 16)) {
ABGRToUVRow = ABGRToUVRow_MMI;
}
}
#endif
#if defined(HAS_ABGRTOYROW_MSA) && defined(HAS_ABGRTOUVROW_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
ABGRToYRow = ABGRToYRow_Any_MSA;
ABGRToUVRow = ABGRToUVRow_Any_MSA;
if (IS_ALIGNED(width, 16)) {
ABGRToYRow = ABGRToYRow_MSA;
}
if (IS_ALIGNED(width, 32)) {
ABGRToUVRow = ABGRToUVRow_MSA;
}
}
#endif
#if defined(HAS_MERGEUVROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2)) {
MergeUVRow_ = MergeUVRow_Any_SSE2;
if (IS_ALIGNED(halfwidth, 16)) {
MergeUVRow_ = MergeUVRow_SSE2;
}
}
#endif
#if defined(HAS_MERGEUVROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
MergeUVRow_ = MergeUVRow_Any_AVX2;
if (IS_ALIGNED(halfwidth, 32)) {
MergeUVRow_ = MergeUVRow_AVX2;
}
}
#endif
#if defined(HAS_MERGEUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
MergeUVRow_ = MergeUVRow_Any_NEON;
if (IS_ALIGNED(halfwidth, 16)) {
MergeUVRow_ = MergeUVRow_NEON;
}
}
#endif
#if defined(HAS_MERGEUVROW_MMI)
if (TestCpuFlag(kCpuHasMMI)) {
MergeUVRow_ = MergeUVRow_Any_MMI;
if (IS_ALIGNED(halfwidth, 8)) {
MergeUVRow_ = MergeUVRow_MMI;
}
}
#endif
#if defined(HAS_MERGEUVROW_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
MergeUVRow_ = MergeUVRow_Any_MSA;
if (IS_ALIGNED(halfwidth, 16)) {
MergeUVRow_ = MergeUVRow_MSA;
}
}
#endif
{
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 31) & ~31) * 2);
uint8_t* row_v = row_u + ((halfwidth + 31) & ~31);
for (y = 0; y < height - 1; y += 2) {
ABGRToUVRow(src_abgr, src_stride_abgr, row_u, row_v, width);
MergeUVRow_(row_u, row_v, dst_uv, halfwidth);
ABGRToYRow(src_abgr, dst_y, width);
ABGRToYRow(src_abgr + src_stride_abgr, dst_y + dst_stride_y, width);
src_abgr += src_stride_abgr * 2;
dst_y += dst_stride_y * 2;
dst_uv += dst_stride_uv;
}
if (height & 1) {
ABGRToUVRow(src_abgr, 0, row_u, row_v, width);
MergeUVRow_(row_u, row_v, dst_uv, halfwidth);
ABGRToYRow(src_abgr, dst_y, width);
}
free_aligned_buffer_64(row_u);
}
return 0;
}
// Check the OMX error code and assert if an error occurred.
#define OMX_CHECK(_expr) \
do { \
assert(OMX_ErrorNone == (_expr)); \
} while (0)
extern ExitHandler do_exit;
// ***** OMX callback functions *****
void OmxEncoder::wait_for_state(OMX_STATETYPE state_) {
std::unique_lock lk(this->state_lock);
while (this->state != state_) {
this->state_cv.wait(lk);
}
}
static OMX_CALLBACKTYPE omx_callbacks = {
.EventHandler = OmxEncoder::event_handler,
.EmptyBufferDone = OmxEncoder::empty_buffer_done,
.FillBufferDone = OmxEncoder::fill_buffer_done,
};
OMX_ERRORTYPE OmxEncoder::event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event,
OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data) {
OmxEncoder *e = (OmxEncoder*)app_data;
if (event == OMX_EventCmdComplete) {
assert(data1 == OMX_CommandStateSet);
LOG("set state event 0x%x", data2);
{
std::unique_lock lk(e->state_lock);
e->state = (OMX_STATETYPE)data2;
}
e->state_cv.notify_all();
} else if (event == OMX_EventError) {
LOGE("OMX error 0x%08x", data1);
} else {
LOGE("OMX unhandled event %d", event);
assert(false);
}
return OMX_ErrorNone;
}
OMX_ERRORTYPE OmxEncoder::empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
OMX_BUFFERHEADERTYPE *buffer) {
OmxEncoder *e = (OmxEncoder*)app_data;
e->free_in.push(buffer);
return OMX_ErrorNone;
}
OMX_ERRORTYPE OmxEncoder::fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
OMX_BUFFERHEADERTYPE *buffer) {
OmxEncoder *e = (OmxEncoder*)app_data;
e->done_out.push(buffer);
return OMX_ErrorNone;
}
#define PORT_INDEX_IN 0
#define PORT_INDEX_OUT 1
static const char* omx_color_fomat_name(uint32_t format) __attribute__((unused));
static const char* omx_color_fomat_name(uint32_t format) {
switch (format) {
case OMX_COLOR_FormatUnused: return "OMX_COLOR_FormatUnused";
case OMX_COLOR_FormatMonochrome: return "OMX_COLOR_FormatMonochrome";
case OMX_COLOR_Format8bitRGB332: return "OMX_COLOR_Format8bitRGB332";
case OMX_COLOR_Format12bitRGB444: return "OMX_COLOR_Format12bitRGB444";
case OMX_COLOR_Format16bitARGB4444: return "OMX_COLOR_Format16bitARGB4444";
case OMX_COLOR_Format16bitARGB1555: return "OMX_COLOR_Format16bitARGB1555";
case OMX_COLOR_Format16bitRGB565: return "OMX_COLOR_Format16bitRGB565";
case OMX_COLOR_Format16bitBGR565: return "OMX_COLOR_Format16bitBGR565";
case OMX_COLOR_Format18bitRGB666: return "OMX_COLOR_Format18bitRGB666";
case OMX_COLOR_Format18bitARGB1665: return "OMX_COLOR_Format18bitARGB1665";
case OMX_COLOR_Format19bitARGB1666: return "OMX_COLOR_Format19bitARGB1666";
case OMX_COLOR_Format24bitRGB888: return "OMX_COLOR_Format24bitRGB888";
case OMX_COLOR_Format24bitBGR888: return "OMX_COLOR_Format24bitBGR888";
case OMX_COLOR_Format24bitARGB1887: return "OMX_COLOR_Format24bitARGB1887";
case OMX_COLOR_Format25bitARGB1888: return "OMX_COLOR_Format25bitARGB1888";
case OMX_COLOR_Format32bitBGRA8888: return "OMX_COLOR_Format32bitBGRA8888";
case OMX_COLOR_Format32bitARGB8888: return "OMX_COLOR_Format32bitARGB8888";
case OMX_COLOR_FormatYUV411Planar: return "OMX_COLOR_FormatYUV411Planar";
case OMX_COLOR_FormatYUV411PackedPlanar: return "OMX_COLOR_FormatYUV411PackedPlanar";
case OMX_COLOR_FormatYUV420Planar: return "OMX_COLOR_FormatYUV420Planar";
case OMX_COLOR_FormatYUV420PackedPlanar: return "OMX_COLOR_FormatYUV420PackedPlanar";
case OMX_COLOR_FormatYUV420SemiPlanar: return "OMX_COLOR_FormatYUV420SemiPlanar";
case OMX_COLOR_FormatYUV422Planar: return "OMX_COLOR_FormatYUV422Planar";
case OMX_COLOR_FormatYUV422PackedPlanar: return "OMX_COLOR_FormatYUV422PackedPlanar";
case OMX_COLOR_FormatYUV422SemiPlanar: return "OMX_COLOR_FormatYUV422SemiPlanar";
case OMX_COLOR_FormatYCbYCr: return "OMX_COLOR_FormatYCbYCr";
case OMX_COLOR_FormatYCrYCb: return "OMX_COLOR_FormatYCrYCb";
case OMX_COLOR_FormatCbYCrY: return "OMX_COLOR_FormatCbYCrY";
case OMX_COLOR_FormatCrYCbY: return "OMX_COLOR_FormatCrYCbY";
case OMX_COLOR_FormatYUV444Interleaved: return "OMX_COLOR_FormatYUV444Interleaved";
case OMX_COLOR_FormatRawBayer8bit: return "OMX_COLOR_FormatRawBayer8bit";
case OMX_COLOR_FormatRawBayer10bit: return "OMX_COLOR_FormatRawBayer10bit";
case OMX_COLOR_FormatRawBayer8bitcompressed: return "OMX_COLOR_FormatRawBayer8bitcompressed";
case OMX_COLOR_FormatL2: return "OMX_COLOR_FormatL2";
case OMX_COLOR_FormatL4: return "OMX_COLOR_FormatL4";
case OMX_COLOR_FormatL8: return "OMX_COLOR_FormatL8";
case OMX_COLOR_FormatL16: return "OMX_COLOR_FormatL16";
case OMX_COLOR_FormatL24: return "OMX_COLOR_FormatL24";
case OMX_COLOR_FormatL32: return "OMX_COLOR_FormatL32";
case OMX_COLOR_FormatYUV420PackedSemiPlanar: return "OMX_COLOR_FormatYUV420PackedSemiPlanar";
case OMX_COLOR_FormatYUV422PackedSemiPlanar: return "OMX_COLOR_FormatYUV422PackedSemiPlanar";
case OMX_COLOR_Format18BitBGR666: return "OMX_COLOR_Format18BitBGR666";
case OMX_COLOR_Format24BitARGB6666: return "OMX_COLOR_Format24BitARGB6666";
case OMX_COLOR_Format24BitABGR6666: return "OMX_COLOR_Format24BitABGR6666";
case OMX_COLOR_FormatAndroidOpaque: return "OMX_COLOR_FormatAndroidOpaque";
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar: return "OMX_TI_COLOR_FormatYUV420PackedSemiPlanar";
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar: return "OMX_QCOM_COLOR_FormatYVU420SemiPlanar";
case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka: return "OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka";
case OMX_SEC_COLOR_FormatNV12Tiled: return "OMX_SEC_COLOR_FormatNV12Tiled";
case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m: return "OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m";
case QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka: return "QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka";
case QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka: return "QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka";
case QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView: return "QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView";
case QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed: return "QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed";
case QOMX_COLOR_Format32bitRGBA8888: return "QOMX_COLOR_Format32bitRGBA8888";
case QOMX_COLOR_Format32bitRGBA8888Compressed: return "QOMX_COLOR_Format32bitRGBA8888Compressed";
default:
return "unkn";
}
}
// ***** encoder functions *****
OmxEncoder::OmxEncoder(const char* path, int width, int height, int fps, int bitrate, bool h265, bool downscale) {
this->path = path;
this->width = width;
this->height = height;
this->fps = fps;
this->remuxing = !h265;
this->downscale = downscale;
if (this->downscale) {
this->y_ptr2 = (uint8_t *)malloc(this->width*this->height);
this->u_ptr2 = (uint8_t *)malloc(this->width*this->height/4);
this->v_ptr2 = (uint8_t *)malloc(this->width*this->height/4);
}
auto component = (OMX_STRING)(h265 ? "OMX.qcom.video.encoder.hevc" : "OMX.qcom.video.encoder.avc");
int err = OMX_GetHandle(&this->handle, component, this, &omx_callbacks);
if (err != OMX_ErrorNone) {
LOGE("error getting codec: %x", err);
}
// setup input port
OMX_PARAM_PORTDEFINITIONTYPE in_port = {0};
in_port.nSize = sizeof(in_port);
in_port.nPortIndex = (OMX_U32) PORT_INDEX_IN;
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
in_port.format.video.nFrameWidth = this->width;
in_port.format.video.nFrameHeight = this->height;
in_port.format.video.nStride = VENUS_Y_STRIDE(COLOR_FMT_NV12, this->width);
in_port.format.video.nSliceHeight = this->height;
in_port.nBufferSize = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height);
in_port.format.video.xFramerate = (this->fps * 65536);
in_port.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
in_port.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
this->in_buf_headers.resize(in_port.nBufferCountActual);
// setup output port
OMX_PARAM_PORTDEFINITIONTYPE out_port = {0};
out_port.nSize = sizeof(out_port);
out_port.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR)&out_port));
out_port.format.video.nFrameWidth = this->width;
out_port.format.video.nFrameHeight = this->height;
out_port.format.video.xFramerate = 0;
out_port.format.video.nBitrate = bitrate;
if (h265) {
out_port.format.video.eCompressionFormat = OMX_VIDEO_CodingHEVC;
} else {
out_port.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
}
out_port.format.video.eColorFormat = OMX_COLOR_FormatUnused;
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &out_port));
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &out_port));
this->out_buf_headers.resize(out_port.nBufferCountActual);
OMX_VIDEO_PARAM_BITRATETYPE bitrate_type = {0};
bitrate_type.nSize = sizeof(bitrate_type);
bitrate_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamVideoBitrate, (OMX_PTR) &bitrate_type));
bitrate_type.eControlRate = OMX_Video_ControlRateVariable;
bitrate_type.nTargetBitrate = bitrate;
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamVideoBitrate, (OMX_PTR) &bitrate_type));
if (h265) {
// setup HEVC
#ifndef QCOM2
OMX_VIDEO_PARAM_HEVCTYPE hevc_type = {0};
OMX_INDEXTYPE index_type = (OMX_INDEXTYPE) OMX_IndexParamVideoHevc;
#else
OMX_VIDEO_PARAM_PROFILELEVELTYPE hevc_type = {0};
OMX_INDEXTYPE index_type = OMX_IndexParamVideoProfileLevelCurrent;
#endif
hevc_type.nSize = sizeof(hevc_type);
hevc_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
OMX_CHECK(OMX_GetParameter(this->handle, index_type, (OMX_PTR) &hevc_type));
hevc_type.eProfile = OMX_VIDEO_HEVCProfileMain;
hevc_type.eLevel = OMX_VIDEO_HEVCHighTierLevel5;
OMX_CHECK(OMX_SetParameter(this->handle, index_type, (OMX_PTR) &hevc_type));
} else {
// setup h264
OMX_VIDEO_PARAM_AVCTYPE avc = { 0 };
avc.nSize = sizeof(avc);
avc.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamVideoAvc, &avc));
avc.nBFrames = 0;
avc.nPFrames = 15;
avc.eProfile = OMX_VIDEO_AVCProfileHigh;
avc.eLevel = OMX_VIDEO_AVCLevel31;
avc.nAllowedPictureTypes |= OMX_VIDEO_PictureTypeB;
avc.eLoopFilterMode = OMX_VIDEO_AVCLoopFilterEnable;
avc.nRefFrames = 1;
avc.bUseHadamard = OMX_TRUE;
avc.bEntropyCodingCABAC = OMX_TRUE;
avc.bWeightedPPrediction = OMX_TRUE;
avc.bconstIpred = OMX_TRUE;
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamVideoAvc, &avc));
}
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL));
for (auto &buf : this->in_buf_headers) {
OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_IN, this,
in_port.nBufferSize));
}
for (auto &buf : this->out_buf_headers) {
OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_OUT, this,
out_port.nBufferSize));
}
wait_for_state(OMX_StateIdle);
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL));
wait_for_state(OMX_StateExecuting);
// give omx all the output buffers
for (auto &buf : this->out_buf_headers) {
OMX_CHECK(OMX_FillThisBuffer(this->handle, buf));
}
// fill the input free queue
for (auto &buf : this->in_buf_headers) {
this->free_in.push(buf);
}
}
void OmxEncoder::handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf) {
int err;
uint8_t *buf_data = out_buf->pBuffer + out_buf->nOffset;
if (out_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
if (e->codec_config_len < out_buf->nFilledLen) {
e->codec_config = (uint8_t *)realloc(e->codec_config, out_buf->nFilledLen);
}
e->codec_config_len = out_buf->nFilledLen;
memcpy(e->codec_config, buf_data, out_buf->nFilledLen);
#ifdef QCOM2
out_buf->nTimeStamp = 0;
#endif
}
if (e->of) {
fwrite(buf_data, out_buf->nFilledLen, 1, e->of);
}
if (e->remuxing) {
if (!e->wrote_codec_config && e->codec_config_len > 0) {
// extradata will be freed by av_free() in avcodec_free_context()
e->codec_ctx->extradata = (uint8_t*)av_mallocz(e->codec_config_len + AV_INPUT_BUFFER_PADDING_SIZE);
e->codec_ctx->extradata_size = e->codec_config_len;
memcpy(e->codec_ctx->extradata, e->codec_config, e->codec_config_len);
err = avcodec_parameters_from_context(e->out_stream->codecpar, e->codec_ctx);
assert(err >= 0);
err = avformat_write_header(e->ofmt_ctx, NULL);
assert(err >= 0);
e->wrote_codec_config = true;
}
if (out_buf->nTimeStamp > 0) {
// input timestamps are in microseconds
AVRational in_timebase = {1, 1000000};
AVPacket pkt;
av_init_packet(&pkt);
pkt.data = buf_data;
pkt.size = out_buf->nFilledLen;
enum AVRounding rnd = static_cast<enum AVRounding>(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.pts = pkt.dts = av_rescale_q_rnd(out_buf->nTimeStamp, in_timebase, e->ofmt_ctx->streams[0]->time_base, rnd);
pkt.duration = av_rescale_q(50*1000, in_timebase, e->ofmt_ctx->streams[0]->time_base);
if (out_buf->nFlags & OMX_BUFFERFLAG_SYNCFRAME) {
pkt.flags |= AV_PKT_FLAG_KEY;
}
err = av_write_frame(e->ofmt_ctx, &pkt);
if (err < 0) { LOGW("ts encoder write issue"); }
av_free_packet(&pkt);
}
}
// give omx back the buffer
#ifdef QCOM2
if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
out_buf->nTimeStamp = 0;
}
#endif
OMX_CHECK(OMX_FillThisBuffer(e->handle, out_buf));
}
int OmxEncoder::encode_frame_rgba(const uint8_t *ptr, int in_width, int in_height, uint64_t ts) {
int err;
if (!this->is_open) {
return -1;
}
// this sometimes freezes... put it outside the encoder lock so we can still trigger rotates...
// THIS IS A REALLY BAD IDEA, but apparently the race has to happen 30 times to trigger this
OMX_BUFFERHEADERTYPE* in_buf = nullptr;
while (!this->free_in.try_pop(in_buf, 20)) {
if (do_exit) {
return -1;
}
}
int ret = this->counter;
uint8_t *in_buf_ptr = in_buf->pBuffer;
uint8_t *in_y_ptr = in_buf_ptr;
int in_y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, this->width);
int in_uv_stride = VENUS_UV_STRIDE(COLOR_FMT_NV12, this->width);
uint8_t *in_uv_ptr = in_buf_ptr + (in_y_stride * VENUS_Y_SCANLINES(COLOR_FMT_NV12, this->height));
err = ABGRToNV12(ptr, this->width*4,
in_y_ptr, in_y_stride,
in_uv_ptr, in_uv_stride,
this->width, this->height);
assert(err == 0);
in_buf->nFilledLen = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height);
in_buf->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
in_buf->nOffset = 0;
in_buf->nTimeStamp = ts/1000LL; // OMX_TICKS, in microseconds
this->last_t = in_buf->nTimeStamp;
OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
// pump output
while (true) {
OMX_BUFFERHEADERTYPE *out_buf;
if (!this->done_out.try_pop(out_buf)) {
break;
}
handle_out_buf(this, out_buf);
}
this->dirty = true;
this->counter++;
return ret;
}
void OmxEncoder::encoder_open(const char* filename) {
int err;
struct stat st = {0};
if (stat(this->path.c_str(), &st) == -1) {
mkdir(this->path.c_str(), 0755);
}
snprintf(this->vid_path, sizeof(this->vid_path), "%s/%s", this->path.c_str(), filename);
printf("encoder_open %s remuxing:%d\n", this->vid_path, this->remuxing);
if (this->remuxing) {
avformat_alloc_output_context2(&this->ofmt_ctx, NULL, NULL, this->vid_path);
assert(this->ofmt_ctx);
this->out_stream = avformat_new_stream(this->ofmt_ctx, NULL);
assert(this->out_stream);
// set codec correctly
av_register_all();
AVCodec *codec = NULL;
codec = avcodec_find_encoder(AV_CODEC_ID_H264);
assert(codec);
this->codec_ctx = avcodec_alloc_context3(codec);
assert(this->codec_ctx);
this->codec_ctx->width = this->width;
this->codec_ctx->height = this->height;
this->codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
this->codec_ctx->time_base = (AVRational){ 1, this->fps };
err = avio_open(&this->ofmt_ctx->pb, this->vid_path, AVIO_FLAG_WRITE);
assert(err >= 0);
this->wrote_codec_config = false;
} else {
this->of = fopen(this->vid_path, "wb");
assert(this->of);
#ifndef QCOM2
if (this->codec_config_len > 0) {
fwrite(this->codec_config, this->codec_config_len, 1, this->of);
}
#endif
}
// create camera lock file
snprintf(this->lock_path, sizeof(this->lock_path), "%s/%s.lock", this->path.c_str(), filename);
int lock_fd = HANDLE_EINTR(open(this->lock_path, O_RDWR | O_CREAT, 0664));
assert(lock_fd >= 0);
close(lock_fd);
this->is_open = true;
this->counter = 0;
}
void OmxEncoder::encoder_close() {
if (this->is_open) {
if (this->dirty) {
// drain output only if there could be frames in the encoder
OMX_BUFFERHEADERTYPE* in_buf = this->free_in.pop();
in_buf->nFilledLen = 0;
in_buf->nOffset = 0;
in_buf->nFlags = OMX_BUFFERFLAG_EOS;
in_buf->nTimeStamp = this->last_t + 1000000LL/this->fps;
OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
while (true) {
OMX_BUFFERHEADERTYPE *out_buf = this->done_out.pop();
handle_out_buf(this, out_buf);
if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
break;
}
}
this->dirty = false;
}
if (this->remuxing) {
av_write_trailer(this->ofmt_ctx);
avcodec_free_context(&this->codec_ctx);
avio_closep(&this->ofmt_ctx->pb);
avformat_free_context(this->ofmt_ctx);
} else {
fclose(this->of);
this->of = nullptr;
}
unlink(this->lock_path);
}
this->is_open = false;
}
OmxEncoder::~OmxEncoder() {
assert(!this->is_open);
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL));
wait_for_state(OMX_StateIdle);
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL));
for (auto &buf : this->in_buf_headers) {
OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_IN, buf));
}
for (auto &buf : this->out_buf_headers) {
OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_OUT, buf));
}
wait_for_state(OMX_StateLoaded);
OMX_CHECK(OMX_FreeHandle(this->handle));
OMX_BUFFERHEADERTYPE *out_buf;
while (this->free_in.try_pop(out_buf));
while (this->done_out.try_pop(out_buf));
if (this->codec_config) {
free(this->codec_config);
}
if (this->downscale) {
free(this->y_ptr2);
free(this->u_ptr2);
free(this->v_ptr2);
}
}

View File

@ -0,0 +1,72 @@
#pragma once
#include <cstdint>
#include <cstdio>
#include <vector>
#include <string>
#include <OMX_Component.h>
extern "C" {
#include <libavformat/avformat.h>
}
#include "common/queue.h"
// OmxEncoder, lossey codec using hardware hevc
class OmxEncoder {
public:
OmxEncoder(const char* path, int width, int height, int fps, int bitrate, bool h265, bool downscale);
~OmxEncoder();
int encode_frame_rgba(const uint8_t *ptr, int in_width, int in_height, uint64_t ts);
void encoder_open(const char* filename);
void encoder_close();
// OMX callbacks
static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event,
OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data);
static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
OMX_BUFFERHEADERTYPE *buffer);
static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
OMX_BUFFERHEADERTYPE *buffer);
private:
void wait_for_state(OMX_STATETYPE state);
static void handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf);
int width, height, fps;
char vid_path[1024];
char lock_path[1024];
bool is_open = false;
bool dirty = false;
int counter = 0;
std::string path;
FILE *of;
size_t codec_config_len;
uint8_t *codec_config = NULL;
bool wrote_codec_config;
std::mutex state_lock;
std::condition_variable state_cv;
OMX_STATETYPE state = OMX_StateLoaded;
OMX_HANDLETYPE handle;
std::vector<OMX_BUFFERHEADERTYPE *> in_buf_headers;
std::vector<OMX_BUFFERHEADERTYPE *> out_buf_headers;
uint64_t last_t;
SafeQueue<OMX_BUFFERHEADERTYPE *> free_in;
SafeQueue<OMX_BUFFERHEADERTYPE *> done_out;
AVFormatContext *ofmt_ctx;
AVCodecContext *codec_ctx;
AVStream *out_stream;
bool remuxing;
bool downscale;
uint8_t *y_ptr2, *u_ptr2, *v_ptr2;
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,579 @@
/*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** OMX_Component.h - OpenMax IL version 1.1.2
* The OMX_Component header file contains the definitions used to define
* the public interface of a component. This header file is intended to
* be used by both the application and the component.
*/
#ifndef OMX_Component_h
#define OMX_Component_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header must include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Audio.h>
#include <OMX_Video.h>
#include <OMX_Image.h>
#include <OMX_Other.h>
/** @ingroup comp */
typedef enum OMX_PORTDOMAINTYPE {
OMX_PortDomainAudio,
OMX_PortDomainVideo,
OMX_PortDomainImage,
OMX_PortDomainOther,
OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_PortDomainMax = 0x7ffffff
} OMX_PORTDOMAINTYPE;
/** @ingroup comp */
typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
OMX_U32 nSize; /**< Size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< Port number the structure applies to */
OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */
OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */
OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */
OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */
OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by
OMX_CommandPortEnable/OMX_CommandPortDisable.
When disabled a port is unpopulated. A disabled port
is not populated with buffers on a transition to IDLE. */
OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by
nBufferCountActual. A disabled port is always unpopulated.
An enabled port is populated on a transition to OMX_StateIdle
and unpopulated on a transition to loaded. */
OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */
union {
OMX_AUDIO_PORTDEFINITIONTYPE audio;
OMX_VIDEO_PORTDEFINITIONTYPE video;
OMX_IMAGE_PORTDEFINITIONTYPE image;
OMX_OTHER_PORTDEFINITIONTYPE other;
} format;
OMX_BOOL bBuffersContiguous;
OMX_U32 nBufferAlignment;
} OMX_PARAM_PORTDEFINITIONTYPE;
/** @ingroup comp */
typedef struct OMX_PARAM_U32TYPE {
OMX_U32 nSize; /**< Size of this structure, in Bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< port that this structure applies to */
OMX_U32 nU32; /**< U32 value */
} OMX_PARAM_U32TYPE;
/** @ingroup rpm */
typedef enum OMX_SUSPENSIONPOLICYTYPE {
OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
OMX_SuspensionEnabled, /**< Suspension allowed */
OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_SuspensionPolicyMax = 0x7fffffff
} OMX_SUSPENSIONPOLICYTYPE;
/** @ingroup rpm */
typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_SUSPENSIONPOLICYTYPE ePolicy;
} OMX_PARAM_SUSPENSIONPOLICYTYPE;
/** @ingroup rpm */
typedef enum OMX_SUSPENSIONTYPE {
OMX_NotSuspended, /**< component is not suspended */
OMX_Suspended, /**< component is suspended */
OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_SuspendMax = 0x7FFFFFFF
} OMX_SUSPENSIONTYPE;
/** @ingroup rpm */
typedef struct OMX_PARAM_SUSPENSIONTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_SUSPENSIONTYPE eType;
} OMX_PARAM_SUSPENSIONTYPE ;
typedef struct OMX_CONFIG_BOOLEANTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_BOOL bEnabled;
} OMX_CONFIG_BOOLEANTYPE;
/* Parameter specifying the content uri to use. */
/** @ingroup cp */
typedef struct OMX_PARAM_CONTENTURITYPE
{
OMX_U32 nSize; /**< size of the structure in bytes, including
actual URI name */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U8 contentURI[1]; /**< The URI name */
} OMX_PARAM_CONTENTURITYPE;
/* Parameter specifying the pipe to use. */
/** @ingroup cp */
typedef struct OMX_PARAM_CONTENTPIPETYPE
{
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_HANDLETYPE hPipe; /**< The pipe handle*/
} OMX_PARAM_CONTENTPIPETYPE;
/** @ingroup rpm */
typedef struct OMX_RESOURCECONCEALMENTTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment
methods (like degrading algorithm quality to
lower resource consumption or functional bypass)
on a component as a resolution to resource conflicts. */
} OMX_RESOURCECONCEALMENTTYPE;
/** @ingroup metadata */
typedef enum OMX_METADATACHARSETTYPE {
OMX_MetadataCharsetUnknown = 0,
OMX_MetadataCharsetASCII,
OMX_MetadataCharsetBinary,
OMX_MetadataCharsetCodePage1252,
OMX_MetadataCharsetUTF8,
OMX_MetadataCharsetJavaConformantUTF8,
OMX_MetadataCharsetUTF7,
OMX_MetadataCharsetImapUTF7,
OMX_MetadataCharsetUTF16LE,
OMX_MetadataCharsetUTF16BE,
OMX_MetadataCharsetGB12345,
OMX_MetadataCharsetHZGB2312,
OMX_MetadataCharsetGB2312,
OMX_MetadataCharsetGB18030,
OMX_MetadataCharsetGBK,
OMX_MetadataCharsetBig5,
OMX_MetadataCharsetISO88591,
OMX_MetadataCharsetISO88592,
OMX_MetadataCharsetISO88593,
OMX_MetadataCharsetISO88594,
OMX_MetadataCharsetISO88595,
OMX_MetadataCharsetISO88596,
OMX_MetadataCharsetISO88597,
OMX_MetadataCharsetISO88598,
OMX_MetadataCharsetISO88599,
OMX_MetadataCharsetISO885910,
OMX_MetadataCharsetISO885913,
OMX_MetadataCharsetISO885914,
OMX_MetadataCharsetISO885915,
OMX_MetadataCharsetShiftJIS,
OMX_MetadataCharsetISO2022JP,
OMX_MetadataCharsetISO2022JP1,
OMX_MetadataCharsetISOEUCJP,
OMX_MetadataCharsetSMS7Bit,
OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
} OMX_METADATACHARSETTYPE;
/** @ingroup metadata */
typedef enum OMX_METADATASCOPETYPE
{
OMX_MetadataScopeAllLevels,
OMX_MetadataScopeTopLevel,
OMX_MetadataScopePortLevel,
OMX_MetadataScopeNodeLevel,
OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_MetadataScopeTypeMax = 0x7fffffff
} OMX_METADATASCOPETYPE;
/** @ingroup metadata */
typedef enum OMX_METADATASEARCHMODETYPE
{
OMX_MetadataSearchValueSizeByIndex,
OMX_MetadataSearchItemByIndex,
OMX_MetadataSearchNextItemByKey,
OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_MetadataSearchTypeMax = 0x7fffffff
} OMX_METADATASEARCHMODETYPE;
/** @ingroup metadata */
typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_METADATASCOPETYPE eScopeMode;
OMX_U32 nScopeSpecifier;
OMX_U32 nMetadataItemCount;
} OMX_CONFIG_METADATAITEMCOUNTTYPE;
/** @ingroup metadata */
typedef struct OMX_CONFIG_METADATAITEMTYPE
{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_METADATASCOPETYPE eScopeMode;
OMX_U32 nScopeSpecifier;
OMX_U32 nMetadataItemIndex;
OMX_METADATASEARCHMODETYPE eSearchMode;
OMX_METADATACHARSETTYPE eKeyCharset;
OMX_U8 nKeySizeUsed;
OMX_U8 nKey[128];
OMX_METADATACHARSETTYPE eValueCharset;
OMX_STRING sLanguageCountry;
OMX_U32 nValueMaxSize;
OMX_U32 nValueSizeUsed;
OMX_U8 nValue[1];
} OMX_CONFIG_METADATAITEMTYPE;
/* @ingroup metadata */
typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_BOOL bAllKeys;
OMX_U32 nParentNodeID;
OMX_U32 nNumNodes;
} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
/** @ingroup metadata */
typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_BOOL bAllKeys;
OMX_U32 nParentNodeID;
OMX_U32 nNodeIndex;
OMX_U32 nNodeID;
OMX_STRING cNodeName;
OMX_BOOL bIsLeafType;
} OMX_CONFIG_CONTAINERNODEIDTYPE;
/** @ingroup metadata */
typedef struct OMX_PARAM_METADATAFILTERTYPE
{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and
* the three key fields below are ignored */
OMX_METADATACHARSETTYPE eKeyCharset;
OMX_U32 nKeySizeUsed;
OMX_U8 nKey [128];
OMX_U32 nLanguageCountrySizeUsed;
OMX_U8 nLanguageCountry[128];
OMX_BOOL bEnabled; /* if true then key is part of filter (e.g.
* retained for query later). If false then
* key is not part of filter */
} OMX_PARAM_METADATAFILTERTYPE;
/** The OMX_HANDLETYPE structure defines the component handle. The component
* handle is used to access all of the component's public methods and also
* contains pointers to the component's private data area. The component
* handle is initialized by the OMX core (with help from the component)
* during the process of loading the component. After the component is
* successfully loaded, the application can safely access any of the
* component's public functions (although some may return an error because
* the state is inappropriate for the access).
*
* @ingroup comp
*/
typedef struct OMX_COMPONENTTYPE
{
/** The size of this structure, in bytes. It is the responsibility
of the allocator of this structure to fill in this value. Since
this structure is allocated by the GetHandle function, this
function will fill in this value. */
OMX_U32 nSize;
/** nVersion is the version of the OMX specification that the structure
is built against. It is the responsibility of the creator of this
structure to initialize this value and every user of this structure
should verify that it knows how to use the exact version of
this structure found herein. */
OMX_VERSIONTYPE nVersion;
/** pComponentPrivate is a pointer to the component private data area.
This member is allocated and initialized by the component when the
component is first loaded. The application should not access this
data area. */
OMX_PTR pComponentPrivate;
/** pApplicationPrivate is a pointer that is a parameter to the
OMX_GetHandle method, and contains an application private value
provided by the IL client. This application private data is
returned to the IL Client by OMX in all callbacks */
OMX_PTR pApplicationPrivate;
/** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL
specification for details on the GetComponentVersion method.
*/
OMX_ERRORTYPE (*GetComponentVersion)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_STRING pComponentName,
OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
OMX_OUT OMX_UUIDTYPE* pComponentUUID);
/** refer to OMX_SendCommand in OMX_core.h or the OMX IL
specification for details on the SendCommand method.
*/
OMX_ERRORTYPE (*SendCommand)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_COMMANDTYPE Cmd,
OMX_IN OMX_U32 nParam1,
OMX_IN OMX_PTR pCmdData);
/** refer to OMX_GetParameter in OMX_core.h or the OMX IL
specification for details on the GetParameter method.
*/
OMX_ERRORTYPE (*GetParameter)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR pComponentParameterStructure);
/** refer to OMX_SetParameter in OMX_core.h or the OMX IL
specification for details on the SetParameter method.
*/
OMX_ERRORTYPE (*SetParameter)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentParameterStructure);
/** refer to OMX_GetConfig in OMX_core.h or the OMX IL
specification for details on the GetConfig method.
*/
OMX_ERRORTYPE (*GetConfig)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_INOUT OMX_PTR pComponentConfigStructure);
/** refer to OMX_SetConfig in OMX_core.h or the OMX IL
specification for details on the SetConfig method.
*/
OMX_ERRORTYPE (*SetConfig)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure);
/** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL
specification for details on the GetExtensionIndex method.
*/
OMX_ERRORTYPE (*GetExtensionIndex)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE* pIndexType);
/** refer to OMX_GetState in OMX_core.h or the OMX IL
specification for details on the GetState method.
*/
OMX_ERRORTYPE (*GetState)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_STATETYPE* pState);
/** The ComponentTunnelRequest method will interact with another OMX
component to determine if tunneling is possible and to setup the
tunneling. The return codes for this method can be used to
determine if tunneling is not possible, or if tunneling is not
supported.
Base profile components (i.e. non-interop) do not support this
method and should return OMX_ErrorNotImplemented
The interop profile component MUST support tunneling to another
interop profile component with a compatible port parameters.
A component may also support proprietary communication.
If proprietary communication is supported the negotiation of
proprietary communication is done outside of OMX in a vendor
specific way. It is only required that the proper result be
returned and the details of how the setup is done is left
to the component implementation.
When this method is invoked when nPort in an output port, the
component will:
1. Populate the pTunnelSetup structure with the output port's
requirements and constraints for the tunnel.
When this method is invoked when nPort in an input port, the
component will:
1. Query the necessary parameters from the output port to
determine if the ports are compatible for tunneling
2. If the ports are compatible, the component should store
the tunnel step provided by the output port
3. Determine which port (either input or output) is the buffer
supplier, and call OMX_SetParameter on the output port to
indicate this selection.
The component will return from this call within 5 msec.
@param [in] hComp
Handle of the component to be accessed. This is the component
handle returned by the call to the OMX_GetHandle method.
@param [in] nPort
nPort is used to select the port on the component to be used
for tunneling.
@param [in] hTunneledComp
Handle of the component to tunnel with. This is the component
handle returned by the call to the OMX_GetHandle method. When
this parameter is 0x0 the component should setup the port for
communication with the application / IL Client.
@param [in] nPortOutput
nPortOutput is used indicate the port the component should
tunnel with.
@param [in] pTunnelSetup
Pointer to the tunnel setup structure. When nPort is an output port
the component should populate the fields of this structure. When
When nPort is an input port the component should review the setup
provided by the component with the output port.
@return OMX_ERRORTYPE
If the command successfully executes, the return code will be
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
@ingroup tun
*/
OMX_ERRORTYPE (*ComponentTunnelRequest)(
OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_U32 nPort,
OMX_IN OMX_HANDLETYPE hTunneledComp,
OMX_IN OMX_U32 nTunneledPort,
OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup);
/** refer to OMX_UseBuffer in OMX_core.h or the OMX IL
specification for details on the UseBuffer method.
@ingroup buf
*/
OMX_ERRORTYPE (*UseBuffer)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_PTR pAppPrivate,
OMX_IN OMX_U32 nSizeBytes,
OMX_IN OMX_U8* pBuffer);
/** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL
specification for details on the AllocateBuffer method.
@ingroup buf
*/
OMX_ERRORTYPE (*AllocateBuffer)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_PTR pAppPrivate,
OMX_IN OMX_U32 nSizeBytes);
/** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL
specification for details on the FreeBuffer method.
@ingroup buf
*/
OMX_ERRORTYPE (*FreeBuffer)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
/** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL
specification for details on the EmptyThisBuffer method.
@ingroup buf
*/
OMX_ERRORTYPE (*EmptyThisBuffer)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
/** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL
specification for details on the FillThisBuffer method.
@ingroup buf
*/
OMX_ERRORTYPE (*FillThisBuffer)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
/** The SetCallbacks method is used by the core to specify the callback
structure from the application to the component. This is a blocking
call. The component will return from this call within 5 msec.
@param [in] hComponent
Handle of the component to be accessed. This is the component
handle returned by the call to the GetHandle function.
@param [in] pCallbacks
pointer to an OMX_CALLBACKTYPE structure used to provide the
callback information to the component
@param [in] pAppData
pointer to an application defined value. It is anticipated that
the application will pass a pointer to a data structure or a "this
pointer" in this area to allow the callback (in the application)
to determine the context of the call
@return OMX_ERRORTYPE
If the command successfully executes, the return code will be
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
*/
OMX_ERRORTYPE (*SetCallbacks)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_CALLBACKTYPE* pCallbacks,
OMX_IN OMX_PTR pAppData);
/** ComponentDeInit method is used to deinitialize the component
providing a means to free any resources allocated at component
initialization. NOTE: After this call the component handle is
not valid for further use.
@param [in] hComponent
Handle of the component to be accessed. This is the component
handle returned by the call to the GetHandle function.
@return OMX_ERRORTYPE
If the command successfully executes, the return code will be
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
*/
OMX_ERRORTYPE (*ComponentDeInit)(
OMX_IN OMX_HANDLETYPE hComponent);
/** @ingroup buf */
OMX_ERRORTYPE (*UseEGLImage)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_PTR pAppPrivate,
OMX_IN void* eglImage);
OMX_ERRORTYPE (*ComponentRoleEnum)(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_U8 *cRole,
OMX_IN OMX_U32 nIndex);
} OMX_COMPONENTTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

View File

@ -0,0 +1,195 @@
/*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
* The OMX_ContentPipe header file contains the definitions used to define
* the public interface for content piples. This header file is intended to
* be used by the component.
*/
#ifndef OMX_CONTENTPIPE_H
#define OMX_CONTENTPIPE_H
#ifndef KD_EACCES
/* OpenKODE error codes. CPResult values may be zero (indicating success
or one of the following values) */
#define KD_EACCES (1)
#define KD_EADDRINUSE (2)
#define KD_EAGAIN (5)
#define KD_EBADF (7)
#define KD_EBUSY (8)
#define KD_ECONNREFUSED (9)
#define KD_ECONNRESET (10)
#define KD_EDEADLK (11)
#define KD_EDESTADDRREQ (12)
#define KD_ERANGE (35)
#define KD_EEXIST (13)
#define KD_EFBIG (14)
#define KD_EHOSTUNREACH (15)
#define KD_EINVAL (17)
#define KD_EIO (18)
#define KD_EISCONN (20)
#define KD_EISDIR (21)
#define KD_EMFILE (22)
#define KD_ENAMETOOLONG (23)
#define KD_ENOENT (24)
#define KD_ENOMEM (25)
#define KD_ENOSPC (26)
#define KD_ENOSYS (27)
#define KD_ENOTCONN (28)
#define KD_EPERM (33)
#define KD_ETIMEDOUT (36)
#define KD_EILSEQ (19)
#endif
/** Map types from OMX standard types only here so interface is as generic as possible. */
typedef OMX_U32 CPresult;
typedef char * CPstring;
typedef void * CPhandle;
typedef OMX_U32 CPuint;
typedef OMX_S32 CPint;
typedef char CPbyte;
typedef OMX_BOOL CPbool;
/** enumeration of origin types used in the CP_PIPETYPE's Seek function
* @ingroup cp
*/
typedef enum CP_ORIGINTYPE {
CP_OriginBegin,
CP_OriginCur,
CP_OriginEnd,
CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
CP_OriginMax = 0X7FFFFFFF
} CP_ORIGINTYPE;
/** enumeration of contact access types used in the CP_PIPETYPE's Open function
* @ingroup cp
*/
typedef enum CP_ACCESSTYPE {
CP_AccessRead,
CP_AccessWrite,
CP_AccessReadWrite ,
CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
CP_AccessMax = 0X7FFFFFFF
} CP_ACCESSTYPE;
/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function
* @ingroup cp
*/
typedef enum CP_CHECKBYTESRESULTTYPE
{
CP_CheckBytesOk, /**< There are at least the request number
of bytes available */
CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes
and presently lacks sufficient bytes.
Client will be called when they are
sufficient bytes are available. */
CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes
but those available are less than those
requested */
CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream
and no more bytes are available. */
CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */
CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
CP_CheckBytesMax = 0X7FFFFFFF
} CP_CHECKBYTESRESULTTYPE;
/** enumeration of content pipe events sent to the client callback.
* @ingroup cp
*/
typedef enum CP_EVENTTYPE{
CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/
CP_Overflow, /** enumeration of content pipe events sent to the client callback*/
CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/
CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
CP_EventMax = 0X7FFFFFFF
} CP_EVENTTYPE;
/** content pipe definition
* @ingroup cp
*/
typedef struct CP_PIPETYPE
{
/** Open a content stream for reading or writing. */
CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
/** Close a content stream. */
CPresult (*Close)( CPhandle hContent );
/** Create a content source and open it for writing. */
CPresult (*Create)( CPhandle *hContent, CPstring szURI );
/** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
/** Seek to certain position in the content relative to the specified origin. */
CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
/** Retrieve the current position relative to the start of the content. */
CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
/** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize);
/** Retrieve a buffer allocated by the pipe that contains the requested number of bytes.
Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
returns the size of the block actually read. Content pointer advances the by the returned size.
Note: pipe provides pointer. This function is appropriate for large reads. The client must call
ReleaseReadBuffer when done with buffer.
In some cases the requested block may not reside in contiguous memory within the
pipe implementation. For instance if the pipe leverages a circular buffer then the requested
block may straddle the boundary of the circular buffer. By default a pipe implementation
performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory
boundary. Here the client may retrieve the data in segments over successive calls. */
CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
/** Release a buffer obtained by ReadBuffer back to the pipe. */
CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
/** Write data of the specified size to the content (advance content pointer by size of data).
Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize);
/** Retrieve a buffer allocated by the pipe used to write data to the content.
Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
/** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the
the contents of the buffer to content and advance content pointer by the size of the buffer */
CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
/** Register a per-handle client callback with the content pipe. */
CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
} CP_PIPETYPE;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2009 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** OMX_CoreExt.h - OpenMax IL version 1.1.2
* The OMX_CoreExt header file contains extensions to the definitions used
* by both the application and the component to access common items.
*/
#ifndef OMX_CoreExt_h
#define OMX_CoreExt_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header shall include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Core.h>
/** Event type extensions. */
typedef enum OMX_EVENTEXTTYPE
{
OMX_EventIndexSettingChanged = OMX_EventKhronosExtensions, /**< component signals the IL client of a change
in a param, config, or extension */
OMX_EventExtMax = 0x7FFFFFFF
} OMX_EVENTEXTTYPE;
/** Enable or disable a callback event. */
typedef struct OMX_CONFIG_CALLBACKREQUESTTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< port that this structure applies to */
OMX_INDEXTYPE nIndex; /**< the index the callback is requested for */
OMX_BOOL bEnable; /**< enable (OMX_TRUE) or disable (OMX_FALSE) the callback */
} OMX_CONFIG_CALLBACKREQUESTTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* OMX_CoreExt_h */
/* File EOF */

View File

@ -0,0 +1,933 @@
/**
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @file OMX_IVCommon.h - OpenMax IL version 1.1.2
* The structures needed by Video and Image components to exchange
* parameters and configuration data with the components.
*/
#ifndef OMX_IVCommon_h
#define OMX_IVCommon_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Each OMX header must include all required header files to allow the header
* to compile without errors. The includes below are required for this header
* file to compile successfully
*/
#include <OMX_Core.h>
/** @defgroup iv OpenMAX IL Imaging and Video Domain
* Common structures for OpenMAX IL Imaging and Video domains
* @{
*/
/**
* Enumeration defining possible uncompressed image/video formats.
*
* ENUMS:
* Unused : Placeholder value when format is N/A
* Monochrome : black and white
* 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0
* 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0
* 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
* 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
* 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0
* 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0
* 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0
* 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
* 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
* 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0
* 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0
* 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
* 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
* 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
* 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
* YUV411Planar : U,Y are subsampled by a factor of 4 horizontally
* YUV411PackedPlanar : packed per payload in planar slices
* YUV420Planar : Three arrays Y,U,V.
* YUV420PackedPlanar : packed per payload in planar slices
* YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V
* YUV422Planar : Three arrays Y,U,V.
* YUV422PackedPlanar : packed per payload in planar slices
* YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V
* YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr)
* YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb)
* CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY)
* CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY)
* YUV444Interleaved : Each pixel contains equal parts YUV
* RawBayer8bit : SMIA camera output format
* RawBayer10bit : SMIA camera output format
* RawBayer8bitcompressed : SMIA camera output format
*/
typedef enum OMX_COLOR_FORMATTYPE {
OMX_COLOR_FormatUnused,
OMX_COLOR_FormatMonochrome,
OMX_COLOR_Format8bitRGB332,
OMX_COLOR_Format12bitRGB444,
OMX_COLOR_Format16bitARGB4444,
OMX_COLOR_Format16bitARGB1555,
OMX_COLOR_Format16bitRGB565,
OMX_COLOR_Format16bitBGR565,
OMX_COLOR_Format18bitRGB666,
OMX_COLOR_Format18bitARGB1665,
OMX_COLOR_Format19bitARGB1666,
OMX_COLOR_Format24bitRGB888,
OMX_COLOR_Format24bitBGR888,
OMX_COLOR_Format24bitARGB1887,
OMX_COLOR_Format25bitARGB1888,
OMX_COLOR_Format32bitBGRA8888,
OMX_COLOR_Format32bitARGB8888,
OMX_COLOR_FormatYUV411Planar,
OMX_COLOR_FormatYUV411PackedPlanar,
OMX_COLOR_FormatYUV420Planar,
OMX_COLOR_FormatYUV420PackedPlanar,
OMX_COLOR_FormatYUV420SemiPlanar,
OMX_COLOR_FormatYUV422Planar,
OMX_COLOR_FormatYUV422PackedPlanar,
OMX_COLOR_FormatYUV422SemiPlanar,
OMX_COLOR_FormatYCbYCr,
OMX_COLOR_FormatYCrYCb,
OMX_COLOR_FormatCbYCrY,
OMX_COLOR_FormatCrYCbY,
OMX_COLOR_FormatYUV444Interleaved,
OMX_COLOR_FormatRawBayer8bit,
OMX_COLOR_FormatRawBayer10bit,
OMX_COLOR_FormatRawBayer8bitcompressed,
OMX_COLOR_FormatL2,
OMX_COLOR_FormatL4,
OMX_COLOR_FormatL8,
OMX_COLOR_FormatL16,
OMX_COLOR_FormatL24,
OMX_COLOR_FormatL32,
OMX_COLOR_FormatYUV420PackedSemiPlanar,
OMX_COLOR_FormatYUV422PackedSemiPlanar,
OMX_COLOR_Format18BitBGR666,
OMX_COLOR_Format24BitARGB6666,
OMX_COLOR_Format24BitABGR6666,
OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
/**<Reserved android opaque colorformat. Tells the encoder that
* the actual colorformat will be relayed by the
* Gralloc Buffers.
* FIXME: In the process of reserving some enum values for
* Android-specific OMX IL colorformats. Change this enum to
* an acceptable range once that is done.
* */
OMX_COLOR_FormatAndroidOpaque = 0x7F000789,
OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03,
OMX_SEC_COLOR_FormatNV12Tiled = 0x7FC00002,
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m = 0x7FA30C04,
OMX_COLOR_FormatMax = 0x7FFFFFFF
} OMX_COLOR_FORMATTYPE;
/**
* Defines the matrix for conversion from RGB to YUV or vice versa.
* iColorMatrix should be initialized with the fixed point values
* used in converting between formats.
*/
typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
OMX_U32 nSize; /**< Size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
OMX_U32 nPortIndex; /**< Port that this struct applies to */
OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
OMX_S32 xColorOffset[4]; /**< Stored in signed Q16 format */
}OMX_CONFIG_COLORCONVERSIONTYPE;
/**
* Structure defining percent to scale each frame dimension. For example:
* To make the width 50% larger, use fWidth = 1.5 and to make the width
* 1/2 the original size, use fWidth = 0.5
*/
typedef struct OMX_CONFIG_SCALEFACTORTYPE {
OMX_U32 nSize; /**< Size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
OMX_U32 nPortIndex; /**< Port that this struct applies to */
OMX_S32 xWidth; /**< Fixed point value stored as Q16 */
OMX_S32 xHeight; /**< Fixed point value stored as Q16 */
}OMX_CONFIG_SCALEFACTORTYPE;
/**
* Enumeration of possible image filter types
*/
typedef enum OMX_IMAGEFILTERTYPE {
OMX_ImageFilterNone,
OMX_ImageFilterNoise,
OMX_ImageFilterEmboss,
OMX_ImageFilterNegative,
OMX_ImageFilterSketch,
OMX_ImageFilterOilPaint,
OMX_ImageFilterHatch,
OMX_ImageFilterGpen,
OMX_ImageFilterAntialias,
OMX_ImageFilterDeRing,
OMX_ImageFilterSolarize,
OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_ImageFilterMax = 0x7FFFFFFF
} OMX_IMAGEFILTERTYPE;
/**
* Image filter configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eImageFilter : Image filter type enumeration
*/
typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_IMAGEFILTERTYPE eImageFilter;
} OMX_CONFIG_IMAGEFILTERTYPE;
/**
* Customized U and V for color enhancement
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* bColorEnhancement : Enable/disable color enhancement
* nCustomizedU : Practical values: 16-240, range: 0-255, value set for
* U component
* nCustomizedV : Practical values: 16-240, range: 0-255, value set for
* V component
*/
typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bColorEnhancement;
OMX_U8 nCustomizedU;
OMX_U8 nCustomizedV;
} OMX_CONFIG_COLORENHANCEMENTTYPE;
/**
* Define color key and color key mask
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nARGBColor : 32bit Alpha, Red, Green, Blue Color
* nARGBMask : 32bit Mask for Alpha, Red, Green, Blue channels
*/
typedef struct OMX_CONFIG_COLORKEYTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nARGBColor;
OMX_U32 nARGBMask;
} OMX_CONFIG_COLORKEYTYPE;
/**
* List of color blend types for pre/post processing
*
* ENUMS:
* None : No color blending present
* AlphaConstant : Function is (alpha_constant * src) +
* (1 - alpha_constant) * dst)
* AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
* Alternate : Function is alternating pixels from src and dst
* And : Function is (src & dst)
* Or : Function is (src | dst)
* Invert : Function is ~src
*/
typedef enum OMX_COLORBLENDTYPE {
OMX_ColorBlendNone,
OMX_ColorBlendAlphaConstant,
OMX_ColorBlendAlphaPerPixel,
OMX_ColorBlendAlternate,
OMX_ColorBlendAnd,
OMX_ColorBlendOr,
OMX_ColorBlendInvert,
OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_ColorBlendMax = 0x7FFFFFFF
} OMX_COLORBLENDTYPE;
/**
* Color blend configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nRGBAlphaConstant : Constant global alpha values when global alpha is used
* eColorBlend : Color blend type enumeration
*/
typedef struct OMX_CONFIG_COLORBLENDTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nRGBAlphaConstant;
OMX_COLORBLENDTYPE eColorBlend;
} OMX_CONFIG_COLORBLENDTYPE;
/**
* Hold frame dimension
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nWidth : Frame width in pixels
* nHeight : Frame height in pixels
*/
typedef struct OMX_FRAMESIZETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nWidth;
OMX_U32 nHeight;
} OMX_FRAMESIZETYPE;
/**
* Rotation configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nRotation : +/- integer rotation value
*/
typedef struct OMX_CONFIG_ROTATIONTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nRotation;
} OMX_CONFIG_ROTATIONTYPE;
/**
* Possible mirroring directions for pre/post processing
*
* ENUMS:
* None : No mirroring
* Vertical : Vertical mirroring, flip on X axis
* Horizontal : Horizontal mirroring, flip on Y axis
* Both : Both vertical and horizontal mirroring
*/
typedef enum OMX_MIRRORTYPE {
OMX_MirrorNone = 0,
OMX_MirrorVertical,
OMX_MirrorHorizontal,
OMX_MirrorBoth,
OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_MirrorMax = 0x7FFFFFFF
} OMX_MIRRORTYPE;
/**
* Mirroring configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eMirror : Mirror type enumeration
*/
typedef struct OMX_CONFIG_MIRRORTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_MIRRORTYPE eMirror;
} OMX_CONFIG_MIRRORTYPE;
/**
* Position information only
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nX : X coordinate for the point
* nY : Y coordinate for the point
*/
typedef struct OMX_CONFIG_POINTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nX;
OMX_S32 nY;
} OMX_CONFIG_POINTTYPE;
/**
* Frame size plus position
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nLeft : X Coordinate of the top left corner of the rectangle
* nTop : Y Coordinate of the top left corner of the rectangle
* nWidth : Width of the rectangle
* nHeight : Height of the rectangle
*/
typedef struct OMX_CONFIG_RECTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nLeft;
OMX_S32 nTop;
OMX_U32 nWidth;
OMX_U32 nHeight;
} OMX_CONFIG_RECTTYPE;
/**
* Deblocking state; it is required to be set up before starting the codec
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* bDeblocking : Enable/disable deblocking mode
*/
typedef struct OMX_PARAM_DEBLOCKINGTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bDeblocking;
} OMX_PARAM_DEBLOCKINGTYPE;
/**
* Stabilization state
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* bStab : Enable/disable frame stabilization state
*/
typedef struct OMX_CONFIG_FRAMESTABTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bStab;
} OMX_CONFIG_FRAMESTABTYPE;
/**
* White Balance control type
*
* STRUCT MEMBERS:
* SunLight : Referenced in JSR-234
* Flash : Optimal for device's integrated flash
*/
typedef enum OMX_WHITEBALCONTROLTYPE {
OMX_WhiteBalControlOff = 0,
OMX_WhiteBalControlAuto,
OMX_WhiteBalControlSunLight,
OMX_WhiteBalControlCloudy,
OMX_WhiteBalControlShade,
OMX_WhiteBalControlTungsten,
OMX_WhiteBalControlFluorescent,
OMX_WhiteBalControlIncandescent,
OMX_WhiteBalControlFlash,
OMX_WhiteBalControlHorizon,
OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_WhiteBalControlMax = 0x7FFFFFFF
} OMX_WHITEBALCONTROLTYPE;
/**
* White Balance control configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eWhiteBalControl : White balance enumeration
*/
typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
} OMX_CONFIG_WHITEBALCONTROLTYPE;
/**
* Exposure control type
*/
typedef enum OMX_EXPOSURECONTROLTYPE {
OMX_ExposureControlOff = 0,
OMX_ExposureControlAuto,
OMX_ExposureControlNight,
OMX_ExposureControlBackLight,
OMX_ExposureControlSpotLight,
OMX_ExposureControlSports,
OMX_ExposureControlSnow,
OMX_ExposureControlBeach,
OMX_ExposureControlLargeAperture,
OMX_ExposureControlSmallApperture,
OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_ExposureControlMax = 0x7FFFFFFF
} OMX_EXPOSURECONTROLTYPE;
/**
* White Balance control configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eExposureControl : Exposure control enumeration
*/
typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_EXPOSURECONTROLTYPE eExposureControl;
} OMX_CONFIG_EXPOSURECONTROLTYPE;
/**
* Defines sensor supported mode.
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nFrameRate : Single shot mode is indicated by a 0
* bOneShot : Enable for single shot, disable for streaming
* sFrameSize : Framesize
*/
typedef struct OMX_PARAM_SENSORMODETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nFrameRate;
OMX_BOOL bOneShot;
OMX_FRAMESIZETYPE sFrameSize;
} OMX_PARAM_SENSORMODETYPE;
/**
* Defines contrast level
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nContrast : Values allowed for contrast -100 to 100, zero means no change
*/
typedef struct OMX_CONFIG_CONTRASTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nContrast;
} OMX_CONFIG_CONTRASTTYPE;
/**
* Defines brightness level
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nBrightness : 0-100%
*/
typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nBrightness;
} OMX_CONFIG_BRIGHTNESSTYPE;
/**
* Defines backlight level configuration for a video sink, e.g. LCD panel
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nBacklight : Values allowed for backlight 0-100%
* nTimeout : Number of milliseconds before backlight automatically turns
* off. A value of 0x0 disables backight timeout
*/
typedef struct OMX_CONFIG_BACKLIGHTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nBacklight;
OMX_U32 nTimeout;
} OMX_CONFIG_BACKLIGHTTYPE;
/**
* Defines setting for Gamma
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nGamma : Values allowed for gamma -100 to 100, zero means no change
*/
typedef struct OMX_CONFIG_GAMMATYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nGamma;
} OMX_CONFIG_GAMMATYPE;
/**
* Define for setting saturation
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nSaturation : Values allowed for saturation -100 to 100, zero means
* no change
*/
typedef struct OMX_CONFIG_SATURATIONTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nSaturation;
} OMX_CONFIG_SATURATIONTYPE;
/**
* Define for setting Lightness
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nLightness : Values allowed for lightness -100 to 100, zero means no
* change
*/
typedef struct OMX_CONFIG_LIGHTNESSTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_S32 nLightness;
} OMX_CONFIG_LIGHTNESSTYPE;
/**
* Plane blend configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Index of input port associated with the plane.
* nDepth : Depth of the plane in relation to the screen. Higher
* numbered depths are "behind" lower number depths.
* This number defaults to the Port Index number.
* nAlpha : Transparency blending component for the entire plane.
* See blending modes for more detail.
*/
typedef struct OMX_CONFIG_PLANEBLENDTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nDepth;
OMX_U32 nAlpha;
} OMX_CONFIG_PLANEBLENDTYPE;
/**
* Define interlace type
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* bEnable : Enable control variable for this functionality
* (see below)
* nInterleavePortIndex : Index of input or output port associated with
* the interleaved plane.
* pPlanarPortIndexes[4] : Index of input or output planar ports.
*/
typedef struct OMX_PARAM_INTERLEAVETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bEnable;
OMX_U32 nInterleavePortIndex;
} OMX_PARAM_INTERLEAVETYPE;
/**
* Defines the picture effect used for an input picture
*/
typedef enum OMX_TRANSITIONEFFECTTYPE {
OMX_EffectNone,
OMX_EffectFadeFromBlack,
OMX_EffectFadeToBlack,
OMX_EffectUnspecifiedThroughConstantColor,
OMX_EffectDissolve,
OMX_EffectWipe,
OMX_EffectUnspecifiedMixOfTwoScenes,
OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_EffectMax = 0x7FFFFFFF
} OMX_TRANSITIONEFFECTTYPE;
/**
* Structure used to configure current transition effect
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eEffect : Effect to enable
*/
typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_TRANSITIONEFFECTTYPE eEffect;
} OMX_CONFIG_TRANSITIONEFFECTTYPE;
/**
* Defines possible data unit types for encoded video data. The data unit
* types are used both for encoded video input for playback as well as
* encoded video output from recording.
*/
typedef enum OMX_DATAUNITTYPE {
OMX_DataUnitCodedPicture,
OMX_DataUnitVideoSegment,
OMX_DataUnitSeveralSegments,
OMX_DataUnitArbitraryStreamSection,
OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_DataUnitMax = 0x7FFFFFFF
} OMX_DATAUNITTYPE;
/**
* Defines possible encapsulation types for coded video data unit. The
* encapsulation information is used both for encoded video input for
* playback as well as encoded video output from recording.
*/
typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
OMX_DataEncapsulationElementaryStream,
OMX_DataEncapsulationGenericPayload,
OMX_DataEncapsulationRtpPayload,
OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_DataEncapsulationMax = 0x7FFFFFFF
} OMX_DATAUNITENCAPSULATIONTYPE;
/**
* Structure used to configure the type of being decoded/encoded
*/
typedef struct OMX_PARAM_DATAUNITTYPE {
OMX_U32 nSize; /**< Size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< Port that this structure applies to */
OMX_DATAUNITTYPE eUnitType;
OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
} OMX_PARAM_DATAUNITTYPE;
/**
* Defines dither types
*/
typedef enum OMX_DITHERTYPE {
OMX_DitherNone,
OMX_DitherOrdered,
OMX_DitherErrorDiffusion,
OMX_DitherOther,
OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_DitherMax = 0x7FFFFFFF
} OMX_DITHERTYPE;
/**
* Structure used to configure current type of dithering
*/
typedef struct OMX_CONFIG_DITHERTYPE {
OMX_U32 nSize; /**< Size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< Port that this structure applies to */
OMX_DITHERTYPE eDither; /**< Type of dithering to use */
} OMX_CONFIG_DITHERTYPE;
typedef struct OMX_CONFIG_CAPTUREMODETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex; /**< Port that this structure applies to */
OMX_BOOL bContinuous; /**< If true then ignore frame rate and emit capture
* data as fast as possible (otherwise obey port's frame rate). */
OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
* specified number of frames (otherwise the port does not
* terminate the capture until instructed to do so by the client).
* Even if set, the client may manually terminate the capture prior
* to reaching the limit. */
OMX_U32 nFrameLimit; /**< Limit on number of frames emitted during a capture (only
* valid if bFrameLimited is set). */
} OMX_CONFIG_CAPTUREMODETYPE;
typedef enum OMX_METERINGTYPE {
OMX_MeteringModeAverage, /**< Center-weighted average metering. */
OMX_MeteringModeSpot, /**< Spot (partial) metering. */
OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */
OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_EVModeMax = 0x7fffffff
} OMX_METERINGTYPE;
typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_METERINGTYPE eMetering;
OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */
OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */
OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */
OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */
OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */
OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */
} OMX_CONFIG_EXPOSUREVALUETYPE;
/**
* Focus region configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* bCenter : Use center region as focus region of interest
* bLeft : Use left region as focus region of interest
* bRight : Use right region as focus region of interest
* bTop : Use top region as focus region of interest
* bBottom : Use bottom region as focus region of interest
* bTopLeft : Use top left region as focus region of interest
* bTopRight : Use top right region as focus region of interest
* bBottomLeft : Use bottom left region as focus region of interest
* bBottomRight : Use bottom right region as focus region of interest
*/
typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bCenter;
OMX_BOOL bLeft;
OMX_BOOL bRight;
OMX_BOOL bTop;
OMX_BOOL bBottom;
OMX_BOOL bTopLeft;
OMX_BOOL bTopRight;
OMX_BOOL bBottomLeft;
OMX_BOOL bBottomRight;
} OMX_CONFIG_FOCUSREGIONTYPE;
/**
* Focus Status type
*/
typedef enum OMX_FOCUSSTATUSTYPE {
OMX_FocusStatusOff = 0,
OMX_FocusStatusRequest,
OMX_FocusStatusReached,
OMX_FocusStatusUnableToReach,
OMX_FocusStatusLost,
OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_FocusStatusMax = 0x7FFFFFFF
} OMX_FOCUSSTATUSTYPE;
/**
* Focus status configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eFocusStatus : Specifies the focus status
* bCenterStatus : Use center region as focus region of interest
* bLeftStatus : Use left region as focus region of interest
* bRightStatus : Use right region as focus region of interest
* bTopStatus : Use top region as focus region of interest
* bBottomStatus : Use bottom region as focus region of interest
* bTopLeftStatus : Use top left region as focus region of interest
* bTopRightStatus : Use top right region as focus region of interest
* bBottomLeftStatus : Use bottom left region as focus region of interest
* bBottomRightStatus : Use bottom right region as focus region of interest
*/
typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_FOCUSSTATUSTYPE eFocusStatus;
OMX_BOOL bCenterStatus;
OMX_BOOL bLeftStatus;
OMX_BOOL bRightStatus;
OMX_BOOL bTopStatus;
OMX_BOOL bBottomStatus;
OMX_BOOL bTopLeftStatus;
OMX_BOOL bTopRightStatus;
OMX_BOOL bBottomLeftStatus;
OMX_BOOL bBottomRightStatus;
} OMX_PARAM_FOCUSSTATUSTYPE;
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

View File

@ -0,0 +1,328 @@
/**
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* @file OMX_Image.h - OpenMax IL version 1.1.2
* The structures needed by Image components to exchange parameters and
* configuration data with the components.
*/
#ifndef OMX_Image_h
#define OMX_Image_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Each OMX header must include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_IVCommon.h>
/** @defgroup imaging OpenMAX IL Imaging Domain
* @ingroup iv
* Structures for OpenMAX IL Imaging domain
* @{
*/
/**
* Enumeration used to define the possible image compression coding.
*/
typedef enum OMX_IMAGE_CODINGTYPE {
OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
OMX_IMAGE_CodingEXIF, /**< EXIF image format */
OMX_IMAGE_CodingTIFF, /**< TIFF image format */
OMX_IMAGE_CodingGIF, /**< Graphics image format */
OMX_IMAGE_CodingPNG, /**< PNG image format */
OMX_IMAGE_CodingLZW, /**< LZW image format */
OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_IMAGE_CodingMax = 0x7FFFFFFF
} OMX_IMAGE_CODINGTYPE;
/**
* Data structure used to define an image path. The number of image paths
* for input and output will vary by type of the image component.
*
* Input (aka Source) : Zero Inputs, one Output,
* Splitter : One Input, 2 or more Outputs,
* Processing Element : One Input, one output,
* Mixer : 2 or more inputs, one output,
* Output (aka Sink) : One Input, zero outputs.
*
* The PortDefinition structure is used to define all of the parameters
* necessary for the compliant component to setup an input or an output
* image path. If additional vendor specific data is required, it should
* be transmitted to the component using the CustomCommand function.
* Compliant components will prepopulate this structure with optimal
* values during the OMX_GetParameter() command.
*
* STRUCT MEMBERS:
* cMIMEType : MIME type of data for the port
* pNativeRender : Platform specific reference for a display if a
* sync, otherwise this field is 0
* nFrameWidth : Width of frame to be used on port if
* uncompressed format is used. Use 0 for
* unknown, don't care or variable
* nFrameHeight : Height of frame to be used on port if
* uncompressed format is used. Use 0 for
* unknown, don't care or variable
* nStride : Number of bytes per span of an image (i.e.
* indicates the number of bytes to get from
* span N to span N+1, where negative stride
* indicates the image is bottom up
* nSliceHeight : Height used when encoding in slices
* bFlagErrorConcealment : Turns on error concealment if it is supported by
* the OMX component
* eCompressionFormat : Compression format used in this instance of
* the component. When OMX_IMAGE_CodingUnused is
* specified, eColorFormat is valid
* eColorFormat : Decompressed format used by this component
* pNativeWindow : Platform specific reference for a window object if a
* display sink , otherwise this field is 0x0.
*/
typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
OMX_STRING cMIMEType;
OMX_NATIVE_DEVICETYPE pNativeRender;
OMX_U32 nFrameWidth;
OMX_U32 nFrameHeight;
OMX_S32 nStride;
OMX_U32 nSliceHeight;
OMX_BOOL bFlagErrorConcealment;
OMX_IMAGE_CODINGTYPE eCompressionFormat;
OMX_COLOR_FORMATTYPE eColorFormat;
OMX_NATIVE_WINDOWTYPE pNativeWindow;
} OMX_IMAGE_PORTDEFINITIONTYPE;
/**
* Port format parameter. This structure is used to enumerate the various
* data input/output format supported by the port.
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Indicates which port to set
* nIndex : Indicates the enumeration index for the format from
* 0x0 to N-1
* eCompressionFormat : Compression format used in this instance of the
* component. When OMX_IMAGE_CodingUnused is specified,
* eColorFormat is valid
* eColorFormat : Decompressed format used by this component
*/
typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nIndex;
OMX_IMAGE_CODINGTYPE eCompressionFormat;
OMX_COLOR_FORMATTYPE eColorFormat;
} OMX_IMAGE_PARAM_PORTFORMATTYPE;
/**
* Flash control type
*
* ENUMS
* Torch : Flash forced constantly on
*/
typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
OMX_IMAGE_FlashControlOn = 0,
OMX_IMAGE_FlashControlOff,
OMX_IMAGE_FlashControlAuto,
OMX_IMAGE_FlashControlRedEyeReduction,
OMX_IMAGE_FlashControlFillin,
OMX_IMAGE_FlashControlTorch,
OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
} OMX_IMAGE_FLASHCONTROLTYPE;
/**
* Flash control configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eFlashControl : Flash control type
*/
typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
/**
* Focus control type
*/
typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
OMX_IMAGE_FocusControlOn = 0,
OMX_IMAGE_FocusControlOff,
OMX_IMAGE_FocusControlAuto,
OMX_IMAGE_FocusControlAutoLock,
OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
} OMX_IMAGE_FOCUSCONTROLTYPE;
/**
* Focus control configuration
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eFocusControl : Focus control
* nFocusSteps : Focus can take on values from 0 mm to infinity.
* Interest is only in number of steps over this range.
* nFocusStepIndex : Current focus step index
*/
typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
OMX_U32 nFocusSteps;
OMX_U32 nFocusStepIndex;
} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
/**
* Q Factor for JPEG compression, which controls the tradeoff between image
* quality and size. Q Factor provides a more simple means of controlling
* JPEG compression quality, without directly programming Quantization
* tables for chroma and luma
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
* produces the smallest, worst quality images, and a factor
* of 100 produces the largest, best quality images. A
* typical default is 75 for small good quality images
*/
typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nQFactor;
} OMX_IMAGE_PARAM_QFACTORTYPE;
/**
* Quantization table type
*/
typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
OMX_IMAGE_QuantizationTableLuma = 0,
OMX_IMAGE_QuantizationTableChroma,
OMX_IMAGE_QuantizationTableChromaCb,
OMX_IMAGE_QuantizationTableChromaCr,
OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
} OMX_IMAGE_QUANTIZATIONTABLETYPE;
/**
* JPEG quantization tables are used to determine DCT compression for
* YUV data, as an alternative to specifying Q factor, providing exact
* control of compression
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eQuantizationTable : Quantization table type
* nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
* in increasing columns then by rows of data (i.e.
* row 1, ... row 8). Quantization values are in
* the range 0-255 and stored in linear order
* (i.e. the component will zig-zag the
* quantization table data if required internally)
*/
typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
OMX_U8 nQuantizationMatrix[64];
} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
/**
* Huffman table type, the same Huffman table is applied for chroma and
* luma component
*/
typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
OMX_IMAGE_HuffmanTableAC = 0,
OMX_IMAGE_HuffmanTableDC,
OMX_IMAGE_HuffmanTableACLuma,
OMX_IMAGE_HuffmanTableACChroma,
OMX_IMAGE_HuffmanTableDCLuma,
OMX_IMAGE_HuffmanTableDCChroma,
OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
} OMX_IMAGE_HUFFMANTABLETYPE;
/**
* JPEG Huffman table
*
* STRUCT MEMBERS:
* nSize : Size of the structure in bytes
* nVersion : OMX specification version information
* nPortIndex : Port that this structure applies to
* eHuffmanTable : Huffman table type
* nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
* possible length
* nHuffmanTable[256] : 0-255, the size used for AC and DC
* HuffmanTable are 16 and 162
*/
typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
OMX_U8 nNumberOfHuffmanCodeOfLength[16];
OMX_U8 nHuffmanTable[256];
}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

View File

@ -0,0 +1,259 @@
/*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** @file OMX_Index.h - OpenMax IL version 1.1.2
* The OMX_Index header file contains the definitions for both applications
* and components .
*/
#ifndef OMX_Index_h
#define OMX_Index_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header must include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Types.h>
/** The OMX_INDEXTYPE enumeration is used to select a structure when either
* getting or setting parameters and/or configuration data. Each entry in
* this enumeration maps to an OMX specified structure. When the
* OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
* are used, the second parameter will always be an entry from this enumeration
* and the third entry will be the structure shown in the comments for the entry.
* For example, if the application is initializing a cropping function, the
* OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter
* and would send a pointer to an initialized OMX_RECTTYPE structure as the
* third parameter.
*
* The enumeration entries named with the OMX_Config prefix are sent using
* the OMX_SetConfig command and the enumeration entries named with the
* OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
*/
typedef enum OMX_INDEXTYPE {
OMX_IndexComponentStartUnused = 0x01000000,
OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */
OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */
OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */
OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */
OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */
OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */
OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */
OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */
OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */
OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */
OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */
OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */
OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
OMX_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */
OMX_IndexPortStartUnused = 0x02000000,
OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
OMX_IndexReservedStartUnused = 0x03000000,
/* Audio parameters and configurations */
OMX_IndexAudioStartUnused = 0x04000000,
OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */
OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */
OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */
OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */
OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */
OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
/* Image specific parameters and configurations */
OMX_IndexImageStartUnused = 0x05000000,
OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
OMX_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
OMX_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
OMX_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
OMX_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
OMX_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
OMX_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
/* Video specific parameters and configurations */
OMX_IndexVideoStartUnused = 0x06000000,
OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
OMX_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
OMX_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
OMX_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
OMX_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */
OMX_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
OMX_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */
OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
OMX_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */
OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
OMX_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
OMX_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
OMX_IndexConfigCommonDeinterlace, /**< reference: OMX_VIDEO_CONFIG_DEINTERLACE */
/* Image & Video common Configurations */
OMX_IndexCommonStartUnused = 0x07000000,
OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */
OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */
OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */
OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */
OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */
OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */
OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */
OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
OMX_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */
OMX_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
OMX_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
OMX_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */
OMX_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */
OMX_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
OMX_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */
OMX_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */
OMX_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */
OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */
OMX_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
OMX_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
OMX_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
/* Reserved Configuration range */
OMX_IndexOtherStartUnused = 0x08000000,
OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
/* Reserved Time range */
OMX_IndexTimeStartUnused = 0x09000000,
OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */
OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
OMX_IndexConfigTimeClientStartTime, /**<reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
OMX_IndexConfigTimePosition, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
/* Vendor specific area */
OMX_IndexVendorStartUnused = 0x7F000000,
/* Vendor specific structures should be in the range of 0x7F000000
to 0x7FFFFFFE. This range is not broken out by vendor, so
private indexes are not guaranteed unique and therefore should
only be sent to the appropriate component. */
OMX_IndexMax = 0x7FFFFFFF
} OMX_INDEXTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2010 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** @file OMX_IndexExt.h - OpenMax IL version 1.1.2
* The OMX_IndexExt header file contains extensions to the definitions
* for both applications and components .
*/
#ifndef OMX_IndexExt_h
#define OMX_IndexExt_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header shall include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Index.h>
/** Khronos standard extension indices.
This enum lists the current Khronos extension indices to OpenMAX IL.
*/
typedef enum OMX_INDEXEXTTYPE {
/* Component parameters and configurations */
OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000,
OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */
OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */
OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */
/* Port parameters and configurations */
OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000,
/* Audio parameters and configurations */
OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000,
/* Image parameters and configurations */
OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000,
/* Video parameters and configurations */
OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000,
OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */
OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */
OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */
OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */
OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */
OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */
OMX_IndexParamVideoReserved, /**< Reserved for future index */
OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */
/* Image & Video common configurations */
OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000,
/* Other configurations */
OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000,
OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */
OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */
OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */
/* Time configurations */
OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000,
OMX_IndexExtMax = 0x7FFFFFFF
} OMX_INDEXEXTTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* OMX_IndexExt_h */
/* File EOF */

View File

@ -0,0 +1,337 @@
/*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** @file OMX_Other.h - OpenMax IL version 1.1.2
* The structures needed by Other components to exchange
* parameters and configuration data with the components.
*/
#ifndef OMX_Other_h
#define OMX_Other_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header must include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Core.h>
/**
* Enumeration of possible data types which match to multiple domains or no
* domain at all. For types which are vendor specific, a value above
* OMX_OTHER_VENDORTSTART should be used.
*/
typedef enum OMX_OTHER_FORMATTYPE {
OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time,
time deltas, etc */
OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power
management, setting clocks? */
OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames
dropped, etc */
OMX_OTHER_FormatBinary, /**< Arbitrary binary data */
OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific
formats */
OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_OTHER_FormatMax = 0x7FFFFFFF
} OMX_OTHER_FORMATTYPE;
/**
* Enumeration of seek modes.
*/
typedef enum OMX_TIME_SEEKMODETYPE {
OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
* of the requested seek position over
* the actual seek position if it
* results in a faster seek. */
OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek
* position over an approximation
* of the requested seek position even
* if it results in a slower seek. */
OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_TIME_SeekModeMax = 0x7FFFFFFF
} OMX_TIME_SEEKMODETYPE;
/* Structure representing the seekmode of the component */
typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */
} OMX_TIME_CONFIG_SEEKMODETYPE;
/** Structure representing a time stamp used with the following configs
* on the Clock Component (CC):
*
* OMX_IndexConfigTimeCurrentWallTime: query of the CCs current wall
* time
* OMX_IndexConfigTimeCurrentMediaTime: query of the CCs current media
* time
* OMX_IndexConfigTimeCurrentAudioReference and
* OMX_IndexConfigTimeCurrentVideoReference: audio/video reference
* clock sending SC its reference time
* OMX_IndexConfigTimeClientStartTime: a Clock Component client sends
* this structure to the Clock Component via a SetConfig on its
* client port when it receives a buffer with
* OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
* specified by that buffer for nStartTimestamp.
*
* Its also used with the following config on components in general:
*
* OMX_IndexConfigTimePosition: IL client querying component position
* (GetConfig) or commanding a component to seek to the given location
* (SetConfig)
*/
typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version
* information */
OMX_U32 nPortIndex; /**< port that this structure applies to */
OMX_TICKS nTimestamp; /**< timestamp .*/
} OMX_TIME_CONFIG_TIMESTAMPTYPE;
/** Enumeration of possible reference clocks to the media time. */
typedef enum OMX_TIME_UPDATETYPE {
OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */
OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */
OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */
OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_TIME_UpdateMax = 0x7FFFFFFF
} OMX_TIME_UPDATETYPE;
/** Enumeration of possible reference clocks to the media time. */
typedef enum OMX_TIME_REFCLOCKTYPE {
OMX_TIME_RefClockNone, /**< Use no references. */
OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_TIME_RefClockMax = 0x7FFFFFFF
} OMX_TIME_REFCLOCKTYPE;
/** Enumeration of clock states. */
typedef enum OMX_TIME_CLOCKSTATE {
OMX_TIME_ClockStateRunning, /**< Clock running. */
OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the
* prescribed clients emit their
* start time. */
OMX_TIME_ClockStateStopped, /**< Clock stopped. */
OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_TIME_ClockStateMax = 0x7FFFFFFF
} OMX_TIME_CLOCKSTATE;
/** Structure representing a media time request to the clock component.
*
* A client component sends this structure to the Clock Component via a SetConfig
* on its client port to specify a media timestamp the Clock Component
* should emit. The Clock Component should fulfill the request by sending a
* OMX_TIME_MEDIATIMETYPE when its media clock matches the requested
* timestamp.
*
* The client may require a media time request be fulfilled slightly
* earlier than the media time specified. In this case the client specifies
* an offset which is equal to the difference between wall time corresponding
* to the requested media time and the wall time when it will be
* fulfilled.
*
* A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
* time events according to timestamps. If a client must perform an operation O at
* a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a
* media time request at T (perhaps specifying an offset to ensure the request fulfillment
* is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
* structure back to the client component, the client may perform operation O (perhaps having
* to wait a slight amount more time itself as specified by the return values).
*/
typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< port that this structure applies to */
OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time
* from others (e.g. the number of the frame to deliver).
* Duplicated in the media time structure that fulfills
* this request. A value of zero is reserved for time scale
* updates. */
OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/
OMX_TICKS nOffset; /**< Amount of wall clock time by which this
* request should be fulfilled early */
} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
/**< Structure sent from the clock component client either when fulfilling
* a media time request or when the time scale has changed.
*
* In the former case the Clock Component fills this structure and times its emission
* to a client component (via the client port) according to the corresponding media
* time request sent by the client. The Clock Component should time the emission to occur
* when the requested timestamp matches the Clock Component's media time but also the
* prescribed offset early.
*
* Upon scale changes the clock component clears the nClientPrivate data, sends the current
* media time and sets the nScale to the new scale via the client port. It emits a
* OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to
* alter processing to accomodate scaling. For instance a video component might skip inter-frames
* in the case of extreme fastforward. Likewise an audio component might add or remove samples
* from an audio frame to scale audio data.
*
* It is expected that some clock components may not be able to fulfill requests
* at exactly the prescribed time. This is acceptable so long as the request is
* fulfilled at least as early as described and not later. This structure provides
* fields the client may use to wait for the remaining time.
*
* The client may use either the nOffset or nWallTimeAtMedia fields to determine the
* wall time until the nMediaTimestamp actually occurs. In the latter case the
* client can get a more accurate value for offset by getting the current wall
* from the cloc component and subtracting it from nWallTimeAtMedia.
*/
typedef struct OMX_TIME_MEDIATIMETYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time
* from others. Copied from the media time request.
* A value of zero is reserved for time scale updates. */
OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was
* requested then this is the current media time. */
OMX_TICKS nOffset; /**< Amount of wall clock time by which this
* request was actually fulfilled early */
OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
* A client may compare this value to current
* media time obtained from the Clock Component to determine
* the wall time until the media timestamp is really
* current. */
OMX_S32 xScale; /**< Current media time scale in Q16 format. */
OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/
/**< State of the media time. */
} OMX_TIME_MEDIATIMETYPE;
/** Structure representing the current media time scale factor. Applicable only to clock
* component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
* the clock component client ports. Upon recieving this config the clock component changes
* the rate by which the media time increases or decreases effectively implementing trick modes.
*/
typedef struct OMX_TIME_CONFIG_SCALETYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_S32 xScale; /**< This is a value in Q16 format which is used for
* scaling the media time */
} OMX_TIME_CONFIG_SCALETYPE;
/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPEs nWaitMask field */
#define OMX_CLOCKPORT0 0x00000001
#define OMX_CLOCKPORT1 0x00000002
#define OMX_CLOCKPORT2 0x00000004
#define OMX_CLOCKPORT3 0x00000008
#define OMX_CLOCKPORT4 0x00000010
#define OMX_CLOCKPORT5 0x00000020
#define OMX_CLOCKPORT6 0x00000040
#define OMX_CLOCKPORT7 0x00000080
/** Structure representing the current mode of the media clock.
* IL Client uses this config to change or query the mode of the
* media clock of the clock component. Applicable only to clock
* component.
*
* On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
* starts immediately at the prescribed start time. If
* OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
* the given nStartTime and waits for all clients specified in the
* nWaitMask to send starttimes (via
* OMX_IndexConfigTimeClientStartTime). The Clock Component then starts
* the media clock using the earliest start time supplied. */
typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version
* information */
OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
OMX_TICKS nStartTime; /**< Start time of the media time. */
OMX_TICKS nOffset; /**< Time to offset the media time by
* (e.g. preroll). Media time will be
* reported to be nOffset ticks earlier.
*/
OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */
} OMX_TIME_CONFIG_CLOCKSTATETYPE;
/** Structure representing the reference clock currently being used to
* compute media time. IL client uses this config to change or query the
* clock component's active reference clock */
typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */
} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
/** Descriptor for setting specifics of power type.
* Note: this structure is listed for backwards compatibility. */
typedef struct OMX_OTHER_CONFIG_POWERTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_BOOL bEnablePM; /**< Flag to enable Power Management */
} OMX_OTHER_CONFIG_POWERTYPE;
/** Descriptor for setting specifics of stats type.
* Note: this structure is listed for backwards compatibility. */
typedef struct OMX_OTHER_CONFIG_STATSTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
/* what goes here */
} OMX_OTHER_CONFIG_STATSTYPE;
/**
* The PortDefinition structure is used to define all of the parameters
* necessary for the compliant component to setup an input or an output other
* path.
*/
typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
} OMX_OTHER_PORTDEFINITIONTYPE;
/** Port format parameter. This structure is used to enumerate
* the various data input/output format supported by the port.
*/
typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
OMX_U32 nSize; /**< size of the structure in bytes */
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
OMX_U32 nPortIndex; /**< Indicates which port to set */
OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
} OMX_OTHER_PARAM_PORTFORMATTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
/*@@@+++@@@@******************************************************************
Microsoft Skype Engineering
Copyright (C) 2014 Microsoft Corporation.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*@@@---@@@@******************************************************************/
#ifndef __OMX_SKYPE_VIDEOEXTENSIONS_H__
#define __OMX_SKYPE_VIDEOEXTENSIONS_H__
#ifdef __cplusplus
extern "C"
{
#endif
#include <OMX_Core.h>
#pragma pack(push, 1)
typedef enum OMX_SKYPE_VIDEO_SliceControlMode
{
OMX_SKYPE_VIDEO_SliceControlModeNone = 0,
OMX_SKYPE_VIDEO_SliceControlModeMB = 1,
OMX_SKYPE_VIDEO_SliceControlModeByte = 2,
OMX_SKYPE_VIDEO_SliceControlModMBRow = 3,
} OMX_SKYPE_VIDEO_SliceControlMode;
typedef enum OMX_SKYPE_VIDEO_HierarType
{
OMX_SKYPE_VIDEO_HierarType_P = 0x01,
OMX_SKYPE_VIDEO_HierarType_B = 0x02,
} OMX_SKYPE_VIDEO_HIERAR_HierarType;
typedef enum OMX_VIDEO_EXTENSION_AVCPROFILETYPE
{
OMX_VIDEO_EXT_AVCProfileConstrainedBaseline = 0x01,
OMX_VIDEO_EXT_AVCProfileConstrainedHigh = 0x02,
} OMX_VIDEO_EXTENSION_AVCPROFILETYPE;
typedef struct OMX_SKYPE_VIDEO_ENCODERPARAMS {
OMX_BOOL bLowLatency;
OMX_BOOL bUseExtendedProfile;
OMX_BOOL bSequenceHeaderWithIDR;
OMX_VIDEO_EXTENSION_AVCPROFILETYPE eProfile;
OMX_U32 nLTRFrames;
OMX_SKYPE_VIDEO_HierarType eHierarType;
OMX_U32 nMaxTemporalLayerCount;
OMX_SKYPE_VIDEO_SliceControlMode eSliceControlMode;
OMX_U32 nSarIndex;
OMX_U32 nSarWidth;
OMX_U32 nSarHeight;
} OMX_SKYPE_VIDEO_ENCODERPARAMS;
typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERSETTING {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_SKYPE_VIDEO_ENCODERPARAMS stEncParam;
} OMX_SKYPE_VIDEO_PARAM_ENCODESETTING;
typedef struct OMX_SKYPE_VIDEO_ENCODERCAP {
OMX_BOOL bLowLatency;
OMX_U32 nMaxFrameWidth;
OMX_U32 nMaxFrameHeight;
OMX_U32 nMaxInstances;
OMX_U32 nMaxTemporaLayerCount;
OMX_U32 nMaxRefFrames;
OMX_U32 nMaxLTRFrames;
OMX_VIDEO_AVCLEVELTYPE nMaxLevel;
OMX_U32 nSliceControlModesBM;
OMX_U32 nMaxMacroblockProcessingRate;
OMX_U32 xMinScaleFactor;
} OMX_SKYPE_VIDEO_ENCODERCAP;
typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERCAP {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_SKYPE_VIDEO_ENCODERCAP stEncCap;
} OMX_SKYPE_VIDEO_PARAM_ENCODERCAP;
typedef struct OMX_SKYPE_VIDEO_DECODERCAP {
OMX_BOOL bLowLatency;
OMX_U32 nMaxFrameWidth;
OMX_U32 nMaxFrameHeight;
OMX_U32 nMaxInstances;
OMX_VIDEO_AVCLEVELTYPE nMaxLevel;
OMX_U32 nMaxMacroblockProcessingRate;
} OMX_SKYPE_VIDEO_DECODERCAP;
typedef struct OMX_SKYPE_VIDEO_PARAM_DECODERCAP {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_SKYPE_VIDEO_DECODERCAP stDecoderCap;
} OMX_SKYPE_VIDEO_PARAM_DECODERCAP;
typedef struct OMX_SKYPE_VIDEO_CONFIG_QP {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nQP;
} OMX_SKYPE_VIDEO_CONFIG_QP;
typedef struct OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U32 nPID;
} OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID;
typedef struct OMX_SKYPE_VIDEO_PARAM_DRIVERVER {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_U64 nDriverVersion;
} OMX_SKYPE_VIDEO_PARAM_DRIVERVER;
typedef enum OMX_SKYPE_VIDEO_DownScaleFactor
{
OMX_SKYPE_VIDEO_DownScaleFactor_1_1 = 0,
OMX_SKYPE_VIDEO_DownScaleFactor_Equal_AR = 1,
OMX_SKYPE_VIDEO_DownScaleFactor_Any = 2,
} OMX_SKYPE_VIDEO_DownScaleFactor;
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,359 @@
/*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** OMX_Types.h - OpenMax IL version 1.1.2
* The OMX_Types header file contains the primitive type definitions used by
* the core, the application and the component. This file may need to be
* modified to be used on systems that do not have "char" set to 8 bits,
* "short" set to 16 bits and "long" set to 32 bits.
*/
#ifndef OMX_Types_h
#define OMX_Types_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** The OMX_API and OMX_APIENTRY are platform specific definitions used
* to declare OMX function prototypes. They are modified to meet the
* requirements for a particular platform */
#ifdef __SYMBIAN32__
# ifdef __OMX_EXPORTS
# define OMX_API __declspec(dllexport)
# else
# ifdef _WIN32
# define OMX_API __declspec(dllexport)
# else
# define OMX_API __declspec(dllimport)
# endif
# endif
#else
# ifdef _WIN32
# ifdef __OMX_EXPORTS
# define OMX_API __declspec(dllexport)
# else
# define OMX_API __declspec(dllimport)
# endif
# else
# ifdef __OMX_EXPORTS
# define OMX_API
# else
# define OMX_API extern
# endif
# endif
#endif
#ifndef OMX_APIENTRY
#define OMX_APIENTRY
#endif
/** OMX_IN is used to identify inputs to an OMX function. This designation
will also be used in the case of a pointer that points to a parameter
that is used as an output. */
#ifndef OMX_IN
#define OMX_IN
#endif
/** OMX_OUT is used to identify outputs from an OMX function. This
designation will also be used in the case of a pointer that points
to a parameter that is used as an input. */
#ifndef OMX_OUT
#define OMX_OUT
#endif
/** OMX_INOUT is used to identify parameters that may be either inputs or
outputs from an OMX function at the same time. This designation will
also be used in the case of a pointer that points to a parameter that
is used both as an input and an output. */
#ifndef OMX_INOUT
#define OMX_INOUT
#endif
/** OMX_ALL is used to as a wildcard to select all entities of the same type
* when specifying the index, or referring to a object by an index. (i.e.
* use OMX_ALL to indicate all N channels). When used as a port index
* for a config or parameter this OMX_ALL denotes that the config or
* parameter applies to the entire component not just one port. */
#define OMX_ALL 0xFFFFFFFF
/** In the following we define groups that help building doxygen documentation */
/** @defgroup core OpenMAX IL core
* Functions and structure related to the OMX IL core
*/
/** @defgroup comp OpenMAX IL component
* Functions and structure related to the OMX IL component
*/
/** @defgroup rpm Resource and Policy Management
* Structures for resource and policy management of components
*/
/** @defgroup buf Buffer Management
* Buffer handling functions and structures
*/
/** @defgroup tun Tunneling
* @ingroup core comp
* Structures and functions to manage tunnels among component ports
*/
/** @defgroup cp Content Pipes
* @ingroup core
*/
/** @defgroup metadata Metadata handling
*
*/
/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
typedef unsigned char OMX_U8;
/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
typedef signed char OMX_S8;
/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
typedef unsigned short OMX_U16;
/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
typedef signed short OMX_S16;
/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
typedef unsigned int OMX_U32;
/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
typedef signed int OMX_S32;
/* Users with compilers that cannot accept the "long long" designation should
define the OMX_SKIP64BIT macro. It should be noted that this may cause
some components to fail to compile if the component was written to require
64 bit integral types. However, these components would NOT compile anyway
since the compiler does not support the way the component was written.
*/
#ifndef OMX_SKIP64BIT
#ifdef __SYMBIAN32__
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
typedef unsigned long long OMX_U64;
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
typedef signed long long OMX_S64;
#elif defined(WIN32)
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
typedef unsigned __int64 OMX_U64;
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
typedef signed __int64 OMX_S64;
#else /* WIN32 */
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
typedef unsigned long long OMX_U64;
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
typedef signed long long OMX_S64;
#endif /* WIN32 */
#endif
/** The OMX_BOOL type is intended to be used to represent a true or a false
value when passing parameters to and from the OMX core and components. The
OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
*/
typedef enum OMX_BOOL {
OMX_FALSE = 0,
OMX_TRUE = !OMX_FALSE,
OMX_BOOL_MAX = 0x7FFFFFFF
} OMX_BOOL;
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
typedef OMX_U32 OMX_PTR;
typedef OMX_PTR OMX_STRING;
typedef OMX_PTR OMX_BYTE;
#else
/** The OMX_PTR type is intended to be used to pass pointers between the OMX
applications and the OMX Core and components. This is a 32 bit pointer and
is aligned on a 32 bit boundary.
*/
typedef void* OMX_PTR;
/** The OMX_STRING type is intended to be used to pass "C" type strings between
the application and the core and component. The OMX_STRING type is a 32
bit pointer to a zero terminated string. The pointer is word aligned and
the string is byte aligned.
*/
typedef char* OMX_STRING;
/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
buffers between the application and the component and core. The OMX_BYTE
type is a 32 bit pointer to a zero terminated string. The pointer is word
aligned and the string is byte aligned.
*/
typedef unsigned char* OMX_BYTE;
/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
at runtime. This identifier should be generated by a component in a way
that guarantees that every instance of the identifier running on the system
is unique. */
#endif
typedef unsigned char OMX_UUIDTYPE[128];
/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
an output port. This enumeration is common across all component types.
*/
typedef enum OMX_DIRTYPE
{
OMX_DirInput, /**< Port is an input port */
OMX_DirOutput, /**< Port is an output port */
OMX_DirMax = 0x7FFFFFFF
} OMX_DIRTYPE;
/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
for numerical data (i.e. big endian, or little endian).
*/
typedef enum OMX_ENDIANTYPE
{
OMX_EndianBig, /**< big endian */
OMX_EndianLittle, /**< little endian */
OMX_EndianMax = 0x7FFFFFFF
} OMX_ENDIANTYPE;
/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
is signed or unsigned
*/
typedef enum OMX_NUMERICALDATATYPE
{
OMX_NumericalDataSigned, /**< signed data */
OMX_NumericalDataUnsigned, /**< unsigned data */
OMX_NumercialDataMax = 0x7FFFFFFF
} OMX_NUMERICALDATATYPE;
/** Unsigned bounded value type */
typedef struct OMX_BU32 {
OMX_U32 nValue; /**< actual value */
OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
} OMX_BU32;
/** Signed bounded value type */
typedef struct OMX_BS32 {
OMX_S32 nValue; /**< actual value */
OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
} OMX_BS32;
/** Structure representing some time or duration in microseconds. This structure
* must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
* negative deltas and preroll scenarios. The quantity is represented in microseconds
* to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
* on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
* individual audio samples delivered at 192 kHz). The quantity is 64 bit to
* accommodate a large dynamic range (signed 32 bit values would allow only for plus
* or minus 35 minutes).
*
* Implementations with limited precision may convert the signed 64 bit value to
* a signed 32 bit value internally but risk loss of precision.
*/
#ifndef OMX_SKIP64BIT
typedef OMX_S64 OMX_TICKS;
#else
typedef struct OMX_TICKS
{
OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */
OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */
} OMX_TICKS;
#endif
#define OMX_TICKS_PER_SECOND 1000000
/** Define the public interface for the OMX Handle. The core will not use
this value internally, but the application should only use this value.
*/
typedef void* OMX_HANDLETYPE;
typedef struct OMX_MARKTYPE
{
OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will
generate a mark event upon
processing the mark. */
OMX_PTR pMarkData; /**< Application specific data associated with
the mark sent on a mark event to disambiguate
this mark from others. */
} OMX_MARKTYPE;
/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
* platform & operating specific object used to reference the display
* or can be used by a audio port for native audio rendering */
typedef void* OMX_NATIVE_DEVICETYPE;
/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
* platform & operating specific object used to reference the window */
typedef void* OMX_NATIVE_WINDOWTYPE;
/** The OMX_VERSIONTYPE union is used to specify the version for
a structure or component. For a component, the version is entirely
specified by the component vendor. Components doing the same function
from different vendors may or may not have the same version. For
structures, the version shall be set by the entity that allocates the
structure. For structures specified in the OMX 1.1 specification, the
value of the version shall be set to 1.1.0.0 in all cases. Access to the
OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
by accessing one of the structure elements to, for example, check only
the Major revision.
*/
typedef union OMX_VERSIONTYPE
{
struct
{
OMX_U8 nVersionMajor; /**< Major version accessor element */
OMX_U8 nVersionMinor; /**< Minor version accessor element */
OMX_U8 nRevision; /**< Revision version accessor element */
OMX_U8 nStep; /**< Step version accessor element */
} s;
OMX_U32 nVersion; /**< 32 bit value to make accessing the
version easily done in a single word
size copy/compare operation */
} OMX_VERSIONTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/* File EOF */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@
/*
* Copyright (c) 2010 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/** OMX_VideoExt.h - OpenMax IL version 1.1.2
* The OMX_VideoExt header file contains extensions to the
* definitions used by both the application and the component to
* access video items.
*/
#ifndef OMX_VideoExt_h
#define OMX_VideoExt_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Each OMX header shall include all required header files to allow the
* header to compile without errors. The includes below are required
* for this header file to compile successfully
*/
#include <OMX_Core.h>
/** NALU Formats */
typedef enum OMX_NALUFORMATSTYPE {
OMX_NaluFormatStartCodes = 1,
OMX_NaluFormatOneNaluPerBuffer = 2,
OMX_NaluFormatOneByteInterleaveLength = 4,
OMX_NaluFormatTwoByteInterleaveLength = 8,
OMX_NaluFormatFourByteInterleaveLength = 16,
OMX_NaluFormatCodingMax = 0x7FFFFFFF
} OMX_NALUFORMATSTYPE;
/** NAL Stream Format */
typedef struct OMX_NALSTREAMFORMATTYPE{
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_NALUFORMATSTYPE eNaluFormat;
} OMX_NALSTREAMFORMATTYPE;
/** VP8 profiles */
typedef enum OMX_VIDEO_VP8PROFILETYPE {
OMX_VIDEO_VP8ProfileMain = 0x01,
OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF,
OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF
} OMX_VIDEO_VP8PROFILETYPE;
/** VP8 levels */
typedef enum OMX_VIDEO_VP8LEVELTYPE {
OMX_VIDEO_VP8Level_Version0 = 0x01,
OMX_VIDEO_VP8Level_Version1 = 0x02,
OMX_VIDEO_VP8Level_Version2 = 0x04,
OMX_VIDEO_VP8Level_Version3 = 0x08,
OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF,
OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF
} OMX_VIDEO_VP8LEVELTYPE;
/** VP8 Param */
typedef struct OMX_VIDEO_PARAM_VP8TYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_VIDEO_VP8PROFILETYPE eProfile;
OMX_VIDEO_VP8LEVELTYPE eLevel;
OMX_U32 nDCTPartitions;
OMX_BOOL bErrorResilientMode;
} OMX_VIDEO_PARAM_VP8TYPE;
/** Structure for configuring VP8 reference frames */
typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bPreviousFrameRefresh;
OMX_BOOL bGoldenFrameRefresh;
OMX_BOOL bAlternateFrameRefresh;
OMX_BOOL bUsePreviousFrame;
OMX_BOOL bUseGoldenFrame;
OMX_BOOL bUseAlternateFrame;
} OMX_VIDEO_VP8REFERENCEFRAMETYPE;
/** Structure for querying VP8 reference frame type */
typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_BOOL bIsIntraFrame;
OMX_BOOL bIsGoldenOrAlternateFrame;
} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE;
/** HEVC Profiles */
typedef enum OMX_VIDEO_HEVCPROFILETYPE {
OMX_VIDEO_HEVCProfileMain = 0x01,
OMX_VIDEO_HEVCProfileMain10 = 0x02,
OMX_VIDEO_HEVCProfileUnknown = 0x6EFFFFFF,
OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF
} OMX_VIDEO_HEVCPROFILETYPE;
/** HEVC levels */
typedef enum OMX_VIDEO_HEVCLEVELTYPE {
OMX_VIDEO_HEVCLevel_Version0 = 0x0,
OMX_VIDEO_HEVCMainTierLevel1 = 0x1,
OMX_VIDEO_HEVCHighTierLevel1 = 0x2,
OMX_VIDEO_HEVCMainTierLevel2 = 0x4,
OMX_VIDEO_HEVCHighTierLevel2 = 0x8,
OMX_VIDEO_HEVCMainTierLevel21 = 0x10,
OMX_VIDEO_HEVCHighTierLevel21 = 0x20,
OMX_VIDEO_HEVCMainTierLevel3 = 0x40,
OMX_VIDEO_HEVCHighTierLevel3 = 0x80,
OMX_VIDEO_HEVCMainTierLevel31 = 0x100,
OMX_VIDEO_HEVCHighTierLevel31 = 0x200,
OMX_VIDEO_HEVCMainTierLevel4 = 0x400,
OMX_VIDEO_HEVCHighTierLevel4 = 0x800,
OMX_VIDEO_HEVCMainTierLevel41 = 0x1000,
OMX_VIDEO_HEVCHighTierLevel41 = 0x2000,
OMX_VIDEO_HEVCMainTierLevel5 = 0x4000,
OMX_VIDEO_HEVCHighTierLevel5 = 0x8000,
OMX_VIDEO_HEVCMainTierLevel51 = 0x10000,
OMX_VIDEO_HEVCHighTierLevel51 = 0x20000,
OMX_VIDEO_HEVCMainTierLevel52 = 0x40000,
OMX_VIDEO_HEVCHighTierLevel52 = 0x80000,
OMX_VIDEO_HEVCMainTierLevel6 = 0x100000,
OMX_VIDEO_HEVCHighTierLevel6 = 0x200000,
OMX_VIDEO_HEVCMainTierLevel61 = 0x400000,
OMX_VIDEO_HEVCHighTierLevel61 = 0x800000,
OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000,
OMX_VIDEO_HEVCLevelUnknown = 0x6EFFFFFF,
OMX_VIDEO_HEVCLevelMax = 0x7FFFFFFF
} OMX_VIDEO_HEVCLEVELTYPE;
/** HEVC Param */
typedef struct OMX_VIDEO_PARAM_HEVCTYPE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
OMX_U32 nPortIndex;
OMX_VIDEO_HEVCPROFILETYPE eProfile;
OMX_VIDEO_HEVCLEVELTYPE eLevel;
} OMX_VIDEO_PARAM_HEVCTYPE;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* OMX_VideoExt_h */
/* File EOF */

View File

@ -0,0 +1,141 @@
#include "libyuv.h"
#include "selfdrive/frogpilot/screenrecorder/screenrecorder.h"
#include "selfdrive/ui/qt/util.h"
namespace {
inline long long milliseconds() {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
}
ScreenRecorder::ScreenRecorder(QWidget *parent) : QPushButton(parent), recording(false), frame(0), started(0) {
screenHeight = 1080;
screenWidth = 2160;
recorderIcon = loadPixmap("../frogpilot/assets/other_images/img_recorder.png", {img_size, img_size});
recordingIcon = loadPixmap("../frogpilot/assets/other_images/img_recording.png", {img_size, img_size});
encoder = std::make_unique<OmxEncoder>("/data/media/0/videos", screenWidth, screenHeight, 60, 8 * 1024 * 1024, false, false);
rgbScaleBuffer = std::make_unique<uint8_t[]>(screenWidth * screenHeight * 4);
setFixedSize(btn_size, btn_size);
connect(this, &QPushButton::clicked, this, &ScreenRecorder::toggleRecording);
}
ScreenRecorder::~ScreenRecorder() {
stop();
}
void ScreenRecorder::toggleRecording() {
recording ? stop() : start();
}
void ScreenRecorder::start() {
if (recording) {
return;
}
recording = true;
frame = 0;
rootWidget = this;
char filename[64];
QDateTime currentTime = QDateTime::currentDateTime();
QString formattedTime = currentTime.toString("MMMM_dd_yyyy-hh:mmAP");
snprintf(filename, sizeof(filename), "%s.mp4", formattedTime.toUtf8().constData());
while (rootWidget->parentWidget() != nullptr) {
rootWidget = rootWidget->parentWidget();
}
try {
openEncoder(filename);
encodingThread = std::thread(&ScreenRecorder::encodingThreadFunction, this);
} catch (const std::exception &e) {
std::cerr << "Error starting encoder: " << e.what() << std::endl;
recording = false;
}
update();
started = milliseconds();
}
void ScreenRecorder::stop() {
if (!recording) {
return;
}
recording = false;
update();
if (encodingThread.joinable()) {
encodingThread.join();
}
try {
closeEncoder();
} catch (const std::exception &e) {
std::cerr << "Error stopping encoder: " << e.what() << std::endl;
}
imageQueue.clear();
}
void ScreenRecorder::openEncoder(const std::string &filename) {
encoder->encoder_open(filename.c_str());
}
void ScreenRecorder::closeEncoder() {
if (encoder) {
encoder->encoder_close();
}
}
void ScreenRecorder::encodingThreadFunction() {
const uint64_t start_time = nanos_since_boot();
while (recording && encoder) {
QImage popImage;
if (imageQueue.pop_wait_for(popImage, std::chrono::milliseconds(10))) {
const QImage image = popImage.convertToFormat(QImage::Format_RGBA8888);
libyuv::ARGBScale(image.bits(), image.width() * 4,
image.width(), image.height(),
rgbScaleBuffer.get(), screenWidth * 4,
screenWidth, screenHeight,
libyuv::kFilterBilinear);
encoder->encode_frame_rgba(rgbScaleBuffer.get(), screenWidth, screenHeight,
nanos_since_boot() - start_time);
}
}
}
void ScreenRecorder::updateScreen() {
if (!uiState()->scene.started) {
if (recording) {
stop();
}
return;
}
if (!recording) {
return;
}
if (milliseconds() - started > 1000 * 60 * 3) {
stop();
start();
return;
}
if (rootWidget) {
imageQueue.push(rootWidget->grab().toImage());
}
frame++;
}
void ScreenRecorder::paintEvent(QPaintEvent *event) {
bool flicker = ((milliseconds() - started) / 1000) % 2 == 0;
QPainter p(this);
drawIcon(p, QPoint(btn_size / 2, btn_size / 2), recording && flicker ? recordingIcon : recorderIcon, QColor(0, 0, 0, 0), isDown() ? 0.6 : 1.0);
}

View File

@ -0,0 +1,45 @@
#pragma once
#include "omx_encoder.h"
#include "blocking_queue.h"
#include "selfdrive/ui/qt/onroad/buttons.h"
class ScreenRecorder : public QPushButton {
Q_OBJECT
public:
explicit ScreenRecorder(QWidget *parent = 0);
~ScreenRecorder() override;
void updateScreen();
private:
void closeEncoder();
void encodingThreadFunction();
void openEncoder(const std::string &filename);
void paintEvent(QPaintEvent *event) override;
void start();
void stop();
void toggleRecording();
bool recording;
int frame;
int screenHeight;
int screenWidth;
long long started;
std::unique_ptr<OmxEncoder> encoder;
std::unique_ptr<uint8_t[]> rgbScaleBuffer;
std::thread encodingThread;
BlockingQueue<QImage> imageQueue{30};
QWidget *rootWidget;
QPixmap recorderIcon;
QPixmap recordingIcon;
};

View File

@ -3,7 +3,7 @@ import json
Import('qt_env', 'arch', 'common', 'messaging', 'visionipc', 'transformations')
base_libs = [common, messaging, visionipc, transformations,
'm', 'OpenCL', 'ssl', 'crypto', 'pthread'] + qt_env["LIBS"]
'm', 'OpenCL', 'ssl', 'crypto', 'pthread', 'OmxCore', 'avformat', 'avcodec', 'avutil', 'yuv'] + qt_env["LIBS"]
if arch == 'larch64':
base_libs.append('EGL')
@ -44,7 +44,8 @@ qt_src = ["main.cc", "qt/sidebar.cc", "qt/body.cc",
"qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc",
"qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc",
"qt/onroad/onroad_home.cc", "qt/onroad/annotated_camera.cc",
"qt/onroad/buttons.cc", "qt/onroad/alerts.cc"]
"qt/onroad/buttons.cc", "qt/onroad/alerts.cc",
"../frogpilot/screenrecorder/omx_encoder.cc", "../frogpilot/screenrecorder/screenrecorder.cc"]
# build translation files
with open(File("translations/languages.json").abspath) as f:
@ -87,6 +88,7 @@ if GetOption('extras'):
qt_env.Program('tests/test_translations', [asset_obj, 'tests/test_runner.cc', 'tests/test_translations.cc'] + qt_src, LIBS=qt_libs)
qt_env.Program('tests/ui_snapshot', [asset_obj, "tests/ui_snapshot.cc"] + qt_src, LIBS=qt_libs)
qt_env['CPPPATH'] += ["../frogpilot/screenrecorder/openmax/include/"]
if GetOption('extras') and arch != "Darwin":
# setup and factory resetter

View File

@ -314,6 +314,62 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
});
addItem(deleteDrivingDataBtn);
// Screen recordings
std::vector<QString> recordingsOptions{tr("DELETE"), tr("RENAME")};
FrogPilotButtonsControl *screenRecordingsBtn = new FrogPilotButtonsControl(tr("Screen Recordings"), tr("Delete or rename your screen recordings."), "", recordingsOptions);
connect(screenRecordingsBtn, &FrogPilotButtonsControl::buttonClicked, [=](int id) {
QDir recordingsDir("/data/media/0/videos");
QStringList recordingsNames = recordingsDir.entryList(QDir::Files | QDir::NoDotAndDotDot);
if (id == 0) {
QString selection = MultiOptionDialog::getSelection(tr("Select a recording to delete"), recordingsNames, "", this);
if (!selection.isEmpty()) {
if (!ConfirmationDialog::confirm(tr("Are you sure you want to delete this recording?"), tr("Delete"), this)) return;
std::thread([=]() {
screenRecordingsBtn->setEnabled(false);
screenRecordingsBtn->setValue(tr("Deleting..."));
QFile fileToDelete(recordingsDir.absoluteFilePath(selection));
if (fileToDelete.remove()) {
screenRecordingsBtn->setValue(tr("Deleted!"));
} else {
screenRecordingsBtn->setValue(tr("Failed..."));
}
std::this_thread::sleep_for(std::chrono::seconds(2));
screenRecordingsBtn->setValue("");
screenRecordingsBtn->setEnabled(true);
}).detach();
}
} else if (id == 1) {
QString selection = MultiOptionDialog::getSelection(tr("Select a recording to rename"), recordingsNames, "", this);
if (!selection.isEmpty()) {
QString newName = InputDialog::getText(tr("Enter a new name"), this, tr("Rename Recording"));
if (!newName.isEmpty()) {
std::thread([=]() {
screenRecordingsBtn->setEnabled(false);
screenRecordingsBtn->setValue(tr("Renaming..."));
QString oldPath = recordingsDir.absoluteFilePath(selection);
QString newPath = recordingsDir.absoluteFilePath(newName);
if (QFile::rename(oldPath, newPath)) {
screenRecordingsBtn->setValue(tr("Renamed!"));
} else {
screenRecordingsBtn->setValue(tr("Failed..."));
}
std::this_thread::sleep_for(std::chrono::seconds(2));
screenRecordingsBtn->setValue("");
screenRecordingsBtn->setEnabled(true);
}).detach();
}
}
}
});
addItem(screenRecordingsBtn);
// Backup FrogPilot
std::vector<QString> frogpilotBackupOptions{tr("BACKUP"), tr("DELETE"), tr("RESTORE")};
FrogPilotButtonsControl *frogpilotBackupBtn = new FrogPilotButtonsControl(tr("FrogPilot Backups"), tr("Backup, delete, or restore your FrogPilot backups."), "", frogpilotBackupOptions);

View File

@ -20,6 +20,10 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par
QHBoxLayout *buttons_layout = new QHBoxLayout();
buttons_layout->setSpacing(0);
// Neokii screen recorder
recorder = new ScreenRecorder(this);
buttons_layout->addWidget(recorder);
experimental_btn = new ExperimentalButton(this);
buttons_layout->addWidget(experimental_btn);
@ -641,8 +645,12 @@ void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV
}
void AnnotatedCameraWidget::paintGL() {
}
void AnnotatedCameraWidget::paintEvent(QPaintEvent *event) {
UIState *s = uiState();
SubMaster &sm = *(s->sm);
QPainter painter(this);
const double start_draw_t = millis_since_boot();
const cereal::ModelDataV2::Reader &model = sm["modelV2"].getModelV2();
const float v_ego = sm["carState"].getCarState().getVEgo();
@ -687,11 +695,12 @@ void AnnotatedCameraWidget::paintGL() {
} else {
CameraWidget::updateCalibration(DEFAULT_CALIBRATION);
}
painter.beginNativePainting();
CameraWidget::setFrameId(model.getFrameId());
CameraWidget::paintGL();
painter.endNativePainting();
}
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
@ -819,6 +828,13 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
connect(animationTimer, &QTimer::timeout, this, [this] {
animationFrameIndex = (animationFrameIndex + 1) % totalFrames;
});
// Initialize the timer for the screen recorder
QTimer *recordTimer = new QTimer(this);
QObject::connect(recordTimer, &QTimer::timeout, this, [this] {
recorder->updateScreen();
});
recordTimer->start(75);
}
void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UIScene &scene) {
@ -918,6 +934,8 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UISce
pedal_icons->updateState(scene);
}
recorder->setVisible(scene.screen_recorder && !mapOpen);
reverseCruise = scene.reverse_cruise;
roadNameUI = scene.road_name_ui;

View File

@ -6,6 +6,8 @@
#include "selfdrive/ui/qt/onroad/buttons.h"
#include "selfdrive/ui/qt/widgets/cameraview.h"
#include "selfdrive/frogpilot/screenrecorder/screenrecorder.h"
class Compass : public QWidget {
Q_OBJECT
@ -102,6 +104,7 @@ private:
Compass *compass_img;
DistanceButton *distance_btn;
PedalIcons *pedal_icons;
ScreenRecorder *recorder;
QHBoxLayout *bottom_layout;
@ -188,6 +191,7 @@ protected:
void drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd, const float v_ego);
void drawHud(QPainter &p);
void drawDriverState(QPainter &painter, const UIState *s);
void paintEvent(QPaintEvent *event) override;
inline QColor redColor(int alpha = 255) { return QColor(201, 34, 49, alpha); }
inline QColor whiteColor(int alpha = 255) { return QColor(255, 255, 255, alpha); }
inline QColor blackColor(int alpha = 255) { return QColor(0, 0, 0, alpha); }

View File

@ -435,6 +435,7 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
scene.hide_max_speed = hide_ui_elements && params.getBool("HideMaxSpeed");
scene.screen_brightness = screen_management ? params.getInt("ScreenBrightness") : 101;
scene.screen_brightness_onroad = screen_management ? params.getInt("ScreenBrightnessOnroad") : 101;
scene.screen_recorder = screen_management && params.getBool("ScreenRecorder");
scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController");
scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset");

View File

@ -176,6 +176,7 @@ typedef struct UIScene {
bool right_hand_drive;
bool road_name_ui;
bool rotating_wheel;
bool screen_recorder;
bool show_aol_status_bar;
bool show_blind_spot;
bool show_cem_status_bar;

View File

@ -68,7 +68,7 @@ procs = [
NativeProcess("mapsd", "selfdrive/navd", ["./mapsd"], only_onroad),
PythonProcess("navmodeld", "selfdrive.modeld.navmodeld", only_onroad),
NativeProcess("sensord", "system/sensord", ["./sensord"], only_onroad, enabled=not PC),
NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(5 if not PC else None)),
NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(30 if not PC else None)),
PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad),
NativeProcess("locationd", "selfdrive/locationd", ["./locationd"], only_onroad),
NativeProcess("pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False),