Ejemplo n.º 1
0
    TextBasedDMFramework *FindTextBasedDMFramework(mxfpp::HeaderMetadata *header_metadata, mxfUL xml_metadata_scheme_id, mxfpp::StaticTrack **static_track) {

        MaterialPackage *mp = header_metadata->getPreface()->findMaterialPackage();

        if (!mp)
            return NULL;

        // expect to find Static DM Track -> Sequence -> DM Segment -> DM Framework (a TextBasedDMFramework)
        std::vector<GenericTrack*> tracks = mp->getTracks();
        size_t i;
        for (i = 0; i < tracks.size(); i++) {
            StaticTrack *st = dynamic_cast<StaticTrack*>(tracks[i]);
            if (!st)
                continue;

            StructuralComponent *sc = st->getSequence();
            if (!sc || sc->getDataDefinition() != MXF_DDEF_L(DescriptiveMetadata))
                continue;

            Sequence *seq = dynamic_cast<Sequence*>(sc);
            DMSegment *seg = dynamic_cast<DMSegment*>(sc);
            if (!seq && !seg)
                continue;

            if (seq) {
                std::vector<StructuralComponent*> scs = seq->getStructuralComponents();
                if (scs.size() != 1)
                    continue;

                seg = dynamic_cast<DMSegment*>(scs[0]);
                if (!seg)
                    continue;
            }

            if (!seg->haveDMFramework())
                continue;

            DMFramework *framework = seg->getDMFrameworkLight();
            if (framework) {

		        TextBasedDMFramework *fw = dynamic_cast<TextBasedDMFramework*>(framework);
                if (!fw)
                    continue;
                TextBasedObject *t = dynamic_cast<TextBasedObject*>(fw->getTextBasedObject());
                if (!t)
                    continue;

                mxfUL ul = t->getTextBasedMetadataPayloadSchemaID();
                if (mxf_equals_ul(&ul, &xml_metadata_scheme_id)) {
                    // this is a match!
                    if (static_track != NULL)
                        *static_track = st;
                    return fw;
                }
            }
        }

        return NULL;
    }
Ejemplo n.º 2
0
void AvidInfo::GetLocators(MaterialPackage *mp)
{
    // expect to find (DM) Event Track - (DM) Sequence - DMSegment
    vector<GenericTrack*> tracks = mp->getTracks();
    size_t i;
    for (i = 0; i < tracks.size(); i++) {
        EventTrack *et = dynamic_cast<EventTrack*>(tracks[i]);
        if (!et)
            continue;

        StructuralComponent *sc = et->getSequence();
        if (!sc || sc->getDataDefinition() != MXF_DDEF_L(DescriptiveMetadata))
            continue;

        Sequence *seq = dynamic_cast<Sequence*>(sc);
        if (!seq)
            continue;

        vector<StructuralComponent*> dm_segs = seq->getStructuralComponents();
        if (dm_segs.empty())
            continue;

        size_t j;
        for (j = 0; j < dm_segs.size(); j++) {
            DMSegment *seg = dynamic_cast<DMSegment*>(dm_segs[j]);
            if (!seg)
                break;

            AvidLocator locator;
            locator.position = seg->getEventStartPosition();
            if (seg->haveEventComment())
                locator.comment = seg->getEventComment();
            if (seg->haveItem(&MXF_ITEM_K(DMSegment, CommentMarkerColor))) {
                RGBColor rgb_color;
                BMX_CHECK(mxf_avid_get_rgb_color_item(seg->getCMetadataSet(),
                                                      &MXF_ITEM_K(DMSegment, CommentMarkerColor),
                                                      &rgb_color));
                locator.color = convert_rgb_color(&rgb_color);
            } else {
                locator.color = COLOR_BLACK;
            }
            locators.push_back(locator);
        }
        if (j < dm_segs.size())
            locators.clear();

        locators_edit_rate = et->getEventEditRate();
        break;
    }
}
Ejemplo n.º 3
0
mxfRational FindMaterialPackageEditRate(HeaderMetadata *header_metadata) {
	Track *selectedTrack = NULL;
	MaterialPackage *material_package = header_metadata->getPreface()->findMaterialPackage();
	const std::vector<GenericTrack*>& tracks = material_package->getTracks();
	for (std::vector<GenericTrack*>::const_iterator it = tracks.begin(); it!=tracks.end(); it++) {
		// use only regular timeline tracks
		Track *tlTrk = dynamic_cast<Track*>(*it);
		if (tlTrk!=NULL) {
			// find the timeline component of this track
			StructuralComponent *comp = tlTrk->getSequence();
			if (comp->getDataDefinition() == MXF_DDEF_L(Timecode)) {
				// this is it, fetch editrate from the track
				selectedTrack = tlTrk;
				break;
			}
		}
	}
	if (selectedTrack == NULL) {
		for (std::vector<GenericTrack*>::const_iterator it = tracks.begin(); it!=tracks.end(); it++) {
			Track *tlTrk = dynamic_cast<Track*>(*it);
			if (tlTrk!=NULL) {
				if (tlTrk->getSequence()->getDataDefinition() == MXF_DDEF_L(Picture)) {
					selectedTrack = tlTrk;
					break;
				}
			}
		}
	}
	if (selectedTrack == NULL) {
		for (std::vector<GenericTrack*>::const_iterator it = tracks.begin(); it!=tracks.end(); it++) {
			Track *tlTrk = dynamic_cast<Track*>(*it);
			if (tlTrk!=NULL) {
				if (tlTrk->getSequence()->getDataDefinition() == MXF_DDEF_L(Sound)) {
					selectedTrack = tlTrk;
					break;
				}
			}
		}
	}

	mxfRational rate = {-1, 0};
	if (selectedTrack != NULL) rate = selectedTrack->getEditRate();
	return rate;
}
Ejemplo n.º 4
0
std::vector<DMFramework*> GetStaticFrameworks(MaterialPackage *mp)
{
    std::vector<DMFramework*> frameworks;

    // expect to find Static DM Track -> Sequence -> DM Segment -> DM Framework

    std::vector<GenericTrack*> tracks = mp->getTracks();
    size_t i;
    for (i = 0; i < tracks.size(); i++) {
        StaticTrack *st = dynamic_cast<StaticTrack*>(tracks[i]);
        if (!st)
            continue;

        StructuralComponent *sc = st->getSequence();
        if (!sc || sc->getDataDefinition() != MXF_DDEF_L(DescriptiveMetadata))
            continue;

        Sequence *seq = dynamic_cast<Sequence*>(sc);
        DMSegment *seg = dynamic_cast<DMSegment*>(sc);
        if (!seq && !seg)
            continue;

        if (seq) {
            std::vector<StructuralComponent*> scs = seq->getStructuralComponents();
            if (scs.size() != 1)
                continue;

            seg = dynamic_cast<DMSegment*>(scs[0]);
            if (!seg)
                continue;
        }

        if (!seg->haveDMFramework())
            continue;

        DMFramework *framework = seg->getDMFrameworkLight();
        if (framework)
            frameworks.push_back(framework);
    }

    return frameworks;
}