Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15342196
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: 嵌入式

2011-01-20 16:02:00

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);
    }
}
阅读(1985) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~