summaryrefslogtreecommitdiff
path: root/libs/mediaScan/include
diff options
context:
space:
mode:
Diffstat (limited to 'libs/mediaScan/include')
-rw-r--r--libs/mediaScan/include/AbstractMedia.h85
-rw-r--r--libs/mediaScan/include/AbstractMultiFileMovie.h57
-rw-r--r--libs/mediaScan/include/Audio.h46
-rw-r--r--libs/mediaScan/include/DVDImage.h46
-rw-r--r--libs/mediaScan/include/FSMediaScanner.h52
-rw-r--r--libs/mediaScan/include/LegacyVdrRecording.h41
-rw-r--r--libs/mediaScan/include/MediaFactory.h58
-rw-r--r--libs/mediaScan/include/Movie.h46
-rw-r--r--libs/mediaScan/include/Picture.h44
-rw-r--r--libs/mediaScan/include/VdrRecording.h41
10 files changed, 516 insertions, 0 deletions
diff --git a/libs/mediaScan/include/AbstractMedia.h b/libs/mediaScan/include/AbstractMedia.h
new file mode 100644
index 0000000..8c87dd5
--- /dev/null
+++ b/libs/mediaScan/include/AbstractMedia.h
@@ -0,0 +1,85 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: AbstractMedia.h
+ * Created: 2. Juli 2012, 14
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef ABSTRACTMEDIA_H
+#define ABSTRACTMEDIA_H
+
+#include <File.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <vector>
+
+typedef struct {
+ const char *extension;
+ const char *mimeType;
+} SupportedExtension;
+
+class cAbstractMedia {
+public:
+ typedef enum {
+ Invalid,
+ Audio,
+ Movie,
+ DVDImage,
+ LegacyVdrRecording,
+ VdrRecording,
+ Picture,
+ Unknown
+ } SupportedMediaType;
+
+ virtual ~cAbstractMedia();
+
+ SupportedMediaType MediaType(void) const { return mediaType; }
+ const char *MimeType(void) const { return mimeType; }
+ const char *AbsolutePath(void) const;
+ ulong LastModified(void) const;
+ const char *LogicalPath(void) const { return logicalPath; }
+ virtual const char *Name(void) const;
+ virtual bool NeedsFurtherScan(void) const;
+ virtual size_t Size(void) const;
+ virtual const char *URI(void) const { return uri; }
+ virtual void Refresh(void);
+ ///< will be called right before start streaming, so this call is used to
+ ///< determine the real size, number of files, etc.
+ virtual size_t ReadChunk(char *buf, size_t bufSize);
+ ///< used to hide the differences between single- and multi-file media.
+ virtual void Reset(void);
+ static const char *MediaType2Text(int Type);
+
+protected:
+ cAbstractMedia(const cFile &File, const char *Mime, SupportedMediaType Type);
+ void SetMimeType(const char *MimeType);
+ const cFile &KeyPath(void) { return keyPath; }
+ int fd;
+
+private:
+ SupportedMediaType mediaType;
+ char *mimeType;
+ char *uri;
+ char *logicalPath;
+ cFile keyPath;
+ };
+
+#endif /* ABSTRACTMEDIA_H */
+
diff --git a/libs/mediaScan/include/AbstractMultiFileMovie.h b/libs/mediaScan/include/AbstractMultiFileMovie.h
new file mode 100644
index 0000000..6913a74
--- /dev/null
+++ b/libs/mediaScan/include/AbstractMultiFileMovie.h
@@ -0,0 +1,57 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: AbstractMultiFileMovie.h
+ * Created: 3. Juli 2012, 07
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef ABSTRACTMULTIFILEMOVIE_H
+#define ABSTRACTMULTIFILEMOVIE_H
+
+#include <Movie.h>
+
+class cAbstractMultiFileMovie : public cMovie {
+public:
+ virtual ~cAbstractMultiFileMovie();
+
+ virtual size_t ReadChunk(char *buf, size_t bufSize);
+ virtual const char *Name(void) const { return name; }
+ virtual const char *FirstFile(void) = 0;
+ virtual const char *NextFile(void) = 0;
+ virtual size_t Size(void) const { return size; }
+
+protected:
+ cAbstractMultiFileMovie(const cFile &File, const char *Mime, SupportedMediaType Type);
+ virtual void Reset(void);
+ void SetName(char *Name);
+ void SetSize(size_t Size);
+ bool checkBuffer(void);
+ int movieFiles;
+ int curFileNo;
+ char *buf;
+ int bufSize;
+
+private:
+ char *name; ///< name of multifile media may be different from any filesystem name, so handle a copy
+ size_t size;
+ };
+
+#endif /* ABSTRACTMULTIFILEMOVIE_H */
+
diff --git a/libs/mediaScan/include/Audio.h b/libs/mediaScan/include/Audio.h
new file mode 100644
index 0000000..42611c2
--- /dev/null
+++ b/libs/mediaScan/include/Audio.h
@@ -0,0 +1,46 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: Audio.h
+ * Created: 2. Juli 2012, 15
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef AUDIO_H
+#define AUDIO_H
+
+#include <AbstractMedia.h>
+
+class cAudio : public cAbstractMedia {
+public:
+ cAudio(const cFile &File, const char *Mime);
+ virtual ~cAudio();
+
+ virtual bool NeedsFurtherScan(void) const;
+
+private:
+ static const char *ContentType(const char *Extension);
+ static SupportedExtension knownExtensions[];
+ friend class cMediaFactory;
+ friend class FScanTest;
+ friend int check4Media(void *, cFile *, const char *);
+ };
+
+#endif /* AUDIO_H */
+
diff --git a/libs/mediaScan/include/DVDImage.h b/libs/mediaScan/include/DVDImage.h
new file mode 100644
index 0000000..5845d77
--- /dev/null
+++ b/libs/mediaScan/include/DVDImage.h
@@ -0,0 +1,46 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: DVDImage.h
+ * Created: 3. Juli 2012, 08
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef DVDIMAGE_H
+#define DVDIMAGE_H
+
+#include <AbstractMultiFileMovie.h>
+
+class cDVDImage : public cAbstractMultiFileMovie {
+public:
+ cDVDImage(const cFile &File);
+ virtual ~cDVDImage();
+
+ virtual const char *Name(void) const;
+ virtual const char *FirstFile(void);
+ virtual const char *NextFile(void);
+ virtual void Refresh(void);
+ virtual size_t Size(void) const;
+
+private:
+ int mainMovie;
+ };
+
+#endif /* DVDIMAGE_H */
+
diff --git a/libs/mediaScan/include/FSMediaScanner.h b/libs/mediaScan/include/FSMediaScanner.h
new file mode 100644
index 0000000..1c85b46
--- /dev/null
+++ b/libs/mediaScan/include/FSMediaScanner.h
@@ -0,0 +1,52 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: FSMediaScanner.h
+ * Created: 2. Juli 2012, 13
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef FSMEDIASCANNER_H
+#define FSMEDIASCANNER_H
+
+#include <ManagedVector.h>
+#include <MediaFactory.h>
+#include <map>
+
+class cAbstractMedia;
+class cFSMediaScanner {
+public:
+ cFSMediaScanner();
+ virtual ~cFSMediaScanner();
+
+ cManagedVector &MediaPool(void) { return pool; }
+ std::map<int, size_t> &Categories(void) { return categories; }
+ cAbstractMedia *FindMedia(const char *LogicalPath);
+ void Refresh(void);
+ void SetMediaFactory(cMediaFactory *factory);
+
+private:
+ size_t fileBufSize;
+ cManagedVector pool;
+ std::map<int, size_t> categories;
+ cMediaFactory *mediaFactory;
+ };
+
+#endif /* FSMEDIASCANNER_H */
+
diff --git a/libs/mediaScan/include/LegacyVdrRecording.h b/libs/mediaScan/include/LegacyVdrRecording.h
new file mode 100644
index 0000000..cc46348
--- /dev/null
+++ b/libs/mediaScan/include/LegacyVdrRecording.h
@@ -0,0 +1,41 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: LegacyVdrRecording.h
+ * Created: 3. Juli 2012, 08
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef LEGACYVDRRECORDING_H
+#define LEGACYVDRRECORDING_H
+
+#include <AbstractMultiFileMovie.h>
+
+class cLegacyVdrRecording : public cAbstractMultiFileMovie {
+public:
+ cLegacyVdrRecording(const cFile &File);
+ virtual ~cLegacyVdrRecording();
+
+ virtual const char *FirstFile(void);
+ virtual const char *NextFile(void);
+ virtual void Refresh(void);
+ };
+
+#endif /* LEGACYVDRRECORDING_H */
+
diff --git a/libs/mediaScan/include/MediaFactory.h b/libs/mediaScan/include/MediaFactory.h
new file mode 100644
index 0000000..2ddcaa5
--- /dev/null
+++ b/libs/mediaScan/include/MediaFactory.h
@@ -0,0 +1,58 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: MediaFactory.h
+ * Created: 2. Juli 2012, 15
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef MEDIAFACTORY_H
+#define MEDIAFACTORY_H
+
+#include <File.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+class cAbstractMedia;
+class cFile;
+class cManagedVector;
+class cServerConfig;
+class cMediaFactory {
+public:
+ cMediaFactory(const cServerConfig &config);
+ virtual ~cMediaFactory();
+
+ cAbstractMedia *CreateMedia(const cFile &FileOrDirectory);
+ void Scan4Media(cManagedVector &pool);
+ const cFile &BaseDirectory(void) { return baseDirectory; }
+ void SetBaseDirectory(const cFile &dir);
+
+private:
+ void Scan4MetaData(cAbstractMedia *media);
+ int CreateMedia(const cFile *Parent, const char *Name);
+ static int createMedia(void *opaque, cFile *Parent, const char *Name);
+ const cServerConfig &config;
+ cFile baseDirectory;
+ cManagedVector *mediaPool;
+ char *scratch;
+ size_t scratchSize;
+ };
+
+#endif /* MEDIAFACTORY_H */
+
diff --git a/libs/mediaScan/include/Movie.h b/libs/mediaScan/include/Movie.h
new file mode 100644
index 0000000..5a4f60d
--- /dev/null
+++ b/libs/mediaScan/include/Movie.h
@@ -0,0 +1,46 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: Movie.h
+ * Created: 2. Juli 2012, 15
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef MOVIE_H
+#define MOVIE_H
+
+#include <AbstractMedia.h>
+
+class cMovie : public cAbstractMedia {
+public:
+ cMovie(const cFile &File, const char *Mime, SupportedMediaType Type = cAbstractMedia::Movie);
+ virtual ~cMovie();
+
+ virtual bool NeedsFurtherScan(void) const;
+
+private:
+ static const char *ContentType(const char *Extension);
+ static SupportedExtension knownExtensions[];
+ friend class cMediaFactory;
+ friend class FScanTest;
+ friend int check4Media(void *, cFile *, const char *);
+ };
+
+#endif /* MOVIE_H */
+
diff --git a/libs/mediaScan/include/Picture.h b/libs/mediaScan/include/Picture.h
new file mode 100644
index 0000000..669509b
--- /dev/null
+++ b/libs/mediaScan/include/Picture.h
@@ -0,0 +1,44 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: Picture.h
+ * Created: 2. Juli 2012, 15
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef PICTURE_H
+#define PICTURE_H
+
+#include <AbstractMedia.h>
+
+class cPicture : public cAbstractMedia {
+public:
+ cPicture(const cFile &File, const char *Mime);
+ virtual ~cPicture();
+
+private:
+ static const char *ContentType(const char *Extension);
+ static SupportedExtension knownExtensions[];
+ friend class cMediaFactory;
+ friend class FScanTest;
+ friend int check4Media(void *, cFile *, const char *);
+ };
+
+#endif /* PICTURE_H */
+
diff --git a/libs/mediaScan/include/VdrRecording.h b/libs/mediaScan/include/VdrRecording.h
new file mode 100644
index 0000000..a8ec292
--- /dev/null
+++ b/libs/mediaScan/include/VdrRecording.h
@@ -0,0 +1,41 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: VdrRecording.h
+ * Created: 3. Juli 2012, 08
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef VDRRECORDING_H
+#define VDRRECORDING_H
+
+#include <AbstractMultiFileMovie.h>
+
+class cVdrRecording : public cAbstractMultiFileMovie {
+public:
+ cVdrRecording(const cFile &File);
+ virtual ~cVdrRecording();
+
+ virtual const char *FirstFile(void);
+ virtual const char *NextFile(void);
+ virtual void Refresh(void);
+ };
+
+#endif /* VDRRECORDING_H */
+