diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-30 09:19:12 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-30 09:19:12 +0200 |
commit | 41922cdaf9c8db57c6b51f090eefe95b0008a0fb (patch) | |
tree | dbedbef06a7419552b7be90ac97b48417fda1fa1 /libs/mediaScan | |
parent | 05bf6a9b1be1c03ed33df638d3f7d0fddf968ebc (diff) | |
download | cmp-41922cdaf9c8db57c6b51f090eefe95b0008a0fb.tar.gz cmp-41922cdaf9c8db57c6b51f090eefe95b0008a0fb.tar.bz2 |
former libfsScan now contains only media related stuff, so renamed lib to libmediaScan
Diffstat (limited to 'libs/mediaScan')
37 files changed, 2662 insertions, 0 deletions
diff --git a/libs/mediaScan/.dep.inc b/libs/mediaScan/.dep.inc new file mode 100644 index 0000000..4560e55 --- /dev/null +++ b/libs/mediaScan/.dep.inc @@ -0,0 +1,5 @@ +# This code depends on make tool being used +DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES})) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/libs/mediaScan/Makefile b/libs/mediaScan/Makefile new file mode 100644 index 0000000..ec9de69 --- /dev/null +++ b/libs/mediaScan/Makefile @@ -0,0 +1,128 @@ +# +# There exist several targets which are by default empty and which can be +# used for execution of your targets. These targets are usually executed +# before and after some main targets. They are: +# +# .build-pre: called before 'build' target +# .build-post: called after 'build' target +# .clean-pre: called before 'clean' target +# .clean-post: called after 'clean' target +# .clobber-pre: called before 'clobber' target +# .clobber-post: called after 'clobber' target +# .all-pre: called before 'all' target +# .all-post: called after 'all' target +# .help-pre: called before 'help' target +# .help-post: called after 'help' target +# +# Targets beginning with '.' are not intended to be called on their own. +# +# Main targets can be executed directly, and they are: +# +# build build a specific configuration +# clean remove built files from a configuration +# clobber remove all built files +# all build all configurations +# help print help mesage +# +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and +# .help-impl are implemented in nbproject/makefile-impl.mk. +# +# Available make variables: +# +# CND_BASEDIR base directory for relative paths +# CND_DISTDIR default top distribution directory (build artifacts) +# CND_BUILDDIR default top build directory (object files, ...) +# CONF name of current configuration +# CND_PLATFORM_${CONF} platform name (current configuration) +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) +# +# NOCDDL + + +# Environment +MKDIR=mkdir +CP=cp +CCADMIN=CCadmin + + +# build +build: .build-post + +.build-pre: +# Add your pre 'build' code here... + +.build-post: .build-impl +# Add your post 'build' code here... + + +# clean +clean: .clean-post + +.clean-pre: +# Add your pre 'clean' code here... + +.clean-post: .clean-impl +# Add your post 'clean' code here... + + +# clobber +clobber: .clobber-post + +.clobber-pre: +# Add your pre 'clobber' code here... + +.clobber-post: .clobber-impl +# Add your post 'clobber' code here... + + +# all +all: .all-post + +.all-pre: +# Add your pre 'all' code here... + +.all-post: .all-impl +# Add your post 'all' code here... + + +# build tests +build-tests: .build-tests-post + +.build-tests-pre: +# Add your pre 'build-tests' code here... + +.build-tests-post: .build-tests-impl +# Add your post 'build-tests' code here... + + +# run tests +test: .test-post + +.test-pre: +# Add your pre 'test' code here... + +.test-post: .test-impl +# Add your post 'test' code here... + + +# help +help: .help-post + +.help-pre: +# Add your pre 'help' code here... + +.help-post: .help-impl +# Add your post 'help' code here... + + + +# include project implementation makefile +include nbproject/Makefile-impl.mk + +# include project make variables +include nbproject/Makefile-variables.mk 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 */ + diff --git a/libs/mediaScan/mediaScan.cbp b/libs/mediaScan/mediaScan.cbp new file mode 100644 index 0000000..6d4d7ec --- /dev/null +++ b/libs/mediaScan/mediaScan.cbp @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="CMP.libs.mediaScan" /> + <Option pch_mode="2" /> + <Option compiler="gcc" /> + <Build> + <Target title="Debug"> + <Option output="mediaScan" prefix_auto="1" extension_auto="1" /> + <Option working_dir="" /> + <Option object_output="obj/Debug/" /> + <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-Wall" /> + <Add option="-g" /> + </Compiler> + </Target> + <Target title="Release"> + <Option output="mediaScan" prefix_auto="1" extension_auto="1" /> + <Option working_dir="" /> + <Option object_output="obj/Release/" /> + <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-Wall" /> + <Add option="-O2" /> + </Compiler> + <Linker> + <Add option="-s" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration" /> + <Add option="-D_REENTRANT" /> + <Add option="-D_GNU_SOURCE=1" /> + <Add directory="../vdr/include" /> + <Add directory="../util/include" /> + <Add directory="../IO/include" /> + <Add directory="../networking/include" /> + <Add directory="include" /> + </Compiler> + <Unit filename="include/AbstractMedia.h" /> + <Unit filename="include/AbstractMultiFileMovie.h" /> + <Unit filename="include/Audio.h" /> + <Unit filename="include/DVDImage.h" /> + <Unit filename="include/FSMediaScanner.h" /> + <Unit filename="include/LegacyVdrRecording.h" /> + <Unit filename="include/MediaFactory.h" /> + <Unit filename="include/Movie.h" /> + <Unit filename="include/Picture.h" /> + <Unit filename="include/VdrRecording.h" /> + <Unit filename="src/AbstractMedia.cc" /> + <Unit filename="src/AbstractMultiFileMovie.cc" /> + <Unit filename="src/Audio.cc" /> + <Unit filename="src/DVDImage.cc" /> + <Unit filename="src/FSMediaScanner.cc" /> + <Unit filename="src/LegacyVdrRecording.cc" /> + <Unit filename="src/MediaFactory.cc" /> + <Unit filename="src/Movie.cc" /> + <Unit filename="src/Picture.cc" /> + <Unit filename="src/VdrRecording.cc" /> + <Extensions> + <code_completion /> + <envvars /> + <lib_finder disable_auto="1" /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file> diff --git a/libs/mediaScan/mediaScan.depend b/libs/mediaScan/mediaScan.depend new file mode 100644 index 0000000..c4ac310 --- /dev/null +++ b/libs/mediaScan/mediaScan.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/libs/mediaScan/mediaScan.layout b/libs/mediaScan/mediaScan.layout new file mode 100644 index 0000000..4398ab3 --- /dev/null +++ b/libs/mediaScan/mediaScan.layout @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_layout_file> + <ActiveTarget name="Debug" /> + <File name="src/VdrRecording.cc" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1404" topLine="0" /> + </Cursor> + </File> + <File name="src/LegacyVdrRecording.cc" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1450" topLine="0" /> + </Cursor> + </File> + <File name="src/AbstractMedia.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1453" topLine="0" /> + </Cursor> + </File> + <File name="include/MediaFactory.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1670" topLine="0" /> + </Cursor> + </File> + <File name="src/MediaFactory.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1317" topLine="18" /> + </Cursor> + </File> + <File name="include/AbstractMedia.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="1008" topLine="0" /> + </Cursor> + </File> +</CodeBlocks_layout_file> diff --git a/libs/mediaScan/nbproject/Makefile-Debug.mk b/libs/mediaScan/nbproject/Makefile-Debug.mk new file mode 100644 index 0000000..1e0062b --- /dev/null +++ b/libs/mediaScan/nbproject/Makefile-Debug.mk @@ -0,0 +1,148 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Environment +MKDIR=mkdir +CP=cp +GREP=grep +NM=nm +CCADMIN=CCadmin +RANLIB=ranlib +CC=gcc +CCC=g++ +CXX=g++ +FC=gfortran +AS=as + +# Macros +CND_PLATFORM=GNU-Linux-x86 +CND_DLIB_EXT=so +CND_CONF=Debug +CND_DISTDIR=dist +CND_BUILDDIR=build + +# Include project Makefile +include Makefile + +# Object Directory +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} + +# Object Files +OBJECTFILES= \ + ${OBJECTDIR}/src/Picture.o \ + ${OBJECTDIR}/src/Audio.o \ + ${OBJECTDIR}/src/DVDImage.o \ + ${OBJECTDIR}/src/VdrRecording.o \ + ${OBJECTDIR}/src/MediaFactory.o \ + ${OBJECTDIR}/src/LegacyVdrRecording.o \ + ${OBJECTDIR}/src/FSMediaScanner.o \ + ${OBJECTDIR}/src/AbstractMultiFileMovie.o \ + ${OBJECTDIR}/src/AbstractMedia.o \ + ${OBJECTDIR}/src/Movie.o + + +# C Compiler Flags +CFLAGS= + +# CC Compiler Flags +CCFLAGS=-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration +CXXFLAGS=-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration + +# Fortran Compiler Flags +FFLAGS= + +# Assembler Flags +ASFLAGS= + +# Link Libraries and Options +LDLIBSOPTIONS= + +# Build Targets +.build-conf: ${BUILD_SUBPROJECTS} + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a: ${OBJECTFILES} + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a ${OBJECTFILES} + $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +${OBJECTDIR}/src/Picture.o: 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 + ${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 + ${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 + ${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 + ${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 + ${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/FSMediaScanner.o: 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 + ${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 + ${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 + ${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 + +# Subprojects +.build-subprojects: + cd ../vdr && ${MAKE} -f Makefile CONF=Debug + cd ../util && ${MAKE} -f Makefile CONF=Debug + cd ../networking && ${MAKE} -f Makefile CONF=Debug + cd ../IO && ${MAKE} -f Makefile CONF=Debug + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +# Subprojects +.clean-subprojects: + cd ../vdr && ${MAKE} -f Makefile CONF=Debug clean + cd ../util && ${MAKE} -f Makefile CONF=Debug clean + cd ../networking && ${MAKE} -f Makefile CONF=Debug clean + cd ../IO && ${MAKE} -f Makefile CONF=Debug clean + +# Enable dependency checking +.dep.inc: .depcheck-impl + +include .dep.inc diff --git a/libs/mediaScan/nbproject/Makefile-Release.mk b/libs/mediaScan/nbproject/Makefile-Release.mk new file mode 100644 index 0000000..bc8c6a9 --- /dev/null +++ b/libs/mediaScan/nbproject/Makefile-Release.mk @@ -0,0 +1,140 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Environment +MKDIR=mkdir +CP=cp +GREP=grep +NM=nm +CCADMIN=CCadmin +RANLIB=ranlib +CC=gcc +CCC=g++ +CXX=g++ +FC=gfortran +AS=as + +# Macros +CND_PLATFORM=GNU-Linux-x86 +CND_DLIB_EXT=so +CND_CONF=Release +CND_DISTDIR=dist +CND_BUILDDIR=build + +# Include project Makefile +include Makefile + +# Object Directory +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} + +# Object Files +OBJECTFILES= \ + ${OBJECTDIR}/src/Picture.o \ + ${OBJECTDIR}/src/Audio.o \ + ${OBJECTDIR}/src/DVDImage.o \ + ${OBJECTDIR}/src/VdrRecording.o \ + ${OBJECTDIR}/src/MediaFactory.o \ + ${OBJECTDIR}/src/LegacyVdrRecording.o \ + ${OBJECTDIR}/src/FSMediaScanner.o \ + ${OBJECTDIR}/src/AbstractMultiFileMovie.o \ + ${OBJECTDIR}/src/AbstractMedia.o \ + ${OBJECTDIR}/src/Movie.o + + +# C Compiler Flags +CFLAGS= + +# CC Compiler Flags +CCFLAGS= +CXXFLAGS= + +# Fortran Compiler Flags +FFLAGS= + +# Assembler Flags +ASFLAGS= + +# Link Libraries and Options +LDLIBSOPTIONS= + +# Build Targets +.build-conf: ${BUILD_SUBPROJECTS} + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a: ${OBJECTFILES} + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a ${OBJECTFILES} + $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +${OBJECTDIR}/src/Picture.o: 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 + ${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 + ${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 + ${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 + ${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 + ${MKDIR} -p ${OBJECTDIR}/src + ${RM} $@.d + $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc + +${OBJECTDIR}/src/FSMediaScanner.o: 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 + ${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 + ${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 + ${MKDIR} -p ${OBJECTDIR}/src + ${RM} $@.d + $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc + +# Subprojects +.build-subprojects: + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a + +# Subprojects +.clean-subprojects: + +# Enable dependency checking +.dep.inc: .depcheck-impl + +include .dep.inc diff --git a/libs/mediaScan/nbproject/Makefile-impl.mk b/libs/mediaScan/nbproject/Makefile-impl.mk new file mode 100644 index 0000000..1d398f7 --- /dev/null +++ b/libs/mediaScan/nbproject/Makefile-impl.mk @@ -0,0 +1,133 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a pre- and a post- target defined where you can add customization code. +# +# This makefile implements macros and targets common to all configurations. +# +# NOCDDL + + +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf +# and .clean-reqprojects-conf unless SUB has the value 'no' +SUB_no=NO +SUBPROJECTS=${SUB_${SUB}} +BUILD_SUBPROJECTS_=.build-subprojects +BUILD_SUBPROJECTS_NO= +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} +CLEAN_SUBPROJECTS_=.clean-subprojects +CLEAN_SUBPROJECTS_NO= +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} + + +# Project Name +PROJECTNAME=fsScan + +# Active Configuration +DEFAULTCONF=Debug +CONF=${DEFAULTCONF} + +# All Configurations +ALLCONFS=Debug Release + + +# build +.build-impl: .build-pre .validate-impl .depcheck-impl + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf + + +# clean +.clean-impl: .clean-pre .validate-impl .depcheck-impl + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf + + +# clobber +.clobber-impl: .clobber-pre .depcheck-impl + @#echo "=> Running $@..." + for CONF in ${ALLCONFS}; \ + do \ + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \ + done + +# all +.all-impl: .all-pre .depcheck-impl + @#echo "=> Running $@..." + for CONF in ${ALLCONFS}; \ + do \ + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \ + done + +# build tests +.build-tests-impl: .build-impl .build-tests-pre + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf + +# run tests +.test-impl: .build-tests-impl .test-pre + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf + +# dependency checking support +.depcheck-impl: + @echo "# This code depends on make tool being used" >.dep.inc + @if [ -n "${MAKE_VERSION}" ]; then \ + echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ + echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ + echo "include \$${DEPFILES}" >>.dep.inc; \ + echo "endif" >>.dep.inc; \ + else \ + echo ".KEEP_STATE:" >>.dep.inc; \ + echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ + fi + +# configuration validation +.validate-impl: + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ + then \ + echo ""; \ + echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \ + echo "See 'make help' for details."; \ + echo "Current directory: " `pwd`; \ + echo ""; \ + fi + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ + then \ + exit 1; \ + fi + + +# help +.help-impl: .help-pre + @echo "This makefile supports the following configurations:" + @echo " ${ALLCONFS}" + @echo "" + @echo "and the following targets:" + @echo " build (default target)" + @echo " clean" + @echo " clobber" + @echo " all" + @echo " help" + @echo "" + @echo "Makefile Usage:" + @echo " make [CONF=<CONFIGURATION>] [SUB=no] build" + @echo " make [CONF=<CONFIGURATION>] [SUB=no] clean" + @echo " make [SUB=no] clobber" + @echo " make [SUB=no] all" + @echo " make help" + @echo "" + @echo "Target 'build' will build a specific configuration and, unless 'SUB=no'," + @echo " also build subprojects." + @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no'," + @echo " also clean subprojects." + @echo "Target 'clobber' will remove all built files from all configurations and," + @echo " unless 'SUB=no', also from subprojects." + @echo "Target 'all' will will build all configurations and, unless 'SUB=no'," + @echo " also build subprojects." + @echo "Target 'help' prints this message." + @echo "" + diff --git a/libs/mediaScan/nbproject/Makefile-variables.mk b/libs/mediaScan/nbproject/Makefile-variables.mk new file mode 100644 index 0000000..e22487e --- /dev/null +++ b/libs/mediaScan/nbproject/Makefile-variables.mk @@ -0,0 +1,35 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +CND_BASEDIR=`pwd` +CND_BUILDDIR=build +CND_DISTDIR=dist +# Debug configuration +CND_PLATFORM_Debug=GNU-Linux-x86 +CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux-x86 +CND_ARTIFACT_NAME_Debug=libfsscan.a +CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/libfsscan.a +CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux-x86/package +CND_PACKAGE_NAME_Debug=fsScan.tar +CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/fsScan.tar +# Release configuration +CND_PLATFORM_Release=GNU-Linux-x86 +CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux-x86 +CND_ARTIFACT_NAME_Release=libfsscan.a +CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/libfsscan.a +CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux-x86/package +CND_PACKAGE_NAME_Release=fsScan.tar +CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/fsScan.tar +# +# include compiler specific variables +# +# dmake command +ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \ + (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk) +# +# gmake command +.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)) +# +include nbproject/private/Makefile-variables.mk diff --git a/libs/mediaScan/nbproject/Package-Debug.bash b/libs/mediaScan/nbproject/Package-Debug.bash new file mode 100644 index 0000000..2a9c453 --- /dev/null +++ b/libs/mediaScan/nbproject/Package-Debug.bash @@ -0,0 +1,75 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_PLATFORM=GNU-Linux-x86 +CND_CONF=Debug +CND_DISTDIR=dist +CND_BUILDDIR=build +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a +OUTPUT_BASENAME=libfsscan.a +PACKAGE_TOP_DIR=fsScan/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package +rm -rf ${NBTMPDIR} +mkdir -p ${NBTMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory "${NBTMPDIR}/fsScan/lib" +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar +cd ${NBTMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${NBTMPDIR} diff --git a/libs/mediaScan/nbproject/Package-Release.bash b/libs/mediaScan/nbproject/Package-Release.bash new file mode 100644 index 0000000..d996196 --- /dev/null +++ b/libs/mediaScan/nbproject/Package-Release.bash @@ -0,0 +1,75 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_PLATFORM=GNU-Linux-x86 +CND_CONF=Release +CND_DISTDIR=dist +CND_BUILDDIR=build +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a +OUTPUT_BASENAME=libfsscan.a +PACKAGE_TOP_DIR=fsScan/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package +rm -rf ${NBTMPDIR} +mkdir -p ${NBTMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory "${NBTMPDIR}/fsScan/lib" +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar +cd ${NBTMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${NBTMPDIR} diff --git a/libs/mediaScan/nbproject/configurations.xml b/libs/mediaScan/nbproject/configurations.xml new file mode 100644 index 0000000..9984a4c --- /dev/null +++ b/libs/mediaScan/nbproject/configurations.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configurationDescriptor version="84"> + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT"> + <logicalFolder name="HeaderFiles" + displayName="Header Files" + projectFiles="true"> + <itemPath>include/AbstractMedia.h</itemPath> + <itemPath>include/AbstractMultiFileMovie.h</itemPath> + <itemPath>include/Audio.h</itemPath> + <itemPath>include/DVDImage.h</itemPath> + <itemPath>include/FSMediaScanner.h</itemPath> + <itemPath>include/LegacyVdrRecording.h</itemPath> + <itemPath>include/MediaFactory.h</itemPath> + <itemPath>include/Movie.h</itemPath> + <itemPath>include/Picture.h</itemPath> + <itemPath>include/VdrRecording.h</itemPath> + </logicalFolder> + <logicalFolder name="ResourceFiles" + displayName="Resource Files" + projectFiles="true"> + </logicalFolder> + <logicalFolder name="SourceFiles" + displayName="Source Files" + projectFiles="true"> + <itemPath>src/AbstractMedia.cc</itemPath> + <itemPath>src/AbstractMultiFileMovie.cc</itemPath> + <itemPath>src/Audio.cc</itemPath> + <itemPath>src/DVDImage.cc</itemPath> + <itemPath>src/FSMediaScanner.cc</itemPath> + <itemPath>src/LegacyVdrRecording.cc</itemPath> + <itemPath>src/MediaFactory.cc</itemPath> + <itemPath>src/Movie.cc</itemPath> + <itemPath>src/Picture.cc</itemPath> + <itemPath>src/VdrRecording.cc</itemPath> + </logicalFolder> + <logicalFolder name="TestFiles" + displayName="Test Files" + projectFiles="false" + kind="TEST_LOGICAL_FOLDER"> + </logicalFolder> + <logicalFolder name="ExternalFiles" + displayName="Important Files" + projectFiles="false" + kind="IMPORTANT_FILES_FOLDER"> + <itemPath>Makefile</itemPath> + <itemPath>summary.txt</itemPath> + </logicalFolder> + </logicalFolder> + <projectmakefile>Makefile</projectmakefile> + <confs> + <conf name="Debug" type="3"> + <toolsSet> + <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode> + <compilerSet>default</compilerSet> + </toolsSet> + <compileType> + <ccTool> + <incDir> + <pElem>include</pElem> + <pElem>../networking/include</pElem> + <pElem>../IO/include</pElem> + <pElem>../util/include</pElem> + <pElem>../vdr/include</pElem> + </incDir> + <commandLine>-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration</commandLine> + <preprocessorList> + <Elem>_FILE_OFFSET_BITS=64</Elem> + <Elem>_GNU_SOURCE=1</Elem> + <Elem>_LARGEFILE64_SOURCE</Elem> + <Elem>_LARGEFILE_SOURCE</Elem> + <Elem>_REENTRANT</Elem> + <Elem>__STDC_CONSTANT_MACROS</Elem> + <Elem>__STDC_FORMAT_MACROS</Elem> + <Elem>__STDC_LIMIT_MACROS</Elem> + </preprocessorList> + <warningLevel>2</warningLevel> + </ccTool> + <archiverTool> + </archiverTool> + <requiredProjects> + <makeArtifact PL="../vdr" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../vdr" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libvdr.a"> + </makeArtifact> + <makeArtifact PL="../util" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../util" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libutil.a"> + </makeArtifact> + <makeArtifact PL="../networking" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../networking" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libnetworking.a"> + </makeArtifact> + <makeArtifact PL="../IO" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../IO" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a"> + </makeArtifact> + </requiredProjects> + </compileType> + </conf> + <conf name="Release" type="3"> + <toolsSet> + <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode> + <compilerSet>default</compilerSet> + </toolsSet> + <compileType> + <cTool> + <developmentMode>5</developmentMode> + </cTool> + <ccTool> + <developmentMode>5</developmentMode> + </ccTool> + <fortranCompilerTool> + <developmentMode>5</developmentMode> + </fortranCompilerTool> + <asmTool> + <developmentMode>5</developmentMode> + </asmTool> + <archiverTool> + </archiverTool> + </compileType> + </conf> + </confs> +</configurationDescriptor> diff --git a/libs/mediaScan/nbproject/private/Makefile-variables.mk b/libs/mediaScan/nbproject/private/Makefile-variables.mk new file mode 100644 index 0000000..a64183e --- /dev/null +++ b/libs/mediaScan/nbproject/private/Makefile-variables.mk @@ -0,0 +1,7 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +# Debug configuration +# Release configuration diff --git a/libs/mediaScan/nbproject/private/configurations.xml b/libs/mediaScan/nbproject/private/configurations.xml new file mode 100644 index 0000000..616cc91 --- /dev/null +++ b/libs/mediaScan/nbproject/private/configurations.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configurationDescriptor version="84"> + <projectmakefile>Makefile</projectmakefile> + <confs> + <conf name="Debug" type="3"> + <toolsSet> + <developmentServer>localhost</developmentServer> + <platform>2</platform> + </toolsSet> + <dbx_gdbdebugger version="1"> + <gdb_pathmaps> + </gdb_pathmaps> + <gdb_interceptlist> + <gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/> + </gdb_interceptlist> + <gdb_options> + <DebugOptions> + </DebugOptions> + </gdb_options> + <gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/> + </dbx_gdbdebugger> + <nativedebugger version="1"> + <engine>gdb</engine> + </nativedebugger> + <runprofile version="9"> + <runcommandpicklist> + <runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem> + </runcommandpicklist> + <runcommand>"${OUTPUT_PATH}"</runcommand> + <rundir></rundir> + <buildfirst>true</buildfirst> + <terminal-type>0</terminal-type> + <remove-instrumentation>0</remove-instrumentation> + <environment> + </environment> + </runprofile> + </conf> + <conf name="Release" type="3"> + <toolsSet> + <developmentServer>localhost</developmentServer> + <platform>2</platform> + </toolsSet> + <dbx_gdbdebugger version="1"> + <gdb_pathmaps> + </gdb_pathmaps> + <gdb_interceptlist> + <gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/> + </gdb_interceptlist> + <gdb_options> + <DebugOptions> + </DebugOptions> + </gdb_options> + <gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/> + </dbx_gdbdebugger> + <nativedebugger version="1"> + <engine>gdb</engine> + </nativedebugger> + <runprofile version="9"> + <runcommandpicklist> + <runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem> + </runcommandpicklist> + <runcommand>"${OUTPUT_PATH}"</runcommand> + <rundir></rundir> + <buildfirst>true</buildfirst> + <terminal-type>0</terminal-type> + <remove-instrumentation>0</remove-instrumentation> + <environment> + </environment> + </runprofile> + </conf> + </confs> +</configurationDescriptor> diff --git a/libs/mediaScan/nbproject/private/private.xml b/libs/mediaScan/nbproject/private/private.xml new file mode 100644 index 0000000..dfdcba4 --- /dev/null +++ b/libs/mediaScan/nbproject/private/private.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> + <data xmlns="http://www.netbeans.org/ns/make-project-private/1"> + <activeConfTypeElem>3</activeConfTypeElem> + <activeConfIndexElem>0</activeConfIndexElem> + </data> + <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> + <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> +</project-private> diff --git a/libs/mediaScan/nbproject/project.xml b/libs/mediaScan/nbproject/project.xml new file mode 100644 index 0000000..f749866 --- /dev/null +++ b/libs/mediaScan/nbproject/project.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.cnd.makeproject</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/make-project/1"> + <name>fsScan</name> + <c-extensions/> + <cpp-extensions>cc</cpp-extensions> + <header-extensions>h</header-extensions> + <sourceEncoding>UTF-8</sourceEncoding> + <make-dep-projects> + <make-dep-project>../IO</make-dep-project> + <make-dep-project>../vdr</make-dep-project> + <make-dep-project>../util</make-dep-project> + <make-dep-project>../networking</make-dep-project> + </make-dep-projects> + <sourceRootList/> + <confList> + <confElem> + <name>Debug</name> + <type>3</type> + </confElem> + <confElem> + <name>Release</name> + <type>3</type> + </confElem> + </confList> + </data> + </configuration> +</project> diff --git a/libs/mediaScan/src/AbstractMedia.cc b/libs/mediaScan/src/AbstractMedia.cc new file mode 100644 index 0000000..924f01a --- /dev/null +++ b/libs/mediaScan/src/AbstractMedia.cc @@ -0,0 +1,135 @@ +/** + * ======================== legal notice ====================== + * + * File: AbstractMedia.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <AbstractMedia.h> +#include <Logging.h> +#include <File.h> +#include <Url.h> +#include <Codec.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <util.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> + +cAbstractMedia::cAbstractMedia(const cFile &File, const char *Mime, SupportedMediaType Type) + : fd(-1) + , mediaType(Type) + , mimeType(Mime ? strdup(Mime) : NULL) + , uri(NULL) + , logicalPath(NULL) + , keyPath(File) +{ + uri = keyPath.toURI(); + logicalPath = cUrl::Decoder()->Decode(uri); +} + +cAbstractMedia::~cAbstractMedia() +{ + free(mimeType); + free(uri); + free(logicalPath); +} + +const char *cAbstractMedia::Name(void) const +{ + return keyPath.Name(); +} + +void cAbstractMedia::Refresh(void) +{ +} + +size_t cAbstractMedia::ReadChunk(char* Buf, size_t bufSize) +{ + long rv = 0; + const char *path = AbsolutePath(); + + if (fd < 1) { // fd stays open between various calls + fd = open(path, O_RDONLY | O_LARGEFILE); + if (fd < 1) { + esyslog("could not open requested path %s - Error #%d", path, errno); + return 0; + } + } + isyslog("have filehandle #%d (%s)", fd, path); + if ((rv = read(fd, Buf, bufSize)) < 0) + esyslog("ERROR: failed to read from file %s #%d", path, errno); + else + isyslog("read %u bytes from file %s", rv, path); + if (rv < (long) bufSize) { // most probabely end of file + close(fd); + } + return rv; +} + +void cAbstractMedia::Reset(void) +{ + if (fd >= 0) { + close(fd); + fd = -1; + } +} + +size_t cAbstractMedia::Size(void) const +{ + return keyPath.Size(); +} + +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); + } +} + +bool cAbstractMedia::NeedsFurtherScan(void) const +{ + return false; +} + +const char *cAbstractMedia::AbsolutePath(void) const +{ + return keyPath.AbsolutePath(); +} + +ulong cAbstractMedia::LastModified(void) const +{ + return keyPath.LastModified(); +} + +void cAbstractMedia::SetMimeType(const char *MimeType) +{ + if (mimeType == MimeType) return; + free(mimeType); + mimeType = strdup(MimeType); +} diff --git a/libs/mediaScan/src/AbstractMultiFileMovie.cc b/libs/mediaScan/src/AbstractMultiFileMovie.cc new file mode 100644 index 0000000..f679511 --- /dev/null +++ b/libs/mediaScan/src/AbstractMultiFileMovie.cc @@ -0,0 +1,108 @@ +/** + * ======================== legal notice ====================== + * + * File: AbstractMultiFileMovie.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <AbstractMultiFileMovie.h> +#include <Logging.h> +#include <stdlib.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> + +cAbstractMultiFileMovie::cAbstractMultiFileMovie(const cFile &File, const char *Mime, SupportedMediaType Type) + : cMovie(File, Mime, Type) + , movieFiles(0) + , curFileNo(0) + , buf(NULL) + , bufSize(0) + , name(NULL) +{ +} + +cAbstractMultiFileMovie::~cAbstractMultiFileMovie() +{ + free(name); + free(buf); +} + +bool cAbstractMultiFileMovie::checkBuffer() +{ + if (!buf && bufSize) { + buf = (char *) malloc(bufSize); + } + return buf != NULL; +} + +size_t cAbstractMultiFileMovie::ReadChunk(char* Buf, size_t bufSize) +{ + long rv = 0; + const char *path = NULL; + + if (fd < 1) { + path = FirstFile(); + fd = open(path, O_RDONLY | O_LARGEFILE); + if (fd < 1) { + esyslog("could not open requested path %s - Error #%d", path, errno); + return 0; + } + } + isyslog("have filehandle #%d (%s)", fd, path); + rv = read(fd, Buf, bufSize); + + if (rv < (long) bufSize) { + path = NextFile(); + + if (path) { + close(fd); + fd = open(path, O_RDONLY | O_LARGEFILE); + if (fd < 1) { + esyslog("could not open requested path %s - Error #%d", path, errno); + return 0; + } + isyslog("have filehandle #%d (%s)", fd, path); + rv = read(fd, Buf, bufSize); + } + if (rv < (long) bufSize) { + close(fd); + fd = -1; + } + } + return rv; +} + +void cAbstractMultiFileMovie::Reset() +{ + cMovie::Reset(); + curFileNo = 0; +} + +void cAbstractMultiFileMovie::SetName(char* Name) +///< Name must have already been allocated from heap! +{ + name = Name; +} + +void cAbstractMultiFileMovie::SetSize(size_t Size) +{ + size = Size; +}
\ No newline at end of file diff --git a/libs/mediaScan/src/Audio.cc b/libs/mediaScan/src/Audio.cc new file mode 100644 index 0000000..6c90fbc --- /dev/null +++ b/libs/mediaScan/src/Audio.cc @@ -0,0 +1,70 @@ +/** + * ======================== legal notice ====================== + * + * File: Audio.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <Audio.h> +#include <stddef.h> +#include <string.h> + +SupportedExtension cAudio::knownExtensions[] = { + { "aac", "audio/aac" }, + { "aif", "audio/x-aiff" }, + { "aiff", "audio/x-aiff" }, + { "aifc", "audio/x-aiff" }, + { "au", "audio/x-au" }, + { "fla", "audio/flac" }, + { "flac", "audio/flac" }, + { "oga", "audio/ogg" }, + { "ogg", "audio/ogg" }, + { "mka", "audio/x-matroska" }, + { "mp3", "audio/mpeg" }, + { "mp4", "audio/x-mpeg4" }, + { "m4a", "audio/x-m4" }, +// { "mpg", "audio/mpeg" }, + { "mpp", "audio/x-musepack" }, + { "ram", "audio/x-realaudio" }, + { NULL, NULL } +}; + +cAudio::cAudio(const cFile &File, const char *Mime) + : cAbstractMedia(File, Mime, Audio) +{ +} + +cAudio::~cAudio() +{ +} + +const char *cAudio::ContentType(const char* Extension) +{ + for (SupportedExtension *p = knownExtensions; p && p->extension; ++p) { + if (!strcasecmp(p->extension, Extension)) return p->mimeType; + } + return NULL; +} + +bool cAudio::NeedsFurtherScan(void) const +{ +//TODO: common meta data: artist, title + return true; +} diff --git a/libs/mediaScan/src/DVDImage.cc b/libs/mediaScan/src/DVDImage.cc new file mode 100644 index 0000000..0d23ae1 --- /dev/null +++ b/libs/mediaScan/src/DVDImage.cc @@ -0,0 +1,117 @@ +/** + * ======================== legal notice ====================== + * + * File: DVDImage.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <DVDImage.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#include "File.h" +#define FILE_MASK "VIDEO_TS/VTS_%02d_%d.VOB" + +cDVDImage::cDVDImage(const cFile &File) + : cAbstractMultiFileMovie(File, "video/mpeg", DVDImage) +{ + bufSize = 32; +} + +cDVDImage::~cDVDImage() +{ +} + +const char *cDVDImage::Name(void) const +{ + return cAbstractMedia::Name(); +} + +size_t cDVDImage::Size(void) const +{ + return cAbstractMedia::Size(); +} + +void cDVDImage::Refresh(void) +{ + size_t maxSize = 0; + size_t total = 0; + int numOfMovieFiles = 0; + cFile *tmp; + + movieFiles = 0; + mainMovie = 0; + if (!checkBuffer()) return; + for (int movie = 1; movie < 100; ++movie) { + total = 0; + for (int fileNo = 1;; ++fileNo) { + sprintf(buf, FILE_MASK, movie, fileNo); + tmp = new cFile(KeyPath(), buf); + + if (!tmp || !tmp->Exists()) { + numOfMovieFiles = fileNo - 1; + break; + } + total += tmp->Size(); + delete tmp; + } + if (total > maxSize) { + maxSize = total; + mainMovie = movie; + movieFiles = numOfMovieFiles; + } + } + SetSize(total); +} + +const char *cDVDImage::FirstFile(void) +{ + if (!checkBuffer()) return NULL; + + curFileNo = 1; + sprintf(buf, FILE_MASK, mainMovie, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + rv = tmp->AbsolutePath(); + delete tmp; + } + return rv; +} + +const char *cDVDImage::NextFile(void) +{ + if (++curFileNo < movieFiles) { + if (!checkBuffer()) return NULL; + sprintf(buf, FILE_MASK, mainMovie, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + tmp->AbsolutePath(); + delete tmp; + + return rv; + } + } + return NULL; +} diff --git a/libs/mediaScan/src/FSMediaScanner.cc b/libs/mediaScan/src/FSMediaScanner.cc new file mode 100644 index 0000000..f4ac14e --- /dev/null +++ b/libs/mediaScan/src/FSMediaScanner.cc @@ -0,0 +1,111 @@ +/** + * ======================== legal notice ====================== + * + * File: FSMediaScanner.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <FSMediaScanner.h> +#include <AbstractMedia.h> +#include <Logging.h> +#include <stddef.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <sys/dir.h> +#include <sys/stat.h> +#include <stdio.h> +#include <errno.h> +#include <util.h> + +void freeMediaCallback(void *elem) +{ + delete (cAbstractMedia *)elem; +} + +cFSMediaScanner::cFSMediaScanner() + : fileBufSize(512) + , pool(freeMediaCallback) + , mediaFactory(NULL) +{ +} + +cFSMediaScanner::~cFSMediaScanner() +{ + pool.clear(); + if (mediaFactory) delete mediaFactory; +} + +void cFSMediaScanner::SetMediaFactory(cMediaFactory* factory) +{ + mediaFactory = factory; +} + +// return true if "a" should be ordered before "b" +bool defaultMediaSortOrder(void *a, void *b) +{ + if (a == b) return false; + if (!a) return false; + if (!b) return true; + cAbstractMedia *m0 = (cAbstractMedia *)a; + cAbstractMedia *m1 = (cAbstractMedia *)b; + bool rv = false; + + if (m0->MediaType() == m1->MediaType()) + rv = strcasecmp(m0->Name(), m1->Name()) < 0; + else + rv = (m0->MediaType() - m1->MediaType()) < 0; + + return rv; +} + +void cFSMediaScanner::Refresh() +{ + if (!mediaFactory) return; + pool.clear(); + categories.clear(); + + mediaFactory->Scan4Media(pool); + cAbstractMedia::SupportedMediaType ot = cAbstractMedia::Invalid; + cAbstractMedia *m; + + pool.sort(defaultMediaSortOrder); + for (size_t i=0; i < pool.size(); ++i) { + m = (cAbstractMedia *) pool[i]; + if (m->MediaType() != ot) { + ot = m->MediaType(); + categories[ot] = i; + } + } +} + +cAbstractMedia *cFSMediaScanner::FindMedia(const char *Path) +{ + cAbstractMedia *rv = NULL, *tmp; + + for (size_t i=0; i < pool.size(); ++i) { + tmp = (cAbstractMedia *) pool[i]; + if (!strcmp(tmp->LogicalPath(), Path)) { + rv = tmp; + break; + } + } + return rv; +} diff --git a/libs/mediaScan/src/LegacyVdrRecording.cc b/libs/mediaScan/src/LegacyVdrRecording.cc new file mode 100644 index 0000000..5ee635c --- /dev/null +++ b/libs/mediaScan/src/LegacyVdrRecording.cc @@ -0,0 +1,104 @@ +/** + * ======================== legal notice ====================== + * + * File: LegacyVdrRecording.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <LegacyVdrRecording.h> +#include <StringBuilder.h> +#include <File.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#define FILE_MASK "%03d.vdr" + +cLegacyVdrRecording::cLegacyVdrRecording(const cFile &File) + : cAbstractMultiFileMovie(File, "video/mpeg", LegacyVdrRecording) +{ + cStringBuilder sb; + cFile *parent = File.Parent(); + + sb.Append(parent->Name()); + sb.Append(" (").Append(File.Name()).Append(")"); + delete parent; + SetName(sb.toString()); + bufSize = 8; +} + +cLegacyVdrRecording::~cLegacyVdrRecording() +{ +} + +void cLegacyVdrRecording::Refresh(void) +{ + size_t total = 0; + cFile *tmp; + + if (!checkBuffer()) return; + movieFiles = 0; + for (int fileNo = 1;; ++fileNo) { + sprintf(buf, FILE_MASK, fileNo); + tmp = new cFile(KeyPath(), buf); + + if (!tmp || !tmp->Exists()) { + movieFiles = fileNo - 1; + delete tmp; + break; + } + total += tmp->Size(); + delete tmp; + } + SetSize(total); +} + +const char *cLegacyVdrRecording::FirstFile(void) +{ + if (!checkBuffer()) return NULL; + curFileNo = 1; + sprintf(buf, FILE_MASK, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + rv = tmp->AbsolutePath(); + delete tmp; + } + return rv; +} + +const char *cLegacyVdrRecording::NextFile(void) +{ + if (++curFileNo < movieFiles) { + if (!checkBuffer()) return NULL; + sprintf(buf, FILE_MASK, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + rv = tmp->AbsolutePath(); + delete tmp; + + return rv; + } + } + return NULL; +} diff --git a/libs/mediaScan/src/MediaFactory.cc b/libs/mediaScan/src/MediaFactory.cc new file mode 100644 index 0000000..4dec763 --- /dev/null +++ b/libs/mediaScan/src/MediaFactory.cc @@ -0,0 +1,148 @@ +/** + * ======================== legal notice ====================== + * + * File: MediaFactory.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <MediaFactory.h> +#include <Audio.h> +#include <Movie.h> +#include <Picture.h> +#include <LegacyVdrRecording.h> +#include <VdrRecording.h> +#include <DVDImage.h> +#include <ServerConfig.h> +#include <StringBuilder.h> +#include <Logging.h> +#include <File.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +cMediaFactory::cMediaFactory(const cServerConfig &sc) + : config(sc) + , baseDirectory(sc.DocumentRoot()) + , scratch(NULL) + , scratchSize(1024) +{ + scratch = (char *)malloc(scratchSize); +} + +cMediaFactory::~cMediaFactory() +{ + free(scratch); +} + +void cMediaFactory::SetBaseDirectory(const cFile &dir) +{ + if (!dir.IsDirectory()) { + esyslog("ERROR: attempt to set base directory to a file (%s)", dir.Name()); + return; + } + baseDirectory = dir; +} + +int cMediaFactory::createMedia(void *opaque, cFile *Parent, const char *Name) +{ + if (!opaque) return -1; + cMediaFactory *mf = (cMediaFactory *) opaque; + + return mf->CreateMedia(Parent, 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; + + if (!curFile) { + esyslog("ERROR: out of memory!"); + return -1; + } + if (!curFile->Exists()) { + delete curFile; + return -1; + } + if (curFile->IsDirectory()) { + static const char *keyFiles[] = { "001.vdr", "00001.ts", "VIDEO_TS/VIDEO_TS.IFO", NULL }; + cFile *tmp; + const char *check; + int n=0; + + for (const char **kf = keyFiles; kf && *kf; ++kf, ++n) { + tmp = new cFile(*curFile, *kf); + check = tmp ? tmp->AbsolutePath() : NULL; + + if (tmp->Exists() && tmp->IsFile() && !tmp->IsDirectory()) { + switch (n) { + case 0: rv = new cLegacyVdrRecording(*curFile); break; + case 1: rv = new cVdrRecording(*curFile); break; + default: rv = new cDVDImage(*curFile); break; + } + } + delete tmp; + } + if (!rv) curFile->VisitFiles(createMedia, this); + } + else { + const char *extension = strrchr(Name, '.'); + + if (!extension) { + delete curFile; + + return -1; + } + ++extension; + mimeType = cMovie::ContentType(extension); + if (mimeType) rv = new cMovie(*curFile, mimeType); + else { + mimeType = cAudio::ContentType(extension); + if (mimeType) rv = new cAudio(*curFile, mimeType); + else { + mimeType = cPicture::ContentType(extension); + if (mimeType) rv = new cPicture(*curFile, mimeType); + } + } + } + delete curFile; + if (rv) { + if (config.WantExtendedScan() && rv->NeedsFurtherScan()) Scan4MetaData(rv); + mediaPool->push_back(rv); + return 0; + } + return -1; +} + +void cMediaFactory::Scan4Media(cManagedVector& pool) +{ + if (!baseDirectory.Exists() || !baseDirectory.IsDirectory()) return; + + baseDirectory.SetVirtualRoot(); + mediaPool = &pool; + baseDirectory.VisitFiles(createMedia, this); +} + +void cMediaFactory::Scan4MetaData(cAbstractMedia* media) +{ + //TODO: +} diff --git a/libs/mediaScan/src/Movie.cc b/libs/mediaScan/src/Movie.cc new file mode 100644 index 0000000..a63ff19 --- /dev/null +++ b/libs/mediaScan/src/Movie.cc @@ -0,0 +1,67 @@ +/** + * ======================== legal notice ====================== + * + * File: Movie.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <Movie.h> +#include <stddef.h> +#include <string.h> + +SupportedExtension cMovie::knownExtensions[] = { + { "asd", "video/x-ms-asf" }, + { "asf", "video/x-ms-asf" }, + { "avi", "video/x-msvideo" }, + { "dv", "video/x-dv" }, + { "flv", "video/x-flv" }, + { "gl", "video/x-gl" }, + { "iso", "application/x-iso9660-image" }, + { "ogv", "video/ogg" }, + { "mkv", "video/x-matroska" }, + { "mov", "video/quicktime" }, + { "mpg", "video/mpeg" }, + { "mpeg", "video/mpeg" }, + { "swf", "application/x-shockwave-flash" }, + { NULL, NULL } +}; + +cMovie::cMovie(const cFile &File, const char *Mime, SupportedMediaType Type) + : cAbstractMedia(File, Mime, Type) +{ +} + +cMovie::~cMovie() +{ +} + +const char *cMovie::ContentType(const char* Extension) +{ + for (SupportedExtension *p = knownExtensions; p && p->extension; ++p) { + if (!strcasecmp(p->extension, Extension)) return p->mimeType; + } + return NULL; +} + +bool cMovie::NeedsFurtherScan(void) const +{ +//TODO: common meta data: width, height, interlaced + return true; +} diff --git a/libs/mediaScan/src/Picture.cc b/libs/mediaScan/src/Picture.cc new file mode 100644 index 0000000..19a02a1 --- /dev/null +++ b/libs/mediaScan/src/Picture.cc @@ -0,0 +1,69 @@ +/** + * ======================== legal notice ====================== + * + * File: Picture.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <Picture.h> +#include <stddef.h> +#include <string.h> + +SupportedExtension cPicture::knownExtensions[] = { + { "bmp", "image/x-windows-bmp" }, + { "gif", "image/gif" }, + { "jff", "image/jpeg" }, + { "jfif", "image/jpeg" }, + { "jif", "image/jpeg" }, + { "jp2", "image/jp2" }, + { "jpe", "image/jpeg" }, + { "jpeg", "image/jpeg" }, + { "jpg", "image/jpeg" }, + { "jpm", "image/jpm" }, + { "jpx", "image/jpx" }, + { "pbm", "image/x-portable-bitmap" }, + { "pct", "image/x-pict" }, + { "pcx", "image/x-pcx" }, + { "png", "image/png" }, + { "pnm", "image/x-portable-anymap" }, + { "ppm", "image/x-portable-pixmap" }, + { "qti", "image/quicktime" }, + { "ras", "image/x-cmu-raster" }, + { "rgb", "image/x-rgb" }, + { NULL, NULL } +}; + +cPicture::cPicture(const cFile &File, const char *Mime) +: cAbstractMedia(File, Mime, Picture) +{ +} + +cPicture::~cPicture() +{ +} + +const char *cPicture::ContentType(const char* Extension) +{ + for (SupportedExtension *p = knownExtensions; p && p->extension; ++p) { + if (!strcasecmp(p->extension, Extension)) return p->mimeType; + } + return NULL; +} + diff --git a/libs/mediaScan/src/VdrRecording.cc b/libs/mediaScan/src/VdrRecording.cc new file mode 100644 index 0000000..03abccf --- /dev/null +++ b/libs/mediaScan/src/VdrRecording.cc @@ -0,0 +1,103 @@ +/** + * ======================== legal notice ====================== + * + * File: VdrRecording.cc + * 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 + * + * -------------------------------------------------------------- + */ +#include <VdrRecording.h> +#include <StringBuilder.h> +#include <File.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#define FILE_MASK "/%05d.ts" + +cVdrRecording::cVdrRecording(const cFile &File) + : cAbstractMultiFileMovie(File, "video/mpeg", VdrRecording) +{ + cStringBuilder sb; + cFile *parent = File.Parent(); + + sb.Append(parent->Name()); + sb.Append(" (").Append(File.Name()).Append(")"); + delete parent; + SetName(sb.toString()); + bufSize = 10; +} + +cVdrRecording::~cVdrRecording() +{ +} + +void cVdrRecording::Refresh(void) +{ + size_t total = 0; + cFile *tmp; + + if (!checkBuffer()) return; + movieFiles = 0; + for (int fileNo = 1;; ++fileNo) { + sprintf(buf, FILE_MASK, fileNo); + tmp = new cFile(KeyPath(), buf); + + if (!tmp || !tmp->Exists()) { + movieFiles = fileNo - 1; + delete tmp; + break; + } + total += tmp->Size(); + delete tmp; + } + SetSize(total); +} + +const char *cVdrRecording::FirstFile(void) +{ + if (!checkBuffer()) return NULL; + curFileNo = 1; + sprintf(buf, FILE_MASK, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + rv = tmp->AbsolutePath(); + delete tmp; + } + return rv; +} + +const char *cVdrRecording::NextFile(void) +{ + if (++curFileNo < movieFiles) { + if (!checkBuffer()) return NULL; + sprintf(buf, FILE_MASK, curFileNo); + cFile *tmp = new cFile(KeyPath(), buf); + const char *rv = NULL; + + if (tmp) { + rv = tmp->AbsolutePath(); + delete tmp; + + return rv; + } + } + return NULL; +} diff --git a/libs/mediaScan/summary.txt b/libs/mediaScan/summary.txt new file mode 100644 index 0000000..e4c3847 --- /dev/null +++ b/libs/mediaScan/summary.txt @@ -0,0 +1 @@ +libMediaScan: mediatypes and media scanning |