Project

General

Profile

Actions

feature request #9009

closed

Add structure to store media metadata

Added by Andreas Kohlbecker over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Highest
Category:
cdm
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal

Description

Media files can contain metadata (Exif, IPCT, PhotoshopMetadata, etc). The Cdm needs to be able to store data extracted from a media file to avoid fetching and analyzingthe file each time it's metadata is requested.

The data structure will be a cache for


ImageInfo info = new ImageInfo(URI imageUri);
info.getMetaData();
info.getWidth();
info.getHeight();
// etc ...

Since the ImageInfo is fetched for each media URI individually the metadata cache should also extend the MediaRepresentationPart.

Structure of the metadata could be a flat key/value pair list like a Map<String,String>.

Now that ImageInfo and MediaInfo are returning also typed information like width, height, etc it could beneficial to use typed keys and predefined keys with specific types for e.g. with, length, etc ...:

public class MetaDataMap extends HashMap<MetaDataType<T>, T>{

    public static class MetaDataType<T extends Object> {

        public static final MetaDataType<String> stringType = new MetaDataType<String>(String.class);
        public static final MetaDataType<Integer> integerType = new MetaDataType<Integer>(Integer.class);
        public static final MetaDataType<Double> doubleType = new MetaDataType<Double>(Double.class);

        Class<T> type;
        T value;

        private MetaDataType(Class<T> type) {
            this.type = type;
        }

        public void setValue(T value) {
            this.value = value;
        }

        public T getValue() {
            return value;
        }

        public Class<T> getType(){
            return type;
        }

        public boolean hasType(Class otherType) {
            return type.equals(otherType);
        }

    }

    enum MetaDataKey {

        WIDTH(MetaDataMap.MetaDataType.stringType),
        HEIGHT(MetaDataMap.MetaDataType.integerType),
        DURATION(MetaDataMap.MetaDataType.doubleType);

        MetaDataType<?> type;

        private MetaDataKey(MetaDataMap.MetaDataType<?> type){
            this.type = type;
        }
    }
}
Actions #1

Updated by Andreas Müller over 2 years ago

  • Target version changed from CDM UML 5.5 to CDM UML 5.15
Actions #2

Updated by Andreas Müller over 2 years ago

  • Priority changed from New to Highest
Actions #3

Updated by Andreas Müller over 2 years ago

as size information like width and height is already stored in MediaRepresentationPart it is not necessary to store such data in the new class. A pure String based key-value implementation extending CdmBase should be enought. Also versioning is not necessary as the data should be available from the external files if necessary.

Actions #4

Updated by Andreas Müller over 2 years ago

  • Status changed from New to In Progress
Actions #5

Updated by Andreas Müller over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 50
Actions #6

Updated by Andreas Müller over 2 years ago

  • Assignee changed from Andreas Müller to Andreas Kohlbecker
  • % Done changed from 50 to 0

Please review

Actions #7

Updated by Andreas Kohlbecker over 2 years ago

  • Status changed from Resolved to Closed
  • Assignee changed from Andreas Kohlbecker to Andreas Müller
  • % Done changed from 0 to 100

The type level java doc regarding auditing was not up to date. I changed this and the ticket can be closed.

Actions

Also available in: Atom PDF