// Instantiate a frame and metadata utility object.
void MetadataDriver::handleCreate()
{
    LOGV("handleCreate");
    int error = 0;
    OSCL_HeapString<OsclMemAllocator> outputFrameTypeString;
    GetFormatString(PVMF_YUV420, outputFrameTypeString);
    OSCL_TRY(error, mUtil = PVFrameAndMetadataFactory::CreateFrameAndMetadataUtility(outputFrameTypeString.get_str(), this, this, this));
    if (error || mUtil->SetMode(PV_FRAME_METADATA_INTERFACE_MODE_SOURCE_METADATA_AND_THUMBNAIL) != PVMFSuccess) {
        handleCommandFailure();
    } else {
        mState = STATE_ADD_DATA_SOURCE;
        RunIfNotReady();
    }
}
Пример #2
0
//==============================================================================
// FinalizeReporting                                             PUBLIC STATIC
//==============================================================================
//
OSCL_EXPORT_REF void
UT::CM::FinalizeReporting
(
    const char* a_pszTestname,
    OSCL_HeapString<OsclMemAllocator> &a_filename,
    const test_result& a_tr,
    FILE* a_pFileStreamParent,
    FILE* a_pFileStreamChild
)
{
    if (0 == a_pFileStreamChild)
        return;

    //                     report the textual representation of the test results
    text_test_interpreter interp;
    _STRING rs = interp.interpretation(a_tr);
    fprintf(a_pFileStreamChild, "%s", rs.c_str());

    if (0 == a_pszTestname || 0 >= a_filename.get_size() || 0 == a_pFileStreamParent)
        return;

    _STRING strChild;

    fclose(a_pFileStreamChild);                              // close the stream

    OSCL_HeapString<OsclMemAllocator> outFilename(a_filename);
    outFilename += ".out";

    FILE* pFile = fopen(outFilename.get_cstr(), "rb");
    if (0 == pFile)
        fprintf(a_pFileStreamParent, "ERROR: Failed to open file (%s) for capturing test output!\n", outFilename.get_cstr());
    else
    {
        fseek(pFile, 0, SEEK_END);
        long lSize = ftell(pFile);
        rewind(pFile);
        char* buffer = new char[lSize];
        fread(buffer, 1, lSize, pFile);
        strChild = _STRING(buffer, lSize);
        fprintf(a_pFileStreamParent, "%s", strChild.c_str()); // send the captured output back out the parent stream
        delete [] buffer;
        fclose(pFile);
    }

    Oscl_FileServer fs;
    fs.Connect();

    Oscl_File f;
    if (0 == f.Open(a_filename.get_str(), Oscl_File::MODE_READWRITE | Oscl_File::MODE_TEXT, fs))
    {
        _STRING xfr = xml_test_interpreter::interpretation(a_tr, a_pszTestname, &strChild);
        fprintf(a_pFileStreamParent, "\nWrote xml-formatted test results to file: %s\n", a_filename.get_cstr());
        f.Write(xfr.c_str(), sizeof(char), oscl_strlen(xfr.c_str()));
        f.Close();
    }
    else
    {
        fprintf(a_pFileStreamParent, "\nERROR: Failed to open file (%s) for xml-formatted test results\n", a_filename.get_cstr());
    }

    fs.Close();
}