diff options
author | geronimo <geronimo013@gmx.de> | 2012-08-02 08:07:59 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-08-02 08:07:59 +0200 |
commit | adb7d83292e1502ca7c21a123b104412cb22d160 (patch) | |
tree | ecb448802df0d35f1c3289c4f0e7c246ee5c021a /libs/mediaScan/src/AbstractMedia.cc | |
parent | 5416f2e39cfedc474c87e0a3eeff067fbb25dceb (diff) | |
download | cmp-adb7d83292e1502ca7c21a123b104412cb22d160.tar.gz cmp-adb7d83292e1502ca7c21a123b104412cb22d160.tar.bz2 |
worked out processing of some meta data, extended json list elements
Diffstat (limited to 'libs/mediaScan/src/AbstractMedia.cc')
-rw-r--r-- | libs/mediaScan/src/AbstractMedia.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/mediaScan/src/AbstractMedia.cc b/libs/mediaScan/src/AbstractMedia.cc index 2cc85c5..40b94ea 100644 --- a/libs/mediaScan/src/AbstractMedia.cc +++ b/libs/mediaScan/src/AbstractMedia.cc @@ -36,9 +36,14 @@ #include <unistd.h> #include <tuple> #include <iostream> +#include <string> cAbstractMedia::cAbstractMedia(const cFile &File, const char *Mime, SupportedMediaType Type) : fd(-1) + , format(NULL) + , width(0) + , height(0) + , aspect(0) , mediaType(Type) , mimeType(Mime ? strdup(Mime) : NULL) , uri(NULL) @@ -54,10 +59,18 @@ cAbstractMedia::~cAbstractMedia() free(mimeType); free(uri); free(logicalPath); + free(format); } void cAbstractMedia::AddMeta(cMediainfoReader::InfoEntry* Entry) { + if (!Entry) return; + std::string name = std::get<0>(*Entry); + std::string value = std::get<1>(*Entry); + + if (!strcmp("Format", name.c_str()) && !format) SetFormat(value.c_str()); + else if (!strcmp("Width", name.c_str())) width = parseInt(value); + else if (!strcmp("Height", name.c_str())) height = parseInt(value); meta.push_back(Entry); } @@ -117,6 +130,11 @@ void cAbstractMedia::Reset(void) } } +void cAbstractMedia::SetFormat(const char *Format) +{ + format = strdup(Format); +} + void cAbstractMedia::SetMediaType(int NewType) { switch (NewType) { |