From 47b2140da1a99e7bef80f6d0e1108f1fe288aa01 Mon Sep 17 00:00:00 2001
From: James Stokebrand <stokebrand@pv.com>
Date: Mon, 20 Jul 2009 16:48:00 -0500
Subject: [PATCH] RIO-6842 (Import changes from zoom2 public repo)
- Update the authordriver.cpp to handle H264 video encoding. Combine the case statement to reduce duplicate code.
- Update the FMU to improve the handling of new input formats.
- Update the OMX Encoder to handle PVMF_MIME_YUV422_INTERLEAVED_UYVY = OMX_COLOR_FormatCbYCrY.
diff --git a/android/author/authordriver.cpp b/android/author/authordriver.cpp
index 7776c99..322ab8e 100644
--- a/android/author/authordriver.cpp
+++ b/android/author/authordriver.cpp
@@ -1112,11 +1112,12 @@
}
if (ac->which == AUTHOR_SET_VIDEO_ENCODER) {
- // Perform the cast to get the video config interface
- PVMp4H263EncExtensionInterface *config = OSCL_STATIC_CAST(PVMp4H263EncExtensionInterface*,
- mVideoEncoderConfig);
switch(mVideoEncoder) {
- case VIDEO_ENCODER_H263: {
+ case VIDEO_ENCODER_H263:
+ case VIDEO_ENCODER_MPEG_4_SP:
+ case VIDEO_ENCODER_H264: {
+ PVMp4H263EncExtensionInterface *config = OSCL_STATIC_CAST(PVMp4H263EncExtensionInterface*,
+ mVideoEncoderConfig);
// TODO:
// fix the hardcoded bit rate settings.
if (config) {
@@ -1135,23 +1136,6 @@
config->SetIFrameInterval(ANDROID_DEFAULT_I_FRAME_INTERVAL);
}
} break;
- case VIDEO_ENCODER_MPEG_4_SP: {
- if (config) {
- int bitrate_setting = 192000;
- if (mVideoWidth >= 480) {
- bitrate_setting = 420000; // unstable
- } else if (mVideoWidth >= 352) {
- bitrate_setting = 360000;
- } else if (mVideoWidth >= 320) {
- bitrate_setting = 320000;
- }
- config->SetNumLayers(1);
- config->SetOutputBitRate(0, bitrate_setting);
- config->SetOutputFrameSize(0, mVideoWidth, mVideoHeight);
- config->SetOutputFrameRate(0, mVideoFrameRate);
- config->SetIFrameInterval(ANDROID_DEFAULT_I_FRAME_INTERVAL);
- }
- } break;
default:
break;
diff --git a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.cpp b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.cpp
index 97c9d36..4347481 100644
--- a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.cpp
+++ b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.cpp
@@ -47,7 +47,14 @@
iPeer = NULL;
iState = STATE_IDLE;
-
+ // Init the input format capabilities vector
+ iInputFormatCapability.clear();
+ iInputFormatCapability.push_back(PVMF_MIME_PCM);
+ iInputFormatCapability.push_back(PVMF_MIME_PCM8);
+ iInputFormatCapability.push_back(PVMF_MIME_PCM16);
+ iInputFormatCapability.push_back(PVMF_MIME_PCM16_BE);
+ iInputFormatCapability.push_back(PVMF_MIME_ULAW);
+ iInputFormatCapability.push_back(PVMF_MIME_ALAW);
}
@@ -722,17 +729,17 @@
// This component supports any audio format
// Generate a list of all the PVMF audio formats...
- uint32 count = PVMF_SUPPORTED_UNCOMPRESSED_AUDIO_FORMATS_COUNT;
+ uint32 count = iInputFormatCapability.size();
aParameters = (PvmiKvp*)oscl_malloc(count * sizeof(PvmiKvp));
if (aParameters)
{
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_PCM;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_PCM8;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_PCM16;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_PCM16_BE;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_ULAW;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_ALAW;
+ num_parameter_elements = 0;
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iInputFormatCapability.begin(); it != iInputFormatCapability.end(); it++)
+ {
+ aParameters[num_parameter_elements++].value.pChar_value = OSCL_STATIC_CAST(char*, it->getMIMEStrPtr());
+ }
return PVMFSuccess;
}
return PVMFErrNoMemory;
@@ -912,20 +919,16 @@
if (pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/media/format-type")) == 0)
{
- //This component supports PCM8 or PCM16 only.
- if ((pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_PCM8) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_PCM16) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_PCM16) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_PCM16_BE) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_ULAW) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_ALAW) == 0))
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iInputFormatCapability.begin(); it != iInputFormatCapability.end(); it++)
{
- return PVMFSuccess;
+ if (pv_mime_strcmp(aParameters[paramind].value.pChar_value, it->getMIMEStrPtr()) == 0)
+ {
+ return PVMFSuccess;
+ }
}
- else
- {
- return PVMFErrNotSupported;
- }
+ // Not found on the list of supported input formats
+ return PVMFErrNotSupported;
}
}
// For all other parameters return success.
diff --git a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.h b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.h
index 775e513..b6b48ce 100644
--- a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.h
+++ b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_audio.h
@@ -40,10 +40,6 @@
#include "pvmi_media_io_clock_extension.h"
#endif
-// To maintain the count of supported uncompressed audio formats.
-// Should be updated whenever new format is added
-#define PVMF_SUPPORTED_UNCOMPRESSED_AUDIO_FORMATS_COUNT 6
-
class PVLogger;
class PVMFMediaClock;
class ColorConvertBase;
@@ -228,6 +224,8 @@
// For logging
PVLogger* iLogger;
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator> iInputFormatCapability;
+
};
#endif // PV_FRAME_METADATA_MIO_AUDIO_H_INCLUDED
diff --git a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.cpp b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.cpp
index 0b201b5..3d58923 100644
--- a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.cpp
+++ b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.cpp
@@ -68,6 +68,16 @@
iFrameRetrievalInfo.iTimeOffset = 0;
iFrameRetrievalInfo.iFrameBuffer = NULL;
iFrameRetrievalInfo.iBufferSize = NULL;
+
+ // Init the input format capabilities vector
+ iInputFormatCapability.clear();
+ iInputFormatCapability.push_back(PVMF_MIME_YUV420);
+ iInputFormatCapability.push_back(PVMF_MIME_YUV422);
+ iInputFormatCapability.push_back(PVMF_MIME_YUV422_INTERLEAVED_UYVY);
+ iInputFormatCapability.push_back(PVMF_MIME_RGB8);
+ iInputFormatCapability.push_back(PVMF_MIME_RGB12);
+ iInputFormatCapability.push_back(PVMF_MIME_RGB16);
+ iInputFormatCapability.push_back(PVMF_MIME_RGB24);
}
@@ -1094,18 +1104,18 @@
// This is a query for the list of supported formats.
// This component supports all uncompressed video format
// Generate a list of all the PVMF video formats...
- int32 count = PVMF_SUPPORTED_UNCOMPRESSED_VIDEO_FORMATS_COUNT;
+ int32 count = iInputFormatCapability.size();
aParameters = (PvmiKvp*)oscl_malloc(count * sizeof(PvmiKvp));
if (aParameters)
{
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_YUV420;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_YUV422;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_RGB8;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_RGB12;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_RGB16;
- aParameters[num_parameter_elements++].value.pChar_value = (char*)PVMF_MIME_RGB24;
+ num_parameter_elements = 0;
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iInputFormatCapability.begin(); it != iInputFormatCapability.end(); it++)
+ {
+ aParameters[num_parameter_elements++].value.pChar_value = OSCL_STATIC_CAST(char*, it->getMIMEStrPtr());
+ }
return PVMFSuccess;
}
return PVMFErrNoMemory;
@@ -1304,19 +1314,16 @@
if (pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/media/format-type")) == 0)
{
//This component supports only uncompressed formats
- if ((pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_YUV420) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_YUV422) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_RGB8) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_RGB12) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_RGB16) == 0) ||
- (pv_mime_strcmp(aParameters[paramind].value.pChar_value, PVMF_MIME_RGB24) == 0))
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iInputFormatCapability.begin(); it != iInputFormatCapability.end(); it++)
{
- return PVMFSuccess;
+ if (pv_mime_strcmp(aParameters[paramind].value.pChar_value, it->getMIMEStrPtr()) == 0)
+ {
+ return PVMFSuccess;
+ }
}
- else
- {
- return PVMFErrNotSupported;
- }
+ // Not found on the list of supported input formats
+ return PVMFErrNotSupported;
}
}
// For all other parameters return success.
diff --git a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.h b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.h
index d41e16e..5cc3b4e 100644
--- a/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.h
+++ b/engines/adapters/player/framemetadatautility/src/pv_frame_metadata_mio_video.h
@@ -44,10 +44,6 @@
class PVMFMediaClock;
class ColorConvertBase;
-// To maintain the count of supported uncompressed video formats.
-// Should be updated whenever new format is added
-#define PVMF_SUPPORTED_UNCOMPRESSED_VIDEO_FORMATS_COUNT 6
-
class PVFMVideoMIOGetFrameObserver
{
public:
@@ -264,6 +260,8 @@
uint32 iFrameHeight;
};
PVFMVideoMIOFrameRetrieval iFrameRetrievalInfo;
+
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator> iInputFormatCapability;
};
#endif // PV_FRAME_METADATA_MIO_VIDEO_H_INCLUDED
diff --git a/nodes/pvomxencnode/include/pvmf_omx_enc_port.h b/nodes/pvomxencnode/include/pvmf_omx_enc_port.h
index 32c1176..cee3de2 100644
--- a/nodes/pvomxencnode/include/pvmf_omx_enc_port.h
+++ b/nodes/pvomxencnode/include/pvmf_omx_enc_port.h
@@ -204,10 +204,14 @@
{
if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_YUV420) == 0)
{
- return 3;
+ return 4;
}
else if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_YUV422) == 0)
{
+ return 3;
+ }
+ else if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_YUV422_INTERLEAVED_UYVY) == 0)
+ {
return 2;
}
else if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_RGB12) == 0)
diff --git a/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp b/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
index f7acdb0..2b02715 100644
--- a/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
+++ b/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
@@ -707,6 +707,7 @@
// video input
iCapability.iInputFormatCapability.push_back(PVMF_MIME_YUV420);
iCapability.iInputFormatCapability.push_back(PVMF_MIME_YUV422);
+ iCapability.iInputFormatCapability.push_back(PVMF_MIME_YUV422_INTERLEAVED_UYVY);
iCapability.iInputFormatCapability.push_back(PVMF_MIME_RGB24);
iCapability.iInputFormatCapability.push_back(PVMF_MIME_RGB12);
@@ -829,7 +830,6 @@
oscl_memset(&iVideoInputFormat, 0, sizeof(iVideoInputFormat));
// set default values
- iVideoInputFormat.iVideoFormat = EI_YUV420;
iVideoInputFormat.iFrameWidth = DEFAULT_FRAME_WIDTH;
iVideoInputFormat.iFrameHeight = DEFAULT_FRAME_HEIGHT;
iVideoInputFormat.iFrameRate = (float)DEFAULT_FRAME_RATE;
@@ -2036,10 +2036,32 @@
// first of all, check if the port supports the adequate port format
OMX_VIDEO_PARAM_PORTFORMATTYPE Video_port_format;
+ OMX_COLOR_FORMATTYPE DesiredPortColorFormat;
- //TODO: get color format from MIO. JJ 03/09/09
- OMX_COLOR_FORMATTYPE DesiredPortColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
- //OMX_COLOR_FORMATTYPE DesiredPortColorFormat = OMX_COLOR_FormatYUV420Planar;
+ if (iInFormat == PVMF_MIME_RGB24)
+ {
+ DesiredPortColorFormat = OMX_COLOR_Format24bitRGB888;
+ }
+ else if (iInFormat == PVMF_MIME_RGB12)
+ {
+ DesiredPortColorFormat = OMX_COLOR_Format12bitRGB444;
+ }
+ else if (iInFormat == PVMF_MIME_YUV420)
+ {
+ //TODO: get color format from MIO. JJ 03/09/09
+ DesiredPortColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ //DesiredPortColorFormat = OMX_COLOR_FormatYUV420Planar;
+ }
+ else if (iInFormat == PVMF_MIME_YUV422_INTERLEAVED_UYVY)
+ {
+ DesiredPortColorFormat = OMX_COLOR_FormatCbYCrY;
+ }
+ else
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::NegotiateVideoComponentParameters() Problem with input port %d color format", iNodeTypeId, iInputPortIndex));
+ return false;
+ }
CONFIG_SIZE_AND_VERSION(Video_port_format);
@@ -2104,6 +2126,11 @@
iParamPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
//iParamPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
}
+ else if (iInFormat == PVMF_MIME_YUV422_INTERLEAVED_UYVY)
+ {
+ iOMXComponentInputBufferSize = iVideoInputFormat.iFrameWidth * iVideoInputFormat.iFrameHeight * 2;
+ iParamPort.format.video.eColorFormat = OMX_COLOR_FormatCbYCrY;
+ }
else
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
@@ -8591,34 +8618,6 @@
}
iInFormat = aFormat;
-
- if (aFormat == PVMF_MIME_YUV420)
- {
- iVideoInputFormat.iVideoFormat = EI_YUV420;
- }
- else if (aFormat == PVMF_MIME_YUV422)
- {
- iVideoInputFormat.iVideoFormat = EI_UYVY;
- }
- else if (aFormat == PVMF_MIME_RGB24)
- {
- iVideoInputFormat.iVideoFormat = EI_RGB24;
- }
- else if (aFormat == PVMF_MIME_RGB12)
- {
- iVideoInputFormat.iVideoFormat = EI_RGB12;
- }
- else if (aFormat == PVMF_MIME_PCM16)
- {
- // nothing to do here, but don't fail
- }
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::SetInputFormat: Error - Unsupported format", iNodeTypeId));
- return PVMFFailure;
- }
-
return PVMFSuccess;
}
diff --git a/nodes/pvomxencnode/src/pvmf_omx_enc_node.h b/nodes/pvomxencnode/src/pvmf_omx_enc_node.h
index 5716fc8..38ca721 100644
--- a/nodes/pvomxencnode/src/pvmf_omx_enc_node.h
+++ b/nodes/pvomxencnode/src/pvmf_omx_enc_node.h
@@ -1042,6 +1042,9 @@
uint32 GetOutputSamplingRate();
uint32 GetOutputNumChannels();
+ // Capability exchange
+ PVMFNodeCapability iCapability;
+
private:
void CommandComplete(PVMFOMXEncNodeCmdQ& aCmdQ, PVMFOMXEncNodeCommand& aCmd, PVMFStatus aStatus, OsclAny* aEventData = NULL);
@@ -1324,9 +1327,6 @@
// Node configuration update
//PVMFOMXEncNodeConfig iNodeConfig;
- // Capability exchange
- PVMFNodeCapability iCapability;
-
// Reference counter for extension
uint32 iExtensionRefCount;
diff --git a/nodes/pvomxencnode/src/pvmf_omx_enc_port.cpp b/nodes/pvomxencnode/src/pvmf_omx_enc_port.cpp
index 8bf7480..4f5880e 100644
--- a/nodes/pvomxencnode/src/pvmf_omx_enc_port.cpp
+++ b/nodes/pvomxencnode/src/pvmf_omx_enc_port.cpp
@@ -55,26 +55,24 @@
////////////////////////////////////////////////////////////////////////////
bool PVMFOMXEncPort::IsFormatSupported(PVMFFormatType aFmt)
{
- if ((aFmt == PVMF_MIME_YUV420) ||
- (aFmt == PVMF_MIME_YUV422) ||
- (aFmt == PVMF_MIME_RGB12) ||
- (aFmt == PVMF_MIME_RGB24) ||
- (aFmt == PVMF_MIME_PCM16) ||
- (aFmt == PVMF_MIME_H264_VIDEO_RAW) ||
- (aFmt == PVMF_MIME_H264_VIDEO_MP4) ||
- //(aFmt==PVMF_MIME_H264_VIDEO) ||
- (aFmt == PVMF_MIME_M4V) ||
- (aFmt == PVMF_MIME_H2631998) ||
- (aFmt == PVMF_MIME_H2632000) ||
- (aFmt == PVMF_MIME_AMR_IETF) ||
- (aFmt == PVMF_MIME_AMRWB_IETF) ||
- (aFmt == PVMF_MIME_AMR_IF2) ||
- (aFmt == PVMF_MIME_ADTS) ||
- (aFmt == PVMF_MIME_ADIF) ||
- (aFmt == PVMF_MIME_MPEG4_AUDIO))
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iInputFormatCapability.begin();
+ it != iOMXNode->iCapability.iInputFormatCapability.end(); it++)
{
- return true;
+ if (aFmt == *it)
+ {
+ return true;
+ }
}
+ for (it = iOMXNode->iCapability.iOutputFormatCapability.begin();
+ it != iOMXNode->iCapability.iOutputFormatCapability.end(); it++)
+ {
+ if (aFmt == *it)
+ {
+ return true;
+ }
+ }
+ // Not found in the input or output format capability lists
return false;
}
@@ -320,7 +318,7 @@
if (pv_mime_strcmp(param1, param2) == 0)
{
- num_parameter_elements = 5;
+ num_parameter_elements = iOMXNode->iCapability.iInputFormatCapability.size();
status = AllocateKvp(parameters, (OMX_STRING)INPUT_FORMATS_VALTYPE, num_parameter_elements);
if (status != PVMFSuccess)
{
@@ -328,11 +326,13 @@
return status;
}
- parameters[0].value.pChar_value = (char*)PVMF_MIME_YUV420;
- parameters[1].value.pChar_value = (char*)PVMF_MIME_YUV422;
- parameters[2].value.pChar_value = (char*)PVMF_MIME_RGB12;
- parameters[3].value.pChar_value = (char*)PVMF_MIME_RGB24;
- parameters[4].value.pChar_value = (char*)PVMF_MIME_PCM16;
+ uint32 ii = 0;
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iInputFormatCapability.begin();
+ it != iOMXNode->iCapability.iInputFormatCapability.end(); it++)
+ {
+ parameters[ii++].value.pChar_value = OSCL_STATIC_CAST(char*, it->getMIMEStrPtr());
+ }
}
}
@@ -379,26 +379,20 @@
if (pv_mime_strcmp(param1, param2) == 0)
{
- num_parameter_elements = 11;
+ num_parameter_elements = iOMXNode->iCapability.iOutputFormatCapability.size();
status = AllocateKvp(parameters, (OMX_STRING)OUTPUT_FORMATS_VALTYPE, num_parameter_elements);
if (status != PVMFSuccess)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::GetOutputParametersSync: Error - AllocateKvp failed. status=%d", status));
+ return status;
}
- else
- {
- parameters[0].value.pChar_value = (char*)PVMF_MIME_H2631998;
- parameters[1].value.pChar_value = (char*)PVMF_MIME_H2632000;
- parameters[2].value.pChar_value = (char*)PVMF_MIME_M4V;
- parameters[3].value.pChar_value = (char*)PVMF_MIME_H264_VIDEO_RAW;
- parameters[4].value.pChar_value = (char*)PVMF_MIME_H264_VIDEO_MP4;
- parameters[5].value.pChar_value = (char*)PVMF_MIME_AMR_IETF;
- parameters[6].value.pChar_value = (char*)PVMF_MIME_AMRWB_IETF;
- parameters[7].value.pChar_value = (char*)PVMF_MIME_AMR_IF2;
- parameters[8].value.pChar_value = (char*)PVMF_MIME_ADTS;
- parameters[9].value.pChar_value = (char*)PVMF_MIME_ADIF;
- parameters[10].value.pChar_value = (char*)PVMF_MIME_MPEG4_AUDIO;
+ uint32 ii = 0;
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iOutputFormatCapability.begin();
+ it != iOMXNode->iCapability.iOutputFormatCapability.end(); it++)
+ {
+ parameters[ii++].value.pChar_value = OSCL_STATIC_CAST(char*, it->getMIMEStrPtr());
}
}
}
@@ -663,56 +657,47 @@
if (pv_mime_strcmp(aKvp->key, INPUT_FORMATS_VALTYPE) == 0 &&
iTag == PVMF_OMX_ENC_NODE_PORT_TYPE_INPUT)
{
- if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_YUV420) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_YUV422) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_RGB12) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_RGB24) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_PCM16) == 0)
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iInputFormatCapability.begin();
+ it != iOMXNode->iCapability.iInputFormatCapability.end(); it++)
{
- if (aSetParam)
+ if (pv_mime_strcmp(aKvp->value.pChar_value, it->getMIMEStrPtr()) == 0)
{
- iFormat = aKvp->value.pChar_value;
- if (iOMXNode->SetInputFormat(iFormat) != PVMFSuccess)
- return PVMFFailure;
+ if (aSetParam)
+ {
+ iFormat = aKvp->value.pChar_value;
+ if (iOMXNode->SetInputFormat(iFormat) != PVMFSuccess)
+ return PVMFFailure;
+ }
+ return PVMFSuccess;
}
- return PVMFSuccess;
}
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::VerifyAndSetParameter: Error - Input format %d not supported",
- aKvp->value.uint32_value));
- return PVMFFailure;
- }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::VerifyAndSetParameter: Error - Input format %s not supported",
+ aKvp->value.pChar_value));
+ return PVMFFailure;
}
else if (pv_mime_strcmp(aKvp->key, OUTPUT_FORMATS_VALTYPE) == 0 &&
iTag == PVMF_OMX_ENC_NODE_PORT_TYPE_OUTPUT)
{
- if (pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_H2631998) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_H2632000) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_M4V) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_H264_VIDEO_RAW) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_H264_VIDEO_MP4) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_AMR_IETF) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_AMRWB_IETF) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_AMR_IF2) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_ADIF) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_ADTS) == 0 ||
- pv_mime_strcmp(aKvp->value.pChar_value, PVMF_MIME_MPEG4_AUDIO) == 0)
+
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iInputFormatCapability.begin();
+ it != iOMXNode->iCapability.iInputFormatCapability.end(); it++)
{
- if (aSetParam)
+ if (pv_mime_strcmp(aKvp->value.pChar_value, it->getMIMEStrPtr()) == 0)
{
- iFormat = aKvp->value.pChar_value;
- if (iOMXNode->SetCodecType(iFormat) != PVMFSuccess)
- return PVMFFailure;
+ if (aSetParam)
+ {
+ iFormat = aKvp->value.pChar_value;
+ if (iOMXNode->SetCodecType(iFormat) != PVMFSuccess)
+ return PVMFFailure;
+ }
}
return PVMFSuccess;
}
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::VerifyAndSetParameter: Error - Output format %d not supported",
- aKvp->value.pChar_value));
- return PVMFFailure;
- }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::VerifyAndSetParameter: Error - Output format %s not supported",
+ aKvp->value.pChar_value));
+ return PVMFFailure;
}
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::VerifyAndSetParameter: Error - Unsupported parameter"));
@@ -752,21 +737,28 @@
PvmiKvp* selectedAudioKvp = NULL;
for (int32 i = 0; i < numParams; i++)
{
- if (pv_mime_strcmp(kvp->value.pChar_value, PVMF_MIME_YUV420) == 0 ||
- pv_mime_strcmp(kvp->value.pChar_value, PVMF_MIME_YUV422) == 0 ||
- pv_mime_strcmp(kvp->value.pChar_value, PVMF_MIME_RGB12) == 0 ||
- pv_mime_strcmp(kvp->value.pChar_value, PVMF_MIME_RGB24) == 0)
+ Oscl_Vector<PVMFFormatType, OsclMemAllocator>::iterator it;
+ for (it = iOMXNode->iCapability.iInputFormatCapability.begin(); it != iOMXNode->iCapability.iInputFormatCapability.end(); it++)
{
- videoFormat = kvp[i].value.pChar_value;
- err = PushKVP(sortedKvp, &(kvp[i]));
- OSCL_FIRST_CATCH_ANY(err,
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::NegotiateInputSettings: Error - sortedKvp.push failed"));
- return PVMFErrNoMemory;
- );
- }
- else if (pv_mime_strcmp(kvp->value.pChar_value, PVMF_MIME_PCM16) == 0)
- {
- selectedAudioKvp = &kvp[i];
+ // Is the format on the input list?
+ if (pv_mime_strcmp(kvp->value.pChar_value, it->getMIMEStrPtr()) == 0)
+ {
+ // Found. Is it audio or video?
+ if (it->isAudio())
+ {
+ // WARNING there should be only one entry for audio!
+ selectedAudioKvp = &kvp[i];
+ }
+ else // Must be video
+ {
+ videoFormat = kvp[i].value.pChar_value;
+ err = PushKVP(sortedKvp, &(kvp[i]));
+ OSCL_FIRST_CATCH_ANY(err,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncPort::NegotiateInputSettings: Error - sortedKvp.push failed"));
+ return PVMFErrNoMemory;
+ );
+ }
+ }
}
}
diff --git a/pvmi/pvmf/src/pvmf_format_type.cpp b/pvmi/pvmf/src/pvmf_format_type.cpp
index 310de61..59da2c4 100644
--- a/pvmi/pvmf/src/pvmf_format_type.cpp
+++ b/pvmi/pvmf/src/pvmf_format_type.cpp
@@ -36,6 +36,7 @@
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_ALAW) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV420) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV422) == 0) ||
+ (pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV422_INTERLEAVED_UYVY) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB8) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB12) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB16) == 0) ||
@@ -92,6 +93,7 @@
//PV internal video media types
if ((pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV420) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV422) == 0) ||
+ (pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_YUV422_INTERLEAVED_UYVY) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB8) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB12) == 0) ||
(pv_mime_strcmp(iMimeStr.c_str(), PVMF_MIME_RGB16) == 0) ||