void AuthorDriver::handleSetOutputFile(set_output_file_command *ac)
{
LOGV("handleSetOutputFile In");
char filePath[1024];
int pathLen=0;
char tempStr[20];
OsclFileHandle *LutherOsclFileHandle = NULL; // luther.ge fix author core dump
sprintf(tempStr,"/proc/self/fd/%d",ac->fd);
if ((pathLen = readlink(tempStr, filePath, sizeof(filePath)-1)) != -1){
filePath[pathLen] = '\0';
LOGV("FilePath is %s",filePath);
}
else{
LOGV("FilePath can't be retrieved");
}
if (strncmp("/sdcard", filePath, 7) != 0){
LOGV("Content is to be stored in Phone");
iIsInDevice=true;
}
PVMFStatus ret = PVMFFailure;
PvmfFileOutputNodeConfigInterface *config = NULL;
if (!mComposerConfig) goto exit;
config = OSCL_STATIC_CAST(PvmfFileOutputNodeConfigInterface*, mComposerConfig);
if (!config) goto exit;
ifpOutput = fdopen(ac->fd, "wb");
if (NULL == ifpOutput) {
LOGE("Ln %d fopen() error", __LINE__);
goto exit;
}
LutherOsclFileHandle = new OsclFileHandle(ifpOutput);
if (( OUTPUT_FORMAT_AMR_NB == mOutputFormat ) || ( OUTPUT_FORMAT_AMR_WB == mOutputFormat ) ||
( OUTPUT_FORMAT_AAC_ADIF == mOutputFormat ) || ( OUTPUT_FORMAT_AAC_ADTS == mOutputFormat )) {
PvmfFileOutputNodeConfigInterface *config = OSCL_DYNAMIC_CAST(PvmfFileOutputNodeConfigInterface*, mComposerConfig);
if (!config) goto exit;
ret = config->SetOutputFileDescriptor(LutherOsclFileHandle); // (OsclFileHandle *) ifpOutput);
或者直接ret = config->SetOutputFileDescriptor(&OsclFileHandle(ifpOutput));
} else if((OUTPUT_FORMAT_THREE_GPP == mOutputFormat) || (OUTPUT_FORMAT_MPEG_4 == mOutputFormat)){
PVMp4FFCNClipConfigInterface *config = OSCL_DYNAMIC_CAST(PVMp4FFCNClipConfigInterface*, mComposerConfig);
if (!config) goto exit;
config->SetPresentationTimescale(1000);
ret = config->SetOutputFileDescriptor(LutherOsclFileHandle); // (OsclFileHandle *) ifpOutput);
或者直接ret = config->SetOutputFileDescriptor(&OsclFileHandle(ifpOutput));
}
exit:
if (LutherOsclFileHandle) delete LutherOsclFileHandle;
if (ret == PVMFSuccess) {
FinishNonAsyncCommand(ac);
} else {
LOGE("Ln %d SetOutputFile() error", __LINE__);
if (ifpOutput) {
fclose(ifpOutput);
ifpOutput = NULL;
}
commandFailed(ac);
}
}
阅读(2024) | 评论(0) | 转发(0) |