Ejemplo n.º 1
0
    bool Init(CTSTR lpFile)
    {
        strFile = lpFile;
        initialTimestamp = -1;

        if(!fileOut.Open(lpFile, XFILE_CREATEALWAYS, 1024*1024))
            return false;

        fileOut.OutputByte('F');
        fileOut.OutputByte('L');
        fileOut.OutputByte('V');
        fileOut.OutputByte(1);
        fileOut.OutputByte(5); //bit 0 = (hasAudio), bit 2 = (hasAudio)
        fileOut.OutputDword(DWORD_BE(9));
        fileOut.OutputDword(0);

        metaDataPos = fileOut.GetPos();

        char  metaDataBuffer[2048];
        char *enc = metaDataBuffer;
        char *pend = metaDataBuffer+sizeof(metaDataBuffer);

        enc = AMF_EncodeString(enc, pend, &av_onMetaData);
        char *endMetaData  = App->EncMetaData(enc, pend, true);
        UINT  metaDataSize = endMetaData-metaDataBuffer;

        AppendFLVPacket((LPBYTE)metaDataBuffer, metaDataSize, 18, 0);
        return true;
    }
Ejemplo n.º 2
0
    bool Init(CTSTR lpFile)
    {
        strFile = lpFile;

        if(!fileOut.Open(lpFile, XFILE_CREATEALWAYS, 1024*1024))
            return false;

        fileOut.OutputDword(DWORD_BE(0x20));
        fileOut.OutputDword(DWORD_BE('ftyp'));
        fileOut.OutputDword(DWORD_BE('isom'));
        fileOut.OutputDword(DWORD_BE(0x200));
        fileOut.OutputDword(DWORD_BE('isom'));
        fileOut.OutputDword(DWORD_BE('iso2'));
        fileOut.OutputDword(DWORD_BE('avc1'));
        fileOut.OutputDword(DWORD_BE('mp41'));

        fileOut.OutputDword(DWORD_BE(0x8));
        fileOut.OutputDword(DWORD_BE('free'));

        mdatStart = fileOut.GetPos();
        fileOut.OutputDword(DWORD_BE(0x1));
        fileOut.OutputDword(DWORD_BE('mdat'));
#ifdef USE_64BIT_MP4
        fileOut.OutputQword(0);
#endif

        bMP3 = scmp(App->GetAudioEncoder()->GetCodec(), TEXT("MP3")) == 0;

        audioFrameSize = App->GetAudioEncoder()->GetFrameSize();

        bStreamOpened = true;

        return true;
    }
Ejemplo n.º 3
0
void Mesh::SaveMeshFile()
{
    traceIn(Mesh::SaveMeshFile);

    String path;
    Engine::ConvertResourceName(strName, TEXT("models"), path, FALSE);

    XFileOutputSerializer modelFile;
    if(!modelFile.Open(path, XFILE_CREATEALWAYS))
    {
        AppWarning(TEXT("Could not create model file '%s'"), path);
        return;
    }

    VBData *vbd = VertBuffer->GetData();

    DWORD temp = MODELFILE_VER;
    modelFile << temp;

    Vect::SerializeList(modelFile, vbd->VertList);
    Vect::SerializeList(modelFile, vbd->NormalList);
    modelFile << vbd->TVList[0];
    if(vbd->TVList.Num() < 2)
    {
        temp = 0;
        modelFile << temp;
    }
    else
        modelFile << vbd->TVList[1];
    Vect::SerializeList(modelFile, vbd->TangentList);

    modelFile << nFaces;
    modelFile.Serialize(FaceList, nFaces*sizeof(Face));

    modelFile << nEdges;
    if(nEdges) modelFile.Serialize(EdgeList, nEdges*sizeof(Edge));

    modelFile << DefaultMaterialList;

    modelFile << nSections;
    modelFile.Serialize(SectionList, nSections*sizeof(DrawSection));

    modelFile << bounds;
    modelFile.Close();

    traceOut;
}