コード例 #1
0
ファイル: mp4track.cpp プロジェクト: TravisKraatz/cinelerra
void MP4Track::FinishWrite()
{
	// write out any remaining samples in chunk buffer
	WriteChunkBuffer();

	// record buffer size and bitrates
	MP4BitfieldProperty* pBufferSizeProperty;

	if (m_pTrakAtom->FindProperty(
	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.bufferSizeDB",
	  (MP4Property**)&pBufferSizeProperty)) {
		pBufferSizeProperty->SetValue(GetMaxSampleSize());
	}

	MP4Integer32Property* pBitrateProperty;

	if (m_pTrakAtom->FindProperty(
	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.maxBitrate",
	  (MP4Property**)&pBitrateProperty)) {
		pBitrateProperty->SetValue(GetMaxBitrate());
	}

	if (m_pTrakAtom->FindProperty(
	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate",
	  (MP4Property**)&pBitrateProperty)) {
		pBitrateProperty->SetValue(GetAvgBitrate());
	}
}
コード例 #2
0
ファイル: atom_stsc.cpp プロジェクト: hibive/sjmt6410pm090728
void MP4StscAtom::Read() 
{
    // Read as usual
    MP4Atom::Read();

    // Compute the firstSample values for later use
    u_int32_t count = 
        ((MP4Integer32Property*)m_pProperties[2])->GetValue();

    MP4Integer32Property* pFirstChunk = (MP4Integer32Property*)
        ((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
    MP4Integer32Property* pSamplesPerChunk = (MP4Integer32Property*)
        ((MP4TableProperty*)m_pProperties[3])->GetProperty(1);
    MP4Integer32Property* pFirstSample = (MP4Integer32Property*)
        ((MP4TableProperty*)m_pProperties[3])->GetProperty(3);

    MP4SampleId sampleId = 1;

    for (u_int32_t i = 0; i < count; i++) {
        pFirstSample->SetValue(sampleId, i);

        if (i < count - 1) {
            sampleId +=
                (pFirstChunk->GetValue(i+1) - pFirstChunk->GetValue(i))
                 * pSamplesPerChunk->GetValue(i);
        }
    }
}
コード例 #3
0
ファイル: atom_dref.cpp プロジェクト: HITEG/TenByTen6410_MLC
void MP4DrefAtom::Read() 
{
    /* do the usual read */
    MP4Atom::Read();

    // check that number of children == entryCount
    MP4Integer32Property* pCount = 
        (MP4Integer32Property*)m_pProperties[2];

    if (m_pChildAtoms.Size() != pCount->GetValue()) {
        VERBOSE_READ(GetVerbosity(),
            MP4Printf("Warning: dref inconsistency with number of entries"));

        /* fix it */
        pCount->SetReadOnly(false);
        pCount->SetValue(m_pChildAtoms.Size());
        pCount->SetReadOnly(true);
    }
}
コード例 #4
0
ファイル: 3gp.cpp プロジェクト: YueLinHo/freepiano
void MP4File::MakeFtypAtom(char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount)
{
    bool rewriteNeeded = false;
    u_int32_t currentSupportedBrandsCount;
    u_int32_t i;


    MP4Atom* ftypAtom = m_pRootAtom->FindAtom("ftyp");
    if (ftypAtom == NULL) {
        ftypAtom = InsertChildAtom(m_pRootAtom, "ftyp", 0);
    }
    if (majorBrand == NULL)
        return;
    MP4StringProperty* pMajorBrandProperty;
    if (!ftypAtom->FindProperty(
                "ftyp.majorBrand",
                (MP4Property**)&pMajorBrandProperty))
        return;

    pMajorBrandProperty->SetValue(majorBrand);


    MP4Integer32Property* pMinorVersionProperty;
    if (!ftypAtom->FindProperty(
                "ftype.minorVersion",
                (MP4Property**)&pMinorVersionProperty))
        return;

    pMinorVersionProperty->SetValue(minorVersion);

    MP4Integer32Property* pCompatibleBrandsCountProperty;
    if (!ftypAtom->FindProperty(
                "ftyp.compatibleBrandsCount",
                (MP4Property**)&pCompatibleBrandsCountProperty)) return;

    currentSupportedBrandsCount = pCompatibleBrandsCountProperty->GetValue();

    MP4TableProperty* pCompatibleBrandsProperty;
    if (!ftypAtom->FindProperty(
                "ftyp.compatibleBrands",
                (MP4Property**)&pCompatibleBrandsProperty)) return;

    MP4StringProperty* pBrandProperty = (MP4StringProperty*)
                                        pCompatibleBrandsProperty->GetProperty(0);
    ASSERT(pBrandProperty);

    for (i = 0 ; i < ((currentSupportedBrandsCount > supportedBrandsCount) ? supportedBrandsCount : currentSupportedBrandsCount) ; i++) {
        pBrandProperty->SetValue(supportedBrands[i], i);

    }

    if (i < supportedBrandsCount) {
        for ( ; i < supportedBrandsCount ; i++) {
            pBrandProperty->AddValue(supportedBrands[i]);
        }
    }

    if (currentSupportedBrandsCount != supportedBrandsCount) {
        rewriteNeeded = true;
        pBrandProperty->SetCount(supportedBrandsCount);
        pCompatibleBrandsCountProperty->SetReadOnly(false);
        pCompatibleBrandsCountProperty->SetValue(supportedBrandsCount);
        pCompatibleBrandsCountProperty->SetReadOnly(true);
    }

}