feature request #9009
closedAdd structure to store media metadata
100%
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;
}
}
}
Updated by Andreas Müller over 3 years ago
- Target version changed from CDM UML 5.5 to CDM UML 5.15
Updated by Andreas Müller over 3 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.
Updated by Andreas Müller over 3 years ago
- Status changed from New to In Progress
Updated by Andreas Müller over 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 50
Applied in changeset cdmlib|72032e8369286b8e52207a4ed1ed0443e416b72a.
Updated by Andreas Müller over 3 years ago
- Assignee changed from Andreas Müller to Andreas Kohlbecker
- % Done changed from 50 to 0
Please review
Updated by Andreas Kohlbecker over 3 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.