summaryrefslogtreecommitdiff
path: root/libs/mediaScan
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-08-01 17:29:31 +0200
committergeronimo <geronimo013@gmx.de>2012-08-01 17:29:31 +0200
commitcca6e883c8141c3a67c3c5b232ce0c9b18e7fd59 (patch)
tree7149351cb466316771ab0ce0bd4ea64b2ba17aa1 /libs/mediaScan
parent76c51473ee29a9103201618c8dbbc11fe9b7149e (diff)
downloadcmp-cca6e883c8141c3a67c3c5b232ce0c9b18e7fd59.tar.gz
cmp-cca6e883c8141c3a67c3c5b232ce0c9b18e7fd59.tar.bz2
added mediatypes for interlaced video and selective configuration of deepscan
Diffstat (limited to 'libs/mediaScan')
-rw-r--r--libs/mediaScan/include/AbstractMedia.h12
-rw-r--r--libs/mediaScan/include/AbstractMultiFileMovie.h7
-rw-r--r--libs/mediaScan/include/Audio.h1
-rw-r--r--libs/mediaScan/include/DVDImage.h4
-rw-r--r--libs/mediaScan/include/LegacyVdrRecording.h4
-rw-r--r--libs/mediaScan/include/MediainfoReader.h4
-rw-r--r--libs/mediaScan/include/Movie.h2
-rw-r--r--libs/mediaScan/include/Picture.h3
-rw-r--r--libs/mediaScan/include/VdrRecording.h4
-rw-r--r--libs/mediaScan/nbproject/Makefile-Debug.mk22
-rw-r--r--libs/mediaScan/nbproject/Makefile-Release.mk22
-rw-r--r--libs/mediaScan/src/AbstractMedia.cc58
-rw-r--r--libs/mediaScan/src/AbstractMultiFileMovie.cc8
-rw-r--r--libs/mediaScan/src/Audio.cc10
-rw-r--r--libs/mediaScan/src/DVDImage.cc17
-rw-r--r--libs/mediaScan/src/FSMediaScanner.cc18
-rw-r--r--libs/mediaScan/src/LegacyVdrRecording.cc17
-rw-r--r--libs/mediaScan/src/MediaFactory.cc19
-rw-r--r--libs/mediaScan/src/MediainfoReader.cc16
-rw-r--r--libs/mediaScan/src/Movie.cc18
-rw-r--r--libs/mediaScan/src/Picture.cc11
-rw-r--r--libs/mediaScan/src/VdrRecording.cc17
22 files changed, 231 insertions, 63 deletions
diff --git a/libs/mediaScan/include/AbstractMedia.h b/libs/mediaScan/include/AbstractMedia.h
index 18dd18d..6dbf673 100644
--- a/libs/mediaScan/include/AbstractMedia.h
+++ b/libs/mediaScan/include/AbstractMedia.h
@@ -26,6 +26,7 @@
#define ABSTRACTMEDIA_H
#include <File.h>
+#include <MediainfoReader.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <vector>
@@ -41,18 +42,24 @@ public:
Invalid,
Audio,
Movie,
+ IMovie,
DVDImage,
+ IDVDImage,
LegacyVdrRecording,
+ ILegacyVdrRecording,
VdrRecording,
+ IVdrRecording,
Picture,
Unknown
} SupportedMediaType;
virtual ~cAbstractMedia();
+ virtual void AddMeta(cMediainfoReader::InfoEntry *Entry);
SupportedMediaType MediaType(void) const { return mediaType; }
const char *MimeType(void) const { return mimeType; }
const char *AbsolutePath(void) const;
+ virtual const char *KeyFile(void) const;
ulong LastModified(void) const;
const char *LogicalPath(void) const { return logicalPath; }
virtual const char *Name(void) const;
@@ -65,12 +72,14 @@ public:
virtual size_t ReadChunk(char *buf, size_t bufSize);
///< used to hide the differences between single- and multi-file media.
virtual void Reset(void);
+ void Dump(void) const;
static const char *MediaType2Text(int Type);
protected:
cAbstractMedia(const cFile &File, const char *Mime, SupportedMediaType Type);
+ void SetMediaType(int NewType);
void SetMimeType(const char *MimeType);
- const cFile &KeyPath(void) { return keyPath; }
+ const cFile &KeyPath(void) const { return keyPath; }
int fd;
private:
@@ -79,6 +88,7 @@ private:
char *uri;
char *logicalPath;
cFile keyPath;
+ std::vector<cMediainfoReader::InfoEntry *> meta;
};
#endif /* ABSTRACTMEDIA_H */
diff --git a/libs/mediaScan/include/AbstractMultiFileMovie.h b/libs/mediaScan/include/AbstractMultiFileMovie.h
index f933b75..41f6c2d 100644
--- a/libs/mediaScan/include/AbstractMultiFileMovie.h
+++ b/libs/mediaScan/include/AbstractMultiFileMovie.h
@@ -32,8 +32,9 @@ public:
virtual ~cAbstractMultiFileMovie();
virtual size_t ReadChunk(char *buf, size_t bufSize);
+ virtual const char *KeyFile(void) const;
virtual const char *Name(void) const { return name; }
- virtual const char *FirstFile(void) = 0;
+ virtual const char *FirstFile(void) const = 0;
virtual const char *NextFile(void) = 0;
virtual size_t Size(void) const { return size; }
@@ -42,10 +43,10 @@ protected:
virtual void Reset(void);
void SetName(char *Name);
void SetSize(size_t Size);
- bool checkBuffer(void);
+ bool checkBuffer(void) const;
int movieFiles;
int curFileNo;
- char *buf;
+ mutable char *buf;
int bufSize;
private:
diff --git a/libs/mediaScan/include/Audio.h b/libs/mediaScan/include/Audio.h
index fb13f49..3dc8faa 100644
--- a/libs/mediaScan/include/Audio.h
+++ b/libs/mediaScan/include/Audio.h
@@ -33,6 +33,7 @@ public:
virtual ~cAudio();
virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
private:
static const char *ContentType(const char *Extension);
diff --git a/libs/mediaScan/include/DVDImage.h b/libs/mediaScan/include/DVDImage.h
index ce48c79..315e5d1 100644
--- a/libs/mediaScan/include/DVDImage.h
+++ b/libs/mediaScan/include/DVDImage.h
@@ -33,10 +33,12 @@ public:
virtual ~cDVDImage();
virtual const char *Name(void) const;
- virtual const char *FirstFile(void);
+ virtual const char *FirstFile(void) const;
virtual const char *NextFile(void);
virtual void Refresh(void);
virtual size_t Size(void) const;
+ virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
private:
int mainMovie;
diff --git a/libs/mediaScan/include/LegacyVdrRecording.h b/libs/mediaScan/include/LegacyVdrRecording.h
index 1f73acb..0f10394 100644
--- a/libs/mediaScan/include/LegacyVdrRecording.h
+++ b/libs/mediaScan/include/LegacyVdrRecording.h
@@ -32,9 +32,11 @@ public:
cLegacyVdrRecording(const cFile &File);
virtual ~cLegacyVdrRecording();
- virtual const char *FirstFile(void);
+ virtual const char *FirstFile(void) const;
virtual const char *NextFile(void);
virtual void Refresh(void);
+ virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
};
#endif /* LEGACYVDRRECORDING_H */
diff --git a/libs/mediaScan/include/MediainfoReader.h b/libs/mediaScan/include/MediainfoReader.h
index 5e94785..4a6522f 100644
--- a/libs/mediaScan/include/MediainfoReader.h
+++ b/libs/mediaScan/include/MediainfoReader.h
@@ -37,14 +37,14 @@ public:
cMediainfoReader(cLineReader *LineReader);
virtual ~cMediainfoReader();
- void AddValuableKey(const char *Key);
void Close(void);
bool IsValuable(std::string &key);
InfoEntry *ReadEntry(void);
+ static void Setup(const char *keys[]);
private:
cLineReader *reader;
- std::vector<std::string> valuableKeys;
+ static std::vector<std::string> valuableKeys;
};
#endif /* MEDIAINFOREADER_H */
diff --git a/libs/mediaScan/include/Movie.h b/libs/mediaScan/include/Movie.h
index e01903d..36355b3 100644
--- a/libs/mediaScan/include/Movie.h
+++ b/libs/mediaScan/include/Movie.h
@@ -32,7 +32,9 @@ public:
cMovie(const cFile &File, const char *Mime, SupportedMediaType Type = cAbstractMedia::Movie);
virtual ~cMovie();
+ virtual void AddMeta(cMediainfoReader::InfoEntry *Entry);
virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
private:
static const char *ContentType(const char *Extension);
diff --git a/libs/mediaScan/include/Picture.h b/libs/mediaScan/include/Picture.h
index 0ef37bb..ea96313 100644
--- a/libs/mediaScan/include/Picture.h
+++ b/libs/mediaScan/include/Picture.h
@@ -32,6 +32,9 @@ public:
cPicture(const cFile &File, const char *Mime);
virtual ~cPicture();
+ virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
+
private:
static const char *ContentType(const char *Extension);
static SupportedExtension knownExtensions[];
diff --git a/libs/mediaScan/include/VdrRecording.h b/libs/mediaScan/include/VdrRecording.h
index 8e0789b..7c997ad 100644
--- a/libs/mediaScan/include/VdrRecording.h
+++ b/libs/mediaScan/include/VdrRecording.h
@@ -32,9 +32,11 @@ public:
cVdrRecording(const cFile &File);
virtual ~cVdrRecording();
- virtual const char *FirstFile(void);
+ virtual const char *FirstFile(void) const;
virtual const char *NextFile(void);
virtual void Refresh(void);
+ virtual bool NeedsFurtherScan(void) const;
+ static void EnableDeepScan(bool DoScan);
};
#endif /* VDRRECORDING_H */
diff --git a/libs/mediaScan/nbproject/Makefile-Debug.mk b/libs/mediaScan/nbproject/Makefile-Debug.mk
index 57923a8..04e2cd3 100644
--- a/libs/mediaScan/nbproject/Makefile-Debug.mk
+++ b/libs/mediaScan/nbproject/Makefile-Debug.mk
@@ -74,57 +74,57 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
-${OBJECTDIR}/src/Picture.o: src/Picture.cc
+${OBJECTDIR}/src/Picture.o: nbproject/Makefile-${CND_CONF}.mk src/Picture.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Picture.o src/Picture.cc
-${OBJECTDIR}/src/Audio.o: src/Audio.cc
+${OBJECTDIR}/src/Audio.o: nbproject/Makefile-${CND_CONF}.mk src/Audio.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Audio.o src/Audio.cc
-${OBJECTDIR}/src/DVDImage.o: src/DVDImage.cc
+${OBJECTDIR}/src/DVDImage.o: nbproject/Makefile-${CND_CONF}.mk src/DVDImage.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/DVDImage.o src/DVDImage.cc
-${OBJECTDIR}/src/VdrRecording.o: src/VdrRecording.cc
+${OBJECTDIR}/src/VdrRecording.o: nbproject/Makefile-${CND_CONF}.mk src/VdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/VdrRecording.o src/VdrRecording.cc
-${OBJECTDIR}/src/MediaFactory.o: src/MediaFactory.cc
+${OBJECTDIR}/src/MediaFactory.o: nbproject/Makefile-${CND_CONF}.mk src/MediaFactory.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaFactory.o src/MediaFactory.cc
-${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.cc
+${OBJECTDIR}/src/LegacyVdrRecording.o: nbproject/Makefile-${CND_CONF}.mk src/LegacyVdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
-${OBJECTDIR}/src/MediainfoReader.o: src/MediainfoReader.cc
+${OBJECTDIR}/src/MediainfoReader.o: nbproject/Makefile-${CND_CONF}.mk src/MediainfoReader.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediainfoReader.o src/MediainfoReader.cc
-${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.cc
+${OBJECTDIR}/src/FSMediaScanner.o: nbproject/Makefile-${CND_CONF}.mk src/FSMediaScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FSMediaScanner.o src/FSMediaScanner.cc
-${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.cc
+${OBJECTDIR}/src/AbstractMultiFileMovie.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMultiFileMovie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMultiFileMovie.o src/AbstractMultiFileMovie.cc
-${OBJECTDIR}/src/AbstractMedia.o: src/AbstractMedia.cc
+${OBJECTDIR}/src/AbstractMedia.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMedia.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMedia.o src/AbstractMedia.cc
-${OBJECTDIR}/src/Movie.o: src/Movie.cc
+${OBJECTDIR}/src/Movie.o: nbproject/Makefile-${CND_CONF}.mk src/Movie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc
diff --git a/libs/mediaScan/nbproject/Makefile-Release.mk b/libs/mediaScan/nbproject/Makefile-Release.mk
index 2b0a333..81f99bb 100644
--- a/libs/mediaScan/nbproject/Makefile-Release.mk
+++ b/libs/mediaScan/nbproject/Makefile-Release.mk
@@ -74,57 +74,57 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
-${OBJECTDIR}/src/Picture.o: src/Picture.cc
+${OBJECTDIR}/src/Picture.o: nbproject/Makefile-${CND_CONF}.mk src/Picture.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Picture.o src/Picture.cc
-${OBJECTDIR}/src/Audio.o: src/Audio.cc
+${OBJECTDIR}/src/Audio.o: nbproject/Makefile-${CND_CONF}.mk src/Audio.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Audio.o src/Audio.cc
-${OBJECTDIR}/src/DVDImage.o: src/DVDImage.cc
+${OBJECTDIR}/src/DVDImage.o: nbproject/Makefile-${CND_CONF}.mk src/DVDImage.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/DVDImage.o src/DVDImage.cc
-${OBJECTDIR}/src/VdrRecording.o: src/VdrRecording.cc
+${OBJECTDIR}/src/VdrRecording.o: nbproject/Makefile-${CND_CONF}.mk src/VdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/VdrRecording.o src/VdrRecording.cc
-${OBJECTDIR}/src/MediaFactory.o: src/MediaFactory.cc
+${OBJECTDIR}/src/MediaFactory.o: nbproject/Makefile-${CND_CONF}.mk src/MediaFactory.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaFactory.o src/MediaFactory.cc
-${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.cc
+${OBJECTDIR}/src/LegacyVdrRecording.o: nbproject/Makefile-${CND_CONF}.mk src/LegacyVdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
-${OBJECTDIR}/src/MediainfoReader.o: src/MediainfoReader.cc
+${OBJECTDIR}/src/MediainfoReader.o: nbproject/Makefile-${CND_CONF}.mk src/MediainfoReader.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediainfoReader.o src/MediainfoReader.cc
-${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.cc
+${OBJECTDIR}/src/FSMediaScanner.o: nbproject/Makefile-${CND_CONF}.mk src/FSMediaScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FSMediaScanner.o src/FSMediaScanner.cc
-${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.cc
+${OBJECTDIR}/src/AbstractMultiFileMovie.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMultiFileMovie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMultiFileMovie.o src/AbstractMultiFileMovie.cc
-${OBJECTDIR}/src/AbstractMedia.o: src/AbstractMedia.cc
+${OBJECTDIR}/src/AbstractMedia.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMedia.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMedia.o src/AbstractMedia.cc
-${OBJECTDIR}/src/Movie.o: src/Movie.cc
+${OBJECTDIR}/src/Movie.o: nbproject/Makefile-${CND_CONF}.mk src/Movie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc
diff --git a/libs/mediaScan/src/AbstractMedia.cc b/libs/mediaScan/src/AbstractMedia.cc
index 98c72bb..2cc85c5 100644
--- a/libs/mediaScan/src/AbstractMedia.cc
+++ b/libs/mediaScan/src/AbstractMedia.cc
@@ -34,6 +34,8 @@
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
+#include <tuple>
+#include <iostream>
cAbstractMedia::cAbstractMedia(const cFile &File, const char *Mime, SupportedMediaType Type)
: fd(-1)
@@ -54,6 +56,27 @@ cAbstractMedia::~cAbstractMedia()
free(logicalPath);
}
+void cAbstractMedia::AddMeta(cMediainfoReader::InfoEntry* Entry)
+{
+ meta.push_back(Entry);
+}
+
+void cAbstractMedia::Dump(void) const
+{
+ std::cout << MediaType2Text(mediaType) << " [" << mimeType << "] - ( " << Name() << " ) => " << logicalPath << std::endl;
+ std::cout << "\tkey-file: " << KeyFile() << std::endl;
+ for (size_t i=0; i < meta.size(); ++i) {
+ cMediainfoReader::InfoEntry *ie = meta[i];
+
+ std::cout << "\tmeta - [" << std::get<0>(*ie) << "] => " << std::get<1>(*ie) << std::endl;
+ }
+}
+
+const char *cAbstractMedia::KeyFile(void) const
+{
+ return keyPath.AbsolutePath();
+}
+
const char *cAbstractMedia::Name(void) const
{
return keyPath.Name();
@@ -94,6 +117,19 @@ void cAbstractMedia::Reset(void)
}
}
+void cAbstractMedia::SetMediaType(int NewType)
+{
+ switch (NewType) {
+ case IMovie:
+ case IDVDImage:
+ case ILegacyVdrRecording:
+ case IVdrRecording:
+ if (mediaType == (NewType - 1)) mediaType = (SupportedMediaType) NewType;
+ break;
+ default: break;
+ }
+}
+
size_t cAbstractMedia::Size(void) const
{
return keyPath.Size();
@@ -101,15 +137,19 @@ size_t cAbstractMedia::Size(void) const
const char *cAbstractMedia::MediaType2Text(int Type)
{
- switch(Type) {
- case Audio: return TO_STRING(Audio);
- case Movie: return TO_STRING(Movie);
- case DVDImage: return TO_STRING(DVDImage);
- case LegacyVdrRecording: return TO_STRING(LegacyVdrRecording);
- case VdrRecording: return TO_STRING(VdrRecording);
- case Picture: return TO_STRING(Picture);
- default: return TO_STRING(Invalid);
- }
+ switch (Type) {
+ case Audio: return TO_STRING(Audio);
+ case Movie: return TO_STRING(Movie);
+ case IMovie: return TO_STRING(IMovie);
+ case DVDImage: return TO_STRING(DVDImage);
+ case IDVDImage: return TO_STRING(IDVDImage);
+ case LegacyVdrRecording: return TO_STRING(LegacyVdrRecording);
+ case ILegacyVdrRecording: return TO_STRING(ILegacyVdrRecording);
+ case VdrRecording: return TO_STRING(VdrRecording);
+ case IVdrRecording: return TO_STRING(IVdrRecording);
+ case Picture: return TO_STRING(Picture);
+ default: return TO_STRING(Invalid);
+ }
}
bool cAbstractMedia::NeedsFurtherScan(void) const
diff --git a/libs/mediaScan/src/AbstractMultiFileMovie.cc b/libs/mediaScan/src/AbstractMultiFileMovie.cc
index 7ff8b10..ee7121c 100644
--- a/libs/mediaScan/src/AbstractMultiFileMovie.cc
+++ b/libs/mediaScan/src/AbstractMultiFileMovie.cc
@@ -45,7 +45,7 @@ cAbstractMultiFileMovie::~cAbstractMultiFileMovie()
free(buf);
}
-bool cAbstractMultiFileMovie::checkBuffer()
+bool cAbstractMultiFileMovie::checkBuffer(void) const
{
if (!buf && bufSize) {
buf = (char *) malloc(bufSize);
@@ -53,12 +53,18 @@ bool cAbstractMultiFileMovie::checkBuffer()
return buf != NULL;
}
+const char *cAbstractMultiFileMovie::KeyFile(void) const
+{
+ return FirstFile();
+}
+
size_t cAbstractMultiFileMovie::ReadChunk(char* Buf, size_t bufSize)
{
long rv = 0;
const char *path = NULL;
if (fd < 1) {
+ curFileNo = 1;
path = FirstFile();
fd = open(path, O_RDONLY | O_LARGEFILE);
if (fd < 1) {
diff --git a/libs/mediaScan/src/Audio.cc b/libs/mediaScan/src/Audio.cc
index a17517f..fdaae7e 100644
--- a/libs/mediaScan/src/Audio.cc
+++ b/libs/mediaScan/src/Audio.cc
@@ -26,6 +26,8 @@
#include <stddef.h>
#include <string.h>
+static bool deepScanEnabled = false;
+
SupportedExtension cAudio::knownExtensions[] = {
{ "aac", "audio/aac" },
{ "aif", "audio/x-aiff" },
@@ -55,6 +57,11 @@ cAudio::~cAudio()
{
}
+void cAudio::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
const char *cAudio::ContentType(const char* Extension)
{
for (SupportedExtension *p = knownExtensions; p && p->extension; ++p) {
@@ -65,6 +72,5 @@ const char *cAudio::ContentType(const char* Extension)
bool cAudio::NeedsFurtherScan(void) const
{
-//TODO: common meta data: artist, title
- return true;
+ return deepScanEnabled;
}
diff --git a/libs/mediaScan/src/DVDImage.cc b/libs/mediaScan/src/DVDImage.cc
index 1df6d1e..0ddcdac 100644
--- a/libs/mediaScan/src/DVDImage.cc
+++ b/libs/mediaScan/src/DVDImage.cc
@@ -30,6 +30,8 @@
#include "File.h"
#define FILE_MASK "VIDEO_TS/VTS_%02d_%d.VOB"
+static bool deepScanEnabled = true;
+
cDVDImage::cDVDImage(const cFile &File)
: cAbstractMultiFileMovie(File, "video/mpeg", DVDImage)
{
@@ -50,6 +52,16 @@ size_t cDVDImage::Size(void) const
return cAbstractMedia::Size();
}
+void cDVDImage::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
+bool cDVDImage::NeedsFurtherScan(void) const
+{
+ return deepScanEnabled;
+}
+
void cDVDImage::Refresh(void)
{
size_t maxSize = 0;
@@ -82,12 +94,11 @@ void cDVDImage::Refresh(void)
SetSize(total);
}
-const char *cDVDImage::FirstFile(void)
+const char *cDVDImage::FirstFile(void) const
{
if (!checkBuffer()) return NULL;
- curFileNo = 1;
- sprintf(buf, FILE_MASK, mainMovie, curFileNo);
+ sprintf(buf, FILE_MASK, mainMovie, 1);
cFile *tmp = new cFile(KeyPath(), buf);
const char *rv = NULL;
diff --git a/libs/mediaScan/src/FSMediaScanner.cc b/libs/mediaScan/src/FSMediaScanner.cc
index 2df5907..a635f17 100644
--- a/libs/mediaScan/src/FSMediaScanner.cc
+++ b/libs/mediaScan/src/FSMediaScanner.cc
@@ -35,6 +35,23 @@
#include <errno.h>
#include <util.h>
+static const char *MetaKeys[] = {
+ "Format"
+// Audio
+, "Duration"
+, "Album"
+, "Track name"
+, "Performer"
+, "Bit rate"
+// Image
+, "Width"
+, "Height"
+// Video
+, "Display aspect ratio"
+, "Scan type"
+, NULL
+ };
+
void freeMediaCallback(void *elem)
{
delete (cAbstractMedia *)elem;
@@ -82,6 +99,7 @@ void cFSMediaScanner::Refresh()
pool.clear();
categories.clear();
+ cMediainfoReader::Setup(MetaKeys);
mediaFactory->Scan4Media(pool);
cAbstractMedia::SupportedMediaType ot = cAbstractMedia::Invalid;
cAbstractMedia *m;
diff --git a/libs/mediaScan/src/LegacyVdrRecording.cc b/libs/mediaScan/src/LegacyVdrRecording.cc
index 3c74b6e..2b4d7af 100644
--- a/libs/mediaScan/src/LegacyVdrRecording.cc
+++ b/libs/mediaScan/src/LegacyVdrRecording.cc
@@ -31,6 +31,8 @@
#define FILE_MASK "%03d.vdr"
+static bool deepScanEnabled = true;
+
cLegacyVdrRecording::cLegacyVdrRecording(const cFile &File)
: cAbstractMultiFileMovie(File, "video/mpeg", LegacyVdrRecording)
{
@@ -48,6 +50,16 @@ cLegacyVdrRecording::~cLegacyVdrRecording()
{
}
+void cLegacyVdrRecording::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
+bool cLegacyVdrRecording::NeedsFurtherScan(void) const
+{
+ return deepScanEnabled;
+}
+
void cLegacyVdrRecording::Refresh(void)
{
size_t total = 0;
@@ -70,11 +82,10 @@ void cLegacyVdrRecording::Refresh(void)
SetSize(total);
}
-const char *cLegacyVdrRecording::FirstFile(void)
+const char *cLegacyVdrRecording::FirstFile(void) const
{
if (!checkBuffer()) return NULL;
- curFileNo = 1;
- sprintf(buf, FILE_MASK, curFileNo);
+ sprintf(buf, FILE_MASK, 1);
cFile *tmp = new cFile(KeyPath(), buf);
const char *rv = NULL;
diff --git a/libs/mediaScan/src/MediaFactory.cc b/libs/mediaScan/src/MediaFactory.cc
index 0af2fae..1a61dc8 100644
--- a/libs/mediaScan/src/MediaFactory.cc
+++ b/libs/mediaScan/src/MediaFactory.cc
@@ -23,6 +23,9 @@
* --------------------------------------------------------------
*/
#include <MediaFactory.h>
+#include <MediainfoReader.h>
+#include <LineReader.h>
+#include <CommandReader.h>
#include <Audio.h>
#include <Movie.h>
#include <Picture.h>
@@ -70,7 +73,6 @@ int cMediaFactory::createMedia(void *opaque, cFile *Parent, const char *Name)
int cMediaFactory::CreateMedia(const cFile *Parent, const char *Name)
{
-// cManagedVector *pool = (cManagedVector *) opaque;
cFile *curFile = new cFile(*Parent, Name);
const char *mimeType = NULL;
cAbstractMedia *rv = NULL;
@@ -126,7 +128,10 @@ int cMediaFactory::CreateMedia(const cFile *Parent, const char *Name)
}
delete curFile;
if (rv) {
- if (config.WantExtendedScan() && rv->NeedsFurtherScan()) Scan4MetaData(rv);
+ if (config.WantExtendedScan() && rv->NeedsFurtherScan()) {
+ rv->Refresh();
+ Scan4MetaData(rv);
+ }
mediaPool->push_back(rv);
return 0;
}
@@ -144,5 +149,13 @@ void cMediaFactory::Scan4Media(cManagedVector& pool)
void cMediaFactory::Scan4MetaData(cAbstractMedia* media)
{
- //TODO:
+ cCommandReader *cr = new cCommandReader("/usr/bin/mediainfo");
+ cMediainfoReader *mir = new cMediainfoReader(new cLineReader(cr));
+ cMediainfoReader::InfoEntry *ie;
+
+ cr->AddCommandParameter(media->KeyFile());
+ while ((ie = mir->ReadEntry())) {
+ media->AddMeta(ie);
+ }
+ delete mir;
}
diff --git a/libs/mediaScan/src/MediainfoReader.cc b/libs/mediaScan/src/MediainfoReader.cc
index 388c1c3..1668cbf 100644
--- a/libs/mediaScan/src/MediainfoReader.cc
+++ b/libs/mediaScan/src/MediainfoReader.cc
@@ -31,6 +31,8 @@
static pcrecpp::RE comment("^\\s*#.*$");
static pcrecpp::RE emptyLine("^\\s*$");
static pcrecpp::RE entry("^\\s*(.+?)\\s*:\\s*(.+?)\\s*$");
+std::vector<std::string> cMediainfoReader::valuableKeys;
+
cMediainfoReader::cMediainfoReader(cLineReader *LineReader)
: reader(LineReader)
@@ -42,11 +44,6 @@ cMediainfoReader::~cMediainfoReader()
Close();
}
-void cMediainfoReader::AddValuableKey(const char* Key)
-{
- valuableKeys.push_back(Key);
-}
-
void cMediainfoReader::Close(void)
{
if (reader) {
@@ -80,7 +77,14 @@ cMediainfoReader::InfoEntry *cMediainfoReader::ReadEntry()
}
line = reader->ReadLine();
} while (line && !rv);
-
+
return rv;
}
+void cMediainfoReader::Setup(const char* keys[])
+{
+ valuableKeys.clear();
+ for (const char **p = keys; p && *p; ++p) {
+ valuableKeys.push_back(*p);
+ }
+} \ No newline at end of file
diff --git a/libs/mediaScan/src/Movie.cc b/libs/mediaScan/src/Movie.cc
index 042b397..d161dfe 100644
--- a/libs/mediaScan/src/Movie.cc
+++ b/libs/mediaScan/src/Movie.cc
@@ -26,6 +26,8 @@
#include <stddef.h>
#include <string.h>
+static bool deepScanEnabled = true;
+
SupportedExtension cMovie::knownExtensions[] = {
{ "asd", "video/x-ms-asf" },
{ "asf", "video/x-ms-asf" },
@@ -60,8 +62,20 @@ const char *cMovie::ContentType(const char* Extension)
return NULL;
}
+void cMovie::AddMeta(cMediainfoReader::InfoEntry *Entry)
+{
+ if (!strcmp("Scan type", std::get<0>(*Entry).c_str())) {
+ if (!strcmp("Interlaced", std::get<1>(*Entry).c_str())) SetMediaType(MediaType() + 1);
+ }
+ cAbstractMedia::AddMeta(Entry);
+}
+
+void cMovie::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
bool cMovie::NeedsFurtherScan(void) const
{
-//TODO: common meta data: width, height, interlaced
- return true;
+ return deepScanEnabled;
}
diff --git a/libs/mediaScan/src/Picture.cc b/libs/mediaScan/src/Picture.cc
index 5253a78..0401401 100644
--- a/libs/mediaScan/src/Picture.cc
+++ b/libs/mediaScan/src/Picture.cc
@@ -26,6 +26,8 @@
#include <stddef.h>
#include <string.h>
+static bool deepScanEnabled = false;
+
SupportedExtension cPicture::knownExtensions[] = {
{ "bmp", "image/x-windows-bmp" },
{ "gif", "image/gif" },
@@ -67,3 +69,12 @@ const char *cPicture::ContentType(const char* Extension)
return NULL;
}
+void cPicture::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
+bool cPicture::NeedsFurtherScan(void) const
+{
+ return deepScanEnabled;
+}
diff --git a/libs/mediaScan/src/VdrRecording.cc b/libs/mediaScan/src/VdrRecording.cc
index 10b6476..bf1eaab 100644
--- a/libs/mediaScan/src/VdrRecording.cc
+++ b/libs/mediaScan/src/VdrRecording.cc
@@ -30,6 +30,8 @@
#include <stdio.h>
#define FILE_MASK "/%05d.ts"
+static bool deepScanEnabled = true;
+
cVdrRecording::cVdrRecording(const cFile &File)
: cAbstractMultiFileMovie(File, "video/mpeg", VdrRecording)
{
@@ -47,6 +49,16 @@ cVdrRecording::~cVdrRecording()
{
}
+void cVdrRecording::EnableDeepScan(bool DoScan)
+{
+ deepScanEnabled = DoScan;
+}
+
+bool cVdrRecording::NeedsFurtherScan(void) const
+{
+ return deepScanEnabled;
+}
+
void cVdrRecording::Refresh(void)
{
size_t total = 0;
@@ -69,11 +81,10 @@ void cVdrRecording::Refresh(void)
SetSize(total);
}
-const char *cVdrRecording::FirstFile(void)
+const char *cVdrRecording::FirstFile(void) const
{
if (!checkBuffer()) return NULL;
- curFileNo = 1;
- sprintf(buf, FILE_MASK, curFileNo);
+ sprintf(buf, FILE_MASK, 1);
cFile *tmp = new cFile(KeyPath(), buf);
const char *rv = NULL;