diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-13 04:26:40 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-13 04:26:40 +0200 |
commit | 2d48ae784ea6828e8626c32c848f64232d8f35c0 (patch) | |
tree | fab114b03e91125783a778b835dd1913b039cebe /libs/fsScan/include | |
download | cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.gz cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.bz2 |
initial import
Diffstat (limited to 'libs/fsScan/include')
-rw-r--r-- | libs/fsScan/include/AbstractMedia.h | 84 | ||||
-rw-r--r-- | libs/fsScan/include/AbstractMultiFileMovie.h | 48 | ||||
-rw-r--r-- | libs/fsScan/include/Audio.h | 43 | ||||
-rw-r--r-- | libs/fsScan/include/DVDImage.h | 45 | ||||
-rw-r--r-- | libs/fsScan/include/FilesystemScanner.h | 59 | ||||
-rw-r--r-- | libs/fsScan/include/LegacyVdrRecording.h | 42 | ||||
-rw-r--r-- | libs/fsScan/include/MediaFactory.h | 49 | ||||
-rw-r--r-- | libs/fsScan/include/Movie.h | 43 | ||||
-rw-r--r-- | libs/fsScan/include/Picture.h | 43 | ||||
-rw-r--r-- | libs/fsScan/include/VdrRecording.h | 42 |
10 files changed, 498 insertions, 0 deletions
diff --git a/libs/fsScan/include/AbstractMedia.h b/libs/fsScan/include/AbstractMedia.h new file mode 100644 index 0000000..4b8fedd --- /dev/null +++ b/libs/fsScan/include/AbstractMedia.h @@ -0,0 +1,84 @@ +/** + * ======================== legal notice ====================== + * + * File: AbstractMedia.h + * Created: 2. Juli 2012, 14:33 + * 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 <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(); + + 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. + + SupportedMediaType MediaType(void) const { return mediaType; } + const char *LogicalPath(void) const { return logicalPath; } + const char *RealPath(void) const { return realPath; } + const char *Name(void) const { return name; } + const char *MimeType(void) const { return mimeType; } + time_t LastModified(void) const { return lastModified; } + void SetLastModified(time_t when) { lastModified = when; } + size_t Size(void) const { return size; } + void SetSize(size_t Size) { size = Size; } + static const char *MediaType2Text(int Type); + +protected: + cAbstractMedia(SupportedMediaType Type, const char *Name, const char *Logical, const char *Path, const char *Mime); + int fd; + +private: + SupportedMediaType mediaType; + char *logicalPath; + char *realPath; + char *name; + char *mimeType; + time_t lastModified; + size_t size; + }; + +#endif /* ABSTRACTMEDIA_H */ + diff --git a/libs/fsScan/include/AbstractMultiFileMovie.h b/libs/fsScan/include/AbstractMultiFileMovie.h new file mode 100644 index 0000000..e3bd520 --- /dev/null +++ b/libs/fsScan/include/AbstractMultiFileMovie.h @@ -0,0 +1,48 @@ +/** + * ======================== legal notice ====================== + * + * File: AbstractMultiFileMovie.h + * Created: 3. Juli 2012, 07:39 + * 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 *FirstFile(void) = 0; + virtual const char *NextFile(void) = 0; + +protected: + cAbstractMultiFileMovie(const char *Name, const char *Logical, const char *Path, const char *Mime, SupportedMediaType Type); + int movieFiles; + int curFileNo; + char *fileNameBuf; // this class does not need it, but all subclasses do ... + size_t bufSize; + }; + +#endif /* ABSTRACTMULTIFILEMOVIE_H */ + diff --git a/libs/fsScan/include/Audio.h b/libs/fsScan/include/Audio.h new file mode 100644 index 0000000..d1a784a --- /dev/null +++ b/libs/fsScan/include/Audio.h @@ -0,0 +1,43 @@ +/** + * ======================== legal notice ====================== + * + * File: Audio.h + * Created: 2. Juli 2012, 15:00 + * 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 char *Name, const char *Logical, const char *Path, const char *Mime); + virtual ~cAudio(); + +private: + static const char *ContentType(const char *Extension); + static SupportedExtension knownExtensions[]; + friend class cMediaFactory; + friend class FScanTest; + }; + +#endif /* AUDIO_H */ + diff --git a/libs/fsScan/include/DVDImage.h b/libs/fsScan/include/DVDImage.h new file mode 100644 index 0000000..e773e72 --- /dev/null +++ b/libs/fsScan/include/DVDImage.h @@ -0,0 +1,45 @@ +/** + * ======================== legal notice ====================== + * + * File: DVDImage.h + * Created: 3. Juli 2012, 08:34 + * 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 char *Name, const char *Logical, const char *Path); + virtual ~cDVDImage(); + + virtual void Refresh(void); + + virtual const char *FirstFile(void); + virtual const char *NextFile(void); + +private: + int mainMovie; + }; + +#endif /* DVDIMAGE_H */ + diff --git a/libs/fsScan/include/FilesystemScanner.h b/libs/fsScan/include/FilesystemScanner.h new file mode 100644 index 0000000..7a188ce --- /dev/null +++ b/libs/fsScan/include/FilesystemScanner.h @@ -0,0 +1,59 @@ +/** + * ======================== legal notice ====================== + * + * File: FilesystemScanner.h + * Created: 2. Juli 2012, 13:58 + * 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 FILESYSTEMSCANNER_H +#define FILESYSTEMSCANNER_H + +#include <ManagedVector.h> +#include <MediaFactory.h> +#include <map> + +class cAbstractMedia; +class cFilesystemScanner { +public: + cFilesystemScanner(); + virtual ~cFilesystemScanner(); + + cManagedVector &MediaPool(void) { return pool; } + std::map<int, size_t> &Categories(void) { return categories; } + cAbstractMedia *FindMedia(const char *LogicalPath); + void Refresh(void); + + void SetBaseDirectory(const char *dir); + void SetMediaFactory(cMediaFactory *factory); + +protected: + void parseDir(const char *dir, cManagedVector &result); + +private: + char *baseDirectory; + size_t fileBufSize; + struct dirent *dirEntryBuf; + cManagedVector pool; + std::map<int, size_t> categories; + cMediaFactory *mediaFactory; + }; + +#endif /* FILESYSTEMSCANNER_H */ + diff --git a/libs/fsScan/include/LegacyVdrRecording.h b/libs/fsScan/include/LegacyVdrRecording.h new file mode 100644 index 0000000..147e6fc --- /dev/null +++ b/libs/fsScan/include/LegacyVdrRecording.h @@ -0,0 +1,42 @@ +/** + * ======================== legal notice ====================== + * + * File: LegacyVdrRecording.h + * Created: 3. Juli 2012, 08:16 + * 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 char *Name, const char *Logical, const char *Path); + virtual ~cLegacyVdrRecording(); + + virtual void Refresh(void); + + virtual const char *FirstFile(void); + virtual const char *NextFile(void); + }; + +#endif /* LEGACYVDRRECORDING_H */ + diff --git a/libs/fsScan/include/MediaFactory.h b/libs/fsScan/include/MediaFactory.h new file mode 100644 index 0000000..b9b5391 --- /dev/null +++ b/libs/fsScan/include/MediaFactory.h @@ -0,0 +1,49 @@ +/** + * ======================== legal notice ====================== + * + * File: MediaFactory.h + * Created: 2. Juli 2012, 15:43 + * 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 <sys/stat.h> +#include <sys/types.h> + +class cAbstractMedia; +class cMediaFactory { +public: + cMediaFactory(const char *BaseDirectory); + virtual ~cMediaFactory(); + + cAbstractMedia *CreateMedia(const char *FileOrDirname, struct stat *st); + + const char *BaseDirectory(void) const { return baseDirectory; } + void SetBaseDirectory(const char *dir); + +private: + char *baseDirectory; + char *scratch; + size_t scratchSize; + }; + +#endif /* MEDIAFACTORY_H */ + diff --git a/libs/fsScan/include/Movie.h b/libs/fsScan/include/Movie.h new file mode 100644 index 0000000..af8b437 --- /dev/null +++ b/libs/fsScan/include/Movie.h @@ -0,0 +1,43 @@ +/** + * ======================== legal notice ====================== + * + * File: Movie.h + * Created: 2. Juli 2012, 15:12 + * 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 char *Name, const char *Logical, const char *Path, const char *Mime, SupportedMediaType Type = cAbstractMedia::Movie); + virtual ~cMovie(); + +private: + static const char *ContentType(const char *Extension); + static SupportedExtension knownExtensions[]; + friend class cMediaFactory; + friend class FScanTest; + }; + +#endif /* MOVIE_H */ + diff --git a/libs/fsScan/include/Picture.h b/libs/fsScan/include/Picture.h new file mode 100644 index 0000000..a911a71 --- /dev/null +++ b/libs/fsScan/include/Picture.h @@ -0,0 +1,43 @@ +/** + * ======================== legal notice ====================== + * + * File: Picture.h + * Created: 2. Juli 2012, 15:18 + * 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 char *Name, const char *Logical, const char *Path, const char *Mime); + virtual ~cPicture(); + +private: + static const char *ContentType(const char *Extension); + static SupportedExtension knownExtensions[]; + friend class cMediaFactory; + friend class FScanTest; + }; + +#endif /* PICTURE_H */ + diff --git a/libs/fsScan/include/VdrRecording.h b/libs/fsScan/include/VdrRecording.h new file mode 100644 index 0000000..2e3904b --- /dev/null +++ b/libs/fsScan/include/VdrRecording.h @@ -0,0 +1,42 @@ +/** + * ======================== legal notice ====================== + * + * File: VdrRecording.h + * Created: 3. Juli 2012, 08:30 + * 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 char *Name, const char *Logical, const char *Path); + virtual ~cVdrRecording(); + + virtual void Refresh(void); + + virtual const char *FirstFile(void); + virtual const char *NextFile(void); + }; + +#endif /* VDRRECORDING_H */ + |