本文整理汇总了C++中sp::getExtensionIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::getExtensionIndex方法的具体用法?C++ sp::getExtensionIndex怎么用?C++ sp::getExtensionIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::getExtensionIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureVideoDecoder
void ExtendedCodec::configureVideoDecoder(
const sp<AMessage> &msg, const char* mime, sp<IOMX> OMXhandle,
const uint32_t flags, IOMX::node_id nodeID, const char* componentName ) {
if (strncmp(componentName, "OMX.qcom.", 9)) {
//do nothing for non QC component
return;
}
setDIVXFormat(msg, mime, OMXhandle, nodeID, kPortIndexOutput);
AString fileFormat;
const char *fileFormatCStr = NULL;
bool success = msg->findString(getMsgKey(kKeyFileFormat), &fileFormat);
if (success) {
fileFormatCStr = fileFormat.c_str();
}
// Enable timestamp reordering for AVI file type, mpeg4 and vc1 codec types
if (!strcmp(componentName, "OMX.qcom.video.decoder.vc1") ||
!strcmp(componentName, "OMX.qcom.video.decoder.mpeg4") ||
(fileFormatCStr!= NULL && !strncmp(fileFormatCStr, "video/avi", 9))) {
ALOGI("Enabling timestamp reordering");
QOMX_INDEXTIMESTAMPREORDER reorder;
InitOMXParams(&reorder);
reorder.nPortIndex = kPortIndexOutput;
reorder.bEnable = OMX_TRUE;
status_t err = OMXhandle->setParameter(nodeID,
(OMX_INDEXTYPE)OMX_QcomIndexParamEnableTimeStampReorder,
(void *)&reorder, sizeof(reorder));
if(err != OK) {
ALOGW("Failed to enable timestamp reordering");
}
}
// Enable Sync-frame decode mode for thumbnails
if (flags & OMXCodec::kClientNeedsFramebuffer) {
ALOGV("Enabling thumbnail mode.");
QOMX_ENABLETYPE enableType;
OMX_INDEXTYPE indexType;
status_t err = OMXhandle->getExtensionIndex(
nodeID, OMX_QCOM_INDEX_PARAM_VIDEO_SYNCFRAMEDECODINGMODE,
&indexType);
if(err != OK) {
ALOGW("Failed to get extension for SYNCFRAMEDECODINGMODE");
return;
}
enableType.bEnable = OMX_TRUE;
err = OMXhandle->setParameter(nodeID,indexType,
(void *)&enableType, sizeof(enableType));
if(err != OK) {
ALOGW("Failed to get extension for SYNCFRAMEDECODINGMODE");
return;
}
ALOGI("Thumbnail mode enabled.");
}
}
示例2: DescribeColorFormat
bool DescribeColorFormat(
const sp<IOMXNode> &omxNode,
DescribeColorFormat2Params &describeParams)
{
OMX_INDEXTYPE describeColorFormatIndex;
if (omxNode->getExtensionIndex(
"OMX.google.android.index.describeColorFormat",
&describeColorFormatIndex) == OK) {
DescribeColorFormatParams describeParamsV1(describeParams);
if (omxNode->getParameter(
describeColorFormatIndex,
&describeParamsV1, sizeof(describeParamsV1)) == OK) {
describeParams.initFromV1(describeParamsV1);
return describeParams.sMediaImage.mType != MediaImage2::MEDIA_IMAGE_TYPE_UNKNOWN;
}
} else if (omxNode->getExtensionIndex(
"OMX.google.android.index.describeColorFormat2", &describeColorFormatIndex) == OK
&& omxNode->getParameter(
describeColorFormatIndex, &describeParams, sizeof(describeParams)) == OK) {
return describeParams.sMediaImage.mType != MediaImage2::MEDIA_IMAGE_TYPE_UNKNOWN;
}
return DescribeDefaultColorFormat(describeParams);
}
示例3: ALOGV
void ExtendedCodec::setAC3Format(
int32_t numChannels, int32_t sampleRate, sp<IOMX> OMXhandle,
IOMX::node_id nodeID) {
QOMX_AUDIO_PARAM_AC3TYPE profileAC3;
QOMX_AUDIO_PARAM_AC3PP profileAC3PP;
OMX_INDEXTYPE indexTypeAC3;
OMX_INDEXTYPE indexTypeAC3PP;
OMX_PARAM_PORTDEFINITIONTYPE portParam;
//configure input port
ALOGV("setAC3Format samplerate %d, numChannels %d", sampleRate, numChannels);
InitOMXParams(&portParam);
portParam.nPortIndex = 0;
status_t err = OMXhandle->getParameter(
nodeID, OMX_IndexParamPortDefinition, &portParam, sizeof(portParam));
CHECK_EQ(err, (status_t)OK);
err = OMXhandle->setParameter(
nodeID, OMX_IndexParamPortDefinition, &portParam, sizeof(portParam));
CHECK_EQ(err, (status_t)OK);
//configure output port
portParam.nPortIndex = 1;
err = OMXhandle->getParameter(
nodeID, OMX_IndexParamPortDefinition, &portParam, sizeof(portParam));
CHECK_EQ(err, (status_t)OK);
err = OMXhandle->setParameter(
nodeID, OMX_IndexParamPortDefinition, &portParam, sizeof(portParam));
CHECK_EQ(err, (status_t)OK);
err = OMXhandle->getExtensionIndex(nodeID, OMX_QCOM_INDEX_PARAM_AC3TYPE, &indexTypeAC3);
InitOMXParams(&profileAC3);
profileAC3.nPortIndex = kPortIndexInput;
err = OMXhandle->getParameter(nodeID, indexTypeAC3, &profileAC3, sizeof(profileAC3));
CHECK_EQ(err,(status_t)OK);
profileAC3.nSamplingRate = sampleRate;
profileAC3.nChannels = 2;
profileAC3.eChannelConfig = OMX_AUDIO_AC3_CHANNEL_CONFIG_2_0;
ALOGV("numChannels = %d, profileAC3.nChannels = %d", numChannels, profileAC3.nChannels);
err = OMXhandle->setParameter(nodeID, indexTypeAC3, &profileAC3, sizeof(profileAC3));
CHECK_EQ(err,(status_t)OK);
//for output port
OMX_AUDIO_PARAM_PCMMODETYPE profilePcm;
InitOMXParams(&profilePcm);
profilePcm.nPortIndex = kPortIndexOutput;
err = OMXhandle->getParameter(
nodeID, OMX_IndexParamAudioPcm, &profilePcm, sizeof(profilePcm));
CHECK_EQ(err, (status_t)OK);
profilePcm.nSamplingRate = sampleRate;
err = OMXhandle->setParameter(
nodeID, OMX_IndexParamAudioPcm, &profilePcm, sizeof(profilePcm));
CHECK_EQ(err, (status_t)OK);
OMXhandle->getExtensionIndex(nodeID, OMX_QCOM_INDEX_PARAM_AC3PP, &indexTypeAC3PP);
InitOMXParams(&profileAC3PP);
profileAC3PP.nPortIndex = kPortIndexInput;
err = OMXhandle->getParameter(
nodeID, indexTypeAC3PP, &profileAC3PP, sizeof(profileAC3PP));
CHECK_EQ(err, (status_t)OK);
int i;
int channel_routing[6] = {0};
for (i=0; i<6; i++) {
channel_routing[i] = -1;
}
for (i=0; i<6; i++) {
profileAC3PP.eChannelRouting[i] = (OMX_AUDIO_AC3_CHANNEL_ROUTING)channel_routing[i];
}
profileAC3PP.eChannelRouting[0] = OMX_AUDIO_AC3_CHANNEL_LEFT;
profileAC3PP.eChannelRouting[1] = OMX_AUDIO_AC3_CHANNEL_RIGHT;
err = OMXhandle->setParameter(nodeID, indexTypeAC3PP, &profileAC3PP, sizeof(profileAC3PP));
CHECK_EQ(err, (status_t)OK);
}
示例4: setWMAFormat
status_t ExtendedCodec::setWMAFormat(
const sp<AMessage> &msg, sp<IOMX> OMXhandle,
IOMX::node_id nodeID, bool isEncoder ) {
ALOGV("setWMAFormat Called");
if (isEncoder) {
ALOGE("WMA encoding not supported");
return OK;
} else {
int32_t version;
OMX_AUDIO_PARAM_WMATYPE paramWMA;
QOMX_AUDIO_PARAM_WMA10PROTYPE paramWMA10;
CHECK(msg->findInt32(getMsgKey(kKeyWMAVersion), &version));
int32_t numChannels;
int32_t bitRate;
int32_t sampleRate;
int32_t encodeOptions;
int32_t blockAlign;
int32_t bitspersample;
int32_t formattag;
int32_t advencopt1;
int32_t advencopt2;
int32_t VirtualPktSize;
if(version==kTypeWMAPro || version==kTypeWMALossLess) {
CHECK(msg->findInt32(getMsgKey(kKeyWMABitspersample), &bitspersample));
CHECK(msg->findInt32(getMsgKey(kKeyWMAFormatTag), &formattag));
CHECK(msg->findInt32(getMsgKey(kKeyWMAAdvEncOpt1), &advencopt1));
CHECK(msg->findInt32(getMsgKey(kKeyWMAAdvEncOpt2), &advencopt2));
CHECK(msg->findInt32(getMsgKey(kKeyWMAVirPktSize), &VirtualPktSize));
}
if(version==kTypeWMA) {
InitOMXParams(¶mWMA);
paramWMA.nPortIndex = kPortIndexInput;
} else if(version==kTypeWMAPro || version==kTypeWMALossLess) {
InitOMXParams(¶mWMA10);
paramWMA10.nPortIndex = kPortIndexInput;
}
CHECK(msg->findInt32("channel-count", &numChannels));
CHECK(msg->findInt32("sample-rate", &sampleRate));
CHECK(msg->findInt32(getMsgKey(kKeyBitRate), &bitRate));
CHECK(msg->findInt32(getMsgKey(kKeyWMAEncodeOpt), &encodeOptions));
CHECK(msg->findInt32(getMsgKey(kKeyWMABlockAlign), &blockAlign));
ALOGV("Channels: %d, SampleRate: %d, BitRate; %d"
"EncodeOptions: %d, blockAlign: %d", numChannels,
sampleRate, bitRate, encodeOptions, blockAlign);
if(sampleRate>48000 || numChannels>2)
{
ALOGE("Unsupported samplerate/channels");
return ERROR_UNSUPPORTED;
}
if(version==kTypeWMAPro || version==kTypeWMALossLess)
{
ALOGV("Bitspersample: %d, wmaformattag: %d,"
"advencopt1: %d, advencopt2: %d VirtualPktSize %d", bitspersample,
formattag, advencopt1, advencopt2, VirtualPktSize);
}
status_t err = OK;
OMX_INDEXTYPE index;
if(version==kTypeWMA) {
err = OMXhandle->getParameter(
nodeID, OMX_IndexParamAudioWma, ¶mWMA, sizeof(paramWMA));
} else if(version==kTypeWMAPro || version==kTypeWMALossLess) {
OMXhandle->getExtensionIndex(nodeID,"OMX.Qualcomm.index.audio.wma10Pro",&index);
err = OMXhandle->getParameter(
nodeID, index, ¶mWMA10, sizeof(paramWMA10));
}
CHECK_EQ(err, (status_t)OK);
if(version==kTypeWMA) {
paramWMA.nChannels = numChannels;
paramWMA.nSamplingRate = sampleRate;
paramWMA.nEncodeOptions = encodeOptions;
paramWMA.nBitRate = bitRate;
paramWMA.nBlockAlign = blockAlign;
} else if(version==kTypeWMAPro || version==kTypeWMALossLess) {
paramWMA10.nChannels = numChannels;
paramWMA10.nSamplingRate = sampleRate;
paramWMA10.nEncodeOptions = encodeOptions;
paramWMA10.nBitRate = bitRate;
paramWMA10.nBlockAlign = blockAlign;
}
if(version==kTypeWMAPro || version==kTypeWMALossLess) {
paramWMA10.advancedEncodeOpt = advencopt1;
paramWMA10.advancedEncodeOpt2 = advencopt2;
paramWMA10.formatTag = formattag;
paramWMA10.validBitsPerSample = bitspersample;
paramWMA10.nVirtualPktSize = VirtualPktSize;
}
if(version==kTypeWMA) {
err = OMXhandle->setParameter(
nodeID, OMX_IndexParamAudioWma, ¶mWMA, sizeof(paramWMA));
} else if(version==kTypeWMAPro || version==kTypeWMALossLess) {
err = OMXhandle->setParameter(
nodeID, index, ¶mWMA10, sizeof(paramWMA10));
}
return err;
}
return OK;
}
示例5: configureVideoCodec
void ExtendedCodec::configureVideoCodec(
const sp<MetaData> &meta, sp<IOMX> OMXhandle,
const uint32_t flags, IOMX::node_id nodeID, char* componentName ) {
if (strncmp(componentName, "OMX.qcom.", 9)) {
//do nothing for non QC component
return;
}
int32_t arbitraryMode = 0;
bool success = meta->findInt32(kKeyUseArbitraryMode, &arbitraryMode);
bool useFrameByFrameMode = true; //default option
if (success && arbitraryMode) {
useFrameByFrameMode = false;
}
if (useFrameByFrameMode) {
ALOGI("Enable frame by frame mode");
OMX_QCOM_PARAM_PORTDEFINITIONTYPE portFmt;
portFmt.nPortIndex = kPortIndexInput;
portFmt.nFramePackingFormat = OMX_QCOM_FramePacking_OnlyOneCompleteFrame;
status_t err = OMXhandle->setParameter(
nodeID, (OMX_INDEXTYPE)OMX_QcomIndexPortDefn, (void *)&portFmt, sizeof(portFmt));
if(err != OK) {
ALOGW("Failed to set frame packing format on component");
}
} else {
ALOGI("Decoder should be in arbitrary mode");
}
// Enable timestamp reordering for AVI file type, mpeg4 and vc1 codec types
const char *fileFormat;
success = meta->findCString(kKeyFileFormat, &fileFormat);
if (!strcmp(componentName, "OMX.qcom.video.decoder.vc1") ||
!strcmp(componentName, "OMX.qcom.video.decoder.mpeg4") ||
(success && !strncmp(fileFormat, "video/avi", 9))) {
ALOGI("Enabling timestamp reordering");
QOMX_INDEXTIMESTAMPREORDER reorder;
InitOMXParams(&reorder);
reorder.nPortIndex = kPortIndexOutput;
reorder.bEnable = OMX_TRUE;
status_t err = OMXhandle->setParameter(nodeID,
(OMX_INDEXTYPE)OMX_QcomIndexParamEnableTimeStampReorder,
(void *)&reorder, sizeof(reorder));
if(err != OK) {
ALOGW("Failed to enable timestamp reordering");
}
}
// Enable Sync-frame decode mode for thumbnails
if (flags & OMXCodec::kClientNeedsFramebuffer) {
ALOGV("Enabling thumbnail mode.");
QOMX_ENABLETYPE enableType;
OMX_INDEXTYPE indexType;
status_t err = OMXhandle->getExtensionIndex(
nodeID, OMX_QCOM_INDEX_PARAM_VIDEO_SYNCFRAMEDECODINGMODE,
&indexType);
if(err != OK) {
ALOGW("Failed to get extension for SYNCFRAMEDECODINGMODE");
return;
}
enableType.bEnable = OMX_TRUE;
err = OMXhandle->setParameter(nodeID,indexType,
(void *)&enableType, sizeof(enableType));
if(err != OK) {
ALOGW("Failed to get extension for SYNCFRAMEDECODINGMODE");
return;
}
ALOGI("Thumbnail mode enabled.");
}
}