summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING340
-rw-r--r--HISTORY40
-rw-r--r--Makefile164
-rw-r--r--README129
-rw-r--r--channelmap.conf.example30
-rw-r--r--common.cpp24
-rw-r--r--common.h799
-rw-r--r--database/database.cpp300
-rw-r--r--database/metadata.cpp575
-rw-r--r--database/object.cpp1887
-rw-r--r--database/resources.cpp355
-rw-r--r--dlna/avdetector.cpp378
-rw-r--r--dlna/dlna.cpp197
-rw-r--r--dlna/profiles/aac.cpp8
-rw-r--r--dlna/profiles/ac3.cpp85
-rw-r--r--dlna/profiles/amr.cpp8
-rw-r--r--dlna/profiles/atrac3plus.cpp8
-rw-r--r--dlna/profiles/container.cpp117
-rw-r--r--dlna/profiles/jpeg.cpp11
-rw-r--r--dlna/profiles/lpcm.cpp8
-rw-r--r--dlna/profiles/mpa.cpp121
-rw-r--r--dlna/profiles/mpeg1.cpp15
-rw-r--r--dlna/profiles/mpeg2.cpp216
-rw-r--r--dlna/profiles/mpeg4_p10.cpp148
-rw-r--r--dlna/profiles/mpeg4_p2.cpp129
-rw-r--r--dlna/profiles/png.cpp11
-rw-r--r--dlna/profiles/wma.cpp8
-rw-r--r--dlna/profiles/wmv9.cpp8
-rwxr-xr-xhttp/icons/upnpIconLrg.jpegbin6620 -> 0 bytes
-rwxr-xr-xhttp/icons/upnpIconLrg.pngbin17309 -> 0 bytes
-rwxr-xr-xhttp/icons/upnpIconSm.jpegbin2416 -> 0 bytes
-rwxr-xr-xhttp/icons/upnpIconSm.pngbin4769 -> 0 bytes
-rw-r--r--http/xml/cds_scpd.xml145
-rw-r--r--http/xml/cms_scpd.xml133
-rw-r--r--inc/avdetector.h124
-rw-r--r--inc/config.h74
-rw-r--r--inc/database.h1024
-rw-r--r--inc/filehandle.h108
-rw-r--r--inc/livereceiver.h105
-rw-r--r--inc/menusetup.h103
-rw-r--r--inc/metadata.h189
-rw-r--r--inc/object.h1576
-rw-r--r--inc/profiles.h32
-rw-r--r--inc/profiles/aac.h36
-rw-r--r--inc/profiles/ac3.h24
-rw-r--r--inc/profiles/amr.h17
-rw-r--r--inc/profiles/atrac3plus.h16
-rw-r--r--inc/profiles/container.h47
-rw-r--r--inc/profiles/jpeg.h24
-rw-r--r--inc/profiles/lpcm.h16
-rw-r--r--inc/profiles/mpa.h25
-rw-r--r--inc/profiles/mpeg1.h16
-rw-r--r--inc/profiles/mpeg2.h68
-rw-r--r--inc/profiles/mpeg4_p10.h153
-rw-r--r--inc/profiles/mpeg4_p2.h80
-rw-r--r--inc/profiles/png.h22
-rw-r--r--inc/profiles/profile_data.h213
-rw-r--r--inc/profiles/wma.h18
-rw-r--r--inc/profiles/wmv9.h24
-rw-r--r--inc/recplayer.h53
-rw-r--r--inc/resources.h318
-rw-r--r--inc/search.h156
-rw-r--r--inc/server.h221
-rw-r--r--inc/upnp/connectionmanager.h99
-rw-r--r--inc/upnp/contentdirectory.h56
-rw-r--r--inc/upnp/dlna.h97
-rw-r--r--inc/upnp/service.h119
-rw-r--r--inc/util.h151
-rw-r--r--inc/webserver.h160
-rw-r--r--misc/config.cpp135
-rw-r--r--misc/menusetup.cpp205
-rw-r--r--misc/search.cpp809
-rw-r--r--misc/util.cpp535
-rw-r--r--po/de-DE.po271
-rw-r--r--po/de-DE.po~273
-rw-r--r--receiver/livereceiver.cpp188
-rw-r--r--receiver/recplayer.cpp123
-rw-r--r--server/server.cpp371
-rw-r--r--server/webserver.cpp363
-rw-r--r--upnp.cpp140
-rw-r--r--upnp.h120
-rw-r--r--upnp/connectionmanager.cpp393
-rw-r--r--upnp/contentdirectory.cpp306
-rw-r--r--upnp/service.cpp118
84 files changed, 0 insertions, 16311 deletions
diff --git a/COPYING b/COPYING
deleted file mode 100644
index f90922e..0000000
--- a/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/HISTORY b/HISTORY
deleted file mode 100644
index 05b1439..0000000
--- a/HISTORY
+++ /dev/null
@@ -1,40 +0,0 @@
-VDR Plugin 'upnp' Revision History
-----------------------------------
-
-2009-01-25: Version 0.0.2-alpha1
-
- - Bug: A minor bug prevented the plugin from detecting the resources
- correnctly
-
-2009-01-24: Version 0.0.2-alpha0
-
- - New: Added record streaming support for SDTV
- HDTV is not working yet, as it requires different DLNA profiles
- - Bug: Improved live-tv streaming quality, which will hopefully fix the
- problem with the buffer strategy and channels with bad bandwidth
- - New: Rearranged folder structure to meet future features
- - New: Added german translation
- - New: support for DLNA compatible devices. For those devices a special
- patch is required which must be applied to libupnp-1.6.6.
- See README for more information
- - New: Added new command line option to specify the destination folder
- for the metadata database and the webfolder.
- See README for more information
-
-2009-11-19: Version 0.0.1-alpha4
-
-- New: Added options for verbosity level and autodetect settings.
-
-2009-10-23: Version 0.0.1-alpha1
-
-- Fixed #185: Database rejected statements with single quotes inside strings
-
-2009-10-23: Version 0.0.1-alpha0
-
-- Initial revision.
-- Known limitations: currently only channel lists with less than 30 channels
- work.
-- LiveTV support
-- Limited sort capabilities: Title, Creator, Write status, Publisher,
- Description, Long description, Genre
- Note: Sort will only work if this properties are present
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f01ccbb..0000000
--- a/Makefile
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Makefile for a Video Disk Recorder plugin
-#
-# $Id$
-
-# The official name of this plugin.
-# This name will be used in the '-P...' option of VDR to load the plugin.
-# By default the main source file also carries this name.
-# IMPORTANT: the presence of this macro is important for the Make.config
-# file. So it must be defined, even if it is not used here!
-#
-PLUGIN = upnp
-COMMON = common.h
-
-### The version number of this plugin (taken from the main source file):
-
-VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$6 }' | sed -e 's/[";]//g')
-
-### The C++ compiler and options:
-
-CXX ?= gcc
-CXXFLAGS ?= -fPIC -g -Wall -O2 -Wextra -Woverloaded-virtual -Wno-parentheses -Wl,-R/usr/local/lib
-
-### The directory environment:
-
-VDRDIR = ../../..
-LIBDIR = ../../lib
-TMPDIR = /tmp
-
-### Allow user defined options to overwrite defaults:
-
--include $(VDRDIR)/Make.config
-
-### The version number of VDR's plugin API (taken from VDR's "config.h"):
-
-APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
-
-### The name of the distribution archive:
-
-ARCHIVE = $(PLUGIN)-$(VERSION)
-PACKAGE = vdr-$(ARCHIVE)
-
-### Includes and Defines (add further entries here):
-
-LIBS += -lupnp -lixml -lsqlite3 -lavformat -lavcodec
-
-INCLUDES += -I$(VDRDIR)/include -I/usr/include -Iinc \
-
-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-
-ifdef WITH_WINDOWS_MEDIA
- DEFINES += -DWITH_WINDOWS_MEDIA
-endif
-
-DEFINES += -DWITHOUT_AUDIO -DWITHOUT_CUSTOM_VIDEOS
-
-### The object files (add further files here):
-
-# DLNA Profiles
-DLNA_PROFILES = dlna/profiles/aac.o \
- dlna/profiles/ac3.o \
- dlna/profiles/amr.o \
- dlna/profiles/atrac3plus.o \
- dlna/profiles/jpeg.o \
- dlna/profiles/lpcm.o \
- dlna/profiles/mpa.o \
- dlna/profiles/mpeg1.o \
- dlna/profiles/mpeg2.o \
- dlna/profiles/mpeg4_p2.o \
- dlna/profiles/mpeg4_p10.o \
- dlna/profiles/png.o \
- dlna/profiles/container.o
-
-# Windows Media Formats
-ifdef WITH_WINDOWS_MEDIA
- DLNA_PROFILES += dlna/profiles/wma.o \
- dlna/profiles/wmv9.o
-endif
-
-DLNA_OBJS = dlna/dlna.o \
- dlna/avdetector.o \
- $(DLNA_PROFILES)
-
-# Root folder
-OBJS = $(PLUGIN).o \
- common.o \
- misc/menusetup.o \
- misc/util.o \
- misc/config.o \
- misc/search.o \
- database/database.o \
- database/metadata.o \
- database/object.o \
- database/resources.o \
- server/server.o \
- server/webserver.o \
- upnp/service.o \
- upnp/connectionmanager.o \
- upnp/contentdirectory.o \
- receiver/livereceiver.o \
- receiver/recplayer.o \
- $(DLNA_OBJS)
-
-### The main target:
-
-all: libvdr-$(PLUGIN).so i18n
-
-### Implicit rules:
-
-%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $(LIBS) -o $@ $<
-
-### Dependencies:
-
-MAKEDEP = $(CXX) -MM -MG
-DEPFILE = .dependencies
-
-$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@
-
--include $(DEPFILE)
-
-### Internationalization (I18N):
-
-PODIR = po
-LOCALEDIR = $(VDRDIR)/locale
-I18Npo = $(wildcard $(PODIR)/*.po)
-I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
-I18Npot = $(PODIR)/$(PLUGIN).pot
-
-%.mo: %.po
- msgfmt -c -o $@ $<
-
-$(I18Npot): $(wildcard *.cpp)
- xgettext -C -cTRANSLATORS --no-wrap --no-location -k -k_ -ktr -ktrNOOP --msgid-bugs-address='<see README>' -o $@ $(OBJS:%.o=%.cpp)
-
-%.po: $(I18Npot)
- msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
- @touch $@
-
-$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
- @mkdir -p $(dir $@)
- cp $< $@
-
-.PHONY: i18n
-i18n: $(I18Nmsgs) $(I18Npot)
-
-### Targets:
-
-libvdr-$(PLUGIN).so: $(OBJS)
- $(CXX) $(CXXFLAGS) $(LIBS) -shared $(OBJS) -o $@ -lc
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
-
-dist: clean
- @-rm -rf $(TMPDIR)/$(ARCHIVE)
- @mkdir $(TMPDIR)/$(ARCHIVE)
- @cp -a * $(TMPDIR)/$(ARCHIVE)
- @tar --exclude="doc" -czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
- @-rm -rf $(TMPDIR)/$(ARCHIVE)
- @echo Distribution package created as $(PACKAGE).tgz
-
-clean:
- @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
diff --git a/README b/README
deleted file mode 100644
index d6404a7..0000000
--- a/README
+++ /dev/null
@@ -1,129 +0,0 @@
-This is a "plugin" for the Video Disk Recorder (VDR).
-
-Written by: Denis Loh <denis.loh@hftl.de>
- Andreas Günther <andreas.guenther@hftl.de>
-
-Project's homepage: http://upnp.vdr-developer.org
-
-Latest version available at: http://upnp.vdr-developer.org
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-See the file COPYING for more information.
-
-Please note: This plugin is written under the terms of open source
-redistribution by
-
-Hochschule für Telekommunikation Leipzig,
-University of Applied Science
-Gustav-Freytag-Straße 43-45
-04277 Leipzig
-Germany
-http://www.hft-leipzig.de
-
-All rights reserved.
-
-
-Description:
-
-UPnP/DLNA Plugin for Video Disk Recorder
-
-This Plugins extends the VDR with the possibility to act as an UPnP/DLNA Media
-Server (DMS). It will serve VDR's contents in the network to any UPnP-AV and
-DLNA capable devices.
-
-The plugin requires a valid network connection with a IPv4 address. It will find
-its settings automatically by default. In this case, the first network device in
-the network device list with a valid IPv4 address and port 49152 will be used
-for connections. You can change this behavior either by setting the command line
-options or by editing the setup via the VDRs setup page. The command line
-options have a higher priority and substitute the menu settings.
-
-The command line settings are:
- -i <interface> --int=<interface> The server network
- interface
- e.g: eth0, wlan1 etc.
- If given option '-a' must
- be absent.
- -a <address> --address=<address> The server IPv4 address.
- If given option '-i' must
- be absent.
- -p <port> --port=<port> The server port
- Supported ports:
- 0 (auto detect)
- 49152-65535 (user defined)
- -d --autodetect Force auto detection
- Use this option to
- overwrite the setup menu
- options.
- -v --verbose Increase verbosity level
- The more v options the
- higher the output level
- --dbdir=<directory> The directory in which the
- metadata database is stored
- --httpdir=<directory> The directory where the
- http documents are located
-
-The verbose option can be more than once. With each option the verbosity level
-will be increased. The maximum level is 5. Further options are silently ignored.
-
- -v Print most important messages
- -vv Print messages from the components
- i.e. the webserver, CDS, CMS, etc.
- -vvv Print messages from receivers and players
- and other additional components
- -vvvv You can't get enough, hum?
- This will print SQL messages and DIDL
- messages
- -vvvvv Can you read the matrix? You can't?
- Then try first reading SQL statements,
- fetches, buffer and parser outputs or
- any other outputs.
-
-If not options are set, menu options will be used.
-
-The server has a unique identifier, which is
-"uuid:b120ba52-d88d-4500-9b64-888971d83fd3". Other devices in the network can
-find and identify the VDR UPnP Server with this ID. However, the server should
-be found automatically and being listed under the supported media server
-devices. If not, please report this as a bug on the project homepage or send an
-email to the developers of this plugin with the full device description and, if
-applicable, the errors thrown by the media player device and/or the server.
-
-
-Dependencies:
-
-This plugin is tested with and requires the following libraries to work:
-
-libupnp-1.6.6 The UPnP SDK
-libsqlite-3.6 SQLite 3 Database
-libavcodec-svn20090303 FFMPEG Library for analyzing audio video codecs
-libavformat-svn20090303 FFMPEG Library for analyzing audio video formats
-boost::spirit Grammar parser
-boost::function Boost function library
-boost::bind Boost bind library
-
-The boost libraries are usually available in a packed version, so that only a
-single installation is required. The FFMPEG libraries comes with FFMPEG itself.
-
-ATTENTION: DO NOT USE ANOTHER VERSION OF LIBUPNP.
-
-libupnp-1.8.0 is known not to work with this plugin! Versions below 1.6.6 may
-work. However, there may exist some unknown issues.
-
-If you want to know everything about the code, please see the source code
-documentation at http://upnp.vdr-developer.org/docs/ where all public members
-are explained.
-
-I appreciate, if you help making the plugin better. If you find any project
-related errors or missing features, please open a new ticket at the plugin
-website with a detailed description of what you want or what happened.
-
-
-Patching the libupnp:
-
-If you have a DLNA compliant device such as TVs or streaming clients, you may
-require a patched version of libupnp. You can download the patch on the project
-website. \ No newline at end of file
diff --git a/channelmap.conf.example b/channelmap.conf.example
deleted file mode 100644
index 6e541d5..0000000
--- a/channelmap.conf.example
+++ /dev/null
@@ -1,30 +0,0 @@
-#####################################################
-# #
-# VDR UPnP/DLNA Plugin #
-# #
-# Channel mapping #
-# #
-#####################################################
-#
-# Default behavior of the plugin is that it will load
-# all channels from VDRs channels.conf and creates
-# a Video Broadcast item for every single channel
-#
-# It can be controlled by combining or excluding
-# certain channels in this configuration file
-#
-# Syntax:
-#
-# Each rule must be written on a separate line
-#
-# Combine multiple channels (at least 2)
-# <ChannelID>:<ChannelID>[:<ChannelID>]
-#
-# Example: T-8468-514-516:C-8468-514-516:S-8468-514-516
-# This will combine three channels to one metadata item
-#
-# Exclude a channel from list
-# -<ChannelID>
-#
-# Example: -T-8468-514-516
-# This will exclude that channel from loading
diff --git a/common.cpp b/common.cpp
deleted file mode 100644
index 513317d..0000000
--- a/common.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * File: common.cpp
- * Author: savop
- *
- * Created on 17. April 2009, 20:53
- */
-
-#include <stdarg.h>
-#include "common.h"
-#include "config.h"
-
-#define MESSAGE_SIZE 256
-
-void message(int Level, const char* , int , const char* Format, ...){
- if(Level && cUPnPConfig::verbosity >= Level){
- va_list ap;
- char Message[MESSAGE_SIZE];
-
- snprintf(Message, sizeof(Message), "[%d] %s", cThread::ThreadId(), Format);
- va_start(ap, Format);
- vsyslog(LOG_NOTICE, Message, ap);
- va_end(ap);
- }
-} \ No newline at end of file
diff --git a/common.h b/common.h
deleted file mode 100644
index 7a19aa1..0000000
--- a/common.h
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
- * File: common.h
- * Author: savop
- *
- * Created on 19. April 2009, 15:22
- */
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-#include "util.h"
-#include <libintl.h>
-#include <string.h>
-#include <vdr/tools.h>
-#include <vdr/i18n.h>
-#include <vdr/remux.h>
-
-/****************************************************
- *
- * Table of contents
- *
- * This file includes all (or at least most) constant
- * definitions for this plugin. As was growing very
- * fast, I decided to insert this table of contents
- * for faster navigations. However, you have to scroll
- * on your own.
- *
- * 0. Global constants
- * 1. VDR and the VDR subsystem
- * 1.1 Versioning
- * 1.2 Logging
- * 1.3 Plugin constants
- * 1.4 Plugin setup
- * 2. UPnP
- * 2.1 UPnP Namespaces
- * 2.2 Directory hierarchy
- * 2.3 internal Webserver
- * 2.4 Device description
- * 2.5 Connection Manager Service (CMS)
- * 2.6 Content Directory Service (CDS)
- * 2.7 UPnP AV Transport (AVT)
- * 2.8 Media classes
- * 2.9 Storage Media
- * 2.10 Known Errors
- * 2.11 Write Status
- * 2.12 DIDL Properties
- * 3. DLNA
- * 3.1 Protocol Info Fields
- * 3.2 Protocol Info Flags
- * 3.3 Media Profiles
- * 3.4 Container types
- * 3.5 Device types
- * 4. SQLite
- * 4.1 Database setup
- *
- ****************************************************/
-
-/****************************************************
- *
- * 0. Global constants
- *
- ****************************************************/
-
-#define IN
-#define OUT
-#define INOUT
-
-#define TOSTRING(s) #s
-
-#define FALSE 0
-#define TRUE 1
-
-#define bool_t uint8_t
-
-/**
- * Translation with gettext()
- */
-#ifndef _
-#define _(s) gettext(s)
-#endif
-
-#define KB(i) i*1024
-#define MB(i) i*KB(1024)
-
-#define SIZEOF_UUID_STRING 37 // 00000000-0000-0000-0000-000000000000 = 32 + 4 + 1
-
-#define strdup0(s) (s!=NULL?strdup(s):NULL)
-
-#define att(s) strchr(s,'@')!=NULL?strchr(s,'@')+1:NULL
-#define prop(s) substr(s, 0, strchr(s,'@')-s)
-
-#ifdef WITHOUT_AUDIO
- #define WITHOUT_RADIO
- #define WITHOUT_CUSTOM_AUDIO
-#endif
-
-#ifdef WITHOUT_VIDEO
- #define WITHOUT_TV
- #define WITHOUT_RECORDS
- #define WITHOUT_CUSTOM_VIDEO
-#endif
-
-void message(int level, const char* File, int Line, const char* Format, ...) __attribute__ ((format (printf, 4, 5)));
-
-/****************************************************
- *
- * 1. VDR and the VDR subsystem
- *
- ****************************************************/
-
-//#define VDR_RECORDFILE_PATTERN_PES "%s/%03d.vdr"
-//#define VDR_RECORDFILE_PATTERN_TS "%s/%05d.ts"
-#define VDR_MAX_FILES_PER_TSRECORDING 65535
-#define VDR_MAX_FILES_PER_PESRECORDING 255
-//#define VDR_FILENAME_BUFSIZE 2048
-
-/****************************************************
- *
- * 1.1 Versioning
- *
- ****************************************************/
-
-#define VERSION_INT(maj, min, mic) (maj<<16 | min<<8 | mic)
-#define VERSION_DOT(maj, min, mic) maj ##.## min ##.## mic
-#define VERSION_STR(maj, min, mic) TOSTRING(maj.min.mic)
-
-/* If any changes on the version number are commited, please change the version
- * string in the main file "upnp.c" as well to avoid errors with the makefile */
-#define PLUGIN_VERSION_MAJOR 0
-#define PLUGIN_VERSION_MINOR 0
-#define PLUGIN_VERSION_MICRO 2
-/* The plugin version as dot-separated string */
-#define PLUGIN_VERSION VERSION_STR(PLUGIN_VERSION_MAJOR, \
- PLUGIN_VERSION_MINOR, \
- PLUGIN_VERSION_MICRO)
-/* The plugin version as integer representation */
-#define PLUGIN_VERSION_INT VERSION_INT(PLUGIN_VERSION_MAJOR, \
- PLUGIN_VERSION_MINOR, \
- PLUGIN_VERSION_MICRO)
-
-/****************************************************
- *
- * 1.2 Logging
- *
- ****************************************************/
-
-/**
- * Log errors
- *
- * Errors are critical problems which cannot handled by the server and needs
- * the help by the user.
- */
-#define ERROR(s...) esyslog("UPnP server error:" s)
-/**
- * Log warnings
- *
- * Warnings indicate problems with the server which can be handled
- * by the server itself or are not critical to the servers functionality
- */
-#define WARNING(s...) isyslog("UPnP server warning: " s)
-/**
- * Log messages
- *
- * Messages are additional information about the servers behavior. This will
- * be useful for debugging.
- */
-#ifndef DEBUG
-#define MESSAGE(l,s...) message(l,__FILE__, __LINE__, "UPnP server message: " s)
-#else
-#define MESSAGE(l,s...) dsyslog("UPnP server message: " s)
-#endif
-
-
-/**
- * Define at which level the different messages will be printed
- *
- * The log levels reach from 1 to 5, where 1 is the highest log
- * priority and 5 the lowest. 0 will deactivate the logging of
- * the message. If you want to specifiy a certain level, add
- * 'v' options as many as required for the log level.
- *
- * @example
- * - \-v Show warnings
- * - \-vv Log level 1
- * - \-vvv Log level 2
- * - \-vvvv Log level 3
- * - \-vvvvv Log level 4
- * - \-vvvvvv Log level 5
- */
-#define VERBOSE_SQL 4 ///< SQL messages (open DB, close DB etc.)
-#define VERBOSE_SQL_FETCHES 0 ///< SQL fetch messages (SELECT only)
-#define VERBOSE_SQL_STATEMENTS 0 ///< all SQL statements
-#define VERBOSE_DIDL 4 ///< print DIDL related messages
-#define VERBOSE_LIVE_TV 3 ///< print live TV related messages
-#define VERBOSE_RECORDS 3 ///< print messages related to records
-#define VERBOSE_CUSTOMFILES 3 ///< print messages related to custom files and sometimes records
-#define VERBOSE_SDK 1 ///< print important messages of the program flow
-#define VERBOSE_EPG_UPDATES 3 ///< show information on EPG changes
-#define VERBOSE_WEBSERVER 2 ///< print actions done by the webserver
-#define VERBOSE_MODIFICATIONS 2 ///< show modifications to objects or anything else
-#define VERBOSE_METADATA 4 ///< print additional metadata information
-#define VERBOSE_CUSTOM_OUTPUT 5 ///< everything else...
-#define VERBOSE_PARSERS 5 ///< print the parsers output
-#define VERBOSE_BUFFERS 4 ///< print the buffer output
-#define VERBOSE_CDS 2 ///< print messages from the content directory
-#define VERBOSE_CMS 2 ///< print messages from the connection manager
-#define VERBOSE_OBJECTS 3 ///< print messages related to objects
-
-/****************************************************
- *
- * 1.3 Plugin constants
- *
- ****************************************************/
-
-/* The authors of the plugin */
-#define PLUGIN_AUTHORS "Andreas Günther, Denis Loh"
-/* The web site of the plugin */
-#define PLUGIN_WEB_PAGE "http://upnp.methodus.de"
-/* A small discription of the plugin, which is also used as the device description */
-#define PLUGIN_DESCRIPTION "UPnP/DLNA compliant Media Server functionality for VDR"
-/* The short plugin name. This is used as the main menu of VDR */
-#define PLUGIN_SHORT_NAME "DLNA/UPnP"
-/* A somewhat longer name, a.k.a device name */
-#define PLUGIN_NAME "VDR DLNA/UPnP Media Server"
-/* Where the plugin can be downloaded */
-#define PLUGIN_DOWNLOAD_PAGE PLUGIN_WEB_PAGE
-
-/****************************************************
- *
- * 1.4 Plugin setup
- *
- ****************************************************/
-
-#define SETUP_SERVER_ENABLED "Server.Enabled"
-#define SETUP_SERVER_INT "Server.Int"
-#define SETUP_SERVER_PORT "Server.Port"
-#define SETUP_SERVER_AUTO "Server.AutoDetect"
-#define SETUP_SERVER_ADDRESS "Server.Address"
-#define SETUP_WEBSERVER_DIR "Webserver.Directory"
-#define SETUP_DATABASE_DIR "Database.Directory"
-
-/* The server port range where the server interacts with clients */
-#define SERVER_MIN_PORT 49152
-#define SERVER_MAX_PORT 65535
-
-#define RECEIVER_LIVEBUFFER_SIZE MB(1)
-#define RECEIVER_OUTPUTBUFFER_SIZE MB(1)
-#define RECEIVER_RINGBUFFER_MARGIN 10*TS_SIZE
-
-/****************************************************
- *
- * 2. UPnP
- *
- ****************************************************/
-
-/*The maximum size of the device description file
- *must NOT exceed 20KB including HTTP headers
- */
-#define UPNP_DEVICE_DESCRIPTION_MAX_LEN KB(20)
-/* The maximum size of the SOAP requests */
-#define UPNP_SOAP_MAX_LEN KB(20)
-/* The max age of announcements in seconds */
-#define UPNP_ANNOUNCE_MAX_AGE 1800
-/* Max resources per object including
- * preview images and thumbnails
- */
-#define UPNP_MAX_RESOURCES_PER_OBJECT 16
-
-enum UPNP_RESOURCE_TYPES {
- UPNP_RESOURCE_CHANNEL,
- UPNP_RESOURCE_RECORDING,
- UPNP_RESOURCE_FILE,
- UPNP_RESOURCE_URL
-};
-
-/****************************************************
- *
- * 2.1 Namespaces
- *
- ****************************************************/
-
-#define UPNP_XMLNS_UPNP "urn:schemas-upnp-org:metadata-1-0/upnp/"
-#define UPNP_XMLNS_DIDL "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
-#define UPNP_XMLNS_DLNA_META "urn:schemas-dlna-org:metadata-1-0/"
-#define UPNP_XMLNS_UPNP_DEV "urn:schemas-upnp-org:device-1-0"
-#define UPNP_XMLNS_DLNA_DEV "urn:schemas-dlna-org:device-1-0"
-#define UPNP_XMLNS_DUBLINCORE "http://purl.org/dc/elements/1.1/"
-
-#define UPNP_XMLNS_PREFIX_UPNP "upnp"
-#define UPNP_XMLNS_PREFIX_DC "dc"
-#define UPNP_XMLNS_PREFIX_DIDL ""
-#define UPNP_XMLNS_PREFIX_DLNA "dlna"
-
-/****************************************************
- *
- * 2.2 Directory hierarchy
- *
- ****************************************************/
-
-#define UPNP_DIR_CONTROL "/control"
-#define UPNP_DIR_EVENT "/event"
-#define UPNP_DIR_XML "/xml"
-#define UPNP_DIR_SHARES "/shares"
-#define UPNP_DIR_PRESENTATION "/http"
-#define UPNP_DIR_ICONS "/icons"
-
-/****************************************************
- *
- * 2.3 internal webserver
- *
- ****************************************************/
-
-#define UPNP_WEB_MAX_FILE_HANDLES 512
-
-#define UPNP_WEB_PRESENTATION_URL "/index.html"
-#define UPNP_WEB_SERVER_ROOT_DIR UPNP_DIR_PRESENTATION
-
-enum UPNP_WEB_METHODS {
- UPNP_WEB_METHOD_BROWSE,
- UPNP_WEB_METHOD_SHOW,
- UPNP_WEB_METHOD_STREAM,
- UPNP_WEB_METHOD_SEARCH,
- UPNP_WEB_METHOD_DOWNLOAD
-};
-
-/****************************************************
- *
- * 2.4 Device description
- *
- ****************************************************/
-
-/*The device type of the server*/
-#define UPNP_DEVICE_TYPE "urn:schemas-upnp-org:device:MediaServer:1"
-/*Path to device description*/
-#define UPNP_DEVICE_DESCRIPTION_PATH UPNP_WEB_SERVER_ROOT_DIR "/ms_desc.xml"
-/*Values to identify device and services*/
-#define UPNP_DEVICE_UDN "uuid:b120ba52-d88d-4500-9b64-888971d83fd3"
-/* The friendly device name, human readable */
-#define UPNP_DEVICE_FRIENDLY_NAME PLUGIN_NAME
-/* The guys who wrote the crap */
-#define UPNP_DEVICE_MANUFACTURER PLUGIN_AUTHORS
-/* The website of the manufacturer, in this case the plugin website */
-#define UPNP_DEVICE_MANUFACTURER_URL PLUGIN_WEB_PAGE
-/* There is just the one and only model of the plugin, the plugin itself */
-#define UPNP_DEVICE_MODEL_DESCRIPTION PLUGIN_DESCRIPTION
-/* The plugin name... */
-#define UPNP_DEVICE_MODEL_NAME PLUGIN_NAME
-/* The plugin version */
-#define UPNP_DEVICE_MODEL_NUMBER PLUGIN_VERSION
-/* The website of the plugin, this might be different to the manufactures homepage
- * and should redirect to a download mirror where the plugin can be obtained.
- */
-#define UPNP_DEVICE_MODEL_URL PLUGIN_DOWNLOAD_PAGE
-/* The serial number of the plugin. This is the integer value of the version */
-#define UPNP_DEVICE_SERIAL_NUMBER "VDR_DLNAUPNP_" PLUGIN_VERSION
-
-#define UPNP_DEVICE_ICON_JPEG_SM UPNP_DIR_ICONS "/upnpIconSm.jpeg"
-#define UPNP_DEVICE_ICON_JPEG_LRG UPNP_DIR_ICONS "/upnpIconLrg.jpeg"
-#define UPNP_DEVICE_ICON_PNG_SM UPNP_DIR_ICONS "/upnpIconSm.png"
-#define UPNP_DEVICE_ICON_PNG_LRG UPNP_DIR_ICONS "/upnpIconLrg.png"
-
-/****************************************************
- *
- * 2.5 DIDL Properties
- *
- ****************************************************/
-
-#define UPNP_OBJECT_ITEM "item"
-#define UPNP_OBJECT_CONTAINER "container"
-
-#define UPNP_PROP_OBJECTID "@id"
-#define UPNP_PROP_PARENTID "@parentID"
-#define UPNP_PROP_TITLE "dc:title"
-#define UPNP_PROP_CREATOR "dc:creator"
-#define UPNP_PROP_RESTRICTED "@restricted"
-#define UPNP_PROP_WRITESTATUS "upnp:writeStatus"
-#define UPNP_PROP_CLASS "upnp:class"
-#define UPNP_PROP_CLASSNAME UPNP_PROP_CLASS "@name"
-#define UPNP_PROP_CREATECLASS "upnp:createClass"
-#define UPNP_PROP_SEARCHCLASS "upnp:searchClass"
-#define UPNP_PROP_SCLASSDERIVED UPNP_PROP_SEARCHCLASS "@includeDerived"
-#define UPNP_PROP_SCLASSNAME UPNP_PROP_SEARCHCLASS "@name"
-#define UPNP_PROP_CCLASSDERIVED UPNP_PROP_CREATECLASS "@includeDerived"
-#define UPNP_PROP_CCLASSNAME UPNP_PROP_CREATECLASS "@name"
-#define UPNP_PROP_REFERENCEID UPNP_OBJECT_ITEM "@refID"
-#define UPNP_PROP_SEARCHABLE UPNP_OBJECT_CONTAINER "@searchable"
-#define UPNP_PROP_CHILDCOUNT UPNP_OBJECT_CONTAINER "@childcount"
-#define UPNP_PROP_RESOURCE "res"
-#define UPNP_PROP_PROTOCOLINFO UPNP_PROP_RESOURCE "@protocolInfo"
-#define UPNP_PROP_SIZE UPNP_PROP_RESOURCE "@size"
-#define UPNP_PROP_DURATION UPNP_PROP_RESOURCE "@duration"
-#define UPNP_PROP_BITRATE UPNP_PROP_RESOURCE "@bitrate"
-#define UPNP_PROP_SAMPLEFREQUENCE UPNP_PROP_RESOURCE "@sampleFreq"
-#define UPNP_PROP_BITSPERSAMPLE UPNP_PROP_RESOURCE "@bitsPerSample"
-#define UPNP_PROP_NOAUDIOCHANNELS UPNP_PROP_RESOURCE "@nrAudioChannels"
-#define UPNP_PROP_COLORDEPTH UPNP_PROP_RESOURCE "@colorDepth"
-#define UPNP_PROP_RESOLUTION UPNP_PROP_RESOURCE "@resolution"
-#define UPNP_PROP_GENRE "upnp:genre"
-#define UPNP_PROP_LONGDESCRIPTION "upnp:longDescription"
-#define UPNP_PROP_PRODUCER "upnp:producer"
-#define UPNP_PROP_RATING "upnp:rating"
-#define UPNP_PROP_ACTOR "upnp:actor"
-#define UPNP_PROP_DIRECTOR "upnp:director"
-#define UPNP_PROP_DESCRIPTION "dc:description"
-#define UPNP_PROP_PUBLISHER "dc:publisher"
-#define UPNP_PROP_LANGUAGE "dc:language"
-#define UPNP_PROP_RELATION "dc:relation"
-#define UPNP_PROP_STORAGEMEDIUM "upnp:storageMedium"
-#define UPNP_PROP_DVDREGIONCODE "upnp:DVDRegionCode"
-#define UPNP_PROP_CHANNELNAME "upnp:channelName"
-#define UPNP_PROP_SCHEDULEDSTARTTIME "upnp:scheduledStartTime"
-#define UPNP_PROP_SCHEDULEDENDTIME "upnp:scheduledEndTime"
-#define UPNP_PROP_ICON "upnp:icon"
-#define UPNP_PROP_REGION "upnp:region"
-#define UPNP_PROP_CHANNELNR "upnp:channelNr"
-#define UPNP_PROP_RIGHTS "dc:rights"
-#define UPNP_PROP_RADIOCALLSIGN "upnp:radioCallSign"
-#define UPNP_PROP_RADIOSTATIONID "upnp:radioStationID"
-#define UPNP_PROP_RADIOBAND "upnp:radioBand"
-#define UPNP_PROP_CONTRIBUTOR "dc:contributor"
-#define UPNP_PROP_DATE "dc:date"
-#define UPNP_PROP_ALBUM "upnp:album"
-#define UPNP_PROP_ARTIST "upnp:artist"
-#define UPNP_PROP_DLNA_CONTAINERTYPE "dlna:container"
-
-#define UPNP_DIDL_SKELETON "<DIDL-Lite "\
- "xmlns=\"" UPNP_XMLNS_DIDL "\" "\
- "xmlns:dc=\"" UPNP_XMLNS_DUBLINCORE "\" "\
- "xmlns:upnp=\"" UPNP_XMLNS_UPNP "\" "\
- "xmlns:dlna=\"" UPNP_XMLNS_DLNA_META "\">"\
- "</DIDL-Lite>"
-
-/****************************************************
- *
- * 2.6 Connection Manager Service (CMS)
- *
- ****************************************************/
-
-/*Path to service description of conection manager service*/
-#define UPNP_CMS_SCPD_URL UPNP_DIR_XML "/cms_scpd.xml"
-#define UPNP_CMS_CONTROL_URL UPNP_DIR_CONTROL "/cms_control"
-#define UPNP_CMS_EVENT_URL UPNP_DIR_EVENT "/cms_event"
-#define UPNP_CMS_SERVICE_ID "urn:upnp-org:serviceId:ConnectionManager"
-#define UPNP_CMS_SERVICE_TYPE "urn:schemas-upnp-org:service:ConnectionManager:1"
-
-/* Compatibility usage only --> See DLNA Profiles */
-#define UPNP_CMS_SUPPORTED_PROTOCOLS "http-get:*:video/mpeg:*," \
- "http-get:*:audio/mpeg:*"
-
-/****************************************************
- *
- * The UPnP CMS actions
- *
- * This constant definitions represent all actions
- * compliant with UPnP ConnectionManager:1
- *
- ****************************************************/
-
-#define UPNP_CMS_ACTION_GETPROTOCOLINFO "GetProtocolInfo"
-#define UPNP_CMS_ACTION_GETCURRENTCONNECTIONIDS "GetCurrentConnectionIDs"
-#define UPNP_CMS_ACTION_GETCURRENTCONNECTIONINFO "GetCurrentConnectionInfo"
-#define UPNP_CMS_ACTION_PREPAREFORCONNECTION "PrepareForConnection"
-#define UPNP_CMS_ACTION_CONNECTIONCOMPLETE "ConnectionComplete"
-
-/****************************************************
- *
- * 2.7 Content Directory Service (CDS)
- *
- ****************************************************/
-
-/*Path to service description of content directory service*/
-#define UPNP_CDS_SCPD_URL UPNP_DIR_XML "/cds_scpd.xml"
-#define UPNP_CDS_CONTROL_URL UPNP_DIR_CONTROL "/cds_control"
-#define UPNP_CDS_EVENT_URL UPNP_DIR_EVENT "/cds_event"
-#define UPNP_CDS_SERVICE_ID "urn:upnp-org:serviceId:ContentDirectory"
-#define UPNP_CDS_SERVICE_TYPE "urn:schemas-upnp-org:service:ContentDirectory:1"
-
-#define UPNP_CDS_SEARCH_CAPABILITIES ""
-#define UPNP_CDS_SORT_CAPABILITIES UPNP_PROP_TITLE ","\
- UPNP_PROP_CREATOR ","\
- UPNP_PROP_WRITESTATUS ","\
- UPNP_PROP_DESCRIPTION ","\
- UPNP_PROP_GENRE ","\
- UPNP_PROP_LONGDESCRIPTION ","\
- UPNP_PROP_PUBLISHER
-
-#define UPNP_DURATION_FORMAT "%5d:%02d:%02d"
-#define UPNP_DURATION_FRAME_FORMAT "%5d:%02d:%02d.%03d"
-#define UPNP_MAX_METADATA_LENGTH 1024
-#define AVDETECTOR_TIME_BASE 1000
-
-/****************************************************
- *
- * The UPnP CDS actions
- *
- * This constant definitions represent all actions
- * compliant with UPnP ContentDirectory:1
- *
- ****************************************************/
-
-#define UPNP_CDS_ACTION_SEARCHCAPABILITIES "GetSearchCapabilities"
-#define UPNP_CDS_ACTION_SORTCAPABILITIES "GetSortCapabilities"
-#define UPNP_CDS_ACTION_SYSTEMUPDATEID "GetSystemUpdateID"
-#define UPNP_CDS_ACTION_BROWSE "Browse"
-#define UPNP_CDS_ACTION_SEARCH "Search"
-#define UPNP_CDS_ACTION_CREATEOBJECT "CreateObject"
-#define UPNP_CDS_ACTION_DESTROYOBJECT "DestroyObject"
-#define UPNP_CDS_ACTION_UPDATEOBJECT "UpdateObject"
-#define UPNP_CDS_ACTION_IMPORTRESOURCE "ImportResource"
-#define UPNP_CDS_ACTION_EXPORTRESOURCE "ExportResource"
-#define UPNP_CDS_ACTION_STOPTRANSFERRES "StopTransferResource"
-#define UPNP_CDS_ACTION_TRANSFERPROGRESS "GetTransferProgress"
-#define UPNP_CDS_ACTION_DELETERESOURCE "DeleteResource"
-#define UPNP_CDS_ACTION_CREATEREFERENCE "CreateReference"
-
-/****************************************************
- *
- * 2.8 UPnP AV Transport (AVT)
- *
- ****************************************************/
-
-#define UPNP_AVT_SCPD_URL UPNP_DIR_XML "/avt_scpd.xml"
-#define UPNP_AVT_CONTROL_URL UPNP_DIR_CONTROL "/avt_control"
-#define UPNP_AVT_EVENT_URL UPNP_DIR_EVENT "/avt_event"
-#define UPNP_AVT_SERVICE_ID "urn:upnp-org:serviceID:AVTransport"
-#define UPNP_AVT_SERVICE_TYPE "urn:schemas-upnp-org:service:AVTransport:1"
-
-/****************************************************
- *
- * The UPnP AVT actions
- *
- * This constant definitions represent all actions
- * compliant with UPnP AVTransport:1
- *
- ****************************************************/
-
-/****************************************************
- *
- * 2.9 Media classes
- *
- ****************************************************/
-
-#define UPNP_CLASS_OBJECT "object"
-#define UPNP_CLASS_ITEM UPNP_CLASS_OBJECT "." "item"
-#define UPNP_CLASS_CONTAINER UPNP_CLASS_OBJECT "." "container"
-#define UPNP_CLASS_IMAGE UPNP_CLASS_ITEM "." "imageItem"
-#define UPNP_CLASS_AUDIO UPNP_CLASS_ITEM "." "audioItem"
-#define UPNP_CLASS_VIDEO UPNP_CLASS_ITEM "." "videoItem"
-#define UPNP_CLASS_PLAYLIST UPNP_CLASS_ITEM "." "playlistItem"
-#define UPNP_CLASS_TEXT UPNP_CLASS_ITEM "." "textItem"
-#define UPNP_CLASS_PHOTO UPNP_CLASS_IMAGE "." "photo"
-#define UPNP_CLASS_MUSICTRACK UPNP_CLASS_AUDIO "." "musikTrack"
-#define UPNP_CLASS_AUDIOBC UPNP_CLASS_AUDIO "." "audioBroadcast"
-#define UPNP_CLASS_AUDIOBOOK UPNP_CLASS_AUDIO "." "audioBook"
-#define UPNP_CLASS_MOVIE UPNP_CLASS_VIDEO "." "movie"
-#define UPNP_CLASS_VIDEOBC UPNP_CLASS_VIDEO "." "videoBroadcast"
-#define UPNP_CLASS_MUSICVIDCLIP UPNP_CLASS_VIDEO "." "musicVideoClip"
-#define UPNP_CLASS_PERSON UPNP_CLASS_CONTAINER "." "person"
-#define UPNP_CLASS_PLAYLISTCONT UPNP_CLASS_CONTAINER "." "playlistContainer"
-#define UPNP_CLASS_ALBUM UPNP_CLASS_CONTAINER "." "album"
-#define UPNP_CLASS_GENRE UPNP_CLASS_CONTAINER "." "genre"
-#define UPNP_CLASS_STORAGESYS UPNP_CLASS_CONTAINER "." "storageSystem"
-#define UPNP_CLASS_STORAGEVOL UPNP_CLASS_CONTAINER "." "storageVolume"
-#define UPNP_CLASS_STORAGEFOLD UPNP_CLASS_CONTAINER "." "storageFolder"
-#define UPNP_CLASS_MUSICARTIST UPNP_CLASS_PERSON "." "musicArtist"
-#define UPNP_CLASS_MUSICALBUM UPNP_CLASS_ALBUM "." "musicAlbum"
-#define UPNP_CLASS_PHOTOALBUM UPNP_CLASS_ALBUM "." "photoAlbum"
-#define UPNP_CLASS_MUSICGENRE UPNP_CLASS_GENRE "." "musicGenre"
-#define UPNP_CLASS_MOVIEGENRE UPNP_CLASS_GENRE "." "movieGenre"
-
-/****************************************************
- *
- * 2.10 Storage media
- *
- ****************************************************/
-
-#define UPNP_STORAGE_UNKNOWN "UNKNOWN"
-#define UPNP_STORAGE_DV "DV"
-#define UPNP_STORAGE_MINI_DV "MINI-DV"
-#define UPNP_STORAGE_VHS "VHS"
-#define UPNP_STORAGE_W_VHS "W-VHS"
-#define UPNP_STORAGE_S_VHS "S-VHS"
-#define UPNP_STORAGE_D_VHS "D-VHS"
-#define UPNP_STORAGE_VHSC "VHSC"
-#define UPNP_STORAGE_VIDEO8 "VIDEO8"
-#define UPNP_STORAGE_HI8 "HI8"
-#define UPNP_STORAGE_CD_ROM "CD-ROM"
-#define UPNP_STORAGE_CD_DA "CD-DA"
-#define UPNP_STORAGE_CD_R "CD-R"
-#define UPNP_STORAGE_CD_RW "CD-RW"
-#define UPNP_STORAGE_VIDEO_CD "VIDEO-CD"
-#define UPNP_STORAGE_SACD "SACD"
-#define UPNP_STORAGE_MD_AUDIO "MD-AUDIO"
-#define UPNP_STORAGE_MD_PICTURE "MD-PICTURE"
-#define UPNP_STORAGE_DVD_ROM "DVD-ROM"
-#define UPNP_STORAGE_DVD_VIDEO "DVD-VIDEO"
-#define UPNP_STORAGE_DVD_R_MINUS "DVD-R"
-#define UPNP_STORAGE_DVD_RW_PLUS "DVD+RW"
-#define UPNP_STORAGE_DVD_RW_MINUS "DVD-RW"
-#define UPNP_STORAGE_DVD_RAM "DVD-RAM"
-#define UPNP_STORAGE_DVD_AUDIO "DVD-AUDIO"
-#define UPNP_STORAGE_DAT "DAT"
-#define UPNP_STORAGE_LD "LD"
-#define UPNP_STORAGE_HDD "HDD"
-#define UPNP_STORAGE_MICRO_MV "MICRO-MV"
-#define UPNP_STORAGE_NETWORK "NETWORK"
-
-/****************************************************
- *
- * 2.11 Known Errors
- *
- ****************************************************/
-
-/* Errors 401-404, 501 are already defined in
- * Intel SDK, however 403 MUST NOT USED.
- */
-
-/****** 600 Common Action Errors ******/
-
-#define UPNP_SOAP_E_ARGUMENT_INVALID 600
-#define UPNP_SOAP_E_ARGUMENT_OUT_OF_RANGE 601
-#define UPNP_SOAP_E_ACTION_NOT_IMPLEMENTED 602
-#define UPNP_SOAP_E_OUT_OF_MEMORY 603
-#define UPNP_SOAP_E_HUMAN_INTERVENTION 604
-#define UPNP_SOAP_E_STRING_TO_LONG 605
-#define UPNP_SOAP_E_NOT_AUTHORIZED 606
-#define UPNP_SOAP_E_SIGNATURE_FAILURE 607
-#define UPNP_SOAP_E_SIGNATURE_MISSING 608
-#define UPNP_SOAP_E_NOT_ENCRYPTED 609
-#define UPNP_SOAP_E_INVALID_SEQUENCE 610
-#define UPNP_SOAP_E_INVALID_CONTROL_URL 611
-#define UPNP_SOAP_E_NO_SUCH_SESSION 612
-
-/****** 700 Action specific Errors ******/
-
-#define UPNP_CDS_E_NO_SUCH_OBJECT 701
-#define UPNP_CDS_E_INVALID_CURRENT_TAG 702
-#define UPNP_CDS_E_INVALID_NEW_TAG 703
-#define UPNP_CDS_E_REQUIRED_TAG 704
-#define UPNP_CDS_E_READ_ONLY_TAG 705
-#define UPNP_CDS_E_PARAMETER_MISMATCH 706
-#define UPNP_CDS_E_INVALID_SEARCH_CRITERIA 708
-#define UPNP_CDS_E_INVALID_SORT_CRITERIA 709
-#define UPNP_CDS_E_NO_SUCH_CONTAINER 710
-#define UPNP_CDS_E_RESTRICTED_OBJECT 711
-#define UPNP_CDS_E_BAD_METADATA 712
-#define UPNP_CDS_E_RESTRICTED_PARENT 713
-#define UPNP_CDS_E_NO_SUCH_SOURCE_RESOURCE 714
-#define UPNP_CDS_E_RESOURCE_ACCESS_DENIED 715
-#define UPNP_CDS_E_TRANSFER_BUSY 716
-#define UPNP_CDS_E_NO_SUCH_FILE_TRANSFER 717
-#define UPNP_CDS_E_NO_SUCH_DESTINATION_RESOURCE 718
-#define UPNP_CDS_E_DEST_RESOURCE_ACCESS_DENIED 719
-#define UPNP_CDS_E_CANT_PROCESS_REQUEST 720
-
-#define UPNP_CMS_E_INCOMPATIBLE_PROTOCOL_INFO 701
-#define UPNP_CMS_E_INCOMPATIBLE_DIRECTIONS 702
-#define UPNP_CMS_E_INSUFFICIENT_RESOURCES 703
-#define UPNP_CMS_E_LOCAL_RESTRICTIONS 704
-#define UPNP_CMS_E_ACCESS_DENIED 705
-#define UPNP_CMS_E_INVALID_CONNECTION_REFERENCE 706
-#define UPNP_CMS_E_NOT_IN_NETWORK 707
-
-/****************************************************
- *
- * 2.12 Write Status
- *
- ****************************************************/
-
-enum UPnPWriteStatus {
- WS_UNKNOWN=0,
- WS_WRITABLE,
- WS_PROTECTED,
- WS_NOT_WRITABLE,
- WS_MIXED
-};
-
-/****************************************************
- *
- * 3. DLNA
- *
- ****************************************************/
-
-#define DLNA_PROTOCOL_VERSION_MAJOR 1
-#define DLNA_PROTOCOL_VERSION_MINOR 5
-#define DLNA_PROTOCOL_VERSION_MICRO 0
-
-#define DLNA_PROTOCOL_VERSION_INT VERSION_INT(DLNA_PROTOCOL_VERSION_MAJOR, \
- DLNA_PROTOCOL_VERSION_MINOR, \
- DLNA_PROTOCOL_VERSION_MICRO)
-
-#define DLNA_PROTOCOL_VERSION_STR VERSION_STR(DLNA_PROTOCOL_VERSION_MAJOR, \
- DLNA_PROTOCOL_VERSION_MINOR, \
- DLNA_PROTOCOL_VERSION_MICRO)
-
-/****************************************************
- *
- * 3.1 Protocol info fields
- *
- ****************************************************/
-
-/**
- * ATTENTION
- *
- * The following operation field assumes that s0 is NOT changing. Only changes to sN are permitted.
- * If s0 and/or sN changes these fields must be set to false. Use DLNA_FLAG_*_BASED_SEEK flags instead.
- */
-#define DLNA_OPERATION_NONE 00 ///< No seek operations supported
-#define DLNA_OPERATION_TIME_SEEK_RANGE 10 ///< is the server supporting time based seeks?
-#define DLNA_OPERATION_RANGE 01 ///< or byte based seeks?
-
-#define DLNA_CONVERSION_TRANSCODED 1 ///< the content was converted from one media format to another
-#define DLNA_CONVERSION_NONE 0 ///< the content is available without conversion
-
-#define DLNA_SUPPORTED_PLAYSPEEDS "2,4,8,-2,-4,-8"; ///< 1 is required, but omited in the PS parameter
-
-#define DLNA_TRANSFER_PROTOCOL_HTTP 1 ///< use http tranfer
-#define DLNA_TRANSFER_PROTOCOL_RTP 2 ///< use rtp tranfer
-
-/****************************************************
- *
- * 3.2 Protocol info flags
- *
- ****************************************************/
-
-#define DLNA_FLAG_SENDER_PACED 1 << 31 ///< is the server setting the pace (i.e. RTP)?
-#define DLNA_FLAG_TIME_BASED_SEEK 1 << 30 ///< is the server supporting time based seeks?
-#define DLNA_FLAG_BYTE_BASED_SEEK 1 << 29 ///< or byte based seeking?
-#define DLNA_FLAG_PLAY_CONTAINER 1 << 28 ///< is it possible to play all contents of a container?
-#define DLNA_FLAG_S0_INCREASE 1 << 27 ///< is the beginning changing (time shift)?
-#define DLNA_FLAG_SN_INCREASE 1 << 26 ///< is the end changing (live-TV)?
-#define DLNA_FLAG_RTSP_PAUSE 1 << 25 ///< is pausing rtp streams permitted?
-#define DLNA_FLAG_STREAMING_TRANSFER 1 << 24 ///< is the transfer a stream (Audio/AV)?
-#define DLNA_FLAG_INTERACTIVE_TRANSFER 1 << 23 ///< is the transfer interactiv (printings)?
-#define DLNA_FLAG_BACKGROUND_TRANSFER 1 << 22 ///< is the tranfer done in background (downloaded)?
-#define DLNA_FLAG_CONNECTION_STALLING 1 << 21 ///< can the connection be paused on HTTP streams?
-#define DLNA_FLAG_VERSION_1_5 1 << 20 ///< does the server complies with DLNA V1.5
-#define DLNA_FLAG_CLEARTEXT_CONTENT 1 << 16 ///< (Link Protection) currently not used
-#define DLNA_FLAG_CLEARTEXT_BYTE_FULL_SEEK 1 << 15 ///< (Link Protection) currently not used
-#define DLNA_FLAG_CLEARTEXT_LIMITED_SEEK 1 << 14 ///< (Link Protection) currently not used
-
-#define DLNA_SUPPORTED_FLAGS DLNA_FLAG_BYTE_BASED_SEEK | \
- DLNA_FLAG_SN_INCREASE | \
- DLNA_FLAG_STREAMING_TRANSFER | \
- DLNA_FLAG_BACKGROUND_TRANSFER | \
- DLNA_FLAG_CONNECTION_STALLING | \
- DLNA_FLAG_VERSION_1_5
-
-/****************************************************
- *
- * 3.3 Media profiles
- *
- ****************************************************/
-
-/** @see dlna/profiles.h */
-
-/****************************************************
- *
- * 3.4 Container types
- *
- ****************************************************/
-
-enum DLNAContainerTypes {
- TUNER_1_0
-};
-
-#define DLNA_CONTAINER_TUNER "Tuner_1_0" // The DLNA container type for a tuner
-
-/****************************************************
- *
- * 3.5 Device types
- *
- ****************************************************/
-
-#define DLNA_DEVICE_DMS_1_0 "DMS-1.00"
-#define DLNA_DEVICE_DMS_1_5 "DMS-1.50"
-
-/****************************************************
- *
- * 4. SQLite
- *
- ****************************************************/
-/****************************************************
- *
- * 4.1 Database setup
- *
- ****************************************************/
-
-#define SQLITE_DB_FILE "metadata.db"
-
-/****************************************************
- *
- * Please see database.h for further definitions,
- * SQL statements and triggers
- *
- ****************************************************/
-
-#endif /* _COMMON_H */
-
diff --git a/database/database.cpp b/database/database.cpp
deleted file mode 100644
index c58294d..0000000
--- a/database/database.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * File: database.h
- * Author: savop
- *
- * Created on 3. September 2009, 22:20
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <sqlite3.h>
-#include "database.h"
-#include "../common.h"
-#include "object.h"
-#include "../upnp.h"
-#include "config.h"
-
-cSQLiteDatabase* cSQLiteDatabase::mInstance = NULL;
-
-cSQLiteDatabase::cSQLiteDatabase(){
- this->mActiveTransaction = false;
- this->mDatabase = NULL;
- this->mLastRow = NULL;
- this->mRows = NULL;
-}
-
-cSQLiteDatabase::~cSQLiteDatabase(){
- sqlite3_close(this->mDatabase);
-}
-
-cSQLiteDatabase* cSQLiteDatabase::getInstance(){
- if(cSQLiteDatabase::mInstance == NULL){
- cSQLiteDatabase::mInstance = new cSQLiteDatabase;
- DatabaseLocker.Wait();
- cSQLiteDatabase::mInstance->initialize();
- }
-
- if(cSQLiteDatabase::mInstance != NULL)
- return cSQLiteDatabase::mInstance;
- else
- return NULL;
-}
-
-int cSQLiteDatabase::exec(const char* Statement){
- char* Error;
- if(!this->mDatabase){
- ERROR("Database not open. Cannot continue");
- return -1;
- }
- this->mRows = new cRows;
- MESSAGE(VERBOSE_SQL_STATEMENTS,"SQLite: %s", Statement);
- if(sqlite3_exec(this->mDatabase, Statement, cSQLiteDatabase::getResultRow, (cSQLiteDatabase*)this, &Error)!=SQLITE_OK){
- ERROR("Database error: %s", Error);
- ERROR("Statement was: %s", Statement);
- delete this->mRows; this->mRows = NULL;
- sqlite3_free(Error);
- return -1;
- }
-
- sqlite3_free(Error);
- return 0;
-}
-
-const char* cSQLiteDatabase::sprintf(const char* Format, ...){
- va_list vlist;
- va_start(vlist, Format);
- char* SQLStatement = sqlite3_vmprintf(Format, vlist);
- va_end(vlist);
- return SQLStatement;
-}
-
-int cSQLiteDatabase::execStatement(const char* Statement, ...){
- va_list vlist;
- va_start(vlist, Statement);
- char* SQLStatement = sqlite3_vmprintf(Statement, vlist);
- va_end(vlist);
- int ret = this->exec(SQLStatement);
- sqlite3_free(SQLStatement);
- return ret;
-}
-
-int cSQLiteDatabase::getResultRow(void* DB, int NumCols, char** Values, char** ColNames){
- cRow* Row = new cRow;
- Row->ColCount = NumCols;
- Row->Columns = new char*[NumCols];
- Row->Values = new char*[NumCols];
- for(int i=0; i < NumCols; i++){
- Row->Columns[i] = strdup0(ColNames[i]);
- Row->Values[i] = strdup0(Values[i]);
- }
- cSQLiteDatabase* Database = (cSQLiteDatabase*)DB;
- Database->mRows->Add(Row);
- return 0;
-}
-
-cRows::cRows(){
- this->mLastRow = NULL;
-}
-
-cRows::~cRows(){
- this->mLastRow = NULL;
-}
-
-bool cRows::fetchRow(cRow** Row){
- if(this->mLastRow==NULL){
- this->mLastRow = this->First();
- }
- else {
- this->mLastRow = this->Next(this->mLastRow);
- }
- if(this->mLastRow != NULL){
- *Row = this->mLastRow;
- return true;
- }
- else {
- *Row = NULL;
- return false;
- }
- return false;
-}
-
-cRow::cRow(){
- this->currentCol = 0;
- this->ColCount = 0;
- this->Columns = NULL;
- this->Values = NULL;
-}
-
-cRow::~cRow(){
- delete [] this->Columns;
- delete [] this->Values;
- this->Columns = NULL;
- this->Values = NULL;
-}
-
-bool cRow::fetchColumn(cString* Column, cString* Value){
- char *Col, *Val;
- bool ret = this->fetchColumn(&Col, &Val);
- if(ret){
- *Column = cString(Col,true);
- *Value = cString(Val,true);
- }
- return ret;
-}
-
-
-bool cRow::fetchColumn(char** Column, char** Value){
- if(currentCol>=this->ColCount){
- return false;
- }
- MESSAGE(VERBOSE_SQL_FETCHES,"Fetching column %s='%s' (%d/%d)", this->Columns[currentCol], this->Values[currentCol], currentCol+1, this->ColCount);
- *Column = strdup0(this->Columns[currentCol]);
- if(this->Values[currentCol]){
- *Value = strcasecmp(this->Values[currentCol],"NULL")?strdup(this->Values[currentCol]):NULL;
- }
- else {
- *Value = NULL;
- }
- currentCol++;
- return true;
-}
-
-int cSQLiteDatabase::initialize(){
- int ret;
- const char* dbdir = (cUPnPConfig::get()->mDatabaseFolder) ? cUPnPConfig::get()->mDatabaseFolder : cPluginUpnp::getConfigDirectory();
- cString File = cString::sprintf("%s/%s", dbdir, SQLITE_DB_FILE);
- if((ret = sqlite3_open(File, &this->mDatabase))){
- ERROR("Unable to open database file %s (Error code: %d)!", *File, ret);
- sqlite3_close(this->mDatabase);
- return -1;
- }
- MESSAGE(VERBOSE_SDK,"Database file %s opened.", *File);
- if(this->initializeTables()){
- ERROR("Error while creating tables");
- return -1;
- }
- else if(this->initializeTriggers()){
- ERROR("Error while setting triggers");
- return -1;
- }
- return 0;
-}
-
-void cSQLiteDatabase::startTransaction(){
- if(this->mActiveTransaction){
- if(this->mAutoCommit){
- this->commitTransaction();
- }
- else {
- this->rollbackTransaction();
- }
- }
- this->execStatement("BEGIN TRANSACTION");
- MESSAGE(VERBOSE_SQL,"Start new transaction");
- this->mActiveTransaction = true;
-}
-
-void cSQLiteDatabase::commitTransaction(){
- this->execStatement("COMMIT TRANSACTION");
- MESSAGE(VERBOSE_SQL,"Commited transaction");
- this->mActiveTransaction = false;
-}
-
-void cSQLiteDatabase::rollbackTransaction(){
- this->execStatement("ROLLBACK TRANSACTION");
- MESSAGE(VERBOSE_SQL,"Rolled back transaction");
- this->mActiveTransaction = false;
-}
-
-int cSQLiteDatabase::initializeTables(){
- int ret = 0;
- this->startTransaction();
- if(this->execStatement(SQLITE_CREATE_TABLE_ITEMFINDER)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_SYSTEM)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_PRIMARY_KEYS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_ALBUMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_AUDIOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_AUDIOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_CONTAINER)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_IMAGEITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_MOVIES)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_OBJECTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_PHOTOS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_PLAYLISTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_RESOURCES)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_SEARCHCLASS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_VIDEOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_CREATE_TABLE_VIDEOITEMS)==-1) ret = -1;
- if(ret){
- this->rollbackTransaction();
- }
- else {
- this->commitTransaction();
- }
- return ret;
-}
-
-int cSQLiteDatabase::initializeTriggers(){
- int ret = 0;
- this->startTransaction();
- if(this->execStatement(SQLITE_TRIGGER_D_OBJECTS_ITEMFINDER)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_UPDATE_SYSTEM)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_UPDATE_OBJECTID)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_AUDIOITEMS_AUDIOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_CONTAINERS_ALBUMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_CONTAINERS_PLAYLISTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_CONTAINERS_SEARCHCLASSES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_IMAGEITEMS_PHOTOS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_ITEMS_AUDIOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_ITEMS_IMAGEITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_ITEMS_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_ITEMS_VIDEOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_OBJECTS_OBJECTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_OBJECT_CONTAINERS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_OBJECT_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_OBJECT_RESOURCES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_VIDEOITEMS_MOVIES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_D_VIDEOITEMS_VIDEOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_AUDIOITEMS_AUDIOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_CONTAINERS_ALBUMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_CONTAINERS_PLAYLISTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_CONTAINERS_SEARCHCLASSES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_IMAGEITEMS_PHOTOS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_ITEMS_AUDIOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_ITEMS_IMAGEITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_ITEMS_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_ITEMS_VIDEOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_OBJECTS_OBJECTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_OBJECT_CONTAINERS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_OBJECT_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_OBJECT_RESOURCES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_VIDEOITEMS_MOVIES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_I_VIDEOITEMS_VIDEOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_AUDIOITEMS_AUDIOBROADCASTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_CONTAINERS_ALBUMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_CONTAINERS_PLAYLISTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_CONTAINERS_SEARCHCLASSES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_IMAGEITEMS_PHOTOS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_ITEMS_AUDIOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_ITEMS_IMAGEITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_ITEMS_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_ITEMS_VIDEOITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_OBJECTS_OBJECTS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_OBJECT_CONTAINERS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_OBJECT_ITEMS)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_OBJECT_RESOURCES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_VIDEOITEMS_MOVIES)==-1) ret = -1;
- if(this->execStatement(SQLITE_TRIGGER_U_VIDEOITEMS_VIDEOBROADCASTS)==-1) ret = -1;
- if(ret){
- this->rollbackTransaction();
- }
- else {
- this->commitTransaction();
- }
- return ret;
-}
-
-long cSQLiteDatabase::getLastInsertRowID() const {
- return (long)sqlite3_last_insert_rowid(this->mDatabase);
-} \ No newline at end of file
diff --git a/database/metadata.cpp b/database/metadata.cpp
deleted file mode 100644
index a9d780f..0000000
--- a/database/metadata.cpp
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * File: metadata.cpp
- * Author: savop
- *
- * Created on 28. Mai 2009, 16:50
- */
-
-#include <upnp/ixml.h>
-#include <time.h>
-#include <vdr/tools.h>
-#include "object.h"
-#include "resources.h"
-#include "metadata.h"
-#include "../common.h"
-#include "search.h"
-#include <vdr/channels.h>
-#include <vdr/epg.h>
-#include <upnp/upnp.h>
-#include <vdr/device.h>
-
-#define KEY_SYSTEM_UPDATE_ID "SystemUpdateID"
-
- /**********************************************\
- * *
- * Media database *
- * *
- \**********************************************/
-
-cMediaDatabase::cMediaDatabase(){
- this->mSystemUpdateID = 0;
- this->mLastInsertObjectID = 0;
- this->mDatabase = cSQLiteDatabase::getInstance();
- this->mObjects = new cHash<cUPnPClassObject>;
- this->mFactory = cUPnPObjectFactory::getInstance();
- this->mFactory->registerMediator(UPNP_CLASS_ITEM, new cUPnPItemMediator(this));
- this->mFactory->registerMediator(UPNP_CLASS_CONTAINER, new cUPnPContainerMediator(this));
- this->mFactory->registerMediator(UPNP_CLASS_VIDEO, new cUPnPVideoItemMediator(this));
- this->mFactory->registerMediator(UPNP_CLASS_VIDEOBC, new cUPnPVideoBroadcastMediator(this));
- this->mFactory->registerMediator(UPNP_CLASS_MOVIE, new cUPnPMovieMediator(this));
-}
-
-cMediaDatabase::~cMediaDatabase(){
- delete this->mDatabase;
-}
-
-bool cMediaDatabase::init(){
- MESSAGE(VERBOSE_SDK,"Initializing...");
- if(this->prepareDatabase()){
- ERROR("Initializing of database failed.");
- return false;
- }
-#ifndef WITHOUT_TV
- if(this->loadChannels()){
- ERROR("Loading channels failed");
- return false;
- }
-#endif
-#ifndef WITHOUT_RECORDS
- if(this->loadRecordings()){
- ERROR("Loading records failed");
- return false;
- }
-#endif
- return true;
-}
-
-void cMediaDatabase::updateSystemID(){
- this->mDatabase->execStatement("INSERT OR REPLACE INTO %s (Key,Value) VALUES (%Q,%d)",
- SQLITE_TABLE_SYSTEM,
- KEY_SYSTEM_UPDATE_ID,
- this->getSystemUpdateID()+1);
-}
-
-const char* cMediaDatabase::getContainerUpdateIDs(){
- return "";
-}
-
-unsigned int cMediaDatabase::getSystemUpdateID(){
- if(this->mDatabase->execStatement("SELECT Value FROM %s WHERE Key=%Q",
- SQLITE_TABLE_SYSTEM,
- KEY_SYSTEM_UPDATE_ID)){
- ERROR("Error while executing statement");
- return 0;
- }
- cRows* Rows = this->mDatabase->getResultRows();
- cRow* Row;
- cString Column, Value;
- if(!Rows->fetchRow(&Row)){
- ERROR("No rows found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, "Value")){
- this->mSystemUpdateID = (unsigned int)atoi(Value);
- }
- }
- return this->mSystemUpdateID;
-}
-
-cUPnPObjectID cMediaDatabase::getNextObjectID(){
- cString Column, Value;
- if(this->mDatabase->execStatement("SELECT Key FROM %s WHERE KeyID=%Q",
- SQLITE_TABLE_PRIMARY_KEYS,
- PK_OBJECTS)){
- ERROR("Error while executing statement");
- return 0;
- }
- cRows* Rows = this->mDatabase->getResultRows();
- cRow* Row;
- int ret = 0;
- if(!Rows->fetchRow(&Row)){
- ERROR("No rows found");
- ret = 0;
- }
- else {
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, "Key")){
- this->mLastInsertObjectID = atoi(Value);
- ret = this->mLastInsertObjectID;
- }
- }
- }
- delete Rows;
- return ret;
-}
-
-int cMediaDatabase::addFastFind(cUPnPClassObject* Object, const char* FastFind){
- if(!Object || !FastFind){
- MESSAGE(VERBOSE_OBJECTS,"Invalid fast find parameters");
- return -1;
- }
-
- if(this->mDatabase->execStatement("INSERT OR REPLACE INTO %s (%s, %s) VALUES (%Q, %Q)",
- SQLITE_TABLE_ITEMFINDER,
- SQLITE_COL_OBJECTID,
- SQLITE_COL_ITEMFINDER,
- *Object->getID(),
- FastFind)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-cUPnPClassObject* cMediaDatabase::getObjectByFastFind(const char* FastFind){
- if(!FastFind) return NULL;
- MESSAGE(VERBOSE_OBJECTS,"Try to find Object with identifier %s", FastFind);
- cString Column, Value;
- if(this->mDatabase->execStatement("SELECT %s FROM %s WHERE %s=%Q",
- SQLITE_COL_OBJECTID,
- SQLITE_TABLE_ITEMFINDER,
- SQLITE_COL_ITEMFINDER,
- FastFind)){
- ERROR("Error while executing statement");
- return 0;
- }
- cRows* Rows = this->mDatabase->getResultRows();
- cRow* Row;
- if(!Rows->fetchRow(&Row)){
- ERROR("No rows found");
- return NULL;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_OBJECTID)){
- return this->getObjectByID(atoi(Value));
- }
- }
- delete Rows;
- return NULL;
-}
-
-cUPnPClassObject* cMediaDatabase::getObjectByID(cUPnPObjectID ID){
- MESSAGE(VERBOSE_OBJECTS, "Try to find Object with ID '%s'", *ID);
- cUPnPClassObject* Object;
- if((Object = this->mObjects->Get((unsigned int)ID))){
- MESSAGE(VERBOSE_OBJECTS, "Found cached object with ID '%s'", *ID);
- }
- else if((Object = this->mFactory->getObject(ID))){
- //this->cacheObject(Object);
- MESSAGE(VERBOSE_OBJECTS, "Found object with ID '%s' in database", *ID);
- }
- else {
- ERROR("No object with such ID '%s'", *ID);
- return NULL;
- }
- return Object;
-}
-
-void cMediaDatabase::cacheObject(cUPnPClassObject* Object){
- if(this->mObjects->Get((unsigned int)Object->getID())==NULL){
- MESSAGE(VERBOSE_OBJECTS ,"Added %s to cache.", *Object->getID());
- this->mObjects->Add(Object, (unsigned int)Object->getID());
- }
-}
-
-int cMediaDatabase::prepareDatabase(){
- if(this->getObjectByID(0)==NULL){
- MESSAGE(VERBOSE_SDK, "Creating database structure");
- cUPnPClassContainer* Root = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _(PLUGIN_SHORT_NAME));
- Root->setID(0);
- if(this->mFactory->saveObject(Root)) return -1;
-
-#ifndef WITHOUT_VIDEO
- cUPnPClassContainer* Video = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("Video"));
- Video->setID(1);
- Root->addObject(Video);
- cClass VideoClass = { UPNP_CLASS_VIDEO, true };
- Video->addSearchClass(VideoClass);
- Video->setSearchable(true);
- if(this->mFactory->saveObject(Video)) return -1;
-#endif
-#ifndef WITHOUT_AUDIO
- cUPnPClassContainer* Audio = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("Audio"));
- Audio->setID(2);
- Root->addObject(Audio);
- cClass AudioClass = { UPNP_CLASS_AUDIO, true };
- Audio->addSearchClass(AudioClass);
- Audio->setSearchable(true);
- if(this->mFactory->saveObject(Audio)) return -1;
-#endif
-#ifndef WITHOUT_TV
- cUPnPClassContainer* TV = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("TV"));
- TV->setID(3);
- TV->setContainerType(DLNA_CONTAINER_TUNER);
- TV->setSearchable(true);
- cClass VideoBCClass = { UPNP_CLASS_VIDEOBC, true };
- TV->addSearchClass(VideoBCClass);
- Video->addObject(TV);
- if(this->mFactory->saveObject(TV)) return -1;
-#endif
-#ifndef WITHOUT_RECORDS
- cUPnPClassContainer* Records = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("Records"));
- Records->setID(4);
- Video->addObject(Records);
- Records->addSearchClass(VideoClass);
- Records->setSearchable(true);
- if(this->mFactory->saveObject(Records)) return -1;
-#endif
-#ifndef WITHOUT_RADIO
- cUPnPClassContainer* Radio = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("Radio"));
- Radio->setID(5);
- Audio->addObject(Radio);
- cClass AudioBCClass = { UPNP_CLASS_AUDIOBC, true };
- Radio->addSearchClass(AudioBCClass);
- Radio->setSearchable(true);
- if(this->mFactory->saveObject(Radio)) return -1;
-#endif
-#ifndef WITHOUT_CUSTOM_VIDEOS
- cUPnPClassContainer* CustomVideos = (cUPnPClassContainer*)this->mFactory->createObject(UPNP_CLASS_CONTAINER, _("User videos"));
- CustomVideos->setID(6);
- Video->addObject(CustomVideos);
- CustomVideos->addSearchClass(VideoClass);
- CustomVideos->setSearchable(true);
- if(this->mFactory->saveObject(CustomVideos)) return -1;
-#endif
- }
- return 0;
-}
-
-#ifndef WITHOUT_TV
-int cMediaDatabase::loadChannels(){
- MESSAGE(VERBOSE_LIVE_TV ,"Loading channels");
- cUPnPClassContainer* TV = (cUPnPClassContainer*)this->getObjectByID(3);
- if(TV){
- bool noResource = false;
- // TODO: Add to setup
- // if an error occured while loading resources, add the channel anyway
- bool addWithoutResources = false;
- cChannel* Channel = NULL;
- for(int Index = 0; (Channel = Channels.Get(Index)); Index = Channels.GetNextNormal(Index)){
- // Iterating the channels
-// for(Channel = Channels.First(); Channel; Channel = Channels.(Channel)){
- bool inList = false;
-
- tChannelID ChannelID = Channel->GetChannelID();
- MESSAGE(VERBOSE_LIVE_TV, "Determine if the channel %s is already listed", *ChannelID.ToString());
- cUPnPClassVideoBroadcast* ChannelItem = NULL;
-
- ChannelItem = (cUPnPClassVideoBroadcast*)this->getObjectByFastFind(ChannelID.ToString());
-
- inList = (ChannelItem && TV->getObject(ChannelItem->getID())) ? true : false;
-
- if(!inList){
- if(Channel->GroupSep()){
- MESSAGE(VERBOSE_LIVE_TV, "Skipping group '%s'", Channel->Name());
- // Skip channel groups
- // Channel groups may be supported theoretically. However, DLNA states that a tuner needs
- // a consecutive list of channels. A simple work-around may be a virtual tuner for each group.
- }
- else if(Channel->Vpid()==0){
- // TODO: add radio support
- MESSAGE(VERBOSE_LIVE_TV, "Skipping radio '%s'", Channel->Name());
- }
- else {
- noResource = false;
- MESSAGE(VERBOSE_LIVE_TV, "Adding channel '%s' ID:%s", Channel->Name(), *ChannelID.ToString());
- ChannelItem = (cUPnPClassVideoBroadcast*)this->mFactory->createObject(UPNP_CLASS_VIDEOBC, Channel->Name());
- ChannelItem->setChannelName(Channel->Name());
- ChannelItem->setChannelNr(Channel->Number());
- // Set primary language of the stream
- if(Channel->Alang(0)){
- ChannelItem->setLanguage(Channel->Alang(0));
- }
- if(cUPnPResources::getInstance()->createFromChannel(ChannelItem, Channel)){
- ERROR("Unable to get resources for this channel");
- noResource = true;
- }
- if(!noResource || addWithoutResources) {
- TV->addObject(ChannelItem);
- if(this->mFactory->saveObject(ChannelItem) ||
- this->addFastFind(ChannelItem, ChannelID.ToString())){
- this->mFactory->deleteObject(ChannelItem);
- return -1;
- }
- MESSAGE(VERBOSE_LIVE_TV, "Successfuly added channel");
- }
- else {
- // Delete temporarily created object with no resource
- this->mFactory->deleteObject(ChannelItem);
- }
- }
- }
- else {
- MESSAGE(VERBOSE_LIVE_TV, "Skipping %s, already in database", Channel->Name());
- }
- }
- }
- return 0;
-}
-
-void cMediaDatabase::updateChannelEPG(){
- cUPnPClassContainer* TV = (cUPnPClassContainer*)this->getObjectByID(3);
- if(TV){
- // Iterating channels
- MESSAGE(VERBOSE_EPG_UPDATES, "Getting schedule...");
- cSchedulesLock SchedulesLock;
- const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
-
- cList<cUPnPClassObject>* List = TV->getObjectList();
- MESSAGE(VERBOSE_EPG_UPDATES, "TV folder has %d items", List->Count());
- for(cUPnPClassVideoBroadcast* ChannelItem = (cUPnPClassVideoBroadcast*)List->First();
- ChannelItem;
- ChannelItem = (cUPnPClassVideoBroadcast*)List->Next(ChannelItem)
- ){
- MESSAGE(VERBOSE_EPG_UPDATES, "Find channel by number %d", ChannelItem->getChannelNr());
- cChannel* Channel = Channels.GetByNumber(ChannelItem->getChannelNr());
-
- if(!Channel){
- continue;
- }
- else {
- MESSAGE(VERBOSE_EPG_UPDATES, "Found channel with ID %s", *Channel->GetChannelID().ToString());
-
- const cSchedule* Schedule = Schedules->GetSchedule(Channel);
- const cEvent* Event = Schedule?Schedule->GetPresentEvent():NULL;
- if(Event){
-
- time_t LastEPGChange = Event->StartTime();
- time_t LastObjectChange = ChannelItem->modified();
-
- MESSAGE(VERBOSE_EPG_UPDATES, "Last event start: %s", ctime(&LastEPGChange));
- MESSAGE(VERBOSE_EPG_UPDATES, "Last object modification: %s", ctime(&LastObjectChange));
- if(LastEPGChange >= LastObjectChange){
- MESSAGE(VERBOSE_EPG_UPDATES, "Updating details");
-
- if(Event){
- ChannelItem->setTitle(Event->Title()?Event->Title():Channel->Name());
- ChannelItem->setLongDescription(Event->Description());
- ChannelItem->setDescription(Event->ShortText());
- }
- else {
- ChannelItem->setTitle(Channel->Name());
- ChannelItem->setLongDescription(NULL);
- ChannelItem->setDescription(NULL);
- }
-
- this->mFactory->saveObject(ChannelItem);
- }
- else {
- MESSAGE(VERBOSE_EPG_UPDATES, "Channel did not change");
- }
- }
- else {
- MESSAGE(VERBOSE_EPG_UPDATES, "No EPG data");
- ChannelItem->setTitle(Channel->Name());
- ChannelItem->setLongDescription(NULL);
- ChannelItem->setDescription(NULL);
- }
- }
- }
- }
-}
-#endif
-#ifndef WITHOUT_RECORDS
-int cMediaDatabase::loadRecordings(){
- MESSAGE(VERBOSE_RECORDS, "Loading recordings");
- cUPnPClassContainer* Records = (cUPnPClassContainer*)this->getObjectByID(4);
- if(Records){
- bool noResource = false;
- // TODO: Add to setup
- // if an error occured while loading resources, add the channel anyway
- bool addWithoutResources = false;
- cRecording* Recording = NULL;
- for(Recording = Recordings.First(); Recording; Recording = Recordings.Next(Recording)){
- // Iterating the records
- bool inList = false;
-
- MESSAGE(VERBOSE_RECORDS, "Determine if the channel %s is already listed", Recording->FileName());
-
- cUPnPClassMovie *MovieItem = NULL;
-
- MovieItem = (cUPnPClassMovie*)this->getObjectByFastFind(Recording->FileName());
-
- inList = (MovieItem && Records->getObject(MovieItem->getID())) ? true : false;
-
- if(!inList){
- noResource = false;
- const cRecordingInfo* RecInfo = Recording->Info();
-
- MESSAGE(VERBOSE_RECORDS, "Adding movie '%s' File name:%s", RecInfo->Title(), Recording->FileName());
-
- MovieItem = (cUPnPClassMovie*)this->mFactory->createObject(UPNP_CLASS_MOVIE, RecInfo->Title()?RecInfo->Title():Recording->Name());
- MovieItem->setDescription(RecInfo->ShortText());
- MovieItem->setLongDescription(RecInfo->Description());
- MovieItem->setStorageMedium(UPNP_STORAGE_HDD);
-
- if(RecInfo->Components()){
- // The first component
- tComponent *Component = RecInfo->Components()->Component(0);
- if(Component) MovieItem->setLanguage(Component->language);
- }
-
- if(cUPnPResources::getInstance()->createFromRecording(MovieItem, Recording)){
- ERROR("Unable to get resources for this channel");
- noResource = true;
- }
- if(!noResource || addWithoutResources) {
- Records->addObject(MovieItem);
- if(this->mFactory->saveObject(MovieItem) ||
- this->addFastFind(MovieItem, Recording->FileName())){
- this->mFactory->deleteObject(MovieItem);
- return -1;
- }
- MESSAGE(VERBOSE_RECORDS, "Successfuly added movie");
- }
- else {
- // Delete temporarily created object with no resource
- this->mFactory->deleteObject(MovieItem);
- }
- }
- else {
- MESSAGE(VERBOSE_RECORDS, "Skipping %s, already in Database", Recording->FileName());
- }
- }
- }
- return 0;
-}
-#endif
-
-void cMediaDatabase::Action(){
- time_t LastEPGUpdate = 0;
- while(this->Running()){
-
-#ifndef WITHOUT_TV
- if(cSchedules::Modified() >= LastEPGUpdate){
- MESSAGE(VERBOSE_EPG_UPDATES, "Schedule changed. Updating...");
- updateChannelEPG();
- LastEPGUpdate = cSchedules::Modified();
- }
-#endif
-#ifndef WITHOUT_RECORDS
- int NotUsed;
- if(Recordings.StateChanged(NotUsed)){
- MESSAGE(VERBOSE_EPG_UPDATES, "Recordings changed. Updating...");
- loadRecordings();
- }
-#endif
-
- cCondWait::SleepMs(60 * 1000); // sleep a minute
- }
-}
-
-int cMediaDatabase::browse(
- OUT cUPnPResultSet** Results,
- IN const char* ID,
- IN bool BrowseMetadata,
- IN const char* Filter,
- IN unsigned int Offset,
- IN unsigned int Count,
- IN const char* SortCriteria
-){
- *Results = new cUPnPResultSet;
- (*Results)->mNumberReturned = 0;
- (*Results)->mTotalMatches = 0;
- (*Results)->mResult = NULL;
-
- MESSAGE(VERBOSE_DIDL, "===== Browsing =====");
- MESSAGE(VERBOSE_DIDL, "ID: %s", ID);
- MESSAGE(VERBOSE_DIDL, "Browse %s", BrowseMetadata?"metadata":"children");
- MESSAGE(VERBOSE_DIDL, "Filter: %s", Filter);
- MESSAGE(VERBOSE_DIDL, "Offset: %d", Offset);
- MESSAGE(VERBOSE_DIDL, "Count: %d", Count);
- MESSAGE(VERBOSE_DIDL, "Sort: %s", SortCriteria);
-
- cUPnPObjectID ObjectID = atoi(ID);
-
- cStringList* FilterList = cFilterCriteria::parse(Filter);
- cList<cSortCrit>* SortCriterias = cSortCriteria::parse(SortCriteria);
-
- if(!SortCriterias){
- return UPNP_CDS_E_INVALID_SORT_CRITERIA;
- }
-
- cUPnPClassObject* Object = this->getObjectByID(ObjectID);
- if(Object){
- IXML_Document* DIDLDoc = NULL;
- if(ixmlParseBufferEx(UPNP_DIDL_SKELETON, &DIDLDoc)==IXML_SUCCESS){
-
- IXML_Node* Root = ixmlNode_getFirstChild((IXML_Node*) DIDLDoc);
- switch(BrowseMetadata){
- case true:
- ixmlNode_appendChild(Root, Object->createDIDLFragment(DIDLDoc, FilterList));
- delete FilterList;
- (*Results)->mNumberReturned = 1;
- (*Results)->mTotalMatches = 1;
- (*Results)->mResult = ixmlDocumenttoString(DIDLDoc);
- ixmlDocument_free(DIDLDoc);
- return UPNP_E_SUCCESS;
- case false:
- if(Object->isContainer()){
- cUPnPClassContainer* Container = Object->getContainer();
- (*Results)->mTotalMatches = Container->getChildCount();
- cUPnPObjects* Children = Container->getObjectList();
-
- if(SortCriterias){
- for(cSortCrit* SortBy = SortCriterias->First(); SortBy ; SortBy = SortCriterias->Next(SortBy)){
- MESSAGE(VERBOSE_DIDL, "Sorting by %s %s", SortBy->Property, SortBy->SortDescending?"ascending":"descending");
- Children->SortBy(SortBy->Property, SortBy->SortDescending);
- }
- }
-
- cUPnPClassObject* Child = Children->First();
- if(Count==0 || Count > Container->getChildCount())
- Count = Container->getChildCount();
-
- MESSAGE(VERBOSE_DIDL, "Number of children: %d", Count);
- while(Offset-- && (Child = Children->Next(Child))){}
- for(; Count && Child ; Child = Children->Next(Child), Count--){
- MESSAGE(VERBOSE_DIDL, "Appending %s to didl", Child->getTitle());
- ixmlNode_appendChild(Root, Child->createDIDLFragment(DIDLDoc, FilterList));
- (*Results)->mNumberReturned++;
- }
- delete FilterList;
- delete SortCriterias;
- }
- else {
- (*Results)->mNumberReturned = 0;
- (*Results)->mTotalMatches = 0;
- }
- (*Results)->mResult = ixmlDocumenttoString(DIDLDoc);
- ixmlDocument_free(DIDLDoc);
- return UPNP_E_SUCCESS;
- }
- }
- else {
- ERROR("Unable to parse DIDL skeleton");
- return UPNP_CDS_E_CANT_PROCESS_REQUEST;
- }
- }
- else {
- ERROR("No such object: %s", ID);
- return UPNP_CDS_E_NO_SUCH_OBJECT; // No such object;
- }
- return UPNP_SOAP_E_ACTION_FAILED;
-} \ No newline at end of file
diff --git a/database/object.cpp b/database/object.cpp
deleted file mode 100644
index b193567..0000000
--- a/database/object.cpp
+++ /dev/null
@@ -1,1887 +0,0 @@
-/*
- * File: object.cpp
- * Author: savop
- *
- * Created on 11. September 2009, 20:39
- */
-
-#include <string.h>
-#include <stdio.h>
-#include <upnp/upnptools.h>
-#include <vdr/recording.h>
-#include <vector>
-#include "database.h"
-#include <vdr/tools.h>
-#include <upnp/ixml.h>
-#include "metadata.h"
-#include "object.h"
-#include "../common.h"
-#include "resources.h"
-
-static int CompareUPnPObjects(const void *a, const void *b){
- const cUPnPClassObject *la = *(const cUPnPClassObject **)a;
- const cUPnPClassObject *lb = *(const cUPnPClassObject **)b;
- return la->Compare(*lb);
-}
-
-cUPnPObjects::cUPnPObjects(){}
-
-cUPnPObjects::~cUPnPObjects(){}
-
-void cUPnPObjects::SortBy(const char* Property, bool Descending){
- int n = Count();
- cUPnPClassObject *a[n];
- cUPnPClassObject *object = (cUPnPClassObject *)objects;
- int i = 0;
- while (object && i < n) {
- object->setSortCriteria(Property, Descending);
- a[i++] = object;
- object = (cUPnPClassObject *)object->Next();
- }
- qsort(a, n, sizeof(cUPnPClassObject *), CompareUPnPObjects);
- objects = lastObject = NULL;
- for (i = 0; i < n; i++) {
- a[i]->Unlink();
- count--;
- Add(a[i]);
- }
-}
-
- /**********************************************\
- * *
- * UPnP Objects *
- * *
- \**********************************************/
-
- /**********************************************\
- * *
- * Object *
- * *
- \**********************************************/
-
-cUPnPClassObject::cUPnPClassObject(){
- this->mID = -1;
- this->mLastID = -1;
- this->mResources = new cList<cUPnPResource>;
- this->mResourcesID = new cHash<cUPnPResource>;
- this->mParent = NULL;
- this->mClass = NULL;
- this->mCreator = NULL;
- this->mTitle = NULL;
- this->mWriteStatus = WS_UNKNOWN;
- this->mRestricted = true;
- this->mDIDLFragment = NULL;
- this->mSortCriteria = NULL;
- this->mLastModified = NULL;
-}
-
-cUPnPClassObject::~cUPnPClassObject(){
- if(this->mParent) this->mParent->getContainer()->removeObject(this);
- this->mResources->Clear();
- this->mResourcesID->Clear();
- delete this->mResources;
- delete this->mResourcesID;
- free(this->mDIDLFragment);
-}
-
-int cUPnPClassObject::Compare(const cListObject& ListObject) const {
- char* Value1 = NULL; char* Value2 = NULL; int ret = 0;
- cUPnPClassObject* Object = (cUPnPClassObject*)&ListObject;
- if(Object->getProperty(this->mSortCriteria, &Value1) &&
- this->getProperty(this->mSortCriteria, &Value2)){
- ret = strcmp(Value1, Value2);
- if(this->mSortDescending) ret *= -1;
- }
- return ret;
-}
-
-void cUPnPClassObject::setSortCriteria(const char* Property, bool Descending){
- this->mSortCriteria = Property;
- this->mSortDescending = Descending;
-}
-
-void cUPnPClassObject::clearSortCriteria(){
- this->mSortCriteria = NULL;
- this->mSortDescending = false;
-}
-
-int cUPnPClassObject::setID(cUPnPObjectID ID){
- MESSAGE(VERBOSE_MODIFICATIONS, "Set ID from %s to %s", *this->getID(),*ID);
- if((int)ID < 0){
- ERROR("Invalid object ID '%s'",*ID);
- return -1;
- }
- this->mLastID = (this->mID==-1) ? ID : this->mID;
- this->mID = ID;
- return 0;
-}
-
-int cUPnPClassObject::setParent(cUPnPClassContainer* Parent){
- if(Parent==NULL){
- MESSAGE(VERBOSE_MODIFICATIONS, "Object '%s' elected as root object", *this->getID());
- }
- // unregister from old parent
- if(this->mParent && Parent != this->mParent){
- this->mParent->getContainer()->removeObject(this);
- }
- this->mParent = Parent;
- return 0;
-}
-
-int cUPnPClassObject::setClass(const char* Class){
- if( !strcasecmp(Class, UPNP_CLASS_ALBUM) ||
- !strcasecmp(Class, UPNP_CLASS_AUDIO) ||
- !strcasecmp(Class, UPNP_CLASS_AUDIOBC) ||
- !strcasecmp(Class, UPNP_CLASS_AUDIOBOOK) ||
- !strcasecmp(Class, UPNP_CLASS_CONTAINER) ||
- !strcasecmp(Class, UPNP_CLASS_GENRE) ||
- !strcasecmp(Class, UPNP_CLASS_IMAGE) ||
- !strcasecmp(Class, UPNP_CLASS_ITEM) ||
- !strcasecmp(Class, UPNP_CLASS_MOVIE) ||
- !strcasecmp(Class, UPNP_CLASS_MOVIEGENRE) ||
- !strcasecmp(Class, UPNP_CLASS_MUSICALBUM) ||
- !strcasecmp(Class, UPNP_CLASS_MUSICARTIST) ||
- !strcasecmp(Class, UPNP_CLASS_MUSICGENRE) ||
- !strcasecmp(Class, UPNP_CLASS_MUSICTRACK) ||
- !strcasecmp(Class, UPNP_CLASS_MUSICVIDCLIP) ||
- !strcasecmp(Class, UPNP_CLASS_OBJECT) ||
- !strcasecmp(Class, UPNP_CLASS_PERSON) ||
- !strcasecmp(Class, UPNP_CLASS_PHOTO) ||
- !strcasecmp(Class, UPNP_CLASS_PHOTOALBUM) ||
- !strcasecmp(Class, UPNP_CLASS_PLAYLIST) ||
- !strcasecmp(Class, UPNP_CLASS_PLAYLISTCONT) ||
- !strcasecmp(Class, UPNP_CLASS_STORAGEFOLD) ||
- !strcasecmp(Class, UPNP_CLASS_STORAGESYS) ||
- !strcasecmp(Class, UPNP_CLASS_STORAGEVOL) ||
- !strcasecmp(Class, UPNP_CLASS_TEXT) ||
- !strcasecmp(Class, UPNP_CLASS_VIDEO) ||
- !strcasecmp(Class, UPNP_CLASS_VIDEOBC)
- ){
- this->mClass = strdup0(Class);
- return 0;
- }
- else {
- ERROR("Invalid or unsupported class '%s'", Class);
- return -1;
- }
-}
-
-int cUPnPClassObject::setTitle(const char* Title){
- if(Title==NULL){
- ERROR("Title is empty but required");
- return -1;
- }
- this->mTitle = strdup0(Title);
- return 0;
-}
-
-int cUPnPClassObject::setCreator(const char* Creator){
- this->mCreator = strdup0(Creator);
- return 0;
-}
-
-int cUPnPClassObject::setRestricted(bool Restricted){
- this->mRestricted = Restricted;
- return 0;
-}
-
-int cUPnPClassObject::setWriteStatus(int WriteStatus){
- if( WriteStatus == WS_MIXED ||
- WriteStatus == WS_NOT_WRITABLE ||
- WriteStatus == WS_PROTECTED ||
- WriteStatus == WS_UNKNOWN ||
- WriteStatus == WS_WRITABLE){
- this->mWriteStatus = WriteStatus;
- return 0;
- }
- else {
- ERROR("Invalid write status '%d'", WriteStatus);
- return -1;
- }
-}
-
-bool cUPnPClassObject::getProperty(const char* Property, char** Value) const {
- cString Val;
- if(!strcasecmp(Property, SQLITE_COL_OBJECTID) || !strcasecmp(Property, UPNP_PROP_OBJECTID)){
- Val = *this->getID();
- }
- else if(!strcasecmp(Property, SQLITE_COL_PARENTID) || !strcasecmp(Property, UPNP_PROP_PARENTID)){
- Val = *this->getParentID();
- }
- else if(!strcasecmp(Property, SQLITE_COL_CLASS) || !strcasecmp(Property, UPNP_PROP_CLASS)){
- Val = this->getClass();
- }
- else if(!strcasecmp(Property, SQLITE_COL_TITLE) || !strcasecmp(Property, UPNP_PROP_TITLE)){
- Val = this->getTitle();
- }
- else if(!strcasecmp(Property, SQLITE_COL_CREATOR) || !strcasecmp(Property, UPNP_PROP_CREATOR)){
- Val = this->getCreator();
- }
- else if(!strcasecmp(Property, SQLITE_COL_RESTRICTED) || !strcasecmp(Property, UPNP_PROP_RESTRICTED)){
- Val = this->isRestricted()?"1":"0";
- }
- else if(!strcasecmp(Property, SQLITE_COL_WRITESTATUS) || !strcasecmp(Property, UPNP_PROP_WRITESTATUS)){
- Val = itoa(this->getWriteStatus());
- }
- else {
- ERROR("Invalid property '%s'", Property);
- return false;
- }
- *Value = strdup0(*Val);
- return true;
-}
-
-cStringList* cUPnPClassObject::getPropertyList(){
- cStringList* Properties = new cStringList;
- Properties->Append(strdup(UPNP_PROP_CREATOR));
- Properties->Append(strdup(UPNP_PROP_WRITESTATUS));
- return Properties;
-}
-
-bool cUPnPClassObject::setProperty(const char* Property, const char* Value){
- int ret;
- if(!strcasecmp(Property, SQLITE_COL_OBJECTID) || !strcasecmp(Property, UPNP_PROP_OBJECTID)){
- ERROR("Not allowed to set object ID by hand");
- return false;
- }
- else if(!strcasecmp(Property, SQLITE_COL_PARENTID) || !strcasecmp(Property, UPNP_PROP_PARENTID)){
- ERROR("Not allowed to set parent ID by hand");
- return false;
- }
- else if(!strcasecmp(Property, SQLITE_COL_CLASS) || !strcasecmp(Property, UPNP_PROP_CLASS)){
- ERROR("Not allowed to set class by hand");
- return false;
- }
- else if(!strcasecmp(Property, SQLITE_COL_TITLE) || !strcasecmp(Property, UPNP_PROP_TITLE)){
- ret = this->setTitle(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_CREATOR) || !strcasecmp(Property, UPNP_PROP_CREATOR)){
- ret = this->setCreator(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_RESTRICTED) || !strcasecmp(Property, UPNP_PROP_RESTRICTED)){
- ret = this->setRestricted(atoi(Value)==1?true:false);
- }
- else if(!strcasecmp(Property, SQLITE_COL_WRITESTATUS) || !strcasecmp(Property, UPNP_PROP_WRITESTATUS)){
- ret= this->setWriteStatus(atoi(Value));
- }
- else {
- ERROR("Invalid property '%s'", Property);
- return false;
- }
- return ret<0?false:true;
-}
-
-int cUPnPClassObject::addResource(cUPnPResource* Resource){
- MESSAGE(VERBOSE_MODIFICATIONS, "Adding resource #%d", Resource->getID());
- if(!Resource){
- ERROR("No resource");
- return -1;
- }
- this->mResources->Add(Resource);
- this->mResourcesID->Add(Resource, Resource->getID());
- return 0;
-}
-
-int cUPnPClassObject::removeResource(cUPnPResource* Resource){
- if(!Resource){
- ERROR("No resource");
- return -1;
- }
- this->mResourcesID->Del(Resource, Resource->getID());
- this->mResources->Del(Resource);
- return 0;
-}
-
- /**********************************************\
- * *
- * Item *
- * *
- \**********************************************/
-
-cUPnPClassItem::cUPnPClassItem(){
- this->setClass(UPNP_CLASS_ITEM);
- this->mReference = NULL;
-}
-
-int cUPnPClassItem::setReference(cUPnPClassItem* Reference){
- this->mReference = Reference;
- return 0;
-}
-
-cStringList* cUPnPClassItem::getPropertyList(){
- cStringList* Properties = cUPnPClassObject::getPropertyList();
- Properties->Append(strdup(UPNP_PROP_REFERENCEID));
- return Properties;
-}
-
-bool cUPnPClassItem::getProperty(const char* Property, char** Value) const {
-
- if(!strcasecmp(Property, SQLITE_COL_REFERENCEID) || !strcasecmp(Property, UPNP_PROP_REFERENCEID)){
- *Value = strdup0(*this->getReferenceID());
- }
- else return cUPnPClassObject::getProperty(Property, Value);
- return true;
-}
-
-bool cUPnPClassItem::setProperty(const char* Property, const char* Value){
- return cUPnPClassObject::setProperty(Property, Value);
-}
-
-IXML_Node* cUPnPClassItem::createDIDLFragment(IXML_Document* Document, cStringList* Filter){
- this->mDIDLFragment = Document;
-
- MESSAGE(VERBOSE_DIDL, "==(%s)= %s =====", *this->getID(), this->getTitle());
- MESSAGE(VERBOSE_DIDL, "ParentID: %s", *this->getParentID());
- MESSAGE(VERBOSE_DIDL, "Restricted: %s", this->isRestricted()?"1":"0");
- MESSAGE(VERBOSE_DIDL, "Class: %s", this->getClass());
- MESSAGE(VERBOSE_DIDL, "Filter: %d", Filter?Filter->Size():-1);
-
- IXML_Node* Didl = ixmlNode_getFirstChild((IXML_Node*) this->mDIDLFragment);
-
- IXML_Element* eItem = ixmlDocument_createElement(this->mDIDLFragment, "item");
- ixmlNode_appendChild(Didl, (IXML_Node*) eItem);
-
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_OBJECTID, *this->getID());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_PARENTID, *this->getParentID());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_RESTRICTED, this->isRestricted()?"1":"0");
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_TITLE, this->getTitle());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_CLASS, this->getClass());
-
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CREATOR, this->getCreator());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_WRITESTATUS, itoa(this->getWriteStatus()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_REFERENCEID, ((int)(this->getReferenceID())<0)?"":*this->getReferenceID());
-
- for(cUPnPResource* Resource = this->getResources()->First(); Resource; Resource = this->getResources()->Next(Resource)){
- MESSAGE(VERBOSE_DIDL, "Resource: %s", Resource->getResource());
- MESSAGE(VERBOSE_DIDL, "Protocolinfo: %s", Resource->getProtocolInfo());
-
- cString URLBase = cString::sprintf("http://%s:%d", UpnpGetServerIpAddress(), UpnpGetServerPort());
- cString ResourceURL = cString::sprintf("%s%s/get?resId=%d", *URLBase, UPNP_DIR_SHARES, Resource->getID());
-
- MESSAGE(VERBOSE_DIDL, "Resource-URI: %s", *ResourceURL);
-
- IXML_Element* eRes = ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_RESOURCE, *ResourceURL);
- if(eRes){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_BITRATE, itoa(Resource->getBitrate()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_BITSPERSAMPLE, itoa(Resource->getBitsPerSample()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_COLORDEPTH, itoa(Resource->getColorDepth()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_DURATION, Resource->getDuration());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_PROTOCOLINFO, Resource->getProtocolInfo());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eRes, UPNP_PROP_SIZE, cString::sprintf("%lld", Resource->getFileSize()));
- }
-
- }
-
- return (IXML_Node*)eItem;
-}
-
- /**********************************************\
- * *
- * Container *
- * *
- \**********************************************/
-
-cUPnPClassContainer::cUPnPClassContainer(){
- this->setClass(UPNP_CLASS_CONTAINER);
- this->mChildren = new cUPnPObjects;
- this->mChildrenID = new cHash<cUPnPClassObject>;
- this->mContainerType = NULL;
- this->mUpdateID = 0;
- this->mSearchable = false;
-}
-
-cUPnPClassContainer::~cUPnPClassContainer(){
- delete this->mChildren;
- delete this->mChildrenID;
-}
-
-IXML_Node* cUPnPClassContainer::createDIDLFragment(IXML_Document* Document, cStringList* Filter){
- this->mDIDLFragment = Document;
-
- MESSAGE(VERBOSE_DIDL, "===(%s)= %s =====", *this->getID(), this->getTitle());
- MESSAGE(VERBOSE_DIDL, "ParentID: %s", *this->getParentID());
- MESSAGE(VERBOSE_DIDL, "Restricted: %s", this->isRestricted()?"1":"0");
- MESSAGE(VERBOSE_DIDL, "Class: %s", this->getClass());
- MESSAGE(VERBOSE_DIDL, "Filter: %d", Filter?Filter->Size():-1);
-
- IXML_Node* Didl = ixmlNode_getFirstChild((IXML_Node*) this->mDIDLFragment);
- IXML_Element* eItem = ixmlDocument_createElement(this->mDIDLFragment, "container");
- ixmlNode_appendChild(Didl, (IXML_Node*) eItem);
-
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_OBJECTID, *this->getID());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_PARENTID, *this->getParentID());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_RESTRICTED, this->isRestricted()?"1":"0");
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_TITLE, this->getTitle());
- ixmlAddProperty(this->mDIDLFragment, eItem, UPNP_PROP_CLASS, this->getClass());
-
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_DLNA_CONTAINERTYPE, this->getContainerType());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CHILDCOUNT, itoa(this->getChildCount()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_SEARCHABLE, this->isSearchable()?"1":"0");
-
- const tClassVector* CreateClasses = this->getCreateClasses();
- for(unsigned int i = 0; i < CreateClasses->size(); i++){
- cClass CreateClass = CreateClasses->at(i);
- IXML_Element* eCreateClasses = ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CREATECLASS, CreateClass.ID);
- if(eCreateClasses)
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CCLASSDERIVED, CreateClass.includeDerived?"1":"0");
- }
-
- const tClassVector* SearchClasses = this->getSearchClasses();
- for(unsigned int i = 0; i < SearchClasses->size(); i++){
- cClass SearchClass = SearchClasses->at(i);
- IXML_Element* eSearchClasses = ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_SEARCHCLASS, SearchClass.ID);
- if(eSearchClasses)
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_SCLASSDERIVED, SearchClass.includeDerived?"1":"0");
- }
-
- return (IXML_Node*)eItem;
-}
-
-int cUPnPClassContainer::setUpdateID(unsigned int UID){
- this->mUpdateID = UID;
- return 0;
-}
-
-cStringList* cUPnPClassContainer::getPropertyList(){
- cStringList* Properties = cUPnPClassObject::getPropertyList();
- Properties->Append(strdup(UPNP_PROP_DLNA_CONTAINERTYPE));
- Properties->Append(strdup(UPNP_PROP_SEARCHABLE));
- return Properties;
-}
-
-bool cUPnPClassContainer::setProperty(const char* Property, const char* Value){
- int ret;
- if(!strcasecmp(Property, SQLITE_COL_DLNA_CONTAINERTYPE) || !strcasecmp(Property, UPNP_PROP_DLNA_CONTAINERTYPE)){
- ret = this->setContainerType(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_SEARCHABLE) || !strcasecmp(Property, UPNP_PROP_SEARCHABLE)){
- ret = this->setSearchable(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_CONTAINER_UID)){
- ret = this->setUpdateID((unsigned int)atoi(Value));
- }
- else return cUPnPClassObject::setProperty(Property, Value);
- return ret<0?false:true;
-}
-
-bool cUPnPClassContainer::getProperty(const char* Property, char** Value) const {
- cString Val;
- if(!strcasecmp(Property, SQLITE_COL_DLNA_CONTAINERTYPE) || !strcasecmp(Property, UPNP_PROP_DLNA_CONTAINERTYPE)){
- Val = this->getContainerType();
- }
- else if(!strcasecmp(Property, SQLITE_COL_SEARCHABLE) || !strcasecmp(Property, UPNP_PROP_SEARCHABLE)){
- Val = this->isSearchable()?"1":"0";
- }
- else if(!strcasecmp(Property, SQLITE_COL_CONTAINER_UID)){
- Val = cString::sprintf("%d", this->getUpdateID());
- }
- else return cUPnPClassObject::getProperty(Property, Value);
- *Value = strdup0(*Val);
- return true;
-}
-
-void cUPnPClassContainer::addObject(cUPnPClassObject* Object){
- MESSAGE(VERBOSE_MODIFICATIONS, "Adding object (ID:%s) to container (ID:%s)", *Object->getID(), *this->getID());
- Object->setParent(this);
- this->mChildren->Add(Object);
- this->mChildrenID->Add(Object, (unsigned int)Object->getID());
-}
-
-void cUPnPClassContainer::removeObject(cUPnPClassObject* Object){
- this->mChildrenID->Del(Object, (unsigned int)Object->getID());
- this->mChildren->Del(Object, false);
- Object->mParent = NULL;
- MESSAGE(VERBOSE_MODIFICATIONS, "Removed object (ID:%s) from container (ID:%s)", *Object->getID(), *this->getID());
-}
-
-cUPnPClassObject* cUPnPClassContainer::getObject(cUPnPObjectID ID) const {
- MESSAGE(VERBOSE_METADATA, "Getting object (ID:%s)", *ID);
- if((int)ID < 0){
- ERROR("Invalid object ID");
- return NULL;
- }
- return this->mChildrenID->Get((unsigned int)ID);
-}
-
-int cUPnPClassContainer::setContainerType(const char* Type){
- if(Type==NULL){
- this->mContainerType = Type;
- }
- else if(!strcasecmp(Type, DLNA_CONTAINER_TUNER)){
- this->mContainerType = Type;
- }
- else {
- ERROR("Invalid container type '%s'",Type);
- return -1;
- }
- return 0;
-}
-
-int cUPnPClassContainer::addSearchClass(cClass SearchClass){
- this->mSearchClasses.push_back(SearchClass);
- return 0;
-}
-
-int cUPnPClassContainer::delSearchClass(cClass SearchClass){
- tClassVector::iterator it = this->mSearchClasses.begin();
- cClass Class;
- for(unsigned int i=0; i<this->mSearchClasses.size(); i++){
- Class = this->mSearchClasses[i];
- if(Class == SearchClass){
- this->mSearchClasses.erase(it+i);
- return 0;
- }
- }
- return -1;
-}
-
-int cUPnPClassContainer::addCreateClass(cClass CreateClass){
- this->mCreateClasses.push_back(CreateClass);
- return 0;
-}
-
-int cUPnPClassContainer::delCreateClass(cClass CreateClass){
- tClassVector::iterator it = this->mCreateClasses.begin();
- cClass Class;
- for(unsigned int i=0; i<this->mCreateClasses.size(); i++){
- Class = this->mCreateClasses[i];
- if(Class == CreateClass){
- this->mCreateClasses.erase(it+i);
- return 0;
- }
- }
- return -1;
-}
-
-int cUPnPClassContainer::setSearchClasses(std::vector<cClass> SearchClasses){
- this->mSearchClasses = SearchClasses;
- return 0;
-}
-
-int cUPnPClassContainer::setCreateClasses(std::vector<cClass> CreateClasses){
- this->mCreateClasses = CreateClasses;
- return 0;
-}
-
-int cUPnPClassContainer::setSearchable(bool Searchable){
- this->mSearchable = Searchable;
- return 0;
-}
-
-bool cUPnPClassContainer::isUpdated(){
- static unsigned int lastUpdateID = this->getUpdateID();
- if(lastUpdateID != this->getUpdateID()){
- lastUpdateID = this->getUpdateID();
- return true;
- }
- else return false;
-}
-
- /**********************************************\
- * *
- * Video item *
- * *
- \**********************************************/
-
-cUPnPClassVideoItem::cUPnPClassVideoItem(){
- this->setClass(UPNP_CLASS_VIDEO);
- this->mGenre = NULL;
- this->mLongDescription = NULL;
- this->mProducers = NULL;
- this->mRating = NULL;
- this->mActors = NULL;
- this->mDirectors = NULL;
- this->mDescription = NULL;
- this->mPublishers = NULL;
- this->mLanguage = NULL;
- this->mRelations = NULL;
-}
-
-cUPnPClassVideoItem::~cUPnPClassVideoItem(){
-}
-
-IXML_Node* cUPnPClassVideoItem::createDIDLFragment(IXML_Document* Document, cStringList* Filter){
- IXML_Element* eItem = (IXML_Element*) cUPnPClassItem::createDIDLFragment(Document, Filter);
-
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_LONGDESCRIPTION, this->getLongDescription());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_DESCRIPTION, this->getDescription());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_LANGUAGE, this->getLanguage());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_RATING, this->getRating());
-
- char* genre = strtok(strdup0(this->getGenre()), ",");
- while(genre){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_GENRE, genre);
- genre = strtok(NULL, ",");
- }
-
- char* producer = strtok(strdup0(this->getProducers()), ",");
- while(producer){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_PRODUCER, producer);
- producer = strtok(NULL, ",");
- }
-
- char* actor = strtok(strdup0(this->getActors()), ",");
- while(actor){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_ACTOR, actor);
- actor = strtok(NULL, ",");
- }
-
- char* director = strtok(strdup0(this->getDirectors()), ",");
- while(director){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_DIRECTOR, director);
- director = strtok(NULL, ",");
- }
-
- char* publisher = strtok(strdup0(this->getPublishers()), ",");
- while(publisher){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_PUBLISHER, publisher);
- publisher = strtok(NULL, ",");
- }
-
- char* relation = strtok(strdup0(this->getRelations()), ",");
- while(relation){
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_RELATION, relation);
- relation = strtok(NULL, ",");
- }
-
- return (IXML_Node*) eItem;
-}
-
-cStringList* cUPnPClassVideoItem::getPropertyList(){
- cStringList* Properties = cUPnPClassItem::getPropertyList();
- Properties->Append(strdup(UPNP_PROP_LONGDESCRIPTION));
- Properties->Append(strdup(UPNP_PROP_PRODUCER));
- Properties->Append(strdup(UPNP_PROP_GENRE));
- Properties->Append(strdup(UPNP_PROP_RATING));
- Properties->Append(strdup(UPNP_PROP_ACTOR));
- Properties->Append(strdup(UPNP_PROP_DIRECTOR));
- Properties->Append(strdup(UPNP_PROP_DESCRIPTION));
- Properties->Append(strdup(UPNP_PROP_PUBLISHER));
- Properties->Append(strdup(UPNP_PROP_LANGUAGE));
- Properties->Append(strdup(UPNP_PROP_RELATION));
- return Properties;
-}
-
-bool cUPnPClassVideoItem::getProperty(const char* Property, char** Value) const {
- cString Val;
- if(!strcasecmp(Property,SQLITE_COL_GENRE) || !strcasecmp(Property,UPNP_PROP_GENRE)){
- Val = this->getGenre();
- }
- else if(!strcasecmp(Property,SQLITE_COL_LONGDESCRIPTION) || !strcasecmp(Property,UPNP_PROP_LONGDESCRIPTION)){
- Val = this->getLongDescription();
- }
- else if(!strcasecmp(Property,SQLITE_COL_PRODUCER) || !strcasecmp(Property,UPNP_PROP_PRODUCER)){
- Val = this->getProducers();
- }
- else if(!strcasecmp(Property,SQLITE_COL_RATING) || !strcasecmp(Property,UPNP_PROP_RATING)){
- Val = this->getRating();
- }
- else if(!strcasecmp(Property,SQLITE_COL_ACTOR) || !strcasecmp(Property,UPNP_PROP_ACTOR)){
- Val = this->getActors();
- }
- else if(!strcasecmp(Property,SQLITE_COL_DIRECTOR) || !strcasecmp(Property,UPNP_PROP_DIRECTOR)){
- Val = this->getDirectors();
- }
- else if(!strcasecmp(Property,SQLITE_COL_DESCRIPTION) || !strcasecmp(Property,UPNP_PROP_DESCRIPTION)){
- Val = this->getDescription();
- }
- else if(!strcasecmp(Property,SQLITE_COL_PUBLISHER) || !strcasecmp(Property,UPNP_PROP_PUBLISHER)){
- Val = this->getPublishers();
- }
- else if(!strcasecmp(Property,SQLITE_COL_LANGUAGE) || !strcasecmp(Property,UPNP_PROP_LANGUAGE)){
- Val = this->getLanguage();
- }
- else if(!strcasecmp(Property,SQLITE_COL_RELATION) || !strcasecmp(Property,UPNP_PROP_RELATION)){
- Val = this->getRelations();
- }
- else return cUPnPClassItem::getProperty(Property, Value);
- *Value = strdup0(*Val);
- return true;
-}
-
-bool cUPnPClassVideoItem::setProperty(const char* Property, const char* Value){
- bool ret;
- if(!strcasecmp(Property,SQLITE_COL_GENRE) || !strcasecmp(Property,UPNP_PROP_GENRE)){
- ret = this->setGenre(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_LONGDESCRIPTION) || !strcasecmp(Property,UPNP_PROP_LONGDESCRIPTION)){
- ret = this->setLongDescription(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_PRODUCER) || !strcasecmp(Property,UPNP_PROP_PRODUCER)){
- ret = this->setProducers(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_RATING) || !strcasecmp(Property,UPNP_PROP_RATING)){
- ret = this->setRating(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_ACTOR) || !strcasecmp(Property,UPNP_PROP_ACTOR)){
- ret = this->setActors(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_DIRECTOR) || !strcasecmp(Property,UPNP_PROP_DIRECTOR)){
- ret = this->setDirectors(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_DESCRIPTION) || !strcasecmp(Property,UPNP_PROP_DESCRIPTION)){
- ret = this->setDescription(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_PUBLISHER) || !strcasecmp(Property,UPNP_PROP_PUBLISHER)){
- ret = this->setPublishers(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_LANGUAGE) || !strcasecmp(Property,UPNP_PROP_LANGUAGE)){
- ret = this->setLanguage(Value);
- }
- else if(!strcasecmp(Property,SQLITE_COL_RELATION) || !strcasecmp(Property,UPNP_PROP_RELATION)){
- ret = this->setRelations(Value);
- }
- else return cUPnPClassItem::setProperty(Property, Value);
- return ret<0?false:true;
-}
-
-int cUPnPClassVideoItem::setActors(const char* Actors){
- this->mActors = Actors;
- return 0;
-}
-
-int cUPnPClassVideoItem::setGenre(const char* Genre){
- this->mGenre = Genre;
- return 0;
-}
-
-int cUPnPClassVideoItem::setDescription(const char* Description){
- this->mDescription = Description;
- return 0;
-}
-
-int cUPnPClassVideoItem::setLongDescription(const char* LongDescription){
- this->mLongDescription = LongDescription;
- return 0;
-}
-
-int cUPnPClassVideoItem::setProducers(const char* Producers){
- this->mProducers = Producers;
- return 0;
-}
-
-int cUPnPClassVideoItem::setRating(const char* Rating){
- this->mRating = Rating;
- return 0;
-}
-
-int cUPnPClassVideoItem::setDirectors(const char* Directors){
- this->mDirectors = Directors;
- return 0;
-}
-
-int cUPnPClassVideoItem::setPublishers(const char* Publishers){
- this->mPublishers = Publishers;
- return 0;
-}
-
-int cUPnPClassVideoItem::setLanguage(const char* Language){
- this->mLanguage = Language;
- return 0;
-}
-
-int cUPnPClassVideoItem::setRelations(const char* Relations){
- this->mRelations = Relations;
- return 0;
-}
-
- /**********************************************\
- * *
- * Video Broadcast item *
- * *
- \**********************************************/
-
-cUPnPClassVideoBroadcast::cUPnPClassVideoBroadcast(){
- this->setClass(UPNP_CLASS_VIDEOBC);
- this->mIcon = NULL;
- this->mRegion = NULL;
- this->mChannelNr = 0;
-}
-
-cUPnPClassVideoBroadcast::~cUPnPClassVideoBroadcast(){
-}
-
-IXML_Node* cUPnPClassVideoBroadcast::createDIDLFragment(IXML_Document* Document, cStringList* Filter){
- IXML_Element* eItem = (IXML_Element*) cUPnPClassItem::createDIDLFragment(Document, Filter);
-
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CHANNELNAME, this->getChannelName());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_CHANNELNR, itoa(this->getChannelNr()));
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_ICON, this->getIcon());
- ixmlAddFilteredProperty(Filter, this->mDIDLFragment, eItem, UPNP_PROP_REGION, this->getRegion());
-
- return (IXML_Node*) eItem;
-}
-
-cStringList* cUPnPClassVideoBroadcast::getPropertyList(){
- cStringList* Properties = cUPnPClassVideoItem::getPropertyList();
- Properties->Append(strdup(UPNP_PROP_CHANNELNAME));
- Properties->Append(strdup(UPNP_PROP_CHANNELNR));
- Properties->Append(strdup(UPNP_PROP_ICON));
- Properties->Append(strdup(UPNP_PROP_REGION));
- return Properties;
-}
-
-bool cUPnPClassVideoBroadcast::setProperty(const char* Property, const char* Value){
- bool ret;
- if(!strcasecmp(Property, SQLITE_COL_CHANNELNAME) || !strcasecmp(Property, UPNP_PROP_CHANNELNAME)){
- ret = this->setChannelName(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_CHANNELNR) || !strcasecmp(Property, UPNP_PROP_CHANNELNR)){
- ret = this->setChannelNr(atoi(Value));
- }
- else if(!strcasecmp(Property, SQLITE_COL_ICON) || !strcasecmp(Property, UPNP_PROP_ICON)){
- ret = this->setIcon(Value);
- }
- else if(!strcasecmp(Property, SQLITE_COL_REGION) || !strcasecmp(Property, UPNP_PROP_REGION)){
- ret = this->setRegion(Value);
- }
- else return cUPnPClassVideoItem::setProperty(Property, Value);
- return ret<0?false:true;
-}
-
-bool cUPnPClassVideoBroadcast::getProperty(const char* Property, char** Value) const {
- cString Val;
- if(!strcasecmp(Property, SQLITE_COL_CHANNELNAME) || !strcasecmp(Property, UPNP_PROP_CHANNELNAME)){
- Val = this->getChannelName();
- }
- else if(!strcasecmp(Property, SQLITE_COL_CHANNELNR) || !strcasecmp(Property, UPNP_PROP_CHANNELNR)){
- Val = itoa(this->getChannelNr());
- }
- else if(!strcasecmp(Property, SQLITE_COL_ICON) || !strcasecmp(Property, UPNP_PROP_ICON)){
- Val = this->getIcon();
- }
- else if(!strcasecmp(Property, SQLITE_COL_REGION) || !strcasecmp(Property, UPNP_PROP_REGION)){
- Val = this->getRegion();
- }
- else return cUPnPClassVideoItem::getProperty(Property, Value);
- *Value = strdup0(*Val);
- return true;
-}
-
-int cUPnPClassVideoBroadcast::setChannelName(const char* ChannelName){
- this->mChannelName = ChannelName;
- return 0;
-}
-
-int cUPnPClassVideoBroadcast::setChannelNr(int ChannelNr){
- this->mChannelNr = ChannelNr;
- return 0;
-}
-
-int cUPnPClassVideoBroadcast::setIcon(const char* IconURI){
- this->mIcon = IconURI;
- return 0;
-}
-
-int cUPnPClassVideoBroadcast::setRegion(const char* Region){
- this->mRegion = Region;
- return 0;
-}
-
-/**********************************************\
-* *
-* Movie item *
-* *
-\**********************************************/
-
-cUPnPClassMovie::cUPnPClassMovie(){
- this->mDVDRegionCode = 2; // Europe
- this->mStorageMedium = UPNP_STORAGE_UNKNOWN;
-}
-
-cUPnPClassMovie::~cUPnPClassMovie(){}
-
-//cString cUPnPClassMovie::createDIDLFragment(cStringList* Filter){
-// return NULL;
-//}
-
-cStringList* cUPnPClassMovie::getPropertyList(){
- cStringList* Properties = cUPnPClassVideoItem::getPropertyList();
- Properties->Append(strdup(UPNP_PROP_DVDREGIONCODE));
- Properties->Append(strdup(UPNP_PROP_STORAGEMEDIUM));
- return Properties;
-}
-
-bool cUPnPClassMovie::setProperty(const char* Property, const char* Value){
- bool ret;
- if(!strcasecmp(Property, SQLITE_COL_DVDREGIONCODE) || !strcasecmp(Property, UPNP_PROP_DVDREGIONCODE)){
- ret = this->setDVDRegionCode(atoi(Value));
- }
- else if(!strcasecmp(Property, SQLITE_COL_STORAGEMEDIUM) || !strcasecmp(Property, UPNP_PROP_STORAGEMEDIUM)){
- ret = this->setStorageMedium(Value);
- }
- else return cUPnPClassVideoItem::setProperty(Property, Value);
- return ret<0?false:true;
-}
-
-bool cUPnPClassMovie::getProperty(const char* Property, char** Value) const {
- cString Val;
- if(!strcasecmp(Property, SQLITE_COL_DVDREGIONCODE) || !strcasecmp(Property, UPNP_PROP_DVDREGIONCODE)){
- Val = itoa(this->getDVDRegionCode());
- }
- else if(!strcasecmp(Property, SQLITE_COL_STORAGEMEDIUM) || !strcasecmp(Property, UPNP_PROP_STORAGEMEDIUM)){
- Val = this->getStorageMedium();
- }
- else return cUPnPClassVideoItem::getProperty(Property, Value);
- *Value = strdup0(*Val);
- return true;
-}
-
-int cUPnPClassMovie::setDVDRegionCode(int RegionCode){
-// http://en.wikipedia.org/wiki/DVD_region_code
-// 0 Informal term meaning "worldwide". Region 0 is not an official setting; discs that bear the region 0 symbol either have no flag set or have region 1–6 flags set.
-// 1 Canada, United States; U.S. territories; Bermuda
-// 2 Western Europe; incl. United Kingdom, Ireland, and Central Europe; Eastern Europe, Western Asia; including Iran, Israel, Egypt; Japan, South Africa, Swaziland, Lesotho; French overseas territories
-// 3 Southeast Asia; South Korea; Taiwan; Hong Kong; Macau
-// 4 Mexico, Central and South America; Caribbean; Australia; New Zealand; Oceania;
-// 5 Ukraine, Belarus, Russia, Continent of Africa, excluding Egypt, South Africa, Swaziland, and Lesotho; Central and South Asia, Mongolia, North Korea.
-// 6 People's Republic of China
-// 7 Reserved for future use (found in use on protected screener copies of MPAA-related DVDs and "media copies" of pre-releases in Asia)
-// 8 International venues such as aircraft, cruise ships, etc.[1]
-// ALL (9) Region ALL discs have all 8 flags set, allowing the disc to be played in any locale on any player.
- if(0 <= RegionCode && RegionCode <= 9){
- this->mDVDRegionCode = RegionCode;
- return 0;
- }
- else {
- ERROR("Invalid DVD region code: %d", RegionCode);
- return -1;
- }
-}
-
-int cUPnPClassMovie::setStorageMedium(const char* StorageMedium){
- if(!StorageMedium) this->mStorageMedium = UPNP_STORAGE_UNKNOWN;
- else if(
- strcasecmp(StorageMedium,UPNP_STORAGE_CD_DA) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_CD_R) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_CD_ROM) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_CD_RW) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DAT) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DV) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_AUDIO) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_RAM) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_ROM) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_RW_MINUS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_RW_PLUS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_R_MINUS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_DVD_VIDEO) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_D_VHS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_HDD) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_HI8) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_LD) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_MD_AUDIO) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_MD_PICTURE) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_MICRO_MV) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_MINI_DV) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_NETWORK) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_SACD) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_S_VHS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_UNKNOWN) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_VHS) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_VHSC) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_VIDEO8) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_VIDEO_CD) &&
- strcasecmp(StorageMedium,UPNP_STORAGE_W_VHS)
- ){
- ERROR("Invalid storage type: %s", StorageMedium);
- return -1;
- }
- else {
- this->mStorageMedium = StorageMedium;
- }
- return 0;
-}
-
-/**********************************************\
-* *
-* Mediator factory *
-* *
-\**********************************************/
-
-cUPnPObjectFactory* cUPnPObjectFactory::mInstance = NULL;
-
-cUPnPObjectFactory* cUPnPObjectFactory::getInstance(){
- if(!cUPnPObjectFactory::mInstance)
- cUPnPObjectFactory::mInstance = new cUPnPObjectFactory();
-
- if(cUPnPObjectFactory::mInstance) return cUPnPObjectFactory::mInstance;
- else return NULL;
-}
-
-cUPnPObjectFactory::cUPnPObjectFactory(){
- this->mDatabase = cSQLiteDatabase::getInstance();
-}
-
-void cUPnPObjectFactory::registerMediator(const char* UPnPClass, cMediatorInterface* Mediator){
- if(UPnPClass == NULL){
- ERROR("Class is undefined");
- return;
- }
- if(Mediator == NULL){
- ERROR("Mediator is undefined");
- return;
- }
- MESSAGE(VERBOSE_SDK, "Registering mediator for class '%s'", UPnPClass);
- this->mMediators[UPnPClass] = Mediator;
- MESSAGE(VERBOSE_SDK, "Now %d mediators registered", this->mMediators.size());
- return;
-}
-
-void cUPnPObjectFactory::unregisterMediator(const char* UPnPClass, bool freeMediator){
- if(UPnPClass == NULL){
- ERROR("Class is undefined");
- return;
- }
- tMediatorMap::iterator MediatorIterator = this->mMediators.find(UPnPClass);
- if(MediatorIterator==this->mMediators.end()){
- ERROR("No such mediator found for class '%s'", UPnPClass);
- return;
- }
- MESSAGE(VERBOSE_SDK, "Unregistering mediator for class '%s'", UPnPClass);
- this->mMediators.erase(MediatorIterator);
- if(freeMediator) delete MediatorIterator->second;
- MESSAGE(VERBOSE_SDK, "Now %d mediators registered", this->mMediators.size());
- return;
-}
-
-cMediatorInterface* cUPnPObjectFactory::findMediatorByID(cUPnPObjectID ID){
- cString Format = "SELECT %s FROM %s WHERE %s=%Q";
- cString Column = NULL, Value = NULL, Class = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement(Format, SQLITE_COL_CLASS, SQLITE_TABLE_OBJECTS, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return NULL;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- ERROR("No such object with ID '%s'",*ID);
- return NULL;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_CLASS)){
- Class = strdup0(*Value);
- }
- }
- return this->findMediatorByClass(Class);
-}
-
-cMediatorInterface* cUPnPObjectFactory::findMediatorByClass(const char* Class){
- if(!Class){ ERROR("No class specified"); return NULL; }
- MESSAGE(VERBOSE_SQL, "Searching for mediator '%s' in %d mediators", Class, this->mMediators.size());
- tMediatorMap::iterator MediatorIterator = this->mMediators.find(Class);
- if(MediatorIterator==this->mMediators.end()){
- ERROR("No matching mediator for class '%s'",Class);
- return NULL;
- }
- else {
- return MediatorIterator->second;
- }
-}
-
-cUPnPClassObject* cUPnPObjectFactory::getObject(cUPnPObjectID ID){
- cMediatorInterface* Mediator = this->findMediatorByID(ID);
- if(Mediator) return Mediator->getObject(ID);
- else {
- return NULL;
- }
-}
-
-cUPnPClassObject* cUPnPObjectFactory::createObject(const char* UPnPClass, const char* Title, bool Restricted){
- cMediatorInterface* Mediator = this->findMediatorByClass(UPnPClass);
- return Mediator->createObject(Title, Restricted);
-}
-
-int cUPnPObjectFactory::deleteObject(cUPnPClassObject* Object){
- cMediatorInterface* Mediator = this->findMediatorByClass(Object->getClass());
- return Mediator->deleteObject(Object);
-}
-
-int cUPnPObjectFactory::clearObject(cUPnPClassObject* Object){
- cMediatorInterface* Mediator = this->findMediatorByClass(Object->getClass());
- return Mediator->clearObject(Object);
-}
-
-int cUPnPObjectFactory::saveObject(cUPnPClassObject* Object){
- cMediatorInterface* Mediator = this->findMediatorByClass(Object->getClass());
- return Mediator->saveObject(Object);
-}
-
- /**********************************************\
- * *
- * Mediators *
- * *
- \**********************************************/
-
- /**********************************************\
- * *
- * Object mediator *
- * *
- \**********************************************/
-
-cUPnPObjectMediator::cUPnPObjectMediator(cMediaDatabase* MediaDatabase) :
- mMediaDatabase(MediaDatabase){
- this->mDatabase = cSQLiteDatabase::getInstance();
-}
-
-cUPnPObjectMediator::~cUPnPObjectMediator(){
- delete this->mDatabase;
- delete this->mMediaDatabase;
-}
-
-int cUPnPObjectMediator::saveObject(cUPnPClassObject* Object){
- bool succesful = true;
-
- this->mDatabase->startTransaction();
- if(Object->getID() == -1) succesful = false;
- else if(this->objectToDatabase(Object)) succesful = false;
- else succesful = true;
-
- if(succesful){
- this->mDatabase->commitTransaction();
- Object->setModified();
- this->mMediaDatabase->cacheObject(Object);
- this->mMediaDatabase->updateSystemID();
- return 0;
- }
- else {
- this->mDatabase->rollbackTransaction();
- return -1;
- }
- return -1;
-}
-
-int cUPnPObjectMediator::deleteObject(cUPnPClassObject* Object){
- cString Format = "DELETE FROM %s WHERE %s=%Q";
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_OBJECTS, SQLITE_COL_OBJECTID, *Object->getID())){
- ERROR("Error while executing statement");
- return -1;
- }
- #ifdef SQLITE_CASCADE_DELETES
- this->clearObject(Object);
- #endif
- delete Object; Object = NULL;
- return 0;
-}
-
-int cUPnPObjectMediator::clearObject(cUPnPClassObject* Object){
- cUPnPClassContainer* Container = Object->getContainer();
- if(Container){
- cList<cUPnPClassObject>* List = Container->getObjectList();
- for(cUPnPClassObject* Child = List->First(); Child; Child = List->Next(Child)){
- if(this->deleteObject(Child)) return -1;
- }
- }
- return 0;
-}
-
-int cUPnPObjectMediator::initializeObject(cUPnPClassObject* Object, const char* Class, const char* Title, bool Restricted){
- cUPnPObjectID ObjectID = this->mMediaDatabase->getNextObjectID();
- if(Object->setID(ObjectID)){
- ERROR("Error while setting ID");
- return -1;
- }
- cUPnPClassObject* Root = this->mMediaDatabase->getObjectByID(0);
- if(Root){
- Root->getContainer()->addObject(Object);
- }
- else {
- Object->setParent(NULL);
- }
- if(Object->setClass(Class)){
- ERROR("Error while setting class");
- return -1;
- }
- if(Object->setTitle(Title)){
- ERROR("Error while setting title");
- return -1;
- }
- if(Object->setRestricted(Restricted)){
- ERROR("Error while setting restriction");
- return -1;
- }
- if(this->mDatabase->execStatement("INSERT INTO %s (%s, %s, %s, %s, %s) VALUES (%s, %s, %Q, %Q, %d)",
- SQLITE_TABLE_OBJECTS,
- SQLITE_COL_OBJECTID,
- SQLITE_COL_PARENTID,
- SQLITE_COL_CLASS,
- SQLITE_COL_TITLE,
- SQLITE_COL_RESTRICTED,
- *Object->getID(),
- *Object->getParentID(),
- Object->getClass(),
- Object->getTitle(),
- Object->isRestricted()?1:0)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-cUPnPClassObject* cUPnPObjectMediator::getObject(cUPnPObjectID){ WARNING("Getting instance of class 'Object' forbidden"); return NULL; }
-
-cUPnPClassObject* cUPnPObjectMediator::createObject(const char*, bool){ WARNING("Getting instance of class 'Object' forbidden"); return NULL; }
-
-int cUPnPObjectMediator::objectToDatabase(cUPnPClassObject* Object){
- MESSAGE(VERBOSE_MODIFICATIONS, "Updating object #%s", *Object->getID());
- cString Format = "UPDATE %s SET %s WHERE %s='%s'";
- //cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Set=NULL;
- //cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_PARENTID,
- SQLITE_COL_CLASS,
- SQLITE_COL_TITLE,
- SQLITE_COL_RESTRICTED,
- SQLITE_COL_CREATOR,
- SQLITE_COL_WRITESTATUS,
- NULL
- };
- for(cString* Property = Properties; *(*Property)!=NULL; Property++){
- if(!Object->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),*Object->getID());
- return -1;
- }
- Set = cSQLiteDatabase::sprintf("%s%s%s=%Q", *Set?*Set:"", *Set?",":"", *(*Property), Value);
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_OBJECTS, *Set, SQLITE_COL_OBJECTID, *Object->mLastID)){
- ERROR("Error while executing statement");
- return -1;
- }
- // The update was successful --> the current ID is now also the LastID
- Object->mLastID = Object->mID;
- return 0;
-}
-
-int cUPnPObjectMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement("SELECT * FROM %s WHERE %s=%Q",
- SQLITE_TABLE_OBJECTS,
- SQLITE_COL_OBJECTID,
- *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- ERROR("No such object with ID '%s'",*ID);
- return -1;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_OBJECTID)){
- if(!*Value || Object->setID(atoi(Value))){
- ERROR("Error while setting object ID");
- return -1;
- }
- this->mMediaDatabase->cacheObject(Object);
- }
- else if(!strcasecmp(Column, SQLITE_COL_PARENTID)){
- if(*Value){
- cUPnPObjectID RefID = atoi(Value);
- cUPnPClassContainer* ParentObject;
- if(RefID == -1){
- ParentObject = NULL;
- }
- else {
- ParentObject = (cUPnPClassContainer*)this->mMediaDatabase->getObjectByID(RefID);
- if(!ParentObject){
- ERROR("No such parent with ID '%s' found.",*RefID);
- return -1;
- }
- }
- Object->setParent(ParentObject);
- }
- else {
- ERROR("Invalid parent ID");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_CLASS)){
- if(!*Value || Object->setClass(Value)){
- ERROR("Error while setting class");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_TITLE)){
- if(!*Value || Object->setTitle(Value)){
- ERROR("Error while setting title");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_RESTRICTED)){
- if(!*Value || Object->setRestricted(atoi(Value)==1?true:false)){
- ERROR("Error while setting restriction");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_CREATOR)){
- if(Object->setCreator(Value)){
- ERROR("Error while setting creator");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_WRITESTATUS)){
- if(*Value && Object->setWriteStatus(atoi(Value))){
- ERROR("Error while setting write status");
- return -1;
- }
- }
- }
- cUPnPResources::getInstance()->getResourcesOfObject(Object);
- return 0;
-}
-
- /**********************************************\
- * *
- * Item mediator *
- * *
- \**********************************************/
-
-cUPnPItemMediator::cUPnPItemMediator(cMediaDatabase* MediaDatabase) :
- cUPnPObjectMediator(MediaDatabase){}
-
-int cUPnPItemMediator::objectToDatabase(cUPnPClassObject* Object){
- if(cUPnPObjectMediator::objectToDatabase(Object)) return -1;
- cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_REFERENCEID,
- NULL
- };
- for(cString* Property = Properties; *(*Property); Property++){
- Columns = cSQLiteDatabase::sprintf("%s%s%s", *Columns?*Columns:"", *Columns?",":"", *(*Property));
- if(!Object->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),*Object->getID());
- return -1;
- }
- Values = cSQLiteDatabase::sprintf("%s%s%Q", *Values?*Values:"", *Values?",":"", Value);
-
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_ITEMS, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-int cUPnPItemMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- if(cUPnPObjectMediator::databaseToObject(Object,ID)){
- ERROR("Error while loading object");
- return -1;
- }
- cUPnPClassItem* Item = (cUPnPClassItem*) Object;
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement("SELECT * FROM %s WHERE %s=%Q",
- SQLITE_TABLE_ITEMS,
- SQLITE_COL_OBJECTID,
- *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- MESSAGE(VERBOSE_SQL, "No item properties found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_REFERENCEID)){
- cUPnPObjectID RefID = atoi(Value);
- cUPnPClassItem* RefObject;
- if(RefID == -1){
- RefObject = NULL;
- }
- else {
- RefObject = (cUPnPClassItem*)this->mMediaDatabase->getObjectByID(RefID);
- if(!RefObject){
- ERROR("No such reference item with ID '%s' found.",*RefID);
- return -1;
- }
- }
- Item->setReference(RefObject);
- }
- }
- return 0;
-}
-
-cUPnPClassItem* cUPnPItemMediator::getObject(cUPnPObjectID ID){
- MESSAGE(VERBOSE_METADATA, "Getting Item with ID '%s'",*ID);
- cUPnPClassItem* Object = new cUPnPClassItem;
- if(this->databaseToObject(Object, ID)) return NULL;
- return Object;
-}
-
-cUPnPClassItem* cUPnPItemMediator::createObject(const char* Title, bool Restricted){
- MESSAGE(VERBOSE_MODIFICATIONS, "Creating Item '%s'",Title);
- cUPnPClassItem* Object = new cUPnPClassItem;
- if(this->initializeObject(Object, UPNP_CLASS_ITEM, Title, Restricted)) return NULL;
- return Object;
-}
-
- /**********************************************\
- * *
- * Container mediator *
- * *
- \**********************************************/
-
-cUPnPContainerMediator::cUPnPContainerMediator(cMediaDatabase* MediaDatabase) :
- cUPnPObjectMediator(MediaDatabase){}
-
-int cUPnPContainerMediator::objectToDatabase(cUPnPClassObject* Object){
- if(cUPnPObjectMediator::objectToDatabase(Object)) return -1;
- cUPnPClassContainer* Container = (cUPnPClassContainer*)Object;
- cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_DLNA_CONTAINERTYPE,
- SQLITE_COL_SEARCHABLE,
- SQLITE_COL_CONTAINER_UID,
- NULL
- };
- for(cString* Property = Properties; *(*Property); Property++){
- Columns = cSQLiteDatabase::sprintf("%s%s%s", *Columns?*Columns:"", *Columns?",":"", *(*Property));
- if(!Container->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),*Container->getID());
- return -1;
- }
- Values = cSQLiteDatabase::sprintf("%s%s%Q", *Values?*Values:"", *Values?",":"", Value);
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_CONTAINERS, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- for(unsigned int i=0; i<Container->getSearchClasses()->size(); i++){
- cClass Class = Container->getSearchClasses()->at(i);
- Columns = cSQLiteDatabase::sprintf("%s,%s,%s", SQLITE_COL_OBJECTID, SQLITE_COL_CLASS, SQLITE_COL_CLASSDERIVED);
- Values = cSQLiteDatabase::sprintf("%Q,%Q,%d", *Container->getID(), *Class.ID, Class.includeDerived?1:0);
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_SEARCHCLASS, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- }
- // Create classes not necessary at the moment
- return 0;
-}
-
-int cUPnPContainerMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- if(cUPnPObjectMediator::databaseToObject(Object,ID)){
- ERROR("Error while loading object");
- return -1;
- }
- cUPnPClassContainer* Container = (cUPnPClassContainer*)Object;
- cString Format = "SELECT * FROM %s WHERE %s=%s";
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_CONTAINERS, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- MESSAGE(VERBOSE_SQL, "No item properties found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_DLNA_CONTAINERTYPE)){
- if(Container->setContainerType(Value)){
- ERROR("Error while setting container type");
- return -1;
- }
- }
- if(!strcasecmp(Column, SQLITE_COL_CONTAINER_UID)){
- if(Container->setUpdateID((unsigned int)atoi(Value))){
- ERROR("Error while setting update ID");
- return -1;
- }
- }
- if(!strcasecmp(Column, SQLITE_COL_SEARCHABLE)){
- if(Container->setSearchable(atoi(Value)==1?true:false)){
- ERROR("Error while setting searchable");
- return -1;
- }
- }
- }
- if(this->mDatabase->execStatement("SELECT %s FROM %s WHERE %s=%s", SQLITE_COL_OBJECTID,
- SQLITE_TABLE_OBJECTS,
- SQLITE_COL_PARENTID,
- *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- while(Rows->fetchRow(&Row)){
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_OBJECTID)){
- Container->addObject(this->mMediaDatabase->getObjectByID(atoi(Value)));
- }
- }
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_SEARCHCLASS, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- std::vector<cClass> SearchClasses;
- Rows = this->mDatabase->getResultRows();
- while(Rows->fetchRow(&Row)){
- cClass Class;
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_CLASS)){
- Class.ID = strdup0(*Value);
- }
- else if(!strcasecmp(Column, SQLITE_COL_CLASSDERIVED)){
- Class.includeDerived = atoi(Value)==1?true:false;
- }
- }
- SearchClasses.push_back(Class);
- }
- if(Container->setSearchClasses(SearchClasses)){
- ERROR("Error while setting search classes");
- return -1;
- }
- return 0;
-}
-
-cUPnPClassContainer* cUPnPContainerMediator::createObject(const char* Title, bool Restricted){
- MESSAGE(VERBOSE_MODIFICATIONS, "Creating Container '%s'",Title);
- cUPnPClassContainer* Object = new cUPnPClassContainer;
- if(this->initializeObject(Object, UPNP_CLASS_CONTAINER, Title, Restricted)) return NULL;
- return Object;
-}
-
-cUPnPClassContainer* cUPnPContainerMediator::getObject(cUPnPObjectID ID){
- MESSAGE(VERBOSE_METADATA, "Getting Container with ID '%s'",*ID);
- cUPnPClassContainer* Object = new cUPnPClassContainer;
- if(this->databaseToObject(Object, ID)) return NULL;
- return Object;
-}
-
- /**********************************************\
- * *
- * Video item mediator *
- * *
- \**********************************************/
-
-cUPnPVideoItemMediator::cUPnPVideoItemMediator(cMediaDatabase* MediaDatabase) :
- cUPnPItemMediator(MediaDatabase){}
-
-cUPnPClassVideoItem* cUPnPVideoItemMediator::createObject(const char* Title, bool Restricted){
- MESSAGE(VERBOSE_MODIFICATIONS, "Creating Video item '%s'",Title);
- cUPnPClassVideoItem* Object = new cUPnPClassVideoItem;
- if(this->initializeObject(Object, UPNP_CLASS_VIDEO, Title, Restricted)) return NULL;
- return Object;
-}
-
-cUPnPClassVideoItem* cUPnPVideoItemMediator::getObject(cUPnPObjectID ID){
- MESSAGE(VERBOSE_METADATA, "Getting Video item with ID '%s'",*ID);
- cUPnPClassVideoItem* Object = new cUPnPClassVideoItem;
- if(this->databaseToObject(Object, ID)) return NULL;
- return Object;
-}
-
-int cUPnPVideoItemMediator::objectToDatabase(cUPnPClassObject* Object){
- if(cUPnPItemMediator::objectToDatabase(Object)) return -1;
- cUPnPClassVideoItem* VideoItem = (cUPnPClassVideoItem*)Object;
- cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_GENRE,
- SQLITE_COL_LONGDESCRIPTION,
- SQLITE_COL_PRODUCER,
- SQLITE_COL_RATING,
- SQLITE_COL_ACTOR,
- SQLITE_COL_DIRECTOR,
- SQLITE_COL_DESCRIPTION,
- SQLITE_COL_PUBLISHER,
- SQLITE_COL_LANGUAGE,
- SQLITE_COL_RELATION,
- NULL
- };
- for(cString* Property = Properties; *(*Property); Property++){
- Columns = cSQLiteDatabase::sprintf("%s%s%s", *Columns?*Columns:"", *Columns?",":"", *(*Property));
- if(!VideoItem->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),* VideoItem->getID());
- return -1;
- }
- Values = cSQLiteDatabase::sprintf("%s%s%Q", *Values?*Values:"", *Values?",":"", Value);
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_VIDEOITEMS, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-int cUPnPVideoItemMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- if(cUPnPItemMediator::databaseToObject(Object,ID)){
- ERROR("Error while loading object");
- return -1;
- }
- cUPnPClassVideoItem* VideoItem = (cUPnPClassVideoItem*)Object;
- cString Format = "SELECT * FROM %s WHERE %s=%s";
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_VIDEOITEMS, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- MESSAGE(VERBOSE_SQL, "No item properties found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_GENRE)){
- if(VideoItem->setGenre(Value)){
- ERROR("Error while setting genre");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_LONGDESCRIPTION)){
- if(VideoItem->setLongDescription(Value)){
- ERROR("Error while setting long description");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_PRODUCER)){
- if(VideoItem->setProducers(Value)){
- ERROR("Error while setting producers");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_RATING)){
- if(VideoItem->setRating(Value)){
- ERROR("Error while setting rating");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_ACTOR)){
- if(VideoItem->setActors(Value)){
- ERROR("Error while setting actors");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_DIRECTOR)){
- if(VideoItem->setDirectors(Value)){
- ERROR("Error while setting directors");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_DESCRIPTION)){
- if(VideoItem->setDescription(Value)){
- ERROR("Error while setting description");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_PUBLISHER)){
- if(VideoItem->setPublishers(Value)){
- ERROR("Error while setting publishers");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_LANGUAGE)){
- if(VideoItem->setLanguage(Value)){
- ERROR("Error while setting language");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_RELATION)){
- if(VideoItem->setRelations(Value)){
- ERROR("Error while setting relations");
- return -1;
- }
- }
- }
- return 0;
-}
-
- /**********************************************\
- * *
- * Video broadcast item mediator *
- * *
- \**********************************************/
-
-cUPnPVideoBroadcastMediator::cUPnPVideoBroadcastMediator(cMediaDatabase* MediaDatabase) :
- cUPnPVideoItemMediator(MediaDatabase){}
-
-cUPnPClassVideoBroadcast* cUPnPVideoBroadcastMediator::createObject(const char* Title, bool Restricted){
- MESSAGE(VERBOSE_MODIFICATIONS, "Creating Video broadcast '%s'",Title);
- cUPnPClassVideoBroadcast* Object = new cUPnPClassVideoBroadcast;
- if(this->initializeObject(Object, UPNP_CLASS_VIDEOBC, Title, Restricted)) return NULL;
- return Object;
-}
-
-cUPnPClassVideoBroadcast* cUPnPVideoBroadcastMediator::getObject(cUPnPObjectID ID){
- MESSAGE(VERBOSE_METADATA, "Getting Video broadcast with ID '%s'",*ID);
- cUPnPClassVideoBroadcast* Object = new cUPnPClassVideoBroadcast;
- if(this->databaseToObject(Object, ID)) return NULL;
- return Object;
-}
-
-int cUPnPVideoBroadcastMediator::objectToDatabase(cUPnPClassObject* Object){
- if(cUPnPVideoItemMediator::objectToDatabase(Object)) return -1;
- cUPnPClassVideoBroadcast* VideoBroadcast = (cUPnPClassVideoBroadcast*)Object;
- cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_ICON,
- SQLITE_COL_REGION,
- SQLITE_COL_CHANNELNAME,
- SQLITE_COL_CHANNELNR,
- NULL
- };
- for(cString* Property = Properties; *(*Property); Property++){
- Columns = cSQLiteDatabase::sprintf("%s%s%s", *Columns?*Columns:"", *Columns?",":"", *(*Property));
- if(!VideoBroadcast->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),* VideoBroadcast->getID());
- return -1;
- }
- Values = cSQLiteDatabase::sprintf("%s%s%Q", *Values?*Values:"", *Values?",":"", Value);
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_VIDEOBROADCASTS, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-int cUPnPVideoBroadcastMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- if(cUPnPVideoItemMediator::databaseToObject(Object,ID)){
- ERROR("Error while loading object");
- return -1;
- }
- cUPnPClassVideoBroadcast* VideoBroadcast = (cUPnPClassVideoBroadcast*)Object;
- cString Format = "SELECT * FROM %s WHERE %s=%s";
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_VIDEOBROADCASTS, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- MESSAGE(VERBOSE_SQL, "No item properties found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_ICON)){
- if(VideoBroadcast->setIcon(Value)){
- ERROR("Error while setting icon");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_REGION)){
- if(VideoBroadcast->setRegion(Value)){
- ERROR("Error while setting region");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_CHANNELNR)){
- if(VideoBroadcast->setChannelNr(atoi(Value))){
- ERROR("Error while setting channel number");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_CHANNELNAME)){
- if(VideoBroadcast->setChannelName(Value)){
- ERROR("Error while setting channel name");
- return -1;
- }
- }
- }
- return 0;
-}
-
-/**********************************************\
-* *
-* Movie item mediator *
-* *
-\**********************************************/
-
-cUPnPMovieMediator::cUPnPMovieMediator(cMediaDatabase* MediaDatabase) :
- cUPnPVideoItemMediator(MediaDatabase){}
-
-cUPnPClassMovie* cUPnPMovieMediator::createObject(const char* Title, bool Restricted){
- MESSAGE(VERBOSE_MODIFICATIONS, "Creating movie '%s'",Title);
- cUPnPClassMovie* Object = new cUPnPClassMovie;
- if(this->initializeObject(Object, UPNP_CLASS_MOVIE, Title, Restricted)) return NULL;
- return Object;
-}
-
-cUPnPClassMovie* cUPnPMovieMediator::getObject(cUPnPObjectID ID){
- MESSAGE(VERBOSE_METADATA, "Getting movie with ID '%s'",*ID);
- cUPnPClassMovie* Object = new cUPnPClassMovie;
- if(this->databaseToObject(Object, ID)) return NULL;
- return Object;
-}
-
-int cUPnPMovieMediator::objectToDatabase(cUPnPClassObject* Object){
- if(cUPnPVideoItemMediator::objectToDatabase(Object)) return -1;
- cUPnPClassMovie* Movie = (cUPnPClassMovie*)Object;
- cString Format = "INSERT OR REPLACE INTO %s (%s) VALUES (%s);";
- cString Columns=NULL, Values=NULL;
- char *Value=NULL;
- cString Properties[] = {
- SQLITE_COL_OBJECTID,
- SQLITE_COL_DVDREGIONCODE,
- SQLITE_COL_STORAGEMEDIUM,
- NULL
- };
- for(cString* Property = Properties; *(*Property); Property++){
- Columns = cSQLiteDatabase::sprintf("%s%s%s", *Columns?*Columns:"", *Columns?",":"", *(*Property));
- if(!Movie->getProperty(*Property, &Value)){
- ERROR("No such property '%s' in object with ID '%s'",*(*Property),* Movie->getID());
- return -1;
- }
- Values = cSQLiteDatabase::sprintf("%s%s%Q", *Values?*Values:"", *Values?",":"", Value);
- }
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_MOVIES, *Columns, *Values)){
- ERROR("Error while executing statement");
- return -1;
- }
- return 0;
-}
-
-int cUPnPMovieMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID){
- if(cUPnPVideoItemMediator::databaseToObject(Object,ID)){
- ERROR("Error while loading object");
- return -1;
- }
- cUPnPClassMovie* Movie = (cUPnPClassMovie*)Object;
- cString Format = "SELECT * FROM %s WHERE %s=%s";
- cString Column = NULL, Value = NULL;
- cRows* Rows; cRow* Row;
- if(this->mDatabase->execStatement(Format, SQLITE_TABLE_MOVIES, SQLITE_COL_OBJECTID, *ID)){
- ERROR("Error while executing statement");
- return -1;
- }
- Rows = this->mDatabase->getResultRows();
- if(!Rows->fetchRow(&Row)){
- MESSAGE(VERBOSE_SQL, "No item properties found");
- return 0;
- }
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_DVDREGIONCODE)){
- if(Movie->setDVDRegionCode(atoi(Value))){
- ERROR("Error while setting icon");
- return -1;
- }
- }
- else if(!strcasecmp(Column, SQLITE_COL_STORAGEMEDIUM)){
- if(Movie->setStorageMedium(Value)){
- ERROR("Error while setting region");
- return -1;
- }
- }
- }
- return 0;
-} \ No newline at end of file
diff --git a/database/resources.cpp b/database/resources.cpp
deleted file mode 100644
index 23403d5..0000000
--- a/database/resources.cpp
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * File: resources.cpp
- * Author: savop
- *
- * Created on 30. September 2009, 15:17
- */
-
-#include <string.h>
-#include <vdr/channels.h>
-#include "upnp/dlna.h"
-#include <vdr/tools.h>
-#include "resources.h"
-#include "avdetector.h"
-
-cUPnPResource::cUPnPResource(){
- this->mBitrate = 0;
- this->mBitsPerSample = 0;
- this->mColorDepth = 0;
- this->mDuration = NULL;
- this->mImportURI = NULL;
- this->mNrAudioChannels = 0;
- this->mProtocolInfo = NULL;
- this->mResolution = NULL;
- this->mResource = NULL;
- this->mResourceID = 0;
- this->mSampleFrequency = 0;
- this->mSize = 0;
- this->mContentType = NULL;
-}
-
-time_t cUPnPResource::getLastModification() const {
- time_t Time;
- const cRecording* Recording;
- const cEvent* Event;
- switch(this->mResourceType){
- case UPNP_RESOURCE_CHANNEL:
- case UPNP_RESOURCE_URL:
- Time = time(NULL);
- break;
- case UPNP_RESOURCE_RECORDING:
- Recording = Recordings.GetByName(this->mResource);
- Event = (Recording)?Recording->Info()->GetEvent():NULL;
- Time = (Event)?Event->EndTime():time(NULL);
- break;
- case UPNP_RESOURCE_FILE:
- //break;
- default:
- ERROR("Invalid resource type. This resource might be broken");
- Time = -1;
- }
- return Time;
-}
-
-cUPnPResources* cUPnPResources::mInstance = NULL;
-
-cUPnPResources::cUPnPResources(){
- this->mResources = new cHash<cUPnPResource>;
- this->mMediator = new cUPnPResourceMediator;
- this->mDatabase = cSQLiteDatabase::getInstance();
-}
-
-cUPnPResources::~cUPnPResources(){
- delete this->mResources;
- delete this->mMediator;
-}
-
-cUPnPResources* cUPnPResources::getInstance(){
- if(!cUPnPResources::mInstance)
- cUPnPResources::mInstance = new cUPnPResources();
- if(cUPnPResources::mInstance) return cUPnPResources::mInstance;
- else return NULL;
-}
-
-int cUPnPResources::loadResources(){
- if(this->mDatabase->execStatement("SELECT %s FROM %s",SQLITE_COL_RESOURCEID,SQLITE_TABLE_RESOURCES)){
- ERROR("Error while executing statement");
- return -1;
- }
- cRows* Rows = this->mDatabase->getResultRows(); cRow* Row;
- cString Column = NULL, Value = NULL;
- while(Rows->fetchRow(&Row)){
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_RESOURCEID)){
- unsigned int ResourceID = (unsigned int)atoi(Value);
- this->getResource(ResourceID);
- }
- }
- }
- return 0;
-}
-
-int cUPnPResources::getResourcesOfObject(cUPnPClassObject* Object){
- if(this->mDatabase->execStatement("SELECT %s FROM %s WHERE %s=%Q",
- SQLITE_COL_RESOURCEID,
- SQLITE_TABLE_RESOURCES,
- SQLITE_COL_OBJECTID,
- *Object->getID())){
- ERROR("Error while executing statement");
- return -1;
- }
- cRows* Rows = this->mDatabase->getResultRows(); cRow* Row;
- cString Column = NULL, Value = NULL;
- while(Rows->fetchRow(&Row)){
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(Column, SQLITE_COL_RESOURCEID)){
- unsigned int ResourceID = (unsigned int)atoi(Value);
- Object->addResource(this->getResource(ResourceID));
- }
- }
- }
- return 0;
-}
-
-cUPnPResource* cUPnPResources::getResource(unsigned int ResourceID){
- cUPnPResource* Resource;
- if((Resource = this->mResources->Get(ResourceID))){
- MESSAGE(VERBOSE_METADATA, "Found cached resource");
- return Resource;
- }
- else if((Resource = this->mMediator->getResource(ResourceID))){
- MESSAGE(VERBOSE_METADATA, "Found resource in database");
- this->mResources->Add(Resource, ResourceID);
- return Resource;
- }
- else {
- ERROR("No such resource with ID '%d'", ResourceID);
- return NULL;
- }
-}
-
-int cUPnPResources::createFromRecording(cUPnPClassVideoItem* Object, cRecording* Recording){
- if(!Object || !Recording){
- ERROR("Invalid input arguments");
- return -1;
- }
-
- cAudioVideoDetector* Detector = new cAudioVideoDetector(Recording);
-
- if(Detector->detectProperties()){
- ERROR("Error while detecting video properties");
- delete Detector;
- return -1;
- }
-
- if(!Detector->getDLNAProfile()){
- ERROR("No DLNA profile found for Recording %s", Recording->Name());
- delete Detector;
- return -1;
- }
-
- const char* ProtocolInfo = cDlna::getInstance()->getProtocolInfo(Detector->getDLNAProfile());
-
- MESSAGE(VERBOSE_METADATA, "Protocol info: %s", ProtocolInfo);
-
- cString ResourceFile = Recording->FileName();
- cUPnPResource* Resource = this->mMediator->newResource(Object, UPNP_RESOURCE_RECORDING,ResourceFile, Detector->getDLNAProfile()->mime, ProtocolInfo);
- Resource->mBitrate = Detector->getBitrate();
- Resource->mBitsPerSample = Detector->getBitsPerSample();
- Resource->mDuration = duration(Detector->getDuration(), AVDETECTOR_TIME_BASE);
- Resource->mResolution = (Detector->getWidth() && Detector->getHeight()) ? *cString::sprintf("%dx%d",Detector->getWidth(), Detector->getHeight()) : NULL;
- Resource->mSampleFrequency = Detector->getSampleFrequency();
- Resource->mSize = Detector->getFileSize();
- Resource->mNrAudioChannels = Detector->getNumberOfAudioChannels();
- Resource->mImportURI = NULL;
- Resource->mColorDepth = 0;
- Object->addResource(Resource);
- this->mMediator->saveResource(Object, Resource);
- this->mResources->Add(Resource, Resource->getID());
-
- delete Detector;
- return 0;
-}
-
-int cUPnPResources::createFromFile(cUPnPClassItem* , cString ){
- MESSAGE(VERBOSE_SDK, "To be done");
- return -1;
-}
-
-int cUPnPResources::createFromChannel(cUPnPClassVideoBroadcast* Object, cChannel* Channel){
- if(!Object || !Channel){
- ERROR("Invalid input arguments");
- return -1;
- }
-
- cAudioVideoDetector* Detector = new cAudioVideoDetector(Channel);
-
- if(Detector->detectProperties()){
- ERROR("Cannot detect channel properties");
- delete Detector;
- return -1;
- }
-
- if(!Detector->getDLNAProfile()){
- ERROR("No DLNA profile found for Channel %s", *Channel->GetChannelID().ToString());
- delete Detector;
- return -1;
- }
-
- const char* ProtocolInfo = cDlna::getInstance()->getProtocolInfo(Detector->getDLNAProfile());
-
- MESSAGE(VERBOSE_METADATA, "Protocol info: %s", ProtocolInfo);
-
- // Index which may be used to indicate different resources with same channel ID
- // For instance a different DVB card
- // Not used yet.
- int index = 0;
-
- cString ResourceFile = cString::sprintf("%s:%d", *Channel->GetChannelID().ToString(), index);
- cUPnPResource* Resource = this->mMediator->newResource(Object, UPNP_RESOURCE_CHANNEL,ResourceFile, Detector->getDLNAProfile()->mime, ProtocolInfo);
- Resource->mBitrate = Detector->getBitrate();
- Resource->mBitsPerSample = Detector->getBitsPerSample();
- Resource->mDuration = duration(Detector->getDuration());
- Resource->mResolution = (Detector->getWidth() && Detector->getHeight()) ? *cString::sprintf("%dx%d",Detector->getWidth(), Detector->getHeight()) : NULL;
- Resource->mSampleFrequency = Detector->getSampleFrequency();
- Resource->mSize = Detector->getFileSize();
- Resource->mNrAudioChannels = Detector->getNumberOfAudioChannels();
- Resource->mImportURI = NULL;
- Resource->mColorDepth = 0;
- Object->addResource(Resource);
- this->mMediator->saveResource(Object, Resource);
- this->mResources->Add(Resource, Resource->getID());
-
- delete Detector;
- return 0;
-}
-
-cUPnPResourceMediator::cUPnPResourceMediator(){
- this->mDatabase = cSQLiteDatabase::getInstance();
-}
-
-cUPnPResourceMediator::~cUPnPResourceMediator(){}
-
-cUPnPResource* cUPnPResourceMediator::getResource(unsigned int ResourceID){
- cUPnPResource* Resource = new cUPnPResource;
- Resource->mResourceID = ResourceID;
- if(this->mDatabase->execStatement("SELECT * FROM %s WHERE %s=%d",
- SQLITE_TABLE_RESOURCES,
- SQLITE_COL_RESOURCEID,
- ResourceID)){
- ERROR("Error while executing statement");
- return NULL;
- }
- cRows* Rows = this->mDatabase->getResultRows(); cRow* Row;
- if(!Rows->fetchRow(&Row)){
- ERROR("No such resource found");
- return NULL;
- }
- cString Column = NULL, Value = NULL;
- while(Row->fetchColumn(&Column, &Value)){
- if(!strcasecmp(SQLITE_COL_PROTOCOLINFO, Column)){
- Resource->mProtocolInfo = Value;
- }
- else if(!strcasecmp(SQLITE_COL_RESOURCE, Column)){
- Resource->mResource = Value;
- }
- else if(!strcasecmp(SQLITE_COL_SIZE, Column)){
- Resource->mSize = (off64_t)(*Value?atol(Value):0);
- }
- else if(!strcasecmp(SQLITE_COL_DURATION, Column)){
- Resource->mDuration = Value;
- }
- else if(!strcasecmp(SQLITE_COL_BITRATE, Column)){
- Resource->mBitrate = *Value?atoi(Value):0;
- }
- else if(!strcasecmp(SQLITE_COL_SAMPLEFREQUENCE, Column)){
- Resource->mSampleFrequency = *Value?atoi(Value):0;
- }
- else if(!strcasecmp(SQLITE_COL_BITSPERSAMPLE, Column)){
- Resource->mBitsPerSample = *Value?atoi(Value):0;
- }
- else if(!strcasecmp(SQLITE_COL_NOAUDIOCHANNELS, Column)){
- Resource->mNrAudioChannels = *Value?atoi(Value):0;
- }
- else if(!strcasecmp(SQLITE_COL_COLORDEPTH, Column)){
- Resource->mColorDepth = *Value?atoi(Value):0;
- }
- else if(!strcasecmp(SQLITE_COL_RESOLUTION, Column)){
- Resource->mResolution = Value;
- }
- else if(!strcasecmp(SQLITE_COL_CONTENTTYPE, Column)){
- Resource->mContentType = Value;
- }
- else if(!strcasecmp(SQLITE_COL_RESOURCETYPE, Column)){
- Resource->mResourceType = *Value?atoi(Value):0;
- }
- }
- return Resource;
-}
-
-int cUPnPResourceMediator::saveResource(cUPnPClassObject* Object, cUPnPResource* Resource){
-
- cString Format = "UPDATE %s SET %s=%Q,"
- "%s=%Q,"
- "%s=%Q,"
- "%s=%lld,"
- "%s=%Q,"
- "%s=%d,"
- "%s=%d,"
- "%s=%d,"
- "%s=%d,"
- "%s=%d,"
- "%s=%Q,"
- "%s=%Q,"
- "%s=%d"
- " WHERE %s=%d";
-
- if(this->mDatabase->execStatement(Format,
- SQLITE_TABLE_RESOURCES,
- SQLITE_COL_OBJECTID, *Object->getID(),
- SQLITE_COL_PROTOCOLINFO, *Resource->mProtocolInfo,
- SQLITE_COL_RESOURCE, *Resource->mResource,
- SQLITE_COL_SIZE, Resource->mSize,
- SQLITE_COL_DURATION, *Resource->mDuration,
- SQLITE_COL_BITRATE, Resource->mBitrate,
- SQLITE_COL_SAMPLEFREQUENCE, Resource->mSampleFrequency,
- SQLITE_COL_BITSPERSAMPLE, Resource->mBitsPerSample,
- SQLITE_COL_NOAUDIOCHANNELS, Resource->mNrAudioChannels,
- SQLITE_COL_COLORDEPTH, Resource->mColorDepth,
- SQLITE_COL_RESOLUTION, *Resource->mResolution,
- SQLITE_COL_CONTENTTYPE, *Resource->mContentType,
- SQLITE_COL_RESOURCETYPE, Resource->mResourceType,
- SQLITE_COL_RESOURCEID, Resource->mResourceID)){
- ERROR("Error while executing statement");
- return -1;
- }
-
- return 0;
-}
-
-cUPnPResource* cUPnPResourceMediator::newResource(cUPnPClassObject* Object, int ResourceType, cString ResourceFile, cString ContentType, cString ProtocolInfo){
- cUPnPResource* Resource = new cUPnPResource;
-
- if(this->mDatabase->execStatement("INSERT INTO %s (%s,%s,%s,%s,%s) VALUES (%Q,%Q,%Q,%Q,%d)",
- SQLITE_TABLE_RESOURCES,
- SQLITE_COL_OBJECTID,
- SQLITE_COL_RESOURCE,
- SQLITE_COL_PROTOCOLINFO,
- SQLITE_COL_CONTENTTYPE,
- SQLITE_COL_RESOURCETYPE,
- *Object->getID(),
- *ResourceFile,
- *ProtocolInfo,
- *ContentType,
- ResourceType)){
- ERROR("Error while executing statement");
- return NULL;
- }
- Resource->mResourceID = (unsigned int)this->mDatabase->getLastInsertRowID();
- Resource->mResource = ResourceFile;
- Resource->mProtocolInfo = ProtocolInfo;
- Resource->mContentType = ContentType;
- Resource->mResourceType = ResourceType;
-
- return Resource;
-} \ No newline at end of file
diff --git a/dlna/avdetector.cpp b/dlna/avdetector.cpp
deleted file mode 100644
index 461b375..0000000
--- a/dlna/avdetector.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * File: avdetector.cpp
- * Author: savop
- *
- * Created on 26. Oktober 2009, 13:01
- */
-
-#include "avdetector.h"
-#include "profiles/container.h"
-#include "object.h"
-#include <sys/stat.h>
-
-cAudioVideoDetector::cAudioVideoDetector(const char* Filename) : mResourceType(UPNP_RESOURCE_FILE) {
- this->mResource.Filename = Filename;
- this->init();
-}
-
-cAudioVideoDetector::cAudioVideoDetector(const cChannel* Channel) : mResourceType(UPNP_RESOURCE_CHANNEL) {
- this->mResource.Channel = Channel;
- this->init();
-}
-
-cAudioVideoDetector::cAudioVideoDetector(const cRecording* Recording) : mResourceType(UPNP_RESOURCE_RECORDING) {
- this->mResource.Recording = Recording;
- this->init();
-}
-
-cAudioVideoDetector::~cAudioVideoDetector(){
- this->uninit();
-}
-
-void cAudioVideoDetector::init(){
- this->mBitrate = 0;
- this->mBitsPerSample = 0;
- this->mColorDepth = 0;
- this->mDLNAProfile = NULL;
- this->mDuration = 0;
- this->mHeight = 0;
- this->mNrAudioChannels = 0;
- this->mSampleFrequency = 0;
- this->mSize = 0;
- this->mWidth = 0;
-}
-
-void cAudioVideoDetector::uninit(){
- this->mBitrate = 0;
- this->mBitsPerSample = 0;
- this->mColorDepth = 0;
- this->mDLNAProfile = NULL;
- this->mDuration = 0;
- this->mHeight = 0;
- this->mNrAudioChannels = 0;
- this->mSampleFrequency = 0;
- this->mSize = 0;
- this->mWidth = 0;
-}
-
-int cAudioVideoDetector::detectProperties(){
- int ret = 0;
- switch(this->mResourceType){
- case UPNP_RESOURCE_CHANNEL:
- ret = this->detectChannelProperties();
- break;
- case UPNP_RESOURCE_RECORDING:
- ret = this->detectRecordingProperties();
- break;
- case UPNP_RESOURCE_FILE:
- ret = this->detectFileProperties();
- break;
- default:
- WARNING("This resource type is not yet implemented.");
- ret = -1;
- break;
- }
-
- return ret;
-}
-
-int cAudioVideoDetector::detectChannelProperties(){
- MESSAGE(VERBOSE_METADATA, "Detecting channel properties");
-
- this->mBitrate = 0;
- this->mBitsPerSample = 0;
- this->mColorDepth = 0;
- this->mDuration = 0;
- this->mHeight = 0;
- this->mNrAudioChannels = 0;
- this->mSampleFrequency = 0;
- this->mSize = (off64_t)-1;
- this->mWidth = 0;
-
- switch(this->mResource.Channel->Vtype()){
- case 0x02:
- // MPEG2 Video
- this->mDLNAProfile = &DLNA_PROFILE_MPEG_TS_SD_EU_ISO;
- break;
- case 0x1B:
- this->mDLNAProfile = &DLNA_PROFILE_AVC_TS_HD_EU_ISO;
- break;
- default:
- ERROR("Unknown video type %d for channel %s!", this->mResource.Channel->Vtype(), this->mResource.Channel->Name());
- this->mDLNAProfile = NULL;
- return -1;
- }
-
- return 0;
-}
-
-int cAudioVideoDetector::detectRecordingProperties(){
-
- if(this->mResource.Recording->IsPesRecording()){
- ERROR("Sorry, PES Recordings are not supported");
- return -1;
- }
-
- int ret = 0;
- AVFormatContext *FormatCtx = NULL;
-
- cIndexFile* Index = new cIndexFile(this->mResource.Recording->FileName(), false, this->mResource.Recording->IsPesRecording());
- cFileName* RecFile = new cFileName(this->mResource.Recording->FileName(), false, false, this->mResource.Recording->IsPesRecording());
- if(Index && Index->Ok()){
- this->mDuration = (off64_t) (Index->Last() * AVDETECTOR_TIME_BASE / SecondsToFrames(1, this->mResource.Recording->FramesPerSecond()));
- MESSAGE(VERBOSE_METADATA,"Record length: %llds", this->mDuration);
-
- uint16_t FileNumber = 0;
- off_t FileOffset = 0;
-
- if(Index->Get(Index->Last()-1, &FileNumber, &FileOffset))
- for(int i = 0; i < FileNumber; i++){
- struct stat Stats;
- RecFile->SetOffset(i+1);
- stat(RecFile->Name(),&Stats);
- this->mSize += (off64_t) Stats.st_size;
- }
-
- av_register_all();
-
- if(!(ret = av_open_input_file(&FormatCtx, RecFile->Name(), NULL, 0, NULL))){
- if((ret = av_find_stream_info(FormatCtx))<0){
- ERROR("AVDetector: Cannot find the stream information");
- }
- else {
- if((ret = this->analyseVideo(FormatCtx))<0){
- ERROR("AVDetector: Error while analysing video");
- }
- if((ret = this->analyseAudio(FormatCtx))<0){
- ERROR("AVDetector: Error while analysing audio");
- }
- if((ret = this->detectDLNAProfile(FormatCtx)<0)){
- ERROR("AVDetector: Error while detecting DLNA Profile");
- }
- }
- }
- }
- else {
- ret = -1;
- }
-
- if(ret != 0){
- ERROR("Error occured while detecting properties");
- }
-
- delete RecFile;
- delete Index;
- av_free(FormatCtx);
-
- return ret;
-}
-
-int cAudioVideoDetector::detectFileProperties(){
- av_register_all();
-
- int ret = 0;
-
- AVFormatContext *FormatCtx = NULL;
-
- if(av_open_input_file(&FormatCtx, this->mResource.Filename, NULL, 0, NULL)){
- ERROR("AVDetector: Error while opening file %s", this->mResource.Filename);
- return -1;
- }
- else {
- if(av_find_stream_info(FormatCtx)<0){
- ERROR("AVDetector: Cannot find the stream information");
- return -1;
- }
- else {
- this->mSize = FormatCtx->file_size;
- this->mDuration = FormatCtx->duration;
-
- MESSAGE(VERBOSE_METADATA, "Format properties: %lld and %lld Bytes", this->mDuration, this->mSize);
-
- if((ret = this->analyseVideo(FormatCtx))<0){
- ERROR("AVDetector: Error while analysing video");
- return ret;
- }
- if((ret = this->analyseAudio(FormatCtx))<0){
- ERROR("AVDetector: Error while analysing audio");
- return ret;
- }
- if((ret = this->detectDLNAProfile(FormatCtx)<0)){
- ERROR("AVDetector: Error while detecting DLNA Profile");
- return ret;
- }
-
- return 0;
- }
- }
-}
-
-int cAudioVideoDetector::analyseVideo(AVFormatContext* FormatCtx)
-{
- AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_VIDEO);
-
- if(!VideoCodec){
- ERROR("AVDetector: codec not found");
- return -1;
- }
-
- AVCodec* Codec = avcodec_find_decoder(VideoCodec->codec_id);
-
- this->mWidth = VideoCodec->width;
- this->mHeight = VideoCodec->height;
- this->mBitrate = VideoCodec->bit_rate;
- this->mSampleFrequency = VideoCodec->sample_rate;
- this->mBitsPerSample = VideoCodec->bits_per_raw_sample;
-
- // TODO: what's the color depth of the stream
-
- const char* codecName = (Codec)?Codec->name:"unknown";
-
- MESSAGE(VERBOSE_METADATA, "AVDetector: %s-stream %dx%d at %d bit/s", codecName, this->mWidth, this->mHeight, this->mBitrate);
-
- return 0;
-}
-
-int cAudioVideoDetector::analyseAudio(AVFormatContext* FormatCtx){
- AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
-
- if(!AudioCodec){
- ERROR("AVDetector: codec not found");
- return -1;
- }
-
- AVCodec* Codec = avcodec_find_decoder(AudioCodec->codec_id);
-
- this->mNrAudioChannels = AudioCodec->channels;
-
- const char* codecName = (Codec)?Codec->name:"unknown";
-
- MESSAGE(VERBOSE_METADATA, "AVDetector: %s-stream at %d bit/s", codecName, AudioCodec->bit_rate);
-
- return 0;
-}
-
-int cAudioVideoDetector::detectDLNAProfile(AVFormatContext* FormatCtx){
- DLNAProfile* Profile = MPEG2Profiler.probeDLNAProfile(FormatCtx);
- if(Profile!=NULL){
- this->mDLNAProfile = Profile;
- return 0;
- }
- return -1;
-}
-
-AVCodecContext* cCodecToolKit::getFirstCodecContext(AVFormatContext* FormatCtx, CodecType Type){
- return cCodecToolKit::getFirstStream(FormatCtx, Type)->codec;
-}
-
-AVStream* cCodecToolKit::getFirstStream(AVFormatContext* FormatCtx, CodecType Type){
- int Stream = -1; unsigned int i;
- for(i = 0; i < FormatCtx->nb_streams; i++){
- if(FormatCtx->streams[i]->codec->codec_type == Type){
- Stream = i;
- break;
- }
- }
- if(Stream == -1){
- ERROR("AVDetector: No matching stream found");
- return NULL;
- }
-
- return FormatCtx->streams[Stream];
-}
-
-bool cCodecToolKit::matchesAcceptedBitrates(AcceptedBitrates Bitrates, AVCodecContext* Codec){
- if(Codec){
- if(Bitrates.VBR){
- if(Bitrates.bitrates[0] <= Codec->bit_rate && Codec->bit_rate <= Bitrates.bitrates[1] ){
- return true;
- }
- else {
- return false;
- }
- }
- else {
- for(int i=0; Bitrates.bitrates[i]; i++){
- if(Codec->bit_rate == Bitrates.bitrates[i]){
- return true;
- }
- }
- return false;
- }
- }
-
- return false;
-}
-
-bool cCodecToolKit::matchesAcceptedSystemBitrate(AcceptedBitrates Bitrate, AVFormatContext* Format){
- if(Format){
- if(Bitrate.VBR){
- if(Bitrate.bitrates[0] <= Format->bit_rate && Format->bit_rate <= Bitrate.bitrates[1] ){
- return true;
- }
- else {
- return false;
- }
- }
- else {
- for(int i=0; Bitrate.bitrates[i]; i++){
- if(Format->bit_rate == Bitrate.bitrates[i]){
- return true;
- }
- }
- return false;
- }
- }
-
- return false;
-}
-
-bool cCodecToolKit::matchesAcceptedAudioChannels(AcceptedAudioChannels Channels, AVCodecContext* Codec){
- if(Codec){
- if(Codec->channels <= Channels.max_channels){
- if(Codec->channel_layout){
- for(int i=0; Channels.layouts[i]; i++){
- if(Channels.supportsLFE && Codec->channel_layout == (Channels.layouts[i]|CH_LOW_FREQUENCY)){
- return true;
- }
- else if(Codec->channel_layout == Channels.layouts[i]){
- return true;
- }
- }
- }
- else {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool cCodecToolKit::matchesAcceptedSamplingRates(AcceptedSamplingRates SamplingRates, AVCodecContext* Codec){
- if(Codec){
- for(int i=0; SamplingRates.rates[i]; i++){
- if(Codec->sample_rate == SamplingRates.rates[i]){
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool cCodecToolKit::matchesAcceptedResolutions(AcceptedResolution *Resolutions, int Count, AVStream* Stream){
- if(Stream && Resolutions && Stream->codec){
- for(int i=0; i < Count; i++){
- if( Stream->codec->width == Resolutions[i].width &&
- Stream->codec->height == Resolutions[i].height &&
- Stream->r_frame_rate.num == Resolutions[i].fps &&
- Stream->r_frame_rate.den == Resolutions[i].multiplier
- ){
- return true;
- }
- }
- }
-
- return false;
-} \ No newline at end of file
diff --git a/dlna/dlna.cpp b/dlna/dlna.cpp
deleted file mode 100644
index 24da1be..0000000
--- a/dlna/dlna.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * File: dlna.cpp
- * Author: savop
- *
- * Created on 18. April 2009, 23:27
- */
-
-#include <stdio.h>
-#include <vdr/tools.h>
-#include "upnp/dlna.h"
-
-cDlna* cDlna::mInstance = NULL;
-
-cDlna* cDlna::getInstance(void){
- if(cDlna::mInstance == NULL)
- cDlna::mInstance = new cDlna;
-
- if(cDlna::mInstance != NULL)
- return cDlna::mInstance;
- else return NULL;
-}
-
-cDlna::cDlna() {
- this->mRegisteredProfiles.clear();
- this->init();
-}
-
-cDlna::~cDlna() {
- this->mRegisteredProfiles.clear();
-}
-
-
-void cDlna::init(void){
- this->registerProfiles();
-}
-
-void cDlna::registerProfile(DLNAProfile* Profile){
- this->mRegisteredProfiles.push_back(Profile);
-}
-
-void cDlna::registerProfiles(){
- this->registerProfile(&DLNA_PROFILE_MPEG_TS_SD_EU);
- this->registerProfile(&DLNA_PROFILE_AVC_TS_HD_EU);
- this->registerProfile(&DLNA_PROFILE_MPEG_TS_SD_EU_ISO);
- this->registerProfile(&DLNA_PROFILE_AVC_TS_HD_EU_ISO);
-}
-
-const char* cDlna::getSupportedProtocols(){
- cString Protocols;
- list<DLNAProfile*>::iterator it;
- for(it=this->mRegisteredProfiles.begin(); it!=this->mRegisteredProfiles.end(); it++){
- Protocols = cString::sprintf("%s%s%s",(*Protocols)?*Protocols:"",(*Protocols)?",":"",this->getProtocolInfo(*it, DLNA_SUPPORTED_FLAGS));
- }
- return Protocols;
-}
-
-const char* cDlna::getProtocolInfo(DLNAProfile *Profile, int Op, const char* Ps, int Ci, unsigned int Flags){
- cString DLNA4thField = NULL;
- DLNA4thField = cString::sprintf("DLNA.ORG_PN=%s", Profile->ID);
- if(Op != -1)
- DLNA4thField = cString::sprintf("%s;DLNA.ORG_OP=%d",*DLNA4thField,Op);
- if(Ps != NULL)
- DLNA4thField = cString::sprintf("%s;DLNA.ORG_PS=%s",*DLNA4thField,Ps);
- if(Ci != -1)
- DLNA4thField = cString::sprintf("%s;DLNA.ORG_CI=%d",*DLNA4thField,Ci);
- if(Flags != 0)
- DLNA4thField = cString::sprintf("%s;DLNA.ORG_FLAGS=%.8x%.24x",*DLNA4thField,Flags,0);
-
- char* Protocol = strdup(cString::sprintf("http-get:*:%s:%s", Profile->mime, *DLNA4thField));
- return Protocol;
-}
-
-const char* cDlna::getDeviceDescription(const char* URLBase){
- cString description = cString::sprintf(
- "<?xml version = \"1.0\" encoding = \"utf-8\"?> \
- <root xmlns=\"%s\" xmlns:%s=\"%s\"> \
- <specVersion> \
- <major>1</major> \
- <minor>0</minor> \
- </specVersion> \
- <URLBase>%s</URLBase> \
- <device> \
- <deviceType>%s</deviceType> \
- <friendlyName>%s</friendlyName> \
- <manufacturer>%s</manufacturer> \
- <manufacturerURL>%s</manufacturerURL> \
- <modelDescription>%s</modelDescription> \
- <modelName>%s</modelName> \
- <modelNumber>%s</modelNumber> \
- <modelURL>%s</modelURL> \
- <serialNumber>%s</serialNumber> \
- <UDN>%s</UDN> \
- <iconList> \
- <icon> \
- <mimetype>%s</mimetype> \
- <width>%d</width> \
- <height>%d</height> \
- <depth>%d</depth> \
- <url>%s</url> \
- </icon> \
- <icon> \
- <mimetype>%s</mimetype> \
- <width>%d</width> \
- <height>%d</height> \
- <depth>%d</depth> \
- <url>%s</url> \
- </icon> \
- <icon> \
- <mimetype>%s</mimetype> \
- <width>%d</width> \
- <height>%d</height> \
- <depth>%d</depth> \
- <url>%s</url> \
- </icon> \
- <icon> \
- <mimetype>%s</mimetype> \
- <width>%d</width> \
- <height>%d</height> \
- <depth>%d</depth> \
- <url>%s</url> \
- </icon> \
- </iconList> \
- <presentationURL>%s</presentationURL> \
- <%s:X_DLNADOC>%s</dlna:X_DLNADOC> \
- <serviceList> \
- <service> \
- <serviceType>%s</serviceType> \
- <serviceId>%s</serviceId> \
- <SCPDURL>%s</SCPDURL> \
- <controlURL>%s</controlURL> \
- <eventSubURL>%s</eventSubURL> \
- </service> \
- <service> \
- <serviceType>%s</serviceType> \
- <serviceId>%s</serviceId> \
- <SCPDURL>%s</SCPDURL> \
- <controlURL>%s</controlURL> \
- <eventSubURL>%s</eventSubURL> \
- </service> \
- </serviceList> \
- </device> \
- </root>",
- UPNP_XMLNS_UPNP_DEV, // UPnP Device Namespace (2)
- UPNP_XMLNS_PREFIX_DLNA, // DLNA Namespace prefix (2)
- UPNP_XMLNS_DLNA_DEV, // DLNA Device Namespace (2)
- URLBase, // URLBase (IP:PORT) (7)
- UPNP_DEVICE_TYPE, // UPnP Device Type (MediaServer:1) (9)
- UPNP_DEVICE_FRIENDLY_NAME, // UPnP Device Friendly Name (10)
- UPNP_DEVICE_MANUFACTURER, // UPnP Device Manufacturer (11)
- UPNP_DEVICE_MANUFACTURER_URL, // UPnP Device Manufacturer URL (12)
- UPNP_DEVICE_MODEL_DESCRIPTION, // UPnP Device Model Description (13)
- UPNP_DEVICE_MODEL_NAME, // UPnP Device Model Name (14)
- UPNP_DEVICE_MODEL_NUMBER, // UPnP Device Model Number (15)
- UPNP_DEVICE_MODEL_URL, // UPnP Device Model URL (16)
- UPNP_DEVICE_SERIAL_NUMBER, // UPnP Device Serialnumber (17)
- UPNP_DEVICE_UDN, // UPnP Device UDN (18)
- DLNA_ICON_JPEG_LRG_24.mime, // UPnP Device Large Icon JPEG Mimetype (21)
- DLNA_ICON_JPEG_LRG_24.width, // UPnP Device Large Icon Width (22)
- DLNA_ICON_JPEG_LRG_24.height, // UPnP Device Large Icon Height (23)
- DLNA_ICON_JPEG_LRG_24.bitDepth, // UPnP Device Large Icon Bit Depth (24)
- UPNP_DEVICE_ICON_JPEG_LRG, // UPnP Device Large Icon Path (25)
- DLNA_ICON_JPEG_SM_24.mime, // UPnP Device Small Icon JPEG Mimetype (28)
- DLNA_ICON_JPEG_SM_24.width, // UPnP Device Small Icon Width (29)
- DLNA_ICON_JPEG_SM_24.height, // UPnP Device Small Icon Height (30)
- DLNA_ICON_JPEG_SM_24.bitDepth, // UPnP Device Small Icon Bit Depth (31)
- UPNP_DEVICE_ICON_JPEG_SM, // UPnP Device Small Icon Path (32)
- DLNA_ICON_PNG_SM_24A.mime, // UPnP Device Small Icon PNG Mimetype (35)
- DLNA_ICON_PNG_SM_24A.width, // UPnP Device Small Icon Width (36)
- DLNA_ICON_PNG_SM_24A.height, // UPnP Device Small Icon Height (37)
- DLNA_ICON_PNG_SM_24A.bitDepth, // UPnP Device Small Icon Bit Depth (38)
- UPNP_DEVICE_ICON_PNG_SM, // UPnP Device Small Icon Path (39)
- DLNA_ICON_PNG_LRG_24A.mime, // UPnP Device Large Icon PNG Mimetype (42)
- DLNA_ICON_PNG_LRG_24A.width, // UPnP Device Large Icon Width (43)
- DLNA_ICON_PNG_LRG_24A.height, // UPnP Device Large Icon Height (44)
- DLNA_ICON_PNG_LRG_24A.bitDepth, // UPnP Device Large Icon Bit Depth (45)
- UPNP_DEVICE_ICON_PNG_LRG, // UPnP Device Large Icon Path (46)
- UPNP_WEB_PRESENTATION_URL, // UPnP Presentation URL (49)
- UPNP_XMLNS_PREFIX_DLNA, // DLNA Namespace prefix (50)
- DLNA_DEVICE_DMS_1_5, // DLNA Device Type/Version (50)
- UPNP_CMS_SERVICE_TYPE, // UPnP CMS Service Type
- UPNP_CMS_SERVICE_ID, // UPnP CMS Service ID
- UPNP_CMS_SCPD_URL, // UPnP CMS Service Description
- UPNP_CMS_CONTROL_URL, // UPnP CMS Control URL
- UPNP_CMS_EVENT_URL, // UPnP CMS Event URL
- UPNP_CDS_SERVICE_TYPE, // UPnP CDS Service Type
- UPNP_CDS_SERVICE_ID, // UPnP CDS Service ID
- UPNP_CDS_SCPD_URL, // UPnP CDS Service Description
- UPNP_CDS_CONTROL_URL, // UPnP CDS Control URL
- UPNP_CDS_EVENT_URL // UPnP CDS Event URL
-// UPNP_AVT_SERVICE_TYPE, // UPnP AVT Service Type
-// UPNP_AVT_SERVICE_ID, // UPnP AVT Service ID
-// UPNP_AVT_SCPD_URL, // UPnP AVT Service Description
-// UPNP_AVT_CONTROL_URL, // UPnP AVT Control URL
-// UPNP_AVT_EVENT_URL // UPnP AVT Event URL
- );
- return strdup0(*description);
-} \ No newline at end of file
diff --git a/dlna/profiles/aac.cpp b/dlna/profiles/aac.cpp
deleted file mode 100644
index e2b77e2..0000000
--- a/dlna/profiles/aac.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_aac.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:31
- */
-
-#include "profiles/aac.h"
diff --git a/dlna/profiles/ac3.cpp b/dlna/profiles/ac3.cpp
deleted file mode 100644
index 0b7841e..0000000
--- a/dlna/profiles/ac3.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * File: profiles_ac3.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:04
- */
-
-#include "profiles/ac3.h"
-#include "util.h"
-#include "avdetector.h"
-
-DLNAProfile DLNA_PROFILE_AC3 = { "AC3" , "audio/vnd.dolby.dd-raw" };
-
-/**
- * Accepted audio bitrates
- *
- * This are all accepted audio bitrates of this profile
- * The standard says 64Kbps - 640Kbps. However, 32Kbps is used as
- * lower limit to accept low bitrate streams in ATSC and DVB broadcast streams.
- */
-AcceptedBitrates DLNA_BITRATES_AC3 = { true, {Kbps(32), Kbps(448)}};
-AcceptedBitrates DLNA_BITRATES_XAC3 = { true, {Kbps(64), Kbps(640)}};
-
-/**
- * Accepted audio channel layouts
- *
- * This are all accepted audio channel layouts including LFE.
- * Though the LFE is optional and not explicitly mentioned in the documents to be supported
- * by this profile, it is supported by this plugin as it makes no sense to do not.
- * However, this may result in difficulties on some players if they follow the standard correctly
- *
- */
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_AC3 = { 5, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20, CHANNEL_LAYOUT_21,
- CHANNEL_LAYOUT_22, CHANNEL_LAYOUT_30, CHANNEL_LAYOUT_31,
- CHANNEL_LAYOUT_32, CHANNEL_LAYOUT_10_1, CHANNEL_LAYOUT_20_1,
- CHANNEL_LAYOUT_21_1, CHANNEL_LAYOUT_22_1, CHANNEL_LAYOUT_30_1,
- CHANNEL_LAYOUT_31_1, CHANNEL_LAYOUT_5_1
- }, true };
-
-/**
- * Accepted audio sample rates
- *
- * This are all accepted audio sample rates
- * In ATSC systems only 48kHz are supported, the other two sample rates were
- * removed from standard. However, I do not specialice here if there is no
- * real reason for.
- */
-AcceptedSamplingRates DLNA_SAMPLINGRATES_AC3 = {{ KHz(32), KHz(44.1), KHz(48) }};
-AcceptedSamplingRates DLNA_SAMPLINGRATES_XAC3 = {{ KHz(48) }};
-
-AudioPortionProfile cAC3Profiler::probeAudioProfile(AVFormatContext* FormatCtx){
- AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
-
- if(AudioCodec->codec_id == CODEC_ID_AC3){
- // VBR
- if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_AC3, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_AC3, AudioCodec) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_AC3, AudioCodec)){
- return DLNA_APP_AC3;
- }
- else if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_XAC3, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_AC3, AudioCodec) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_XAC3, AudioCodec)){
- return DLNA_APP_XAC3;
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
-}
-
-DLNAProfile* cAC3Profiler::probeDLNAProfile(AVFormatContext* FormatCtx){
- AudioPortionProfile Profile = AC3Profiler.probeAudioProfile(FormatCtx);
- if(Profile==DLNA_APP_AC3 || Profile==DLNA_APP_XAC3){
- return &DLNA_PROFILE_AC3;
- }
- else {
- return NULL;
- }
-}
-
-cAC3Profiler AC3Profiler; \ No newline at end of file
diff --git a/dlna/profiles/amr.cpp b/dlna/profiles/amr.cpp
deleted file mode 100644
index 8c7696f..0000000
--- a/dlna/profiles/amr.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_amr.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:05
- */
-
-#include "profiles/amr.h"
diff --git a/dlna/profiles/atrac3plus.cpp b/dlna/profiles/atrac3plus.cpp
deleted file mode 100644
index 95f28fd..0000000
--- a/dlna/profiles/atrac3plus.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_atrac3plus.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:06
- */
-
-#include "profiles/atrac3plus.h" \ No newline at end of file
diff --git a/dlna/profiles/container.cpp b/dlna/profiles/container.cpp
deleted file mode 100644
index a4418ef..0000000
--- a/dlna/profiles/container.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * File: container.cpp
- * Author: savop
- *
- * Created on 8. Januar 2010, 11:45
- */
-
-#include "profiles/container.h"
-#include "../../common.h"
-#include <vdr/remux.h>
-
-#define DLNA_MPEG_TS_SIZE_ISO TS_SIZE
-#define DLNA_MPEG_TS_SIZE 192
-
-enum VideoFormats {
- FORMAT_MPEG1,
- FORMAT_MPEG2,
- FORMAT_MP4,
-#ifdef WITH_WINDOWS_MEDIA
- FORMAT_WMF,
-#endif
-};
-
-static const struct VideoFormatMapping {
- const char* name;
- VideoFormats format;
-} VideoFormatMap[] = {
- { "mpeg", FORMAT_MPEG2 },
- { "mpegts", FORMAT_MPEG2 },
-#ifdef WITH_WINDOWS_MEDIA
- { "asf", FORMAT_WMF }
-#endif
-};
-
-VideoContainerProfile cContainerDetector::detect(AVFormatContext* Ctx){
- if(Ctx && Ctx->iformat){
- for(int i=0; VideoFormatMap[i].name; i++){
- if(!strcasecmp(VideoFormatMap[i].name,Ctx->iformat->name))
- switch(VideoFormatMap[i].format){
- case FORMAT_MPEG1:
- return cContainerDetector::detectMPEG1Container(Ctx);
- case FORMAT_MPEG2:
- return cContainerDetector::detectMPEG2Container(Ctx);
- case FORMAT_MP4:
- return cContainerDetector::detectMP4Container(Ctx);
-#ifdef WITH_WINDOWS_MEDIA
- case FORMAT_WMF:
- return cContainerDetector::detectWMFContainer(Ctx);
-#endif
- default:
- break;
- }
- }
- ERROR("AVDetector: Unsupported input format \"%s\"", Ctx->iformat->name);
- }
- else {
- ERROR("AVDetector: Input format not found");
- }
- return DLNA_VCP_UNKNOWN;
-}
-
-VideoContainerProfile cContainerDetector::detectMPEG2Container(AVFormatContext* Ctx){
-
- uint8_t buf[5*1024];
- int len;
- int64_t pos;
- int PaketSize = 0;
- VideoContainerProfile VCP = DLNA_VCP_UNKNOWN;
-
- /* read the first 1024 bytes to get packet size */
- pos = url_ftell(Ctx->pb);
- len = get_buffer(Ctx->pb, buf, sizeof(buf));
- if (len != sizeof(buf)) PaketSize = 0;
-
- for(int i = 0; i<DLNA_MPEG_TS_SIZE; i++){
- if(buf[i]==0x47 && buf[i+DLNA_MPEG_TS_SIZE_ISO]==0x47){
- MESSAGE(VERBOSE_METADATA, "AVDetector: MPEG TS ISO Video container found");
- PaketSize = DLNA_MPEG_TS_SIZE_ISO;
- VCP = DLNA_VCP_MPEG2_TS_ISO;
- break;
- }
- else if(buf[i+4]==0x47 && buf[i+DLNA_MPEG_TS_SIZE]==0x47){
- PaketSize = DLNA_MPEG_TS_SIZE;
- if(buf[i]==0x00 && buf[i+1]==0x00 && buf[i+1]==0x00 && buf[i+1]==0x00){
- MESSAGE(VERBOSE_METADATA, "AVDetector: MPEG TS DLNA with zero value time stamp found");
- VCP = DLNA_VCP_MPEG2_TS_T;
- break;
- }
- else {
- MESSAGE(VERBOSE_METADATA, "AVDetector: MPEG TS DLNA with non-zero value time stamp found");
- VCP = DLNA_VCP_MPEG2_TS;
- break;
- }
- }
- else {
- VCP = DLNA_VCP_UNKNOWN;
- }
- }
-
- // TODO: MPEG-PS-Header
-
- return VCP;
-}
-
-VideoContainerProfile cContainerDetector::detectMPEG1Container(AVFormatContext* ){
- return DLNA_VCP_UNKNOWN;
-}
-
-VideoContainerProfile cContainerDetector::detectMP4Container(AVFormatContext* ){
- return DLNA_VCP_UNKNOWN;
-}
-
-#ifdef WITH_WINDOWS_MEDIA
-VideoContainerProfile cContainerDetector::detectWMFContainer(AVFormatContext* ){
- return DLNA_VCP_UNKNOWN;
-}
-#endif \ No newline at end of file
diff --git a/dlna/profiles/jpeg.cpp b/dlna/profiles/jpeg.cpp
deleted file mode 100644
index 61e1149..0000000
--- a/dlna/profiles/jpeg.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * File: profiles_jpeg.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 12:59
- */
-
-#include "profiles/jpeg.h"
-
-DLNAIconProfile DLNA_ICON_JPEG_SM_24 = { "image/jpeg", 48, 48, 24 };
-DLNAIconProfile DLNA_ICON_JPEG_LRG_24 = { "image/jpeg", 120, 120, 24 };
diff --git a/dlna/profiles/lpcm.cpp b/dlna/profiles/lpcm.cpp
deleted file mode 100644
index d80b259..0000000
--- a/dlna/profiles/lpcm.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_lpcm.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:07
- */
-
-#include "profiles/lpcm.h" \ No newline at end of file
diff --git a/dlna/profiles/mpa.cpp b/dlna/profiles/mpa.cpp
deleted file mode 100644
index 09ba77b..0000000
--- a/dlna/profiles/mpa.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * File: profiles_mp3.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:08
- */
-
-#include "profiles/mpa.h"
-#include "profiles/profile_data.h"
-#include "avdetector.h"
-
-DLNAProfile DLNA_PROFILE_MP3 = { "MP3" , "audio/mpeg" };
-DLNAProfile DLNA_PROFILE_MP3X = { "MP3X" , "audio/mpeg" };
-
-AcceptedBitrates DLNA_BITRATES_MPEG1_L1_DVB = { true, { Kbps(32), Kbps(448) }};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L2_DVB = { true, { Kbps(32), Kbps(384) }};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L3_VBR = { true, { Kbps(32), Kbps(320) }};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L3_CBR = { false, { Kbps(32), Kbps(40),
- Kbps(48), Kbps(56),
- Kbps(64), Kbps(80),
- Kbps(96), Kbps(112),
- Kbps(128), Kbps(160),
- Kbps(192), Kbps(224),
- Kbps(256), Kbps(320)}};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L3X_VBR = { true, { Kbps(8), Kbps(320) }};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L3X_CBR = { false, { Kbps(8), Kbps(16), Kbps(24),
- Kbps(32), Kbps(40),
- Kbps(48), Kbps(56),
- Kbps(64), Kbps(80),
- Kbps(96), Kbps(112),
- Kbps(128), Kbps(160),
- Kbps(192), Kbps(224),
- Kbps(256), Kbps(320)}};
-AcceptedBitrates DLNA_BITRATES_MPEG1_L2 = { true, { Kbps(32), Kbps(384) }};
-
-AcceptedSamplingRates DLNA_SAMPLINGRATES_MPEG1_L1_DVB = {{ KHz(16), KHz(22.05), KHz(24),
- KHz(32), KHz(44.1), KHz(48) }};
-AcceptedSamplingRates DLNA_SAMPLINGRATES_MPEG1_L2 = {{ KHz(32), KHz(44.1), KHz(48) }};
-AcceptedSamplingRates DLNA_SAMPLINGRATES_MPEG1_L2_DVB = {{ KHz(16), KHz(22.05), KHz(24),
- KHz(32), KHz(44.1), KHz(48) }};
-AcceptedSamplingRates DLNA_SAMPLINGRATES_MPEG1_L3 = {{ KHz(32), KHz(44.1), KHz(48) }};
-AcceptedSamplingRates DLNA_SAMPLINGRATES_MPEG1_L3X = {{ KHz(16), KHz(22.05), KHz(24),
- KHz(32), KHz(44.1), KHz(48) }};
-
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L1_DVB = { 6, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20,
- CHANNEL_LAYOUT_21, CHANNEL_LAYOUT_22,
- CHANNEL_LAYOUT_30, CHANNEL_LAYOUT_31,
- CHANNEL_LAYOUT_32, }, false };
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L2_DVB = { 6, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20,
- CHANNEL_LAYOUT_21, CHANNEL_LAYOUT_22,
- CHANNEL_LAYOUT_30, CHANNEL_LAYOUT_31,
- CHANNEL_LAYOUT_32, }, false };
-
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L2 = { 2, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20 }, false };
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L3 = { 2, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20 }, false };
-AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L3X = { 2, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20 }, false };
-
-AudioPortionProfile cMPEGAudioProfiler::probeAudioProfile(AVFormatContext* FormatCtx){
- AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
-
- if(AudioCodec->codec_id == CODEC_ID_MP1){
- if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L1_DVB, AudioCodec) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_MPEG1_L1_DVB, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_MPEG1_L1_DVB, AudioCodec)){
- return DLNA_APP_MPEG1_L1;
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
- }
- else if(AudioCodec->codec_id == CODEC_ID_MP2){
- if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L2, AudioCodec) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_MPEG1_L2, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_MPEG1_L2, AudioCodec)){
- return DLNA_APP_MPEG1_L2;
- }
- else if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L2_DVB, AudioCodec) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_MPEG1_L2_DVB, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_MPEG1_L2_DVB, AudioCodec)){
- return DLNA_APP_MPEG1_L2;
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
- }
- else if(AudioCodec->codec_id == CODEC_ID_MP3){
- if((cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L3_VBR, AudioCodec) ||
- cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L3_CBR, AudioCodec)) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_MPEG1_L3, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_MPEG1_L3, AudioCodec)){
- return DLNA_APP_MPEG1_L3;
- }
- else if((cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L3X_VBR, AudioCodec) ||
- cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L3X_CBR, AudioCodec)) &&
- cCodecToolKit::matchesAcceptedSamplingRates(DLNA_SAMPLINGRATES_MPEG1_L3X, AudioCodec) &&
- cCodecToolKit::matchesAcceptedAudioChannels(DLNA_AUDIOCHANNELS_MPEG1_L3X, AudioCodec)){
- return DLNA_APP_MPEG1_L3X;
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
-}
-
-DLNAProfile* cMPEGAudioProfiler::probeDLNAProfile(AVFormatContext* FormatCtx){
- AudioPortionProfile Profile = MPEGAudioProfiler.probeAudioProfile(FormatCtx);
- if(Profile == DLNA_APP_MPEG1_L3){
- return &DLNA_PROFILE_MP3;
- }
- else if(Profile == DLNA_APP_MPEG1_L3X){
- return &DLNA_PROFILE_MP3X;
- }
- else {
- return NULL;
- }
-}
-
-cMPEGAudioProfiler MPEGAudioProfiler; \ No newline at end of file
diff --git a/dlna/profiles/mpeg1.cpp b/dlna/profiles/mpeg1.cpp
deleted file mode 100644
index 9f2d67b..0000000
--- a/dlna/profiles/mpeg1.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * File: profiles_mpeg1.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:34
- */
-
-#include "profiles/mpeg1.h"
-
-DLNAProfile DLNA_PROFILE_MPEG1 = { "MPEG1", "video/mpeg" };
-
-DLNAVideoMapping MPEG1_VIDEO_MAP[] =
-{
- { &DLNA_PROFILE_MPEG1, DLNA_VCP_MPEG1, DLNA_VPP_MPEG1, DLNA_APP_MPEG1_L2 }
-}; \ No newline at end of file
diff --git a/dlna/profiles/mpeg2.cpp b/dlna/profiles/mpeg2.cpp
deleted file mode 100644
index 2816095..0000000
--- a/dlna/profiles/mpeg2.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * File: profiles_mpeg2.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:35
- */
-
-#include "profiles/mpeg2.h"
-#include "profiles/container.h"
-#include "util.h"
-#include "profiles/ac3.h"
-#include "avdetector.h"
-
-AcceptedBitrates DLNA_VIDEOBITRATES_MPEG2_TS_NA_SYSTEM = { true, {1, Mbps(19.3927)}};
-AcceptedBitrates DLNA_VIDEOBITRATES_MPEG2_TS_EU = { true, {1, Mbps(15)}};
-AcceptedBitrates DLNA_VIDEOBITRATES_MPEG2_PS = { true, {1, Mbps(9.80)}};
-
-AcceptedResolution DLNA_RESOLUTIONS_MPEG2_PAL[] = { { 720, 576, 25, 1 },
- { 704, 576, 25, 1 }, ///< compatibility mode for PAL
- { 544, 576, 25, 1 },
- { 480, 576, 25, 1 },
- { 352, 576, 25, 1 },
- { 352, 288, 25, 1 } };
-AcceptedResolution DLNA_RESOLUTIONS_MPEG2_NTSC_SD[] = { { 720, 480, 30, 1001},
- { 704, 480, 30, 1001},
- { 704, 480, 30, 1},
- { 704, 480, 24, 1001},
- { 704, 480, 24, 1},
- { 640, 480, 30, 1001},
- { 640, 480, 30, 1},
- { 640, 480, 24, 1001},
- { 640, 480, 24, 1},
- { 544, 480, 30, 1001},
- { 480, 480, 30, 1001},
- { 352, 480, 30, 1001} };
-AcceptedResolution DLNA_RESOLUTIONS_MPEG2_NTSC_HD[] = { { 1920, 1080, 30, 1001},
- { 1920, 1080, 30, 1},
- { 1920, 1080, 24, 1001},
- { 1920, 1080, 24, 1},
- { 1280, 720, 30, 1001},
- { 1280, 720, 30, 1},
- { 1280, 720, 24, 1001},
- { 1280, 720, 24, 1},
- { 1440, 1080, 30, 1001},
- { 1440, 1080, 30, 1},
- { 1440, 1080, 24, 1001},
- { 1440, 1080, 24, 1},
- { 1280, 1080, 30, 1001},
- { 1280, 1080, 30, 1},
- { 1280, 1080, 24, 1001},
- { 1280, 1080, 24, 1} };
-
-DLNAProfile DLNA_PROFILE_MPEG_PS_NTSC = { "MPEG_PS_NTSC", "video/mpeg" };
-DLNAProfile DLNA_PROFILE_MPEG_PS_NTSC_XAC3 = { "MPEG_PS_NTSC_XAC3", "video/mpeg" };
-DLNAProfile DLNA_PROFILE_MPEG_PS_PAL = { "MPEG_PS_PAL", "video/mpeg" };
-DLNAProfile DLNA_PROFILE_MPEG_PS_PAL_XAC3 = { "MPEG_PS_PAL_XAC3", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA = { "MPEG_TS_SD_NA", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_T = { "MPEG_TS_SD_NA_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_ISO = { "MPEG_TS_SD_NA_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA = { "MPEG_TS_HD_NA", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_T = { "MPEG_TS_HD_NA_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_ISO = { "MPEG_TS_HD_NA_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3 = { "MPEG_TS_SD_NA_XAC3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_T = { "MPEG_TS_SD_NA_XAC3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_ISO = { "MPEG_TS_SD_NA_XAC3_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3 = { "MPEG_TS_HD_NA_XAC3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_T = { "MPEG_TS_HD_NA_XAC3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_ISO = { "MPEG_TS_HD_NA_XAC3_ISO", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU = { "MPEG_TS_SD_EU", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU_T = { "MPEG_TS_SD_EU_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU_ISO = { "MPEG_TS_SD_EU_ISO", "video/mpeg"};
-
-// The Korean profiles are almost identical to the north american profiles.
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO = { "MPEG_TS_SD_KO", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_T = { "MPEG_TS_SD_KO_T", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_ISO = { "MPEG_TS_SD_KO_ISO", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO = { "MPEG_TS_HD_KO", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_T = { "MPEG_TS_HD_KO_T", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_ISO = { "MPEG_TS_HD_KO_ISO", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3 = { "MPEG_TS_SD_KO_XAC3", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3_T = { "MPEG_TS_SD_KO_XAC3_T", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3_ISO = { "MPEG_TS_SD_KO_XAC3_ISO", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3 = { "MPEG_TS_HD_KO_XAC3", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3_T = { "MPEG_TS_HD_KO_XAC3_T", "video/vnd.dlna.mpeg-tts"};
-//DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3_ISO = { "MPEG_TS_HD_KO_XAC3_ISO", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC = { "MPEG_TS_MP_LL_AAC", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC_T = { "MPEG_TS_MP_LL_AAC_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC_ISO = { "MPEG_TS_MP_LL_AAC_ISO", "video/mpeg"};
-
-// The Elementary Stream profiles are currently not supported as they are only supported within RTP streaming
-//DLNAProfile DLNA_PROFILE_MPEG_ES_PAL = { "MPEG_ES_PAL", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_ES_NTSC = { "MPEG_ES_NTSC", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_ES_PAL_XAC3 = { "MPEG_ES_PAL_XAC3", "video/mpeg"};
-//DLNAProfile DLNA_PROFILE_MPEG_ES_NTSC_XAC3 = { "MPEG_ES_NTSC_XAC3", "video/mpeg"};
-
-DLNAVideoMapping MPEG2_VIDEO_MAP[] = {
- { &DLNA_PROFILE_MPEG_PS_NTSC, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_LPCM},
- { &DLNA_PROFILE_MPEG_PS_NTSC, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_MPEG1_L2},
- { &DLNA_PROFILE_MPEG_PS_NTSC, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_MPEG2_L2},
- { &DLNA_PROFILE_MPEG_PS_NTSC, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_PS_NTSC_XAC3, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_PS_PAL, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_LPCM},
- { &DLNA_PROFILE_MPEG_PS_PAL, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L2},
- { &DLNA_PROFILE_MPEG_PS_PAL, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG2_L2},
- { &DLNA_PROFILE_MPEG_PS_PAL, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_PS_PAL_XAC3, DLNA_VCP_MPEG2_PS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA_XAC3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_NTSC_SD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA_XAC3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_NTSC_HD, DLNA_APP_XAC3},
- { &DLNA_PROFILE_MPEG_TS_SD_EU, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L1},
- { &DLNA_PROFILE_MPEG_TS_SD_EU, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG2_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L1},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG2_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L1},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG1_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_MPEG2_L2},
- { &DLNA_PROFILE_MPEG_TS_SD_EU_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_PAL_SD, DLNA_APP_AC3},
- { &DLNA_PROFILE_MPEG_TS_MP_LL_AAC, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG2_MP_LL, DLNA_APP_AAC},
- { &DLNA_PROFILE_MPEG_TS_MP_LL_AAC_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG2_MP_LL, DLNA_APP_AAC},
- { &DLNA_PROFILE_MPEG_TS_MP_LL_AAC_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG2_MP_LL, DLNA_APP_AAC},
-
-};
-
-DLNAProfile* cMPEG2Profiler::probeDLNAProfile(AVFormatContext* FormatCtx){
- VideoContainerProfile VCP = MPEG2Profiler.probeContainerProfile(FormatCtx);
- VideoPortionProfile VPP = MPEG2Profiler.probeVideoProfile(FormatCtx);
- AudioPortionProfile APP = MPEG2Profiler.probeAudioProfile(FormatCtx);
-
- MESSAGE(VERBOSE_METADATA, "VCP: %d, VPP: %d, APP: %d", VCP, VPP, APP);
-
- for(int i=0; i < (int) (sizeof(MPEG2_VIDEO_MAP)/sizeof(DLNAVideoMapping)); i++){
- if( MPEG2_VIDEO_MAP[i].VideoContainer == VCP &&
- MPEG2_VIDEO_MAP[i].VideoProfile == VPP &&
- MPEG2_VIDEO_MAP[i].AudioProfile == APP){
- return MPEG2_VIDEO_MAP[i].Profile;
- }
- }
-
- return NULL;
-}
-
-VideoPortionProfile cMPEG2Profiler::probeVideoProfile(AVFormatContext* FormatCtx){
- AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_VIDEO);
- AVStream* VideoStream = cCodecToolKit::getFirstStream(FormatCtx, CODEC_TYPE_VIDEO);
-
- MESSAGE(VERBOSE_METADATA, "Codec-ID: %d", VideoCodec->codec_id);
- MESSAGE(VERBOSE_METADATA, "Codec-Name: %s", VideoCodec->codec_name);
- MESSAGE(VERBOSE_METADATA, "Codec Bitrate: %d", VideoCodec->bit_rate);
- MESSAGE(VERBOSE_METADATA, "Codec width: %d", VideoCodec->coded_width);
- MESSAGE(VERBOSE_METADATA, "Codec height: %d", VideoCodec->coded_height);
- MESSAGE(VERBOSE_METADATA, "Codec Profile: %d", VideoCodec->profile);
- MESSAGE(VERBOSE_METADATA, "Codec Level: %d", VideoCodec->level);
- MESSAGE(VERBOSE_METADATA, "Codec Chroma: %d", VideoCodec->pix_fmt);
- MESSAGE(VERBOSE_METADATA, "Stream aspect ratio %d:%d", VideoStream->sample_aspect_ratio.num, VideoStream->sample_aspect_ratio.den);
- MESSAGE(VERBOSE_METADATA, "Stream fps %2.3f", av_q2d(VideoStream->r_frame_rate));
-
- if(VideoCodec->codec_id == CODEC_ID_MPEG2VIDEO){
- if(cCodecToolKit::matchesAcceptedResolutions(DLNA_RESOLUTIONS_MPEG2_PAL,
- (int) (sizeof(DLNA_RESOLUTIONS_MPEG2_PAL)/sizeof(AcceptedResolution)) , VideoStream) &&
- (cCodecToolKit::matchesAcceptedBitrates(DLNA_VIDEOBITRATES_MPEG2_TS_EU, VideoCodec) ||
- cCodecToolKit::matchesAcceptedBitrates(DLNA_VIDEOBITRATES_MPEG2_PS, VideoCodec))){
- return DLNA_VPP_MPEG2_PAL_SD;
- }
- else if(cCodecToolKit::matchesAcceptedResolutions(DLNA_RESOLUTIONS_MPEG2_NTSC_SD,
- (int) (sizeof(DLNA_RESOLUTIONS_MPEG2_NTSC_SD)/sizeof(AcceptedResolution)), VideoStream) &&
- (cCodecToolKit::matchesAcceptedSystemBitrate(DLNA_VIDEOBITRATES_MPEG2_TS_NA_SYSTEM, FormatCtx) ||
- cCodecToolKit::matchesAcceptedBitrates(DLNA_VIDEOBITRATES_MPEG2_PS, VideoCodec))) {
- return DLNA_VPP_MPEG2_NTSC_SD;
- }
- else if(cCodecToolKit::matchesAcceptedResolutions(DLNA_RESOLUTIONS_MPEG2_NTSC_HD,
- (int) (sizeof(DLNA_RESOLUTIONS_MPEG2_NTSC_HD)/sizeof(AcceptedResolution)), VideoStream) &&
- cCodecToolKit::matchesAcceptedSystemBitrate(DLNA_VIDEOBITRATES_MPEG2_TS_NA_SYSTEM, FormatCtx)) {
- return DLNA_VPP_MPEG2_NTSC_HD;
- }
- }
-
- return DLNA_VPP_UNKNOWN;
-}
-
-AudioPortionProfile cMPEG2Profiler::probeAudioProfile(AVFormatContext* FormatCtx){
- AudioPortionProfile Profile;
- if((Profile = AC3Profiler.probeAudioProfile(FormatCtx)) != DLNA_APP_UNKNOWN){
- MESSAGE(VERBOSE_METADATA, "AC3: %d", Profile);
- return Profile;
- }
- // First codec is not AC3... trying other codecs
- else if((Profile = MPEGAudioProfiler.probeAudioProfile(FormatCtx)) != DLNA_APP_UNKNOWN){
- MESSAGE(VERBOSE_METADATA, "MPA: %d", Profile);
- return Profile;
- }
- else {
- return DLNA_APP_UNKNOWN;
- }
-}
-
-VideoContainerProfile cMPEG2Profiler::probeContainerProfile(AVFormatContext* FormatCtx){
- return cContainerDetector::detect(FormatCtx);
-}
-
-cMPEG2Profiler MPEG2Profiler; \ No newline at end of file
diff --git a/dlna/profiles/mpeg4_p10.cpp b/dlna/profiles/mpeg4_p10.cpp
deleted file mode 100644
index 80e91b4..0000000
--- a/dlna/profiles/mpeg4_p10.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * File: profiles_mpeg4_p10.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:38
- */
-
-#include "profiles/mpeg4_p10.h"
-
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5 = {"AVC_TS_MP_SD_AAC_MULT5", ""}; ///< AVC main profile AAC 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5_T = {"AVC_TS_MP_SD_AAC_MULT5_T", ""}; ///< AVC main profile AAC 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5_ISO = {"AVC_TS_MP_SD_AAC_MULT5_ISO", ""}; ///< AVC main profile AAC 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2 = {"AVC_TS_MP_SD_HEAAC_L2", ""}; ///< AVC main profile HEAAC L2
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2_T = {"AVC_TS_MP_SD_HEAAC_L2_T", ""}; ///< AVC main profile HEAAC L2 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2_ISO = {"AVC_TS_MP_SD_HEAAC_L2_ISO", ""}; ///< AVC main profile HEAAC L2 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3 = {"AVC_TS_MP_SD_MPEG1_L3", ""}; ///< AVC main profile MP3
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3_T = {"AVC_TS_MP_SD_MPEG1_L3_T", ""}; ///< AVC main profile MP3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3_ISO = {"AVC_TS_MP_SD_MPEG1_L3_ISO", ""}; ///< AVC main profile MP3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3 = {"AVC_TS_MP_SD_AC3", ""}; ///< AVC main profile AC3
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3_T = {"AVC_TS_MP_SD_AC3_T", ""}; ///< AVC main profile AC3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3_ISO = {"AVC_TS_MP_SD_AC3_ISO", ""}; ///< AVC main profile AC3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP = {"AVC_TS_MP_SD_AAC_LTP", ""}; ///< AVC main profile AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_T = {"AVC_TS_MP_SD_AAC_LTP_T", ""}; ///< AVC main profile AAC LTP with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_ISO = {"AVC_TS_MP_SD_AAC_LTP_ISO", ""}; ///< AVC main profile AAC LTP without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5 = {"AVC_TS_MP_SD_AAC_LTP_MULT5", ""}; ///< AVC main profile AAC LTP 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5_T = {"AVC_TS_MP_SD_AAC_LTP_MULT5_T", ""}; ///< AVC main profile AAC LTP 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5_ISO = {"AVC_TS_MP_SD_AAC_LTP_MULT5_ISO", ""}; ///< AVC main profile AAC LTP 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7 = {"AVC_TS_MP_SD_AAC_LTP_MULT7", ""}; ///< AVC main profile AAC LTP 7.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7_T = {"AVC_TS_MP_SD_AAC_LTP_MULT7_T", ""}; ///< AVC main profile AAC LTP 7.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7_ISO = {"AVC_TS_MP_SD_AAC_LTP_MULT7_ISO", ""}; ///< AVC main profile AAC LTP 7.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC = {"AVC_TS_MP_SD_BSAC", ""}; ///< AVC main profile BSAC
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC_T = {"AVC_TS_MP_SD_BSAC_T", ""}; ///< AVC main profile BSAC with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC_ISO = {"AVC_TS_MP_SD_BSAC_ISO", ""}; ///< AVC main profile BSAC without time stamp
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_MULT5 = {"AVC_MP4_MP_SD_AAC_MULT5", ""}; ///< AVC main profile MP4 AAC 5.1
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_HEAAC_L2 = {"AVC_MP4_MP_SD_HEAAC_L2", ""}; ///< AVC main profile MP4 HEAAC L2
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_MPEG1_L3 = {"AVC_MP4_MP_SD_MPEG1_L3", ""}; ///< AVC main profile MP4 MP3
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AC3 = {"AVC_MP4_MP_SD_AC3", ""}; ///< AVC main profile MP4 AC3
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP = {"AVC_MP4_MP_SD_AAC_LTP", ""}; ///< AVC main profile MP4 AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP_MULT5 = {"AVC_MP4_MP_SD_AAC_LTP_MULT5", ""}; ///< AVC main profile MP4 AAC LTP 5.1
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP_MULT7 = {"AVC_MP4_MP_SD_AAC_LTP_MULT7", ""}; ///< AVC main profile MP4 AAC LTP 7.1
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_ATRAC3plus = {"AVC_MP4_MP_SD_ATRAC3plus", ""}; ///< AVC main profile MP4 ATRAC3+
-DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_BSAC = {"AVC_MP4_MP_SD_BSAC", ""}; ///< AVC main profile MP4 BSAC
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3L_SD_AAC = {"AVC_MP4_BP_L3L_SD_AAC", ""}; ///< AVC baseline profile MP4 AAC
-DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3L_SD_HEAAC = {"AVC_MP4_BP_L3L_SD_HEAAC", ""}; ///< AVC baseline profile MP4 HEAAC
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3_SD_AAC = {"AVC_MP4_BP_L3_SD_AAC", ""}; ///< AVC baseline profile standard MP4 AAC
-
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5 = {"AVC_TS_BL_CIF30_AAC_MULT5", ""}; ///< AVC CIF30 baseline profile AAC 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5_T = {"AVC_TS_BL_CIF30_AAC_MULT5_T", ""}; ///< AVC CIF30 baseline profile AAC 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5_ISO = {"AVC_TS_BL_CIF30_AAC_MULT5_ISO", ""}; ///< AVC CIF30 baseline profile AAC 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2 = {"AVC_TS_BL_CIF30_HEAAC_L2", ""}; ///< AVC CIF30 baseline profile HEAAC L2
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2_T = {"AVC_TS_BL_CIF30_HEAAC_L2_T", ""}; ///< AVC CIF30 baseline profile HEAAC L2 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2_ISO = {"AVC_TS_BL_CIF30_HEAAC_L2_ISO", ""}; ///< AVC CIF30 baseline profile HEAAC L2 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3 = {"AVC_TS_BL_CIF30_MPEG1_L3", ""}; ///< AVC CIF30 baseline profile MP3
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3_T = {"AVC_TS_BL_CIF30_MPEG1_L3_T", ""}; ///< AVC CIF30 baseline profile MP3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3_ISO = {"AVC_TS_BL_CIF30_MPEG1_L3_ISO", ""}; ///< AVC CIF30 baseline profile MP3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3 = {"AVC_TS_BL_CIF30_AC3", ""}; ///< AVC CIF30 baseline profile AC3
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3_T = {"AVC_TS_BL_CIF30_AC3_T", ""}; ///< AVC CIF30 baseline profile AC3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3_ISO = {"AVC_TS_BL_CIF30_AC3_ISO", ""}; ///< AVC CIF30 baseline profile AC3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP = {"AVC_TS_BL_CIF30_AAC_LTP", ""}; ///< AVC CIF30 baseline profile AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_T = {"AVC_TS_BL_CIF30_AAC_LTP_T", ""}; ///< AVC CIF30 baseline profile AAC LTP with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_ISO = {"AVC_TS_BL_CIF30_AAC_LTP_ISO", ""}; ///< AVC CIF30 baseline profile AAC LTP without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5 = {"AVC_TS_BL_CIF30_AAC_LTP_MULT5", ""}; ///< AVC CIF30 baseline profile AAC LTP 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5_T = {"AVC_TS_BL_CIF30_AAC_LTP_MULT5_T", ""}; ///< AVC CIF30 baseline profile AAC LTP 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5_ISO = {"AVC_TS_BL_CIF30_AAC_LTP_MULT5_ISO", ""}; ///< AVC CIF30 baseline profile AAC LTP 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940 = {"AVC_TS_BL_CIF30_AAC_940", ""}; ///< AVC CIF30 baseline profile AAC 940
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940_T = {"AVC_TS_BL_CIF30_AAC_940_T", ""}; ///< AVC CIF30 baseline profile AAC 940 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940_ISO = {"AVC_TS_BL_CIF30_AAC_940_ISO", ""}; ///< AVC CIF30 baseline profile AAC 940 without time stamp
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_MULT5 = {"AVC_MP4_BL_CIF30_AAC_MULT5", ""}; ///< AVC CIF30 baseline profile MP4 AAC 5.1
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_HEAAC_L2 = {"AVC_MP4_BL_CIF30_HEAAC_L2", ""}; ///< AVC CIF30 baseline profile MP4 HEAAC L2
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_MPEG1_L3 = {"AVC_MP4_BL_CIF30_MPEG1_L3", ""}; ///< AVC CIF30 baseline profile MP4 MP3
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AC3 = {"AVC_MP4_BL_CIF30_AC3", ""}; ///< AVC CIF30 baseline profile MP4 AC3
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_LTP = {"AVC_MP4_BL_CIF30_AAC_LTP", ""}; ///< AVC CIF30 baseline profile MP4 AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_LTP_MULT5 = {"AVC_MP4_BL_CIF30_AAC_LTP_MULT5", ""}; ///< AVC CIF30 baseline profile MP4 AAC LTP 5.1
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_BSAC = {"AVC_MP4_BL_CIF30_BSAC", ""}; ///< AVC CIF30 baseline profile BSAC
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_BSAC_MULT5 = {"AVC_MP4_BL_CIF30_BSAC_MULT5", ""}; ///< AVC CIF30 baseline profile BSAC 5.1
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L2_CIF30_AAC = {"AVC_MP4_BL_L2_CIF30_AAC", ""}; ///< AVC CIF30 baseline profile L2 AAC
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_HEAAC = {"AVC_MP4_BL_CIF15_HEAAC", ""}; ///< AVC CIF15 baseline profile HEAAC
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AMR = {"AVC_MP4_BL_CIF15_AMR", ""}; ///< AVC CIF15 baseline profile AMR
-
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5 = {"AVC_TS_MP_HD_AAC_MULT5", ""}; ///< AVC main profile AAC 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5_T = {"AVC_TS_MP_HD_AAC_MULT5_T", ""}; ///< AVC main profile AAC 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5_ISO = {"AVC_TS_MP_HD_AAC_MULT5_ISO", ""}; ///< AVC main profile AAC 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2 = {"AVC_TS_MP_HD_HEAAC_L2", ""}; ///< AVC main profile HEAAC L2
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2_T = {"AVC_TS_MP_HD_HEAAC_L2_T", ""}; ///< AVC main profile HEAAC L2 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2_ISO = {"AVC_TS_MP_HD_HEAAC_L2_ISO", ""}; ///< AVC main profile HEAAC L2 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3 = {"AVC_TS_MP_HD_MPEG1_L3", ""}; ///< AVC main profile MP3
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3_T = {"AVC_TS_MP_HD_MPEG1_L3_T", ""}; ///< AVC main profile MP3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3_ISO = {"AVC_TS_MP_HD_MPEG1_L3_ISO", ""}; ///< AVC main profile MP3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3 = {"AVC_TS_MP_HD_AC3", ""}; ///< AVC main profile AC3
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3_T = {"AVC_TS_MP_HD_AC3_T", ""}; ///< AVC main profile AC3 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3_ISO = {"AVC_TS_MP_HD_AC3_ISO", ""}; ///< AVC main profile AC3 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC = {"AVC_TS_MP_HD_AAC", ""}; ///< AVC main profile AAC
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_T = {"AVC_TS_MP_HD_AAC_T", ""}; ///< AVC main profile AAC with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_ISO = {"AVC_TS_MP_HD_AAC_ISO", ""}; ///< AVC main profile AAC without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP = {"AVC_TS_MP_HD_AAC_LTP", ""}; ///< AVC main profile AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_T = {"AVC_TS_MP_HD_AAC_LTP_T", ""}; ///< AVC main profile AAC LTP with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_ISO = {"AVC_TS_MP_HD_AAC_LTP_ISO", ""}; ///< AVC main profile AAC LTP without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5 = {"AVC_TS_MP_HD_AAC_LTP_MULT5", ""}; ///< AVC main profile AAC LTP 5.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5_T = {"AVC_TS_MP_HD_AAC_LTP_MULT5_T", ""}; ///< AVC main profile AAC LTP 5.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5_ISO = {"AVC_TS_MP_HD_AAC_LTP_MULT5_ISO", ""}; ///< AVC main prpfile AAC LTP 5.1 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7 = {"AVC_TS_MP_HD_AAC_LTP_MULT7", ""}; ///< AVC main profile AAC LTP 7.1
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7_T = {"AVC_TS_MP_HD_AAC_LTP_MULT7_T", ""}; ///< AVC main profile AAC LTP 7.1 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7_ISO = {"AVC_TS_MP_HD_AAC_LTP_MULT7_ISO", ""}; ///< AVC main prpfile AAC LTP 7.1 without time stamp
-
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC = {"AVC_TS_BL_CIF15_AAC", ""}; ///< AVC baseline profile AAC
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_T = {"AVC_TS_BL_CIF15_AAC_T", ""}; ///< AVC baseline profile AAC with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_ISO = {"AVC_TS_BL_CIF15_AAC_ISO", ""}; ///< AVC baseline profile AAC without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540 = {"AVC_TS_BL_CIF15_AAC_540", ""}; ///< AVC baseline profile AAC 540
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540_T = {"AVC_TS_BL_CIF15_AAC_540_T", ""}; ///< AVC baseline profile AAC 540 with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540_ISO = {"AVC_TS_BL_CIF15_AAC_540_ISO", ""}; ///< AVC baseline profile AAC 540 without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP = {"AVC_TS_BL_CIF15_AAC_LTP", ""}; ///< AVC baseline profile AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP_T = {"AVC_TS_BL_CIF15_AAC_LTP_T", ""}; ///< AVC baseline profile AAC LTP with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP_IS0 = {"AVC_TS_BL_CIF15_AAC_LTP_IS0", ""}; ///< AVC baseline profile AAC LTP without time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC = {"AVC_TS_BL_CIF15_BSAC", ""}; ///< AVC baseline profile BSAC
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC_T = {"AVC_TS_BL_CIF15_BSAC_T", ""}; ///< AVC baseline profile BSAC with time stamp
-DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC_ISO = {"AVC_TS_BL_CIF15_BSAC_ISO", ""}; ///< AVC baseline profile BSAC without time stamp
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC = {"AVC_MP4_BL_CIF15_AAC", ""}; ///< AVC baseline profile AAC
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_520 = {"AVC_MP4_BL_CIF15_AAC_520", ""}; ///< AVC baseline profile AAC 520
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_LTP = {"AVC_MP4_BL_CIF15_AAC_LTP", ""}; ///< AVC baseline profile AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_LTP_520 = {"AVC_MP4_BL_CIF15_AAC_LTP_520", ""}; ///< AVC baseline profile AAC LTP 520
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_BSAC = {"AVC_MP4_BL_CIF15_BSAC", ""}; ///< AVC baseline profile BSAC
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L12_CIF15_HEAAC = {"AVC_MP4_BL_L12_CIF15_HEAAC", ""}; ///< AVC baseline profile HEAAC
-
-DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L1B_QCIF15_HEAAC = {"AVC_MP4_BL_L1B_QCIF15_HEAAC", ""}; ///< AVC baseline profile QCIF15
-
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_CIF30_AMR_WBplus = {"AVC_3GPP_BL_CIF30_AMR_WBplus", ""}; ///< AVC 3GPP baseline profile CIF30 AMR WB+
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_CIF15_AMR_WBplus = {"AVC_3GPP_BL_CIF15_AMR_WBplus", ""}; ///< AVC 3GPP baseline profile CIF15 AMR WB+
-
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AAC = {"AVC_3GPP_BL_QCIF15_AAC", ""}; ///< AVC 3GPP baseline profile QCIF15 AAC
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AAC_LTP = {"AVC_3GPP_BL_QCIF15_AAC_LTP", ""}; ///< AVC 3GPP baseline profile QCIF15 AAC LTP
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_HEAAC = {"AVC_3GPP_BL_QCIF15_HEAAC", ""}; ///< AVC 3GPP baseline profile QCIF15 HEAAC
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AMR_WBplus = {"AVC_3GPP_BL_QCIF15_AMR_WBplus", ""}; ///< AVC 3GPP baseline profile QCIF15 AMR WB+
-DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AMR = {"AVC_3GPP_BL_QCIF15_AMR", ""}; ///< AVC 3GPP baseline profile QCIF15 AMR
-
-DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU = {"AVC_TS_HD_EU", "video/vnd.dlna.mpeg-tts"}; ///< DLNA Profile for HD DVB Television broadcasts
-DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU_T = {"AVC_TS_HD_EU_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU_ISO = {"AVC_TS_HD_EU_ISO", "video/mpeg"}; ///< DLNA Profile for HD DVB Television broadcasts without timestamp
-
-DLNAVideoMapping MPEG4_P10_VIDEO_MAP[] = {
-}; \ No newline at end of file
diff --git a/dlna/profiles/mpeg4_p2.cpp b/dlna/profiles/mpeg4_p2.cpp
deleted file mode 100644
index 5ed58ab..0000000
--- a/dlna/profiles/mpeg4_p2.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * File: profiles_mpeg4_p2.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:36
- */
-
-#include "profiles/mpeg4_p2.h"
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC = { "MPEG4_P2_MP4_SP_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_HEAAC = { "MPEG4_P2_MP4_SP_HEAAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_ATRAC3plus = { "MPEG4_P2_MP4_SP_ATRAC3plus", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC_LTP = { "MPEG4_P2_MP4_SP_AAC_LTP", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AAC = { "MPEG4_P2_MP4_SP_L2_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AMR = { "MPEG4_P2_MP4_SP_L2_AMR", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_AAC = { "MPEG4_P2_MP4_SP_VGA_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_HEAAC = { "MPEG4_P2_MP4_SP_VGA_HEAAC", "video/mp4"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_AAC = { "MPEG4_P2_MP4_ASP_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC = { "MPEG4_P2_MP4_ASP_HEAAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC_MULT5 = { "MPEG4_P2_MP4_ASP_HEAAC_MULT5", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_ATRAC3plus = { "MPEG4_P2_MP4_ASP_ATRAC3plus", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_AAC = { "MPEG4_P2_MP4_ASP_L5_SO_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC = { "MPEG4_P2_MP4_ASP_L5_SO_HEAAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC_MULT5 = { "MPEG4_P2_MP4_ASP_L5_SO_HEAAC_MULT5", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_G726 = { "MPEG4_P2_MP4_ASP_L5_SO_G726", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_AAC = { "MPEG4_P2_MP4_ASP_L4_SO_AAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC = { "MPEG4_P2_MP4_ASP_L4_SO_HEAAC", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC_MULT5 = { "MPEG4_P2_MP4_ASP_L4_SO_HEAAC_MULT5", "video/mp4"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_G726 = { "MPEG4_P2_MP4_ASP_L4_SO_G726", "video/mp4"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC = { "MPEG4_P2_TS_SP_AAC", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_T = { "MPEG4_P2_TS_SP_AAC_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_ISO = { "MPEG4_P2_TS_SP_AAC_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3 = { "MPEG4_P2_TS_SP_MPEG1_L3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_T = { "MPEG4_P2_TS_SP_MPEG1_L3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_ISO = { "MPEG4_P2_TS_SP_MPEG1_L3_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3 = { "MPEG4_P2_TS_SP_AC3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_T = { "MPEG4_P2_TS_SP_AC3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_ISO = { "MPEG4_P2_TS_SP_AC3_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2 = { "MPEG4_P2_TS_SP_MPEG2_L2", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_T = { "MPEG4_P2_TS_SP_MPEG2_L2_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_IS0 = { "MPEG4_P2_TS_SP_MPEG2_L2_IS0", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3 = { "MPEG4_P2_TS_CO_AC3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_T = { "MPEG4_P2_TS_CO_AC3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_ISO = { "MPEG4_P2_TS_CO_AC3_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2 = { "MPEG4_P2_TS_CO_MPEG2_L2", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_T = { "MPEG4_P2_TS_CO_MPEG2_L2_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_ISO = { "MPEG4_P2_TS_CO_MPEG2_L2_ISO", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC = { "MPEG4_P2_TS_ASP_AAC", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_T = { "MPEG4_P2_TS_ASP_AAC_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_ISO = { "MPEG4_P2_TS_ASP_AAC_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3 = { "MPEG4_P2_TS_ASP_MPEG1_L3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_T = { "MPEG4_P2_TS_ASP_MPEG1_L3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_ISO = { "MPEG4_P2_TS_ASP_MPEG1_L3_ISO", "video/mpeg"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3 = { "MPEG4_P2_TS_ASP_AC3", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_T = { "MPEG4_P2_TS_ASP_AC3_T", "video/vnd.dlna.mpeg-tts"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_ISO = { "MPEG4_P2_TS_ASP_AC3_ISO", "video/mpeg"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_SP_G726 = { "MPEG4_P2_ASF_SP_G726", "video/x-ms-asf"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_ASP_L5_SO_G726 = { "MPEG4_P2_ASF_ASP_L5_SO_G726", "video/x-ms-asf"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_ASP_L4_SO_G726 = { "MPEG4_P2_ASF_ASP_L4_SO_G726", "video/x-ms-asf"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC = { "MPEG4_H263_MP4_P0_L10_AAC", "video/3gpp"};
-DLNAProfile DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC_LTP = { "MPEG4_H263_MP4_P0_L10_AAC_LTP", "video/3gpp"};
-DLNAProfile DLNA_PROFILE_MPEG4_H263_3GPP_P0_L10_AMR_WBplus = { "MPEG4_H263_3GPP_P0_L10_AMR_WBplus", "video/3gpp"};
-DLNAProfile DLNA_PROFILE_MPEG4_H263_3GPP_P3_L10_AMR = { "MPEG4_H263_3GPP_P3_L10_AMR", "video/3gpp"};
-
-DLNAProfile DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AAC = { "MPEG4_P2_3GPP_SP_L0B_AAC", "video/3gpp"};
-DLNAProfile DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AMR = { "MPEG4_P2_3GPP_SP_L0B_AMR", "video/3gpp"};
-
-DLNAVideoMapping MPEG4_P2_VIDEO_MAP[] = {
- { &DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AAC, DLNA_VCP_3GPP, DLNA_VPP_MPEG4_P2_SP_L0B, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AMR, DLNA_VCP_3GPP, DLNA_VPP_MPEG4_P2_SP_L0B, DLNA_APP_AMR },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L2, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AMR, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L2, DLNA_APP_AMR },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_HEAAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_HEAAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_ATRAC3plus, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_ATRAC3plus },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC_LTP, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AAC_LTP },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AAC, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG2_L2 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG2_L2 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_IS0, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_MPEG2_L2 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AC3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_ASF_SP_G726, DLNA_VCP_ASF, DLNA_VPP_MPEG4_P2_SP_L3, DLNA_APP_G726 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3_VGA, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_HEAAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_SP_L3_VGA, DLNA_APP_HEAAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_HEAAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC_MULT5, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_HEAAC_MULT5 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_ATRAC3plus, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_ATRAC3plus },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_MPEG1_L3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_ASP_L5, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5_SO, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5_SO, DLNA_APP_HEAAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC_MULT5, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5_SO, DLNA_APP_HEAAC_MULT5 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_G726, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L5_SO, DLNA_APP_G726 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L4_SO, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L4_SO, DLNA_APP_HEAAC },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC_MULT5, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L4_SO, DLNA_APP_HEAAC_MULT5 },
- { &DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_G726, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_ASP_L4_SO, DLNA_APP_G726 },
- { &DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_H263_P0_L10, DLNA_APP_AAC },
- { &DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC_LTP, DLNA_VCP_MP4, DLNA_VPP_MPEG4_P2_H263_P0_L10, DLNA_APP_AAC_LTP },
- { &DLNA_PROFILE_MPEG4_H263_3GPP_P3_L10_AMR, DLNA_VCP_3GPP, DLNA_VPP_MPEG4_P2_H263_P3_L10, DLNA_APP_AMR },
- { &DLNA_PROFILE_MPEG4_H263_3GPP_P0_L10_AMR_WBplus, DLNA_VCP_3GPP, DLNA_VPP_MPEG4_P2_H263_P0_L10, DLNA_APP_AMR_WBplus },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_AC3, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_AC3 },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2, DLNA_VCP_MPEG2_TS, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_MPEG2_L2 },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_T, DLNA_VCP_MPEG2_TS_T, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_MPEG2_L2 },
- { &DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_ISO, DLNA_VCP_MPEG2_TS_ISO, DLNA_VPP_MPEG4_P2_CO, DLNA_APP_MPEG2_L2 }
-}; \ No newline at end of file
diff --git a/dlna/profiles/png.cpp b/dlna/profiles/png.cpp
deleted file mode 100644
index 46ccc24..0000000
--- a/dlna/profiles/png.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * File: profiles_png.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:01
- */
-
-#include "profiles/png.h"
-
-DLNAIconProfile DLNA_ICON_PNG_SM_24A = { "image/png", 48, 48, 24 };
-DLNAIconProfile DLNA_ICON_PNG_LRG_24A = { "image/png", 120, 120, 24 };
diff --git a/dlna/profiles/wma.cpp b/dlna/profiles/wma.cpp
deleted file mode 100644
index 3956d4c..0000000
--- a/dlna/profiles/wma.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_wma.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:32
- */
-
-#include "profiles/wma.h" \ No newline at end of file
diff --git a/dlna/profiles/wmv9.cpp b/dlna/profiles/wmv9.cpp
deleted file mode 100644
index 02e8de4..0000000
--- a/dlna/profiles/wmv9.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * File: profiles_wmv9.cpp
- * Author: savop
- *
- * Created on 7. Dezember 2009, 14:53
- */
-
-#include "profiles/wmv9.h" \ No newline at end of file
diff --git a/http/icons/upnpIconLrg.jpeg b/http/icons/upnpIconLrg.jpeg
deleted file mode 100755
index 6421267..0000000
--- a/http/icons/upnpIconLrg.jpeg
+++ /dev/null
Binary files differ
diff --git a/http/icons/upnpIconLrg.png b/http/icons/upnpIconLrg.png
deleted file mode 100755
index d93e7c0..0000000
--- a/http/icons/upnpIconLrg.png
+++ /dev/null
Binary files differ
diff --git a/http/icons/upnpIconSm.jpeg b/http/icons/upnpIconSm.jpeg
deleted file mode 100755
index b163f05..0000000
--- a/http/icons/upnpIconSm.jpeg
+++ /dev/null
Binary files differ
diff --git a/http/icons/upnpIconSm.png b/http/icons/upnpIconSm.png
deleted file mode 100755
index d4320f4..0000000
--- a/http/icons/upnpIconSm.png
+++ /dev/null
Binary files differ
diff --git a/http/xml/cds_scpd.xml b/http/xml/cds_scpd.xml
deleted file mode 100644
index dff4252..0000000
--- a/http/xml/cds_scpd.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version = "1.0" encoding="UTF-8"?>
-<scpd xmlns="urn:schemas-upnp-org:service-1-0">
-<specVersion>
-<major>1</major>
-<minor>0</minor>
-</specVersion>
-<actionList>
-<action>
-<name>GetSearchCapabilities</name>
-<argumentList>
-<argument>
-<name>SearchCaps</name>
-<direction>out</direction>
-<relatedStateVariable>SearchCapabilities</relatedStateVariable>
-</argument>
-</argumentList>
-</action>
-<action>
-<name>GetSortCapabilities</name>
-<argumentList>
-<argument>
-<name>SortCaps</name>
-<direction>out</direction>
-<relatedStateVariable>SortCapabilities</relatedStateVariable>
-</argument>
-</argumentList>
-</action>
-<action>
-<name>GetSystemUpdateID</name>
-<argumentList>
-<argument>
-<name>Id</name>
-<direction>out</direction>
-<relatedStateVariable>SystemUpdateID</relatedStateVariable>
-</argument>
-</argumentList>
-</action>
-<action>
-<name>Browse</name>
-<argumentList>
-<argument>
-<name>ObjectID</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
-</argument>
-<argument>
-<name>BrowseFlag</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_BrowseFlag</relatedStateVariable>
-</argument>
-<argument>
-<name>Filter</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>
-</argument>
-<argument>
-<name>StartingIndex</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>
-</argument>
-<argument>
-<name>RequestedCount</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
-</argument>
-<argument>
-<name>SortCriteria</name>
-<direction>in</direction>
-<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>
-</argument>
-<argument>
-<name>Result</name>
-<direction>out</direction>
-<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
-</argument>
-<argument>
-<name>NumberReturned</name>
-<direction>out</direction>
-<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
-</argument>
-<argument>
-<name>TotalMatches</name>
-<direction>out</direction>
-<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
-</argument>
-<argument>
-<name>UpdateID</name>
-<direction>out</direction>
-<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>
-</argument>
-</argumentList>
-</action>
-</actionList>
-<serviceStateTable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_ObjectID</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_Result</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_BrowseFlag</name>
-<dataType>string</dataType>
-<allowedValueList>
-<allowedValue>BrowseMetadata</allowedValue>
-<allowedValue>BrowseDirectChildren</allowedValue>
-</allowedValueList>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_Filter</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_SortCriteria</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_Index</name>
-<dataType>ui4</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_Count</name>
-<dataType>ui4</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>A_ARG_TYPE_UpdateID</name>
-<dataType>ui4</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>SearchCapabilities</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="no">
-<name>SortCapabilities</name>
-<dataType>string</dataType>
-</stateVariable>
-<stateVariable sendEvents="yes">
-<name>SystemUpdateID</name>
-<dataType>ui4</dataType>
-</stateVariable>
-</serviceStateTable>
-</scpd>
-
diff --git a/http/xml/cms_scpd.xml b/http/xml/cms_scpd.xml
deleted file mode 100644
index e4071f9..0000000
--- a/http/xml/cms_scpd.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scpd xmlns="urn:schemas-upnp-org:service-1-0">
- <specVersion>
- <major>1</major>
- <minor>0</minor>
- </specVersion>
- <actionList>
- <action>
- <name>GetProtocolInfo</name>
- <argumentList>
- <argument>
- <name>Source</name>
- <direction>out</direction>
- <relatedStateVariable>SourceProtocolInfo</relatedStateVariable>
- </argument>
- <argument>
- <name>Sink</name>
- <direction>out</direction>
- <relatedStateVariable>SinkProtocolInfo</relatedStateVariable>
- </argument>
- </argumentList>
- </action>
- <action>
- <name>GetCurrentConnectionIDs</name>
- <argumentList>
- <argument>
- <name>ConnectionIDs</name>
- <direction>out</direction>
- <relatedStateVariable>CurrentConnectionIDs</relatedStateVariable>
- </argument>
- </argumentList>
- </action>
- <action>
- <name>GetCurrentConnectionInfo</name>
- <argumentList>
- <argument>
- <name>ConnectionID</name>
- <direction>in</direction>
- <relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>
- </argument>
- <argument>
- <name>RcsID</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_RcsID</relatedStateVariable>
- </argument>
- <argument>
- <name>AVTransportID</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_AVTransportID</relatedStateVariable>
- </argument>
- <argument>
- <name>ProtocolInfo</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_ProtocolInfo</relatedStateVariable>
- </argument>
- <argument>
- <name>PeerConnectionManager</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_ConnectionManager</relatedStateVariable>
- </argument>
- <argument>
- <name>PeerConnectionID</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>
- </argument>
- <argument>
- <name>Direction</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_Direction</relatedStateVariable>
- </argument>
- <argument>
- <name>Status</name>
- <direction>out</direction>
- <relatedStateVariable>A_ARG_TYPE_ConnectionStatus</relatedStateVariable>
- </argument>
- </argumentList>
- </action>
- </actionList>
- <serviceStateTable>
- <stateVariable sendEvents="yes">
- <name>SourceProtocolInfo</name>
- <dataType>string</dataType>
- </stateVariable>
- <stateVariable sendEvents="yes">
- <name>SinkProtocolInfo</name>
- <dataType>string</dataType>
- </stateVariable>
- <stateVariable sendEvents="yes">
- <name>CurrentConnectionIDs</name>
- <dataType>string</dataType>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_ConnectionStatus</name>
- <dataType>string</dataType>
- <allowedValueList>
- <allowedValue>OK</allowedValue>
- <allowedValue>ContentFormatMismatch</allowedValue>
- <allowedValue>InsufficientBandwidth</allowedValue>
- <allowedValue>UnreliableChannel</allowedValue>
- <allowedValue>Unknown</allowedValue>
- </allowedValueList>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_ConnectionManager</name>
- <dataType>string</dataType>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_Direction</name>
- <dataType>string</dataType>
- <allowedValueList>
- <allowedValue>Input</allowedValue>
- <allowedValue>Output</allowedValue>
- </allowedValueList>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_ProtocolInfo</name>
- <dataType>string</dataType>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_ConnectionID</name>
- <dataType>i4</dataType>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_AVTransportID</name>
- <dataType>i4</dataType>
- </stateVariable>
- <stateVariable sendEvents="no">
- <name>A_ARG_TYPE_RcsID</name>
- <dataType>i4</dataType>
- </stateVariable>
- </serviceStateTable>
-</scpd>
-
diff --git a/inc/avdetector.h b/inc/avdetector.h
deleted file mode 100644
index 923608f..0000000
--- a/inc/avdetector.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * File: avdetector.h
- * Author: savop
- *
- * Created on 26. Oktober 2009, 13:02
- */
-
-#ifndef _AVDETECTOR_H
-#define _AVDETECTOR_H
-
-#include "profiles.h"
-#include <vdr/recording.h>
-#include <vdr/channels.h>
-
-extern "C" {
-#include <libavcodec/avcodec.h>
-#include <libavformat/avformat.h>
-}
-
-/**
- * The audio/video detector
- *
- * This is the audio video detector, which analizes the audio and video stream
- * of a file to gather more information about the resource. This is also
- * required for determination of a suitable DLNA profile.
- */
-class cAudioVideoDetector {
-private:
- void init();
- void uninit();
- int detectChannelProperties();
- int detectFileProperties();
- int detectRecordingProperties();
- /**
- * Detect video properties
- *
- * This detects video properties of a video stream
- *
- * @return returns
- * - \bc 0, if the detection was successful
- * - \bc <0, otherwise
- */
- int analyseVideo(AVFormatContext* FormatCtx);
- /**
- * Detect audio properties
- *
- * This detects audio properties of a video or audio stream
- *
- * @return returns
- * - \bc 0, if the detection was successful
- * - \bc <0, otherwise
- */
- int analyseAudio(AVFormatContext* FormatCtx);
- /**
- * Detect DLNA profile
- *
- * This detects the matching DLNA profile for the video or audio item
- *
- * @return returns
- * - \bc 0, if the detection was successful
- * - \bc <0, otherwise
- */
- int detectDLNAProfile(AVFormatContext* FormatCtx);
- UPNP_RESOURCE_TYPES mResourceType;
- union {
- const cChannel* Channel;
- const cRecording* Recording;
- const char* Filename;
- } mResource;
- int mWidth;
- int mHeight;
- int mBitrate;
- int mBitsPerSample;
- int mColorDepth;
- off64_t mDuration;
- off64_t mSize;
- int mSampleFrequency;
- int mNrAudioChannels;
- DLNAProfile* mDLNAProfile;
-public:
- cAudioVideoDetector(const char* Filename);
- cAudioVideoDetector(const cChannel* Channel);
- cAudioVideoDetector(const cRecording* Recording);
- virtual ~cAudioVideoDetector();
- /**
- * Detect resource properties of the file
- *
- * This detects the resource properties of a file. If the returned value
- * is 0, no erros occured while detection and the properties are properly
- * set. Otherwise, in case of an error, the properties may have
- * unpredictable values.
- *
- * @return returns
- * - \bc 0, if the detection was successful
- * - \bc <0, otherwise
- */
- int detectProperties();
- DLNAProfile* getDLNAProfile() const { return this->mDLNAProfile; }
- const char* getContentType() const { return (this->mDLNAProfile) ? this->mDLNAProfile->mime : NULL; }
- const char* getProtocolInfo() const;
- int getWidth() const { return this->mWidth; }
- int getHeight() const { return this->mHeight; }
- int getBitrate() const { return this->mBitrate; }
- int getBitsPerSample() const { return this->mBitsPerSample; }
- int getSampleFrequency() const { return this->mSampleFrequency; }
- int getNumberOfAudioChannels() const { return this->mNrAudioChannels; }
- int getColorDepth() const { return this->mColorDepth; }
- off64_t getFileSize() const { return this->mSize; }
- off64_t getDuration() const { return this->mDuration; }
-};
-
-class cCodecToolKit {
-public:
- static AVCodecContext* getFirstCodecContext(AVFormatContext* FormatCtx, CodecType Type);
- static AVStream* getFirstStream(AVFormatContext* FormatCtx, CodecType Type);
- static bool matchesAcceptedBitrates(AcceptedBitrates Bitrates, AVCodecContext* Codec);
- static bool matchesAcceptedSystemBitrate(AcceptedBitrates Bitrate, AVFormatContext* Format);
- static bool matchesAcceptedAudioChannels(AcceptedAudioChannels Channels, AVCodecContext* Codec);
- static bool matchesAcceptedSamplingRates(AcceptedSamplingRates SamplingRates, AVCodecContext* Codec);
- static bool matchesAcceptedResolutions(AcceptedResolution *Resolutions, int Count, AVStream* Stream);
-};
-
-#endif /* _AVDETECTOR_H */
-
diff --git a/inc/config.h b/inc/config.h
deleted file mode 100644
index 10f92e7..0000000
--- a/inc/config.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * File: config.h
- * Author: savop
- *
- * Created on 15. August 2009, 13:03
- */
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-
-#include <vdr/tools.h>
-#include "../common.h"
-
-/**
- * The configuration settings
- *
- * This holds the configurations for the server. It holds information about the
- * network settings as well as some status flags.
- */
-class cUPnPConfig {
-private:
- static cUPnPConfig* mInstance;
- cString mParsedArgs;
- cUPnPConfig();
-public:
- static int verbosity; ///< the verbosity of the plugin, the higher the more messages
- ///< are printed.
- char* mInterface; ///< the network interface, which the server is bound to
- char* mAddress; ///< the IP address which is used by the server
- int mPort; ///< the port which the server is listening on
- int mEnable; ///< indicates, if the server is enabled or not
- int mAutoSetup; ///< indicates, if the settings are automatically detected
- char* mDatabaseFolder; ///< the directory where the metadata.db is located
- char* mHTTPFolder; ///< the directory where the HTTP data is located
-public:
- virtual ~cUPnPConfig();
- /**
- * Get the configuration
- *
- * This returns the instance of the current configuration settings.
- *
- * @return the configuration object
- */
- static cUPnPConfig* get();
- /**
- * Parse setup variable
- *
- * This parses the setup variable with the according value. The value is a
- * string representation and must be converted into the according data type.
- *
- * @return returns
- * - \bc true, if parsing was successful
- * - \bc false, otherwise
- * @param Name the name of the variable
- * @param Value the according value of the variable
- */
- bool parseSetup(const char* Name, const char* Value);
- /**
- * Processes the commandline arguments
- *
- * This processes the commandline arguments which the user specified at the
- * start of the plugin.
- *
- * @return returns
- * - \bc true, if processing was successful
- * - \bc false, otherwise
- * @param argc the number of arguments in the list
- * @param argv the arguments as a char array
- */
- bool processArgs(int argc, char* argv[]);
-};
-
-#endif /* _CONFIG_H */
-
diff --git a/inc/database.h b/inc/database.h
deleted file mode 100644
index 5bb595f..0000000
--- a/inc/database.h
+++ /dev/null
@@ -1,1024 +0,0 @@
-/*
- * File: database.h
- * Author: savop
- *
- * Created on 3. September 2009, 22:20
- */
-
-#ifndef _DATABASE_H
-#define _DATABASE_H
-
-#include <sqlite3.h>
-#include <vdr/tools.h>
-#include "../common.h"
-
-#define SQLITE_CASCADE_DELETES
-
-#define PK_OBJECTS TOSTRING(1)
-#define PK_RESOURCES TOSTRING(2)
-#define PK_SEARCHCLASSES TOSTRING(3)
-
-#define SQLITE_FIRST_CUSTOMID TOSTRING(100)
-
-#define SQLITE_COLUMN_NAME_LENGTH 64
-
-#define SQLITE_TABLE_RESOURCES "Resources"
-#define SQLITE_TABLE_OBJECTS "Objects"
-#define SQLITE_TABLE_ITEMS "Items"
-#define SQLITE_TABLE_CONTAINERS "Containers"
-#define SQLITE_TABLE_VIDEOITEMS "VideoItems"
-#define SQLITE_TABLE_AUDIOITEMS "AudioItems"
-#define SQLITE_TABLE_IMAGEITEMS "ImageItems"
-#define SQLITE_TABLE_VIDEOBROADCASTS "VideoBroadcasts"
-#define SQLITE_TABLE_AUDIOBROADCASTS "AudioBroadcasts"
-#define SQLITE_TABLE_MOVIES "Movies"
-#define SQLITE_TABLE_PHOTOS "Photos"
-#define SQLITE_TABLE_ALBUMS "Albums"
-#define SQLITE_TABLE_PLAYLISTS "Playlists"
-#define SQLITE_TABLE_SEARCHCLASS "SearchClass"
-#define SQLITE_TABLE_PRIMARY_KEYS "PrimaryKeys"
-#define SQLITE_TABLE_SYSTEM "System"
-#define SQLITE_TABLE_ITEMFINDER "ItemFinder"
-
-#define SQLITE_TYPE_TEXT "TEXT"
-#define SQLITE_TYPE_INTEGER "INTEGER"
-#define SQLITE_TYPE_BOOL SQLITE_TYPE_INTEGER
-#define SQLITE_TYPE_DATE SQLITE_TYPE_TEXT
-#define SQLITE_TYPE_ULONG SQLITE_TYPE_INTEGER
-#define SQLITE_TYPE_LONG SQLITE_TYPE_INTEGER
-#define SQLITE_TYPE_UINTEGER SQLITE_TYPE_INTEGER
-
-#define SQLITE_TRANSACTION_BEGIN "BEGIN IMMEDIATE TRANSACTION "
-#define SQLITE_TRANSACTION_END "COMMIT TRANSACTION"
-#define SQLITE_TRANSACTION_TYPE "ROLLBACK"
-
-#define SQLITE_CONFLICT_CLAUSE "ON CONFLICT " SQLITE_TRANSACTION_TYPE
-#define SQLITE_PRIMARY_KEY SQLITE_TYPE_INTEGER " PRIMARY KEY"
-#define SQLITE_NOT_NULL "NOT NULL"
-#define SQLITE_UNIQUE "UNIQUE"
-
-#define SQLITE_COL_OBJECTID "ObjectID"
-#define SQLITE_COL_PARENTID "ParentID"
-#define SQLITE_COL_TITLE "Title"
-#define SQLITE_COL_CREATOR "Creator"
-#define SQLITE_COL_CLASS "Class"
-#define SQLITE_COL_RESTRICTED "Restricted"
-#define SQLITE_COL_WRITESTATUS "WriteStatus"
-#define SQLITE_COL_REFERENCEID "RefID"
-#define SQLITE_COL_CLASSDERIVED "IncludeDerived"
-#define SQLITE_COL_SEARCHABLE "Searchable"
-#define SQLITE_COL_CONTAINER_UID "UpdateID"
-#define SQLITE_COL_RESOURCEID "ResourceID"
-#define SQLITE_COL_PROTOCOLINFO "ProtocolInfo"
-#define SQLITE_COL_CONTENTTYPE "ContentType"
-#define SQLITE_COL_RESOURCETYPE "ResourceType"
-#define SQLITE_COL_RESOURCE "Resource"
-#define SQLITE_COL_SIZE "Size"
-#define SQLITE_COL_DURATION "Duration"
-#define SQLITE_COL_BITRATE "Bitrate"
-#define SQLITE_COL_SAMPLEFREQUENCE "SampleFreq"
-#define SQLITE_COL_BITSPERSAMPLE "BitsPerSample"
-#define SQLITE_COL_NOAUDIOCHANNELS "NoAudioChannels"
-#define SQLITE_COL_COLORDEPTH "ColorDepth"
-#define SQLITE_COL_RESOLUTION "Resolution"
-#define SQLITE_COL_GENRE "Genre"
-#define SQLITE_COL_LONGDESCRIPTION "LongDescription"
-#define SQLITE_COL_PRODUCER "Producer"
-#define SQLITE_COL_RATING "Rating"
-#define SQLITE_COL_ACTOR "Actor"
-#define SQLITE_COL_DIRECTOR "Director"
-#define SQLITE_COL_DESCRIPTION "Description"
-#define SQLITE_COL_PUBLISHER "Publisher"
-#define SQLITE_COL_LANGUAGE "Language"
-#define SQLITE_COL_RELATION "Relation"
-#define SQLITE_COL_STORAGEMEDIUM "StorageMedium"
-#define SQLITE_COL_DVDREGIONCODE "DVDRegionCode"
-#define SQLITE_COL_CHANNELNAME "Channelname"
-#define SQLITE_COL_SCHEDULEDSTARTTIME "ScheduledStartTime"
-#define SQLITE_COL_SCHEDULEDENDTIME "ScheduledEndTime"
-#define SQLITE_COL_ICON "Icon"
-#define SQLITE_COL_REGION "Region"
-#define SQLITE_COL_CHANNELNR "ChannelNr"
-#define SQLITE_COL_RIGHTS "Rights"
-#define SQLITE_COL_RADIOCALLSIGN "CallSign"
-#define SQLITE_COL_RADIOSTATIONID "StationID"
-#define SQLITE_COL_RADIOBAND "Band"
-#define SQLITE_COL_CONTRIBUTOR "Contributor"
-#define SQLITE_COL_DATE "Date"
-#define SQLITE_COL_ALBUM "Album"
-#define SQLITE_COL_ARTIST "Artist"
-#define SQLITE_COL_DLNA_CONTAINERTYPE "DLNAContainer"
-#define SQLITE_COL_CHILDCOUNT "ChildCount"
-#define SQLITE_COL_ITEMFINDER "ItemFastID"
-
-#define SQLITE_UPNP_OBJECTID SQLITE_COL_OBJECTID " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL " " SQLITE_CONFLICT_CLAUSE " "\
- SQLITE_UNIQUE " " SQLITE_CONFLICT_CLAUSE
-
-#define SQLITE_INSERT_TRIGGER(TableA,TableB,Class) "CREATE TRIGGER IF NOT EXISTS "\
- TableA "_I_" TableB " "\
- "BEFORE INSERT ON "\
- TableB " "\
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "((SELECT " SQLITE_COL_OBJECTID " FROM " TableA " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID " "\
- ") IS NULL) "\
- "OR "\
- "((SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID " "\
- "AND " SQLITE_COL_CLASS " LIKE '" Class "%%') IS NULL) "\
- ") THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", "\
- "'INSERT on table " TableB " failed due constraint violation "\
- "on foreign key " SQLITE_COL_OBJECTID "'"\
- ") "\
- "END; END;"
-
-#define SQLITE_UPDATE_TRIGGER(TableA,TableB,Class) "CREATE TRIGGER IF NOT EXISTS "\
- TableA "_U_" TableB " "\
- "BEFORE UPDATE ON "\
- TableB " "\
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "((SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID " "\
- "AND " SQLITE_COL_CLASS " LIKE '" Class "%%') IS NULL)"\
- ") THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", "\
- "'UPDATE on table " TableB " failed due constraint violation "\
- "on foreign key " SQLITE_COL_OBJECTID "'"\
- ") "\
- "END; END;"
-
-#define SQLITE_INSERT_REFERENCE_TRIGGER(Table,Column) "CREATE TRIGGER IF NOT EXISTS "\
- Table "_I_" Table " "\
- "BEFORE INSERT ON " \
- Table " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ( "\
- "((SELECT " SQLITE_COL_OBJECTID " FROM " Table " "\
- "WHERE " SQLITE_COL_OBJECTID " = NEW." Column ") IS NULL) "\
- "AND "\
- "(NEW." Column "!=-1)"\
- ")THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", 'INSERT on table " Table " "\
- "violates foreign key \"" Column "\"') "\
- "END; END;"
-
-#define SQLITE_UPDATE_REFERENCE_TRIGGER(Table,Column) "CREATE TRIGGER IF NOT EXISTS "\
- Table "_U_" Table " "\
- "BEFORE INSERT ON " \
- Table " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ( "\
- "((SELECT " SQLITE_COL_OBJECTID " FROM " Table " "\
- "WHERE " SQLITE_COL_OBJECTID " = NEW." Column ") IS NULL) "\
- "AND "\
- "(NEW." Column "!=-1)"\
- ")THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", 'UPDATE on table " Table " "\
- "violates foreign key \"" Column "\"') "\
- "END; END;"
-
-#define SQLITE_DELETE_REFERENCE_TRIGGER(Table,Column) "CREATE TRIGGER IF NOT EXISTS "\
- Table "_D_" Table " " \
- "BEFORE DELETE ON " \
- Table " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " Column " FROM " Table " "\
- "WHERE " Column " = OLD." SQLITE_COL_OBJECTID ") IS NOT NULL"\
- ")THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", 'DELETE on table " Table " "\
- "violates foreign key \"" Column "\"') "\
- "END; END;"
-
-#ifdef SQLITE_CASCADE_DELETES
-#define SQLITE_DELETE_TRIGGER(TableA,TableB) "CREATE TRIGGER IF NOT EXISTS "\
- TableA "_D_" TableB " "\
- "BEFORE DELETE ON "\
- TableA " "\
- "FOR EACH ROW BEGIN "\
- "DELETE FROM " TableB " "\
- "WHERE " SQLITE_COL_OBJECTID "=OLD." SQLITE_COL_OBJECTID "; "\
- "END;"
-
-#define SQLITE_DELETE_PARENT_TRIGGER "CREATE TRIGGER IF NOT EXISTS "\
- SQLITE_TABLE_OBJECTS "_D_" SQLITE_TABLE_OBJECTS " " \
- "BEFORE DELETE ON " \
- SQLITE_TABLE_OBJECTS " " \
- "FOR EACH ROW BEGIN "\
- "DELETE FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_PARENTID "=OLD." SQLITE_COL_OBJECTID "; "\
- "END;"
-#else
-#define SQLITE_DELETE_TRIGGER(TableA,TableB) "CREATE TRIGGER IF NOT EXISTS "\
- TableA "_D_" TableB " "\
- "BEFORE DELETE ON "\
- TableA " "\
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " SQLITE_COL_OBJECTID " FROM " TableB " "\
- "WHERE " SQLITE_COL_OBJECTID "=OLD." SQLITE_COL_OBJECTID ") IS NOT NULL"\
- ") THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ", "\
- "'DELETE on table " TableA " failed due constraint violation "\
- "on foreign key " SQLITE_COL_OBJECTID "'"\
- ") "\
- "END; END;"
-
-#define SQLITE_DELETE_PARENT_TRIGGER SQLITE_DELETE_REFERENCE_TRIGGER(SQLITE_TABLE_OBJECTS, SQLITE_COL_PARENTID)
-#endif
-
-/**********************************************\
-* *
-* Primary keys *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_PRIMARY_KEYS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_PRIMARY_KEYS \
- "("\
- "KeyID " SQLITE_PRIMARY_KEY " " SQLITE_NOT_NULL ","\
- "Key " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL\
- ");"\
- "INSERT OR IGNORE INTO "\
- SQLITE_TABLE_PRIMARY_KEYS \
- "(KeyID, Key) VALUES ("\
- PK_OBJECTS "," SQLITE_FIRST_CUSTOMID\
- ");"\
- "INSERT OR IGNORE INTO "\
- SQLITE_TABLE_PRIMARY_KEYS \
- "(KeyID, Key) VALUES ("\
- PK_RESOURCES ",0"\
- ");"\
- "INSERT OR IGNORE INTO "\
- SQLITE_TABLE_PRIMARY_KEYS \
- "(KeyID, Key) VALUES ("\
- PK_SEARCHCLASSES ",0"\
- ");"
-
-#define SQLITE_TRIGGER_UPDATE_OBJECTID "CREATE TRIGGER IF NOT EXISTS "\
- SQLITE_TABLE_OBJECTS "_PK_UPDATE "\
- "AFTER INSERT ON "\
- SQLITE_TABLE_OBJECTS " "\
- "BEGIN "\
- "UPDATE " SQLITE_TABLE_PRIMARY_KEYS " SET Key=Key+1 WHERE KeyID=" PK_OBJECTS "; "\
- "END;"
-
-/**********************************************\
-* *
-* System settings *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_SYSTEM "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_SYSTEM " "\
- "("\
- "Key " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL " " SQLITE_UNIQUE ","\
- "Value " SQLITE_TYPE_TEXT " "\
- ");"
-
-#define SQLITE_TRIGGER_UPDATE_SYSTEM "CREATE TRIGGER IF NOT EXISTS "\
- SQLITE_TABLE_SYSTEM "_VALUE_UPDATE "\
- "BEFORE UPDATE "\
- "ON " SQLITE_TABLE_SYSTEM " "\
- "WHEN ((SELECT Key FROM " SQLITE_TABLE_SYSTEM " WHERE Key=NEW.Key) IS NULL) "\
- "BEGIN INSERT INTO " SQLITE_TABLE_SYSTEM " (Key) VALUES (NEW.Key); END;"
-
-/**********************************************\
-* *
-* Fast item finder *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_ITEMFINDER "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_ITEMFINDER " "\
- "("\
- SQLITE_UPNP_OBJECTID ","\
- SQLITE_COL_ITEMFINDER " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL " " SQLITE_UNIQUE \
- ");"
-
-#define SQLITE_TRIGGER_D_OBJECTS_ITEMFINDER SQLITE_DELETE_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_ITEMFINDER)
-
-/**********************************************\
-* *
-* Objects *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_OBJECTS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_OBJECTS \
- "(" \
- SQLITE_COL_OBJECTID " " SQLITE_PRIMARY_KEY " " SQLITE_NOT_NULL " " SQLITE_CONFLICT_CLAUSE "," \
- SQLITE_COL_PARENTID " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL " " SQLITE_CONFLICT_CLAUSE "," \
- SQLITE_COL_TITLE " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL "," \
- SQLITE_COL_CREATOR " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_CLASS " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL "," \
- SQLITE_COL_RESTRICTED " " SQLITE_TYPE_BOOL " " SQLITE_NOT_NULL "," \
- SQLITE_COL_WRITESTATUS " " SQLITE_TYPE_INTEGER \
- ");"
-
-// Trigger for foreign key ParentID
-
-#define SQLITE_TRIGGER_D_OBJECTS_OBJECTS SQLITE_DELETE_PARENT_TRIGGER
-
-#define SQLITE_TRIGGER_I_OBJECTS_OBJECTS SQLITE_INSERT_REFERENCE_TRIGGER(SQLITE_TABLE_OBJECTS, SQLITE_COL_PARENTID)\
- "CREATE TRIGGER IF NOT EXISTS "\
- SQLITE_TABLE_OBJECTS "_PI_" SQLITE_TABLE_OBJECTS " "\
- "BEFORE INSERT ON "\
- SQLITE_TABLE_OBJECTS " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "((SELECT " SQLITE_COL_PARENTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_PARENTID "=-1) IS NOT NULL) "\
- "AND "\
- "(NEW." SQLITE_COL_PARENTID "=-1)"\
- ") THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ","\
- "'INSERT on table " SQLITE_TABLE_OBJECTS " violates constraint. "\
- SQLITE_COL_PARENTID " must uniquely be -1') "\
- "END; END;"
-
-#define SQLITE_TRIGGER_U_OBJECTS_OBJECTS SQLITE_UPDATE_REFERENCE_TRIGGER(SQLITE_TABLE_OBJECTS, SQLITE_COL_PARENTID)\
- "CREATE TRIGGER IF NOT EXISTS "\
- SQLITE_TABLE_OBJECTS "_PU_" SQLITE_TABLE_OBJECTS " "\
- "BEFORE UPDATE ON "\
- SQLITE_TABLE_OBJECTS " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "((SELECT " SQLITE_COL_PARENTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_PARENTID "=-1 "\
- "AND " SQLITE_COL_OBJECTID "!=NEW." SQLITE_COL_OBJECTID " ) IS NOT NULL) "\
- "AND "\
- "(NEW." SQLITE_COL_PARENTID "=-1) AND (OLD." SQLITE_COL_PARENTID "!=-1) "\
- ") THEN "\
- "RAISE(" SQLITE_TRANSACTION_TYPE ","\
- "'UPDATE on table " SQLITE_TABLE_OBJECTS " violates constraint. "\
- SQLITE_COL_PARENTID " must uniquely be -1') "\
- "END; END;"
-
-/**********************************************\
-* *
-* Items *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_ITEMS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_ITEMS \
- "(" \
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_REFERENCEID " " SQLITE_TYPE_INTEGER " DEFAULT -1" \
- ");"
-
-// Trigger for foreign key ObjectID
-
-#define SQLITE_TRIGGER_D_OBJECT_ITEMS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_ITEMS)
-
-#define SQLITE_TRIGGER_I_OBJECT_ITEMS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_ITEMS,\
- UPNP_CLASS_ITEM)
-
-#define SQLITE_TRIGGER_U_OBJECT_ITEMS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_ITEMS,\
- UPNP_CLASS_ITEM)
-
-// Trigger for Reference items
-
-#define SQLITE_TRIGGER_I_ITEMS_ITEMS SQLITE_INSERT_REFERENCE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_COL_REFERENCEID)
-
-#define SQLITE_TRIGGER_U_ITEMS_ITEMS SQLITE_UPDATE_REFERENCE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_COL_REFERENCEID)
-
-#define SQLITE_TRIGGER_D_ITEMS_ITEMS SQLITE_DELETE_REFERENCE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_COL_REFERENCEID)
-
-/**********************************************\
-* *
-* Containers *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_CONTAINER "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_CONTAINERS \
- "(" \
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_SEARCHABLE " " SQLITE_TYPE_INTEGER ","\
- SQLITE_COL_CONTAINER_UID " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL ","\
- SQLITE_COL_DLNA_CONTAINERTYPE " " SQLITE_TYPE_TEXT \
- ");"
-
-#define SQLITE_TRIGGER_D_OBJECT_CONTAINERS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_CONTAINERS)
-
-#define SQLITE_TRIGGER_I_OBJECT_CONTAINERS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_CONTAINERS,\
- UPNP_CLASS_CONTAINER)
-
-#define SQLITE_TRIGGER_U_OBJECT_CONTAINERS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_OBJECTS,\
- SQLITE_TABLE_CONTAINERS,\
- UPNP_CLASS_CONTAINER)
-
-/**********************************************\
-* *
-* Video items *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_VIDEOITEMS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_VIDEOITEMS \
- "(" \
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_GENRE " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_LONGDESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_PRODUCER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_RATING " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_ACTOR " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DIRECTOR " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_PUBLISHER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_LANGUAGE " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_RELATION " " SQLITE_TYPE_TEXT \
- ");"
-
-#define SQLITE_TRIGGER_D_ITEMS_VIDEOITEMS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_TABLE_VIDEOITEMS)
-
-#define SQLITE_TRIGGER_U_ITEMS_VIDEOITEMS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_VIDEOITEMS, \
- UPNP_CLASS_VIDEO)
-
-#define SQLITE_TRIGGER_I_ITEMS_VIDEOITEMS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_VIDEOITEMS, \
- UPNP_CLASS_VIDEO)
-
-/**********************************************\
-* *
-* Audio items *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_AUDIOITEMS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_AUDIOITEMS \
- "(" \
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_GENRE " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_LONGDESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_PUBLISHER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_RELATION " " SQLITE_TYPE_TEXT \
- ");"
-
-#define SQLITE_TRIGGER_D_ITEMS_AUDIOITEMS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_TABLE_AUDIOITEMS)
-
-#define SQLITE_TRIGGER_U_ITEMS_AUDIOITEMS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_AUDIOITEMS, \
- UPNP_CLASS_AUDIO)
-
-#define SQLITE_TRIGGER_I_ITEMS_AUDIOITEMS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_AUDIOITEMS, \
- UPNP_CLASS_AUDIO)
-
-/**********************************************\
-* *
-* Image items *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_IMAGEITEMS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_IMAGEITEMS \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_LONGDESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_PUBLISHER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_STORAGEMEDIUM " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RATING " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_DATE " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RIGHTS " " SQLITE_TYPE_TEXT\
- ");"
-
-#define SQLITE_TRIGGER_D_ITEMS_IMAGEITEMS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_ITEMS, SQLITE_TABLE_IMAGEITEMS)
-
-#define SQLITE_TRIGGER_U_ITEMS_IMAGEITEMS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_IMAGEITEMS, \
- UPNP_CLASS_IMAGE)
-
-#define SQLITE_TRIGGER_I_ITEMS_IMAGEITEMS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_ITEMS, \
- SQLITE_TABLE_IMAGEITEMS, \
- UPNP_CLASS_IMAGE)
-
-/**********************************************\
-* *
-* Video broadcasts *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_VIDEOBROADCASTS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_VIDEOBROADCASTS \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_ICON " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_REGION " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_CHANNELNR " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_CHANNELNAME " " SQLITE_TYPE_TEXT " " SQLITE_UNIQUE \
- ");"
-
-#define SQLITE_TRIGGER_D_VIDEOITEMS_VIDEOBROADCASTS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_VIDEOITEMS, SQLITE_TABLE_VIDEOBROADCASTS)
-
-#define SQLITE_TRIGGER_U_VIDEOITEMS_VIDEOBROADCASTS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_VIDEOITEMS,\
- SQLITE_TABLE_VIDEOBROADCASTS,\
- UPNP_CLASS_VIDEOBC)
-
-#define SQLITE_TRIGGER_I_VIDEOITEMS_VIDEOBROADCASTS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_VIDEOITEMS,\
- SQLITE_TABLE_VIDEOBROADCASTS,\
- UPNP_CLASS_VIDEOBC)
-
-/**********************************************\
-* *
-* Audio broadcasts *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_AUDIOBROADCASTS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_AUDIOBROADCASTS \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_REGION " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RADIOCALLSIGN " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RADIOSTATIONID " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RADIOBAND " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_CHANNELNR " " SQLITE_TYPE_INTEGER \
- ");"
-
-#define SQLITE_TRIGGER_D_AUDIOITEMS_AUDIOBROADCASTS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_AUDIOITEMS, SQLITE_TABLE_AUDIOBROADCASTS)
-
-#define SQLITE_TRIGGER_I_AUDIOITEMS_AUDIOBROADCASTS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_AUDIOITEMS,\
- SQLITE_TABLE_AUDIOBROADCASTS,\
- UPNP_CLASS_AUDIOBC)
-
-#define SQLITE_TRIGGER_U_AUDIOITEMS_AUDIOBROADCASTS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_AUDIOITEMS,\
- SQLITE_TABLE_AUDIOBROADCASTS,\
- UPNP_CLASS_AUDIOBC)
-
-/**********************************************\
-* *
-* Movies *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_MOVIES "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_MOVIES \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_STORAGEMEDIUM " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DVDREGIONCODE " " SQLITE_TYPE_INTEGER "," \
- SQLITE_COL_CHANNELNAME " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_SCHEDULEDSTARTTIME " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_SCHEDULEDENDTIME " " SQLITE_TYPE_TEXT\
- ");"
-
-#define SQLITE_TRIGGER_D_VIDEOITEMS_MOVIES SQLITE_DELETE_TRIGGER(SQLITE_TABLE_VIDEOITEMS, SQLITE_TABLE_MOVIES)
-
-
-#define SQLITE_TRIGGER_I_VIDEOITEMS_MOVIES SQLITE_INSERT_TRIGGER(SQLITE_TABLE_VIDEOITEMS,\
- SQLITE_TABLE_MOVIES,\
- UPNP_CLASS_MOVIE)
-
-#define SQLITE_TRIGGER_U_VIDEOITEMS_MOVIES SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_VIDEOITEMS,\
- SQLITE_TABLE_MOVIES,\
- UPNP_CLASS_MOVIE)
-
-/**********************************************\
-* *
-* Photos *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_PHOTOS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_PHOTOS \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_ALBUM " " SQLITE_TYPE_TEXT\
- ");"
-
-#define SQLITE_TRIGGER_D_IMAGEITEMS_PHOTOS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_IMAGEITEMS, SQLITE_TABLE_PHOTOS)
-
-#define SQLITE_TRIGGER_I_IMAGEITEMS_PHOTOS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_IMAGEITEMS,\
- SQLITE_TABLE_PHOTOS,\
- UPNP_CLASS_PHOTO)
-
-#define SQLITE_TRIGGER_U_IMAGEITEMS_PHOTOS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_IMAGEITEMS,\
- SQLITE_TABLE_PHOTOS,\
- UPNP_CLASS_PHOTO)
-
-/**********************************************\
-* *
-* Albums *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_ALBUMS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_ALBUMS \
- "("\
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_STORAGEMEDIUM " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_LONGDESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_PUBLISHER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_CONTRIBUTOR " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_DATE " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_RELATION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_RIGHTS " " SQLITE_TYPE_TEXT \
- ");"
-
-#define SQLITE_TRIGGER_D_CONTAINERS_ALBUMS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_CONTAINERS, SQLITE_TABLE_ALBUMS)
-
-#define SQLITE_TRIGGER_U_CONTAINERS_ALBUMS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_CONTAINERS,\
- SQLITE_TABLE_ALBUMS,\
- UPNP_CLASS_ALBUM)
-
-#define SQLITE_TRIGGER_I_CONTAINERS_ALBUMS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_CONTAINERS,\
- SQLITE_TABLE_ALBUMS,\
- UPNP_CLASS_ALBUM)
-
-/**********************************************\
-* *
-* Playlists *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_PLAYLISTS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_PLAYLISTS \
- "(" \
- SQLITE_UPNP_OBJECTID "," \
- SQLITE_COL_ARTIST " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_GENRE " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_LONGDESCRIPTION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DESCRIPTION " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_PRODUCER " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_STORAGEMEDIUM " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_CONTRIBUTOR " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_DATE " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_LANGUAGE " " SQLITE_TYPE_TEXT ","\
- SQLITE_COL_RIGHTS " " SQLITE_TYPE_TEXT\
- ");"
-
-#define SQLITE_TRIGGER_D_CONTAINERS_PLAYLISTS SQLITE_DELETE_TRIGGER(SQLITE_TABLE_CONTAINERS, SQLITE_TABLE_PLAYLISTS)
-
-#define SQLITE_TRIGGER_I_CONTAINERS_PLAYLISTS SQLITE_INSERT_TRIGGER(SQLITE_TABLE_CONTAINERS,\
- SQLITE_TABLE_PLAYLISTS,\
- UPNP_CLASS_PLAYLISTCONT)
-
-#define SQLITE_TRIGGER_U_CONTAINERS_PLAYLISTS SQLITE_UPDATE_TRIGGER(SQLITE_TABLE_CONTAINERS,\
- SQLITE_TABLE_PLAYLISTS,\
- UPNP_CLASS_PLAYLISTCONT)
-
-/**********************************************\
-* *
-* Search classes *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_SEARCHCLASS "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_SEARCHCLASS \
- "(" \
- SQLITE_COL_OBJECTID " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL "," \
- SQLITE_COL_CLASS " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_CLASSDERIVED " " SQLITE_TYPE_BOOL \
- ");"
-
-#define SQLITE_TRIGGER_D_CONTAINERS_SEARCHCLASSES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_CONTAINERS "_D_" SQLITE_TABLE_SEARCHCLASS " " \
- "BEFORE DELETE ON " \
- SQLITE_TABLE_CONTAINERS " " \
- "FOR EACH ROW BEGIN "\
- "DELETE FROM " SQLITE_TABLE_SEARCHCLASS " "\
- "WHERE " SQLITE_COL_OBJECTID "= OLD." SQLITE_COL_OBJECTID "; " \
- "END;"
-
-#define SQLITE_TRIGGER_U_CONTAINERS_SEARCHCLASSES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_CONTAINERS "_U_" SQLITE_TABLE_SEARCHCLASS " " \
- "BEFORE UPDATE ON " \
- SQLITE_TABLE_SEARCHCLASS " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_CONTAINERS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID ") IS NULL "\
- ") THEN "\
- "RAISE (" SQLITE_TRANSACTION_TYPE ", 'UPDATE on table " SQLITE_TABLE_SEARCHCLASS " "\
- "violates foreign key constraint \"" SQLITE_COL_OBJECTID "\"') " \
- "END; END;"
-
-#define SQLITE_TRIGGER_I_CONTAINERS_SEARCHCLASSES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_CONTAINERS "_I_" SQLITE_TABLE_SEARCHCLASS " " \
- "BEFORE INSERT ON " \
- SQLITE_TABLE_SEARCHCLASS " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_CONTAINERS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID ") IS NULL "\
- ") THEN "\
- "RAISE (" SQLITE_TRANSACTION_TYPE ", 'INSERT on table " SQLITE_TABLE_SEARCHCLASS " "\
- "violates foreign key constraint \"" SQLITE_COL_OBJECTID "\"') " \
- "END; END;"
-
-/**********************************************\
-* *
-* Resources *
-* *
-\**********************************************/
-
-#define SQLITE_CREATE_TABLE_RESOURCES "CREATE TABLE IF NOT EXISTS "\
- SQLITE_TABLE_RESOURCES \
- "(" \
- SQLITE_COL_RESOURCEID " " SQLITE_PRIMARY_KEY " " SQLITE_NOT_NULL "," \
- SQLITE_COL_OBJECTID " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL "," \
- SQLITE_COL_PROTOCOLINFO " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL "," \
- SQLITE_COL_CONTENTTYPE " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL "," \
- SQLITE_COL_RESOURCETYPE " " SQLITE_TYPE_INTEGER " " SQLITE_NOT_NULL "," \
- SQLITE_COL_RESOURCE " " SQLITE_TYPE_TEXT " " SQLITE_NOT_NULL "," \
- SQLITE_COL_SIZE " " SQLITE_TYPE_ULONG "," \
- SQLITE_COL_DURATION " " SQLITE_TYPE_TEXT "," \
- SQLITE_COL_BITRATE " " SQLITE_TYPE_UINTEGER "," \
- SQLITE_COL_SAMPLEFREQUENCE " " SQLITE_TYPE_UINTEGER "," \
- SQLITE_COL_BITSPERSAMPLE " " SQLITE_TYPE_UINTEGER "," \
- SQLITE_COL_NOAUDIOCHANNELS " " SQLITE_TYPE_UINTEGER "," \
- SQLITE_COL_COLORDEPTH " " SQLITE_TYPE_UINTEGER "," \
- SQLITE_COL_RESOLUTION " " SQLITE_TYPE_TEXT \
- ");"
-
-#define SQLITE_TRIGGER_D_OBJECT_RESOURCES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_OBJECTS "_D_" SQLITE_TABLE_RESOURCES " " \
- "BEFORE DELETE ON " \
- SQLITE_TABLE_OBJECTS " " \
- "FOR EACH ROW BEGIN "\
- "DELETE FROM " SQLITE_TABLE_RESOURCES " "\
- "WHERE " SQLITE_COL_OBJECTID "= OLD." SQLITE_COL_OBJECTID "; " \
- "END;"
-
-#define SQLITE_TRIGGER_I_OBJECT_RESOURCES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_OBJECTS "_I_" SQLITE_TABLE_RESOURCES " " \
- "BEFORE INSERT ON " \
- SQLITE_TABLE_RESOURCES " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID ") IS NULL"\
- ") THEN "\
- "RAISE (" SQLITE_TRANSACTION_TYPE ", 'INSERT on table " SQLITE_TABLE_RESOURCES " "\
- "violates foreign key constraint \"" SQLITE_COL_OBJECTID "\"') " \
- "END; END;"
-
-#define SQLITE_TRIGGER_U_OBJECT_RESOURCES "CREATE TRIGGER IF NOT EXISTS " \
- SQLITE_TABLE_OBJECTS "_U_" SQLITE_TABLE_RESOURCES " " \
- "BEFORE UPDATE ON " \
- SQLITE_TABLE_RESOURCES " " \
- "FOR EACH ROW BEGIN "\
- "SELECT CASE "\
- "WHEN ("\
- "(SELECT " SQLITE_COL_OBJECTID " FROM " SQLITE_TABLE_OBJECTS " "\
- "WHERE " SQLITE_COL_OBJECTID "=NEW." SQLITE_COL_OBJECTID ") IS NULL"\
- ") THEN "\
- "RAISE (" SQLITE_TRANSACTION_TYPE ", 'INSERT on table " SQLITE_TABLE_RESOURCES " "\
- "violates foreign key constraint \"" SQLITE_COL_OBJECTID "\"') " \
- "END; END;"
-
-class cSQLiteDatabase;
-
-/**
- * Result row of a SQL SELECT request
- *
- * This is a single row of a {\c SQL SELECT} request.
- *
- * @see cRows
- */
-class cRow : public cListObject {
- friend class cSQLiteDatabase;
-private:
- int currentCol;
- int ColCount;
- char** Columns;
- char** Values;
- cRow();
-public:
- virtual ~cRow();
- /**
- * Number of columns in this row
- *
- * @return the number of rows
- */
- int Count(){ return this->ColCount; }
- /**
- * Fetches a Column
- *
- * This will fetch a column of this row and stores the name of the column
- * in the first parameter and the value in the second parameter.
- *
- * @return returns
- * - \bc true, if more columns to come
- * - \bc false, if the column is its last in this row.
- */
- bool fetchColumn(
- cString* Column, /**< The name of the current column */
- cString* Value /**< The value of the current value */
- );
-
- /**
- * Fetches a Column
- *
- * This will fetch a column of this row and stores the name of the column
- * in the first parameter and the value in the second parameter.
- *
- * @return returns
- * - \bc true, if more columns to come
- * - \bc false, if the column is its last in this row.
- */
- bool fetchColumn(
- char** Column, /**< The name of the current column */
- char** Value /**< The value of the current column */
- );
-};
-
-/**
- * Result rows of a SQL SELECT request
- *
- * Contains the rows of a SQL SELECT request
- *
- * @see cRow
- */
-class cRows : public cList<cRow> {
- friend class cSQLiteDatabase;
-private:
- cRow* mLastRow;
- cRows();
-public:
- virtual ~cRows();
- /**
- * Fetches a row from the result
- *
- * This fetches the next row in the resultset by storing the contents of
- * that row in the first parameter.
- *
- * @return returns
- * - \bc true, if more rows to come
- * - \bc false, if the row is its last in this resultset.
- */
- bool fetchRow(
- cRow** Row /**< The Pointer of the row */
- );
-};
-
-/**
- * SQLite Database
- *
- * This is a wrapper class for a SQLite3 database connection
- * It supports simple execution functions.
- *
- * On requests with returns any results a instance of \c cRows* will be created.
- */
-class cSQLiteDatabase {
- friend class cStatement;
-private:
- bool mAutoCommit;
- bool mActiveTransaction;
- cRow* mLastRow;
- cRows* mRows;
- sqlite3* mDatabase;
- static cSQLiteDatabase* mInstance;
- cSQLiteDatabase();
- int initialize();
- int initializeTables();
- int initializeTriggers();
- static int getResultRow(void* DB, int NumCols, char** Values, char** ColNames);
- int exec(const char* Statement);
-public:
- /**
- * Prints a SQLite escaped text
- *
- * Returns a formated text with special characters to escape SQLite special
- * characters like "'". Additionally to the well known characters of \a printf
- * the following are allowed:
- *
- * - \bc q, like s, escapes single quotes in strings
- * - \bc Q, like q, surrounds the escaped string with additional
- * single quotes
- * - \bc z, frees the string after reading and coping it
- *
- * @see sprintf()
- * @return the formated string
- */
- static const char* sprintf(
- const char* Format, /**< The format string */
- ... /**< optional properties which will be passed to sprintf */
- );
- virtual ~cSQLiteDatabase();
- /**
- * Returns the instance of the database
- *
- * Returns the instance of the SQLite database. This will create a single
- * instance of none is existing on the very first call. A subsequent call
- * will return the same instance.
- *
- * @return the database instance
- */
- static cSQLiteDatabase* getInstance();
- /**
- * Row count of the last result
- *
- * Returns the row count of the last {\c SQL SELECT} request.
- *
- * @see cRows
- * @return the result row count
- */
- int getResultCount() const { return this->mRows->Count(); }
- /**
- * The last \c INSERT RowID
- *
- * Returns the primary key of the last inserted row.
- * This will only work if there are no successive calls to the database.
- *
- * @return the last insert RowID
- */
- long getLastInsertRowID() const;
- /**
- * Result set of the last request
- *
- * Returns the result rows of the SQL SELECT request.
- * This might be NULL, if the last statement was not a SELECT.
- *
- * @see cRows
- * @return the result rows of the last \c SELECT statement.
- */
- cRows* getResultRows() const { return this->mRows; }
- /**
- * Executes a SQL statement
- *
- * This will execute the statement in the first parameter. If it is followed
- * by any optional parameters it will be formated using the same function as
- * in \c cSQLiteDatabase::sprintf().
- *
- * \sa cSQLiteDatabase::sprintf().
- *
- * @return returns an integer representing
- * - \bc -1, in case of an error
- * - \bc 0, when the statement was executed successfuly
- */
- int execStatement(
- const char* Statement , /**< Statement to be executed */
- ... /**< optional parameters passed to the format string */
- );
- /**
- * Starts a transaction
- *
- * This starts a new transaction and commits or rolls back a previous.
- *
- * @see cSQLiteDatabase::setAutoCommit
- * @see cSQLiteDatabase::commitTransaction
- */
- void startTransaction();
- /**
- * Commits a transaction
- *
- * This function commits the transaction and writes all changes to the
- * database
- *
- * @see cSQLiteDatabase::startTransaction
- */
- void commitTransaction();
- /**
- * Performs a rollback on a transaction
- *
- * This function performs a rollback. No changes will be made to the
- * database
- *
- * @see cSQLiteDatabase::rollbackTransaction
- */
- void rollbackTransaction();
- /**
- * Set the commit behavior
- *
- * This function sets the auto commit behavior on new transactions with
- * \sa cSQLiteDatabase::startTransaction.
- *
- * - \bc true, commits the last transaction before starting a
- * new one
- * - \bc false, performs a rollback on the old transaction
- *
- */
- void setAutoCommit(
- bool Commit=true /**< Switches the behavior of auto commit */
- ){ this->mAutoCommit = Commit; }
-};
-
-#endif /* _DATABASE_H */ \ No newline at end of file
diff --git a/inc/filehandle.h b/inc/filehandle.h
deleted file mode 100644
index 1dc57bf..0000000
--- a/inc/filehandle.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * File: filehandle.h
- * Author: savop
- *
- * Created on 15. Oktober 2009, 10:49
- */
-
-#ifndef _FILEHANDLE_H
-#define _FILEHANDLE_H
-
-#include <upnp/upnp.h>
-#include "../common.h"
-
-/**
- * Interface for File Handles
- *
- * This class is a pure virtual class to act as an interface for file handles
- * used by the webserver.
- */
-class cFileHandle {
-public:
- /**
- * Opens the file
- *
- * Opens the file at the given mode. These can be:
- * - \b UPNP_READ, to read from the file
- * - \b UPNP_WRITE, to write to the file
- *
- * @param mode The file mode, i.e. one of the following
- * - \b UPNP_READ
- * - \b UPNP_WRITE
- */
- virtual void open(
- UpnpOpenFileMode mode ///< The file mode, i.e. one of the following
- ///< - \b UPNP_READ
- ///< - \b UPNP_WRITE
- ) = 0;
- /**
- * Reads from the file
- *
- * Reads from the file a certain amount of bytes and stores them in a buffer
- *
- * @return returns
- * - \b <0, in case of an error
- * - \b 0, when reading was successful
- *
- * @param buf The char buffer
- * @param buflen The size of the buffer
- */
- virtual int read(
- char* buf, ///< The char buffer
- size_t buflen ///< The size of the buffer
- ) = 0;
- /**
- * Writes to the file
- *
- * Writes to the file a certain amount of bytes which are stored in a buffer
- *
- * @return returns
- * - \b <0, in case of an error
- * - \b 0, when reading was successful
- *
- * @param buf The char buffer
- * @param buflen The size of the buffer
- */
- virtual int write(
- char* buf, ///< The char buffer
- size_t buflen ///< The size of the buffer
- ) = 0;
- /**
- * Seeks in the file
- *
- * Seeks in the file where the offset is the relativ position depending on
- * the second parameter. This means, in case of
- *
- * - \b SEEK_SET, the offset is relative to the beginning of the file
- * - \b SEEK_CUR, it is relative to the current position or
- * - \b SEEK_END, relative to the end of the file.
- *
- * @return returns
- * - \b <0, in case of an error
- * - \b 0, when reading was successful
- *
- * @param offset The byte offset in the file
- * @param whence one of the following
- * - \b SEEK_SET,
- * - \b SEEK_CUR,
- * - \b SEEK_END
- */
- virtual int seek(
- off_t offset, ///< The byte offset in the file
- int whence ///< one of the following
- ///< - \b SEEK_SET,
- ///< - \b SEEK_CUR,
- ///< - \b SEEK_END
- ) = 0;
- /**
- * Closes the open file
- *
- * This will close open file handles and frees the memory obtained by it.
- */
- virtual void close() = 0;
- virtual ~cFileHandle(){};
-private:
-};
-
-#endif /* _FILEHANDLE_H */
-
diff --git a/inc/livereceiver.h b/inc/livereceiver.h
deleted file mode 100644
index 379f453..0000000
--- a/inc/livereceiver.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * File: livereceiver.h
- * Author: savop
- *
- * Created on 4. Juni 2009, 13:28
- */
-
-#ifndef _LIVERECEIVER_H
-#define _LIVERECEIVER_H
-
-#include "../common.h"
-#include "filehandle.h"
-#include <vdr/thread.h>
-#include <vdr/receiver.h>
-#include <vdr/ringbuffer.h>
-
-#define RECEIVER_WAIT_ON_NODATA 50 // 50 ms
-#define RECEIVER_WAIT_ON_NODATA_TIMEOUT 1000 * 2 // 2s
-#define RECEIVER_MIN_BUFFER_FILLAGE 20 // 20%
-
-/**
- * A receiver for live TV
- *
- * This is a receiver object which is attached to a VDR tv card device.
- * It is receiving transport stream packages and generates a single MPEG2
- * transport stream which can be distributed through the network.
- *
- */
-class cLiveReceiver : public cReceiver, public cThread, public cFileHandle {
-public:
- /**
- * Creates a new receiver instance
- *
- * This will create a new instance of a live receiver for the specified
- * channel at the specified priority level.
- *
- * A negativ priority means that the receiver may being detached from a
- * device.
- *
- * The receiver must be free'd with delete after it is not used anylonger.
- *
- * @return returns a new liveReceiver instance
- */
- static cLiveReceiver* newInstance(
- cChannel *Channel, ///< the channel which shall be tuned
- int Priority ///< the priority level
- );
- virtual ~cLiveReceiver(void);
- /*! @copydoc cFileHandle::open(UpnpOpenFileMode) */
- virtual void open(UpnpOpenFileMode mode);
- /*! @copydoc cFileHandle::read(char*,size_t) */
- virtual int read(char* buf, size_t buflen);
- /*! @copydoc cFileHandle::write(char*,size_t) */
- virtual int write(char* buf, size_t buflen);
- /*! @copydoc cFileHandle::seek(off_t,int) */
- virtual int seek(off_t offset, int whence);
- /*! @copydoc cFileHandle::close() */
- virtual void close();
-protected:
- /**
- * Receives data from VDR
- *
- * This is the interface for receiving packet data from the VDR. It buffers
- * the incoming transport stream packets in a linear ringbuffer and returns
- * immediatelly
- */
- virtual void Receive(
- uchar *Data, ///< The data received from VDR
- int Length ///< The length of the data packet, usually 188 bytes
- );
- /**
- * Activates the receiver
- *
- * This activates the receiver which initializes internal data structures to
- * be prepared for receiving data from the VDR
- *
- * If the parameter is \bc true, the receiver will be activated. If it is
- * \bc false, the receiver will be deactivated and stops its threads.
- */
- virtual void Activate(
- bool On ///< Activates the receiver thread
- );
- /**
- * The receiver thread action
- *
- * This actually is the receiver thread, which runs consequitivelly and
- * buffers any received video data from the interal incoming buffer to the
- * internal outgoing buffer.
- *
- * While doing so, it tries to syncronize with the stream and creates new
- * MPEG2-TS PATs and PMTs for a single MPEG2-TS stream
- */
- virtual void Action(void);
-private:
- cLiveReceiver(cChannel *Channel, cDevice *Device);
- cDevice *mDevice;
- cChannel *mChannel;
- cRingBufferLinear *mLiveBuffer;
- cRingBufferLinear *mOutputBuffer;
- cFrameDetector *mFrameDetector;
- cPatPmtGenerator mPatPmtGenerator;
-};
-
-#endif /* _LIVERECEIVER_H */
-
diff --git a/inc/menusetup.h b/inc/menusetup.h
deleted file mode 100644
index 1db0480..0000000
--- a/inc/menusetup.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * File: menusetup.h
- * Author: savop
- *
- * Created on 19. April 2009, 16:50
- */
-
-#ifndef _CMENUSETUPUPNP_H
-#define _CMENUSETUPUPNP_H
-
-#include <vdr/plugin.h>
-#include "server.h"
-#include "config.h"
-
-/**
- * The VDR setup page
- *
- * This class shows and manages the settings within the VDR setup OSD
- *
- */
-class cMenuSetupUPnP : public cMenuSetupPage {
-public:
- cMenuSetupUPnP();
-// virtual ~cMenuSetupUPnP();
- /**
- * Processes a keystroke
- *
- * This processes a keystroke which is done by the user and updates the
- * menu accordingly
- *
- * It returns the current state of the VDR after pressing a key
- *
- * @return The current state of the VDR
- */
- virtual eOSState ProcessKey(
- eKeys Key ///< Key, pressed by the user
- );
-protected:
- /**
- * Stores the setup information
- *
- * This stores the setup information in the configuration file
- */
- virtual void Store(void);
- /**
- * Update the menu
- *
- * This updates the menu osd and refreshes the screen.
- */
- void Update(void);
- /**
- * Loads the setup information
- *
- * This loads the setup information from the configuration file
- */
- void Load(void);
-private:
- const char* const* getInterfaceList(int *count);
- int getInterfaceIndex(const char* Interface);
- const char* getInterface(int Index);
- cOsdItem *mCtrlBind;
- cOsdItem *mCtrlEnabled;
- cOsdItem *mCtrlPort;
- cOsdItem *mCtrlAutoMode;
- cUPnPServer* mUpnpServer;
- /**
- * Is the server enabled or not
- *
- * The server can be switched on or off. If it is turned off, the server
- * will close open transmissions and ports
- *
- */
- int mEnable;
- int mAutoSetup;
- /**
- * The port to listen to (Default: 0 autodetect)
- *
- * The port the server is bound to. The default setting is 0.
- * So, the server will determine automatically a free random port between
- * 49152 and 65535. If a server should use a specific port it can be set
- * to one out of that range.
- *
- */
- int mPort;
- int mDetectPort;
- /**
- * The Interface the server is bound to
- *
- * If multiple interfaces exist the server can be bound to a specific
- * one
- *
- */
- int mInterfaceIndex;
- /**
- * The socket address of the server
- *
- * The IP address and the port of the server
- */
- char *mAddress;
-};
-
-#endif /* _CMENUSETUPUPNP_H */
-
diff --git a/inc/metadata.h b/inc/metadata.h
deleted file mode 100644
index e6200e1..0000000
--- a/inc/metadata.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * File: metadata.h
- * Author: savop
- *
- * Created on 28. Mai 2009, 21:14
- */
-
-#ifndef _METADATA_H
-#define _METADATA_H
-
-#include <vdr/tools.h>
-#include <vdr/channels.h>
-#include <vdr/recording.h>
-#include "../common.h"
-#include "database.h"
-#include "object.h"
-#include "resources.h"
-
-/**
- * The result set of a request
- *
- * This contains the results of a previous \e Browse or \e Search request.
- */
-struct cUPnPResultSet {
- int mNumberReturned; ///< The number of returned matches
- int mTotalMatches; ///< The total amount of matches
- const char* mResult; ///< The DIDL-Lite fragment
-};
-
-/**
- * The media database
- *
- * This class is the global object manager. It holds every object in a local cache.
- * Only this class is allowed to create new objects.
- *
- * @see cUPnPClassObject
- */
-class cMediaDatabase : public cThread {
- friend class cUPnPServer;
- friend class cUPnPObjectMediator;
-private:
- unsigned int mSystemUpdateID;
- cUPnPObjectFactory* mFactory;
- cHash<cUPnPClassObject>* mObjects;
- cSQLiteDatabase* mDatabase;
- cUPnPObjectID mLastInsertObjectID;
- cUPnPObjectID getNextObjectID();
- void cacheObject(cUPnPClassObject* Object);
- int prepareDatabase();
-#ifndef WITHOUT_TV
- int loadChannels();
- void updateChannelEPG();
-#endif
-#ifndef WITHOUT_RECORDS
- int loadRecordings();
- void updateRecordings();
-#endif
- bool init();
- void updateSystemID();
- virtual void Action();
-public:
- /**
- * Returns the SystemUpdateID
- *
- * This returns the \e SystemUpdateID. This changes whenever anything changed
- * within the content directory. This value will be sent through the UPnP
- * network every 2 seconds.
- *
- * @return the SystemUpdateID
- */
- unsigned int getSystemUpdateID();
- /**
- * Returns a CSV list with ContainerUpdateIDs
- *
- * This list contains an unordered list of ordered pairs of ContainerID and
- * its ContainerUpdateID. It contains only recent changes which are not yet
- * beeing evented. This means that evented updates will be removed from list.
- *
- * @return CSV list of ContainerUpdateIDs
- */
- const char* getContainerUpdateIDs();
- /**
- * Constructor
- *
- * This creates an instance of the media database.
- */
- cMediaDatabase();
- virtual ~cMediaDatabase();
- /**
- * Add a Fastfind
- *
- * This creates a \e Fastfind entry. It is a string which can be used to
- * relocate a objectID. Usually this is a file name or another ID with which
- * the related object can be found.
- *
- * @return returns
- * - \bc -1, if the creation was successful
- * - \bc 0, otherwise
- */
- int addFastFind(
- cUPnPClassObject* Object, ///< the object, which should be registered
- const char* FastFind ///< the string with which the object shall be
- ///< relocated
- );
- /**
- * Finds a object by Fastfind
- *
- * This returns the object via the \e Fastfind string. The object must be
- * previosly registered via \c cMediaDatabase::addFastFind().
- *
- * It tries to find the object in the internal object cache. If this fails,
- * the object will be loaded from the database.
- *
- * @see cMediaDatabase::addFastFind
- * @return The object associated with FastFind
- */
- cUPnPClassObject* getObjectByFastFind(
- const char* FastFind ///< the string with which the object shall be
- ///< relocated
- );
- /**
- * Finds a object by its ObjectID
- *
- * This returns the object via its \e ObjectID.
- *
- * It tries to find the object in the internal object cache. If this fails,
- * the object will be loaded from the database.
- *
- * @return The object associated with FastFind
- */
- cUPnPClassObject* getObjectByID(
- cUPnPObjectID ID ///< The ObjectID of the requested object
- );
- /**
- * Performs a browse on the database
- *
- * This performs a browse request on the database and returns a structure
- * containing the matching count and DIDL-Lite fragement which is sent to
- * the control point.
- *
- * @return returns an integer representing one of the following:
- * - \bc UPNP_CDS_E_INVALID_SORT_CRITERIA, when the sort criteria is malformed
- * - \bc UPNP_CDS_E_CANT_PROCESS_REQUEST, when there is an internal error while
- * processing the request
- * - \bc UPNP_CDS_E_NO_SUCH_OBJECT, when the requested ObjectID does not exist
- * - \bc UPNP_SOAP_E_ACTION_FAILED, when the action failed due any reasons
- * - \bc UPNP_E_SUCCESS, if the request was successful
- */
- int browse(
- OUT cUPnPResultSet** Results, ///< the result of the request
- IN const char* ID, ///< the objectID of the request
- IN bool BrowseMetadata, ///< \b true to browse metadata, \b false otherwise
- IN const char* Filter = "*", ///< the filter applied to the returned metadata
- IN unsigned int Offset = 0, ///< the starting offset
- IN unsigned int Count = 0, ///< maximum count returned
- IN const char* SortCriteria = "" ///< sorts the results before returning them
- );
- /**
- * Performs a search on the database
- *
- * This performs a search request on the database and returns a structure
- * containing the matching count and DIDL-Lite fragement which is sent to
- * the control point.
- *
- * @note
- * The submitted ID must be a ContainerID. Searches are performed only
- * in this container.
- *
- * @return returns an integer representing one of the following:
- * - \bc UPNP_CDS_E_INVALID_SORT_CRITERIA, when the sort criteria is malformed
- * - \bc UPNP_CDS_E_CANT_PROCESS_REQUEST, when there is an internal error while
- * processing the request
- * - \bc UPNP_CDS_E_NO_SUCH_OBJECT, when the requested ObjectID does not exist
- * - \bc UPNP_SOAP_E_ACTION_FAILED, when the action failed due any reasons
- * - \bc UPNP_E_SUCCESS, if the request was successful
- */
- int search(
- OUT cUPnPResultSet** Results, ///< the result of the request
- IN const char* ID, ///< the ContainerID
- IN const char* Search, ///< the search string
- IN const char* Filter = "*", ///< the filter applied to the returned metadata
- IN unsigned int Offset = 0, ///< the starting offset
- IN unsigned int Count = 0, ///< maximum count returned
- IN const char* SortCriteria = "" ///< sorts the results before returning them
- );
-};
-
-#endif /* _METADATA_H */
-
diff --git a/inc/object.h b/inc/object.h
deleted file mode 100644
index 1031589..0000000
--- a/inc/object.h
+++ /dev/null
@@ -1,1576 +0,0 @@
-/*
- * File: object.h
- * Author: savop
- *
- * Created on 11. September 2009, 20:39
- */
-
-#ifndef _OBJECT_H
-#define _OBJECT_H
-
-#include "database.h"
-#include "../common.h"
-#include "util.h"
-#include <string.h>
-#include <vdr/tools.h>
-#include <map>
-#include <vector>
-#include <upnp/ixml.h>
-
-/**
- * UPnP Object ID
- *
- * This is a UPnP Object ID representation.
- */
-struct cUPnPObjectID {
- int _ID; ///< The UPnP Object ID
- /**
- * Constructor
- *
- * Creates invalid ID
- */
- cUPnPObjectID():_ID(-1){}
- /**
- * Constructor
- *
- * Creates from long integer
- */
- cUPnPObjectID(
- long ID ///< new ID
- ){ _ID = (int)ID; }
- /**
- * Constructor
- *
- * Creates from integer
- */
- cUPnPObjectID(
- int ID ///< new ID
- ){ _ID = ID; }
- /** Set the object ID */
- cUPnPObjectID &operator=(
- long ID ///< new ID
- ){ _ID = ID; return *this; }
- /** @overload cUPnPObjectID &operator=(long ID) */
- cUPnPObjectID &operator=(
- int ID ///< new ID
- ){ _ID = ID; return *this; }
- /** @overload cUPnPObjectID &operator=(long ID) */
- cUPnPObjectID &operator=(
- const cUPnPObjectID& ID ///< new ID
- ){ if(this != &ID){ _ID = ID._ID; } return *this; }
- /** Pre increment the ID */
- cUPnPObjectID &operator++(){ _ID++; return *this; }
- /** Post increment the ID */
- cUPnPObjectID operator++(int){ cUPnPObjectID old = *this; _ID++; return old; }
- /** Post decrement the ID */
- cUPnPObjectID operator--(int){ cUPnPObjectID old = *this; _ID--; return old; }
- /** Pre decrement the ID */
- cUPnPObjectID &operator--(){ _ID--; return *this; }
- /** Not equal */
- bool operator!=(
- long ID ///< compare with this ID
- ){ return _ID != ID; }
- /** Equal */
- bool operator==(
- long ID ///< compare with this ID
- ){ return _ID == ID; }
- /** @overload bool operator!=(long ID) */
- bool operator!=(
- int ID ///< compare with this ID
- ){ return _ID != ID; }
- /** @overload bool operator==(long ID) */
- bool operator==(
- int ID ///< compare with this ID
- ){ return _ID == ID; }
- /** @overload bool operator!=(long ID) */
- bool operator!=(
- const cUPnPObjectID& ID ///< compare with this ID
- ){ return *this == ID; }
- /** @overload bool operator==(long ID) */
- bool operator==(
- const cUPnPObjectID& ID ///< compare with this ID
- ){ return *this == ID; }
- /** Casts to unsigned int */
- operator unsigned int(){ return (unsigned int)_ID; }
- /** Casts to int */
- operator int(){ return _ID; }
- /** Casts to long */
- operator long(){ return (long)_ID; }
- /** Casts to string */
- const char* operator*(){ char* buf; return asprintf(&buf,"%d",_ID)?buf:NULL; }
-};
-
-/**
- * Structure of a UPnP Class
- *
- * This represents a UPnP Class
- */
-struct cClass {
- cString ID; ///< The upnp class ID
- bool includeDerived; ///< flag, to indicate if derived classes are allowed
- /**
- * Compares two classes
- *
- * @param cmp the other class to compare with
- */
- bool operator==(const cClass &cmp){ return (!strcasecmp(cmp.ID,ID) && includeDerived==cmp.includeDerived); }
- /*! @copydoc operator==(const cClass &cmp) */
- bool operator!=(const cClass &cmp){ return !(*this==cmp); }
-};
-
-class cUPnPClassObject;
-class cUPnPObjectMediator;
-class cUPnPContainerMediator;
-class cUPnPClassContainer;
-class cUPnPResource;
-
-/**
- * List of UPnP Objects
- *
- * This is a cList of UPnP Objects
- * The list can be sorted by using a specific property
- */
-class cUPnPObjects : public cList<cUPnPClassObject> {
-public:
- cUPnPObjects();
- virtual ~cUPnPObjects();
- /**
- * Sorts the list
- *
- * This sorts the list by a specific property and a certain direction
- */
- void SortBy(
- const char* Property, ///< the property used for sorting
- bool Descending = false ///< the direction of the sort
- );
-};
-
-/**
- * The UPnP class Object
- *
- * This is a UPnP class Object representation with all its properties.
- */
-class cUPnPClassObject : public cListObject {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPClassContainer;
-private:
- cUPnPObjectID mLastID;
- bool mDeleted; // is this Objected marked as deleted, NOT used yet.
-protected:
- time_t mLastModified; ///< The last modification of this property
- cUPnPObjectID mID; ///< The object ID
- cUPnPClassObject* mParent; ///< The parent object
- cString mClass; ///< Class (Who am I?)
- cString mTitle; ///< Object title
- cString mCreator; ///< Creator of this object
- bool mRestricted; ///< Ability of changing metadata?
- int mWriteStatus; ///< Ability of writing resources?
- cList<cUPnPResource>* mResources; ///< The resources of this object
- cHash<cUPnPResource>* mResourcesID; ///< The resources of this object as hashmap
- IXML_Document* mDIDLFragment; ///< The DIDL fragment of the object
- cString mSortCriteria; ///< The sort criteria to sort with
- bool mSortDescending; ///< The direction of the sort
- cUPnPClassObject();
- /**
- * Set the Object ID
- *
- * This is only allowed by mediators and the media database. Manually editing
- * the object ID may result in unpredictable behavior.
- *
- * @param ID the ObjectID of this object
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- */
- int setID(cUPnPObjectID ID);
- /**
- * Set the Parent Object
- *
- * This is only allowed by mediators and the media database. Manually editing
- * the parent may result in unpredictable behavior.
- *
- * @param Parent the parent of this object
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- */
- int setParent(cUPnPClassContainer* Parent);
- /**
- * Set the object class
- *
- * This is only allowed by mediators and the media database. Manually editing
- * the object class may result in unpredictable behavior.
- *
- * @param Class the class of this object
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- */
- int setClass(const char* Class);
- /**
- * Set the modification time
- *
- * This sets the last modification time to the current timestamp. This is
- * used to indicate when the object was updated the last time.
- */
- void setModified(void){ this->mLastModified = time(NULL); }
-public:
- /**
- * Last modified
- *
- * Returns when the object was modified the last time.
- *
- * @return last modification timestamp
- */
- time_t modified() const { return this->mLastModified; }
- virtual ~cUPnPClassObject();
- /**
- * Compares a object
- *
- * This compares a given object with this object
- * It uses the SortCriteria to compare them.
- *
- * @return returns
- * - \bc >0, if the object comes after this one
- * - \bc 0, if the objects have the same property
- * - \bc <0, if the object comes before this one
- * @param ListObject the object to compare with
- */
- virtual int Compare(const cListObject& ListObject) const;
- /**
- * Get the properties of the object
- *
- * This returns a property list with all the properties which can be obtained
- * or set with \c getProperty or \c setProperty.
- *
- * @return a stringlist with the properties
- */
- virtual cStringList* getPropertyList();
- /**
- * Gets a property
- *
- * Returns the value of a specified property. The value is converted into a
- * string.
- *
- * @return returns
- * - \bc true, if the property exists
- * - \bc false, otherwise
- * @param Property the property which should be returned
- * @param Value the value of that property
- */
- virtual bool getProperty(const char* Property, char** Value) const ;
- /**
- * Sets a property
- *
- * Sets the value of a specified property. The value is converted from string
- * into the propper data type
- *
- * @return returns
- * - \bc true, if the property exists
- * - \bc false, otherwise
- * @param Property the property which should be set
- * @param Value the value of that property
- */
- virtual bool setProperty(const char* Property, const char* Value);
- /**
- * Converts to container
- *
- * This will convert the object into a container if it is one. If not, it
- * returns \bc NULL.
- *
- * @return returns
- * - \bc NULL, if it is not a container
- * - a container representation of this object
- */
- virtual cUPnPClassContainer* getContainer(){ return NULL; }
- /**
- * Create the DIDL fragment
- *
- * This creates the DIDL-Lite fragment of the object. The DIDL is written to the
- * specified \em IXML document. The details of the output can be controlled via
- * the filter stringlist
- *
- * @return the DIDL fragment of the object
- * @param Document the IXML document where to write the contents
- * @param Filter the string list with the filter criteria
- */
- virtual IXML_Node* createDIDLFragment(IXML_Document* Document, cStringList* Filter) = 0;
- /**
- * Is this a container?
- *
- * Returns if this object is a container or not
- *
- * @return returns
- * - \bc true, if it is a container
- * - \bc false, otherwise
- */
- bool isContainer(){ return this->getContainer()==NULL?false:true; }
- /**
- * Set the sort criteria
- *
- * This sets a certain criteria which the object can be compared with.
- *
- * @param Property the property to sort after
- * @param Descending sort the objects in descending order
- */
- void setSortCriteria(const char* Property, bool Descending = false);
- /**
- * Clears the sort criteria
- *
- * Clears the property of the sort criteria and sets the descending flag to
- * false.
- */
- void clearSortCriteria();
- /******* Setter *******/
- /**
- * Set the title
- *
- * This sets the title of the object. It is a required metadata information.
- * It must not be \bc NULL or an empty string.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Title the title of the object
- */
- int setTitle(const char* Title);
- /**
- * Set the creator
- *
- * The creator of an object is primarily the creator or owner of the object
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Creator the creator of the object
- */
- int setCreator(const char* Creator);
- /**
- * Set the restriction
- *
- * This sets the restriction flag. If the object is restricted, no modifications
- * to its metadata by the user are allowed.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Restricted \bc true, to disallow modification, \bc false to allow it
- */
- int setRestricted(bool Restricted);
- /**
- * Set the write status
- *
- * This sets the write status of a resource. With this indicator, you can set
- * the modifiabilty of resources by a control point.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Status the write status
- */
- int setWriteStatus(int Status);
- /**
- * Set the resources
- *
- * This sets the list of resources of an object. The list usally contain a
- * single resource. However, multiple resources a also very common.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Resources the resource list of this object
- */
- int setResources(cList<cUPnPResource>* Resources);
- /**
- * Add resource to list
- *
- * This adds the specified resource to the resource list of the object
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Resource the resource to be added
- */
- int addResource(cUPnPResource* Resource);
- /**
- * Remove resource from list
- *
- * This removes the specified resource from the resource list of the object
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Resource the resource to be removed
- */
- int removeResource(cUPnPResource* Resource);
- /******* Getter *******/
- /**
- * Get the object ID
- *
- * This returns the object ID of the object.
- *
- * @return the object ID
- */
- cUPnPObjectID getID() const { return this->mID; }
- /**
- * Get the parent ID
- *
- * This returns the ID of the parent container object, associated with this object.
- * It is \bc -1, if the object is the root object.
- *
- * @return the parent ID
- */
- cUPnPObjectID getParentID() const { return this->mParent?this->mParent->getID():cUPnPObjectID(-1); }
- /**
- * Get the parent object
- *
- * This returns the parent container object, associated with this object. It is
- * \bc NULL, if the object is the root object.
- *
- * @return the parent object
- */
- cUPnPClassContainer* getParent() const { return (cUPnPClassContainer*)this->mParent; }
- /**
- * Get the title
- *
- * This returns the title of the object. This may be the title of an item or
- * the folder name in case of a container.
- *
- * @return the title of the object
- */
- const char* getTitle() const { return this->mTitle; }
- /**
- * Get the object class
- *
- * This returns the object class of the object. The classes are defined by
- * the UPnP Working Committee. However, custom classes which are derived from
- * a standardized class are also possible.
- *
- * @return the class of the object
- */
- const char* getClass() const { return this->mClass; }
- /**
- * Get the creator
- *
- * This returns the creator of the object. Usually, this is the primary
- * content creator or the owner of the object
- *
- * @return the creator of the object
- */
- const char* getCreator() const { return this->mCreator; }
- /**
- * Is the resource restricted?
- *
- * Returns \bc true, if the object is restricted or \bc false, otherwise.
- * When the object is restricted, then modifications to the metadata of the
- * object are disallowed.
- *
- * @return returns
- * - \bc true, if the object is restricted
- * - \bc false, otherwise
- */
- bool isRestricted() const { return this->mRestricted; }
- /**
- * Get write status
- *
- * This returns the write status of the object. It gives information, if the
- * resource is modifiable.
- *
- * @return the write status
- */
- int getWriteStatus() const { return this->mWriteStatus; }
- /**
- * Get a resource by its ID
- *
- * Returns the resource with the specified resource ID.
- *
- * @return the resource by ID
- * @param ResourceID the resource ID of the demanded resource
- */
- cUPnPResource* getResource(unsigned int ResourceID) const { return this->mResourcesID->Get(ResourceID); }
- /**
- * Get the resources
- *
- * This returns a list with resources associated with this object.
- *
- * @return the resources of this object
- */
- cList<cUPnPResource>* getResources() const { return this->mResources; }
-};
-
-/**
- * The UPnP class Item
- *
- * This is a UPnP class Item representation with all its properties.
- */
-class cUPnPClassItem : public cUPnPClassObject {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPItemMediator;
-protected:
-// cUPnPObjectID mReferenceID;
- cUPnPClassItem* mReference; ///< The reference item
- /**
- * Constructor of an item
- *
- * This creates a new instance of an item
- */
- cUPnPClassItem();
-public:
- virtual ~cUPnPClassItem(){};
- virtual cStringList* getPropertyList();
- virtual IXML_Node* createDIDLFragment(IXML_Document* Document, cStringList* Filter);
- virtual bool setProperty(const char* Property, const char* Value);
- virtual bool getProperty(const char* Property, char** Value) const;
- /******** Setter ********/
- /**
- * Set a reference item
- *
- * This sets a reference item. Its comparable with symlinks in *nix systems
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Reference the reference item
- */
- int setReference(cUPnPClassItem* Reference);
- /******** Getter ********/
- /**
- * Get the referenced item
- *
- * This returns the referenced item of this item
- *
- * @return the referenced item
- */
- cUPnPClassItem* getReference() const { return this->mReference; }
- /**
- * Get the reference ID
- *
- * This returns the object ID of the referenced item or \b -1, if
- * no reference exists.
- *
- * @return the reference ID
- */
- cUPnPObjectID getReferenceID() const { return this->mReference?this->mReference->getID():cUPnPObjectID(-1); }
-};
-
-typedef std::vector<cClass> tClassVector;
-
-/**
- * The UPnP class Container
- *
- * This is a UPnP class Container representation with all its properties.
- */
-class cUPnPClassContainer : public cUPnPClassObject {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPContainerMediator;
-protected:
- cString mContainerType; ///< DLNA container type
- tClassVector mSearchClasses; ///< Classes which are searchable
- tClassVector mCreateClasses; ///< Classes which are creatable
- bool mSearchable; ///< Is the Container searchable?
- unsigned int mUpdateID; ///< The containerUpdateID
- cUPnPObjects* mChildren; ///< List of children
- cHash<cUPnPClassObject>* mChildrenID; ///< List of children as hash map
- /**
- * Update the container
- *
- * This performs an update, which acutally increases the containerUpdateID.
- */
- void update();
- /**
- * Sets the containerUpdateID
- *
- * This method should only be used when the containerUpdateID is loaded from
- * the database.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param UID the containerUpdateID
- */
- int setUpdateID(unsigned int UID);
- /**
- * Constructor of a container
- *
- * This creates a new instance of a container
- */
- cUPnPClassContainer();
-public:
- virtual ~cUPnPClassContainer();
- virtual cStringList* getPropertyList();
- virtual IXML_Node* createDIDLFragment(IXML_Document* Document, cStringList* Filter);
- virtual bool setProperty(const char* Property, const char* Value);
- virtual bool getProperty(const char* Property, char** Value) const;
- virtual cUPnPClassContainer* getContainer(){ return this; }
- /**
- * Add a child
- *
- * This adds the specified child to this container. The parent container of the
- * child will be set to this container.
- *
- * @param Object the child to be added
- */
- void addObject(cUPnPClassObject* Object);
- /**
- * Remove a child
- *
- * This removes the specified child from the list of children. The child will
- * also loose its parent container, so that there is no link between left.
- *
- * @param Object the child to be removed
- */
- void removeObject(cUPnPClassObject* Object);
- /**
- * Get a child by ID
- *
- * Returns the child, which is specified by the \c ObjectID.
- *
- * @return the child with the specified ID
- * @param ID the \c ObjectID of the child
- */
- cUPnPClassObject* getObject(cUPnPObjectID ID) const;
- /**
- * Get the list of children
- *
- * This returns a list of the children of the container.
- *
- * @return the list of children
- */
- cUPnPObjects* getObjectList() const { return this->mChildren; }
- /**
- * Add a search class
- *
- * This adds a search class to the search classes vector
- *
- * @return returns
- * - \bc 0, if adding was successful
- * - \bc <0, otherwise
- * @param SearchClass the new class to be added
- */
- int addSearchClass(cClass SearchClass);
- /**
- * Remove a search class
- *
- * This removes a search class from the search classes vector
- *
- * @return returns
- * - \bc 0, if deleting was successful
- * - \bc <0, otherwise
- * @param SearchClass the class to be deleted
- */
- int delSearchClass(cClass SearchClass);
- /**
- * Add a create class
- *
- * This adds a create class to the create classes vector
- *
- * @return returns
- * - \bc 0, if adding was successful
- * - \bc <0, otherwise
- * @param CreateClass the new class to be added
- */
- int addCreateClass(cClass CreateClass);
- /**
- * Remove a create class
- *
- * This removes a create class from the create classes vector
- *
- * @return returns
- * - \bc 0, if deleting was successful
- * - \bc <0, otherwise
- * @param CreateClass the class to be deleted
- */
- int delCreateClass(cClass CreateClass);
- /******** Setter ********/
- /**
- * Set the DLNA container type
- *
- * This sets the DLNA container type. It must be a valid container type value.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Type the DLNA container type
- */
- int setContainerType(const char* Type);
- /**
- * Sets the search classes
- *
- * This sets the search classes, which allows the user to search only for
- * these classes in the current container and its children. If the vector
- * is empty the search can return any match. If the additional flag \bc
- * derived is set, then also any derived classes are matched.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param SearchClasses a vector container the allowed search classes
- */
- int setSearchClasses(std::vector<cClass> SearchClasses);
- /**
- * Sets the create classes
- *
- * This sets the create classes, which allows the user to create new objects
- * in this container, if \em restricted is \bc false.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param CreateClasses a vector containing the create classes
- */
- int setCreateClasses(std::vector<cClass> CreateClasses);
- /**
- * Sets the searchable flag
- *
- * This sets the searchable flag, which allows or disallows search on this
- * container.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Searchable \bc true, to enable or \bc false, to disable searching
- */
- int setSearchable(bool Searchable);
- /******** Getter ********/
- /**
- * Get the DLNA container type
- *
- * This returns the DLNA container type. Currently there are only these possible
- * values beside \bc NULL:
- * - \bc TUNER_1_0
- *
- * @return the DLNA container type
- */
- const char* getContainerType() const { return this->mContainerType; }
- /**
- * Get the search classes
- *
- * This returns a vector container all possible search classes. This are classes,
- * which can be used for searching in this container.
- *
- * @return a vector with all search classes
- */
- const tClassVector* getSearchClasses() const { return &(this->mSearchClasses); }
- /**
- * Get the create classes
- *
- * This returns a vector containing all possible create classes. This are classes,
- * which can be created in this container. For instance a TV container can only create
- * items of the class VideoBroadcast. The vector is empty when creation of new items
- * by the user is not allowed.
- *
- * @return a vector with create classes
- */
- const tClassVector* getCreateClasses() const { return &(this->mCreateClasses); }
- /**
- * Is this container searchable
- *
- * This returns \bc true, if the container can be search via \em Search or
- * \bc false, otherwise.
- *
- * @return returns
- * - \bc true, if the container is searchable
- * - \bc false, otherwise
- */
- bool isSearchable() const { return this->mSearchable; }
- /**
- * Get the number of children
- *
- * This returns the total number of children of this container
- *
- * @return the number of childen
- */
- unsigned int getChildCount() const { return this->mChildren->Count(); }
- /**
- * Get the containerUpdateID
- *
- * This returns the containerUpdateID
- *
- * @return the containerUpdateID of this container
- */
- unsigned int getUpdateID() const { return this->mUpdateID; }
- /**
- * Has the container been updated?
- *
- * This returns \bc true, if the container was recently updated or
- * \bc false, otherwise
- *
- * @return returns
- * - \bc true, if the container was updated
- * - \bc false, otherwise
- */
- bool isUpdated();
-};
-
-/**
- * The UPnP class VideoItem
- *
- * This is a UPnP class VideoItem representation with all its properties.
- */
-class cUPnPClassVideoItem : public cUPnPClassItem {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPVideoItemMediator;
-protected:
- cString mGenre; ///< Genre of the video
- cString mDescription; ///< Description
- cString mLongDescription; ///< a longer description
- cString mPublishers; ///< CSV of Publishers
- cString mLanguage; ///< RFC 1766 Language code
- cString mRelations; ///< Relation to other contents
- cString mProducers; ///< CSV of Producers
- cString mRating; ///< Rating (for parential control)
- cString mActors; ///< CSV of Actors
- cString mDirectors; ///< CSV of Directors
- /**
- * Constructor of a video item
- *
- * This creates a new instance of a video item
- */
- cUPnPClassVideoItem();
-public:
- virtual ~cUPnPClassVideoItem();
- virtual IXML_Node* createDIDLFragment(IXML_Document* Document, cStringList* Filter);
- virtual cStringList* getPropertyList();
- virtual bool setProperty(const char* Property, const char* Value);
- virtual bool getProperty(const char* Property, char** Value) const;
- /******** Setter ********/
- /**
- * Set a long description
- *
- * A long description may hold information about the content or the story
- * of a video
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param LongDescription the content or story of a video
- */
- int setLongDescription(const char* LongDescription);
- /**
- * Set a description
- *
- * A description may hold short information about the content or the story
- * of a video. Unlike a long description, this contains just a very short
- * brief like a subtitle or the episode title.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Description the description of a video
- */
- int setDescription(const char* Description);
- /**
- * Set the publishers
- *
- * This is a CSV list of publishers, who distributes the video.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Publishers a CSV list of publishers
- */
- int setPublishers(const char* Publishers);
- /**
- * Set a genre
- *
- * This is a CSV list of genre of a video. This may be something like
- * "Western" or "SciFi". Actually, there is no standardized rule for
- * a genre name, which results in an ambiguous definition of certain
- * genre, like Thriller and Horror.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Genre a CSV list of genre
- */
- int setGenre(const char* Genre);
- /**
- * Set the language
- *
- * This sets the language of a video. It is defined by RFC 1766.
- * A valid language definition is \em "de-DE" or \em "en-US".
- *
- * @see http://www.ietf.org/rfc/rfc1766.txt
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Language the language (RFC 1766)
- */
- int setLanguage(const char* Language);
- /**
- * Sets a relation URL
- *
- * This sets a CSV list of relation URLs, where to find additional
- * information about the movie. The URLs may not contain commas and they
- * must be properly escaped as in RFC 2396
- *
- * @see http://www.ietf.org/rfc/rfc2396.txt
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Relations a CSV list with relations
- */
- int setRelations(const char* Relations);
- /**
- * Sets the directors
- *
- * This sets a CSV list of directors.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Directors a CSV list of directors
- */
- int setDirectors(const char* Directors);
- /**
- * Sets the actors
- *
- * This sets a CSV list of actors in a video. This usually contain the main actors.
- * However, also other actors appearing in the video can be mentioned here.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Actors a CSV list of actors
- */
- int setActors(const char* Actors);
- /**
- * Sets the producers
- *
- * This sets a CSV list of producers of a video. These are the people who are
- * involed in the production of a video
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Producers a CSV list of producers
- */
- int setProducers(const char* Producers);
- /**
- * Sets the rating
- *
- * This is a rating, which can be used for parential control issues.
- *
- * @see http://en.wikipedia.org/wiki/Motion_picture_rating_system
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Rating the rating of a video
- */
- int setRating(const char* Rating);
- /******** Getter ********/
- /**
- * Get the genres
- *
- * This returns a CSV list of genre
- *
- * @return the genre of a video
- */
- const char* getGenre() const { return this->mGenre; }
- /**
- * Get the long description
- *
- * This returns the long description of a video
- *
- * @return the long description of a video
- */
- const char* getLongDescription() const { return this->mLongDescription; }
- /**
- * Get the description
- *
- * This returns the description of a video
- *
- * @return the description of a video
- */
- const char* getDescription() const { return this->mDescription; }
- /**
- * Get the publishers
- *
- * This returns a CSV list of publishers of the video
- *
- * @return a CSV list of publishers
- */
- const char* getPublishers() const { return this->mPublishers; }
- /**
- * Get the language
- *
- * This returns the language of the video
- *
- * @return the language
- */
- const char* getLanguage() const { return this->mLanguage; }
- /**
- * Get the relations
- *
- * This returns a CSV list of relation URLs.
- *
- * @return a CSV list of relation URLs
- */
- const char* getRelations() const { return this->mRelations; }
- /**
- * Get the actors
- *
- * This returns a CSV list of actors in the video
- *
- * @return a CSV list of actors
- */
- const char* getActors() const { return this->mActors; }
- /**
- * Get the producers
- *
- * This returns a CSV list of producers of a video
- *
- * @return a CSV list of producers
- */
- const char* getProducers() const { return this->mProducers; }
- /**
- * Get the directors
- *
- * This returns a CSV list of directors
- *
- * @return a CSV list of directors
- */
- const char* getDirectors() const { return this->mDirectors; }
- /**
- * Get the rating
- *
- * This returns the rating used for parental control.
- *
- * @return the rating of a video
- */
- const char* getRating() const { return this->mRating; }
-};
-
-/**
- * The UPnP class Movie
- *
- * This is a UPnP class Movie representation with all its properties.
- */
-class cUPnPClassMovie : public cUPnPClassVideoItem {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPMovieMediator;
-protected:
- int mDVDRegionCode; ///< The Region code of the movie (0 - 8)
- cString mStorageMedium; ///< The storage medium where the movie is stored
- /**
- * Constructor of a movie
- *
- * This creates a new instance of a movie
- */
- cUPnPClassMovie();
-public:
- virtual ~cUPnPClassMovie();
- //virtual cString createDIDLFragment(cStringList* Filter);
- virtual cStringList* getPropertyList();
- virtual bool setProperty(const char* Property, const char* Value);
- virtual bool getProperty(const char* Property, char** Value) const;
- /******** Setter ********/
- /**
- * Sets the DVD region code
- *
- * For more information on this, see http://en.wikipedia.org/wiki/DVD_region_code
- *
- * The integer representation for \em ALL is 9.
- *
- * @see http://en.wikipedia.org/wiki/DVD_region_code
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param RegionCode the region code of this movie
- */
- int setDVDRegionCode(int RegionCode);
- /**
- * Sets the storage medium
- *
- * This will set the storage medium, where the movie resides. Valid media
- * are defined in \link common.h \endlink
- *
- * @see common.h
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param StorageMedium the medium where the movie is located
- */
- int setStorageMedium(const char* StorageMedium);
- /******** Getter ********/
- /**
- * Get the DVD region code
- *
- * This returns the DVD region code. For more information,
- * see http://en.wikipedia.org/wiki/DVD_region_code
- *
- * The integer representation for \em ALL is 9.
- *
- * @see http://en.wikipedia.org/wiki/DVD_region_code
- * @return the DVD region code
- */
- int getDVDRegionCode() const { return this->mDVDRegionCode; }
- /**
- * Get the storage medium
- *
- * This returns the storage medium, where the movie resides.
- *
- * @return the storage medium
- */
- const char* getStorageMedium() const { return this->mStorageMedium; }
-};
-
-/**
- * The UPnP class VideoBroadcast
- *
- * This is a UPnP class VideoBroadcast representation with all its properties.
- */
-class cUPnPClassVideoBroadcast : public cUPnPClassVideoItem {
- friend class cMediaDatabase;
- friend class cUPnPObjectMediator;
- friend class cUPnPVideoBroadcastMediator;
-protected:
- cString mIcon; ///< The channel icon of the channel
- cString mRegion; ///< The region where the channel can be received
- int mChannelNr; ///< The channel number
- cString mChannelName; ///< The channel name or provider name
- /**
- * Constructor of a video broadcast
- *
- * This creates a new instance of a video broadcast
- */
- cUPnPClassVideoBroadcast();
-public:
- virtual ~cUPnPClassVideoBroadcast();
- virtual IXML_Node* createDIDLFragment(IXML_Document* Document, cStringList* Filter);
- virtual cStringList* getPropertyList();
- virtual bool setProperty(const char* Property, const char* Value);
- virtual bool getProperty(const char* Property, char** Value) const;
- /******** Setter ********/
- /**
- * Set the channel icon
- *
- * This sets the channel icon of this channel. The resource must be a valid
- * URI which can be obtained via the internal webserver
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param IconURI the URI to the icon file
- */
- int setIcon(const char* IconURI);
- /**
- * Set the channel region
- *
- * This sets the region of a channel, where it can be received
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param Region the location where the channel can be received
- */
- int setRegion(const char* Region);
- /**
- * Set channel number
- *
- * This sets the channel number, so that it can be used for directly navigation
- * or channel up and down navigation respectively.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param ChannelNr the channel number
- */
- int setChannelNr(int ChannelNr);
- /**
- * Set the channel name
- *
- * This sets the channel name or the provider of the channel.
- *
- * @return returns
- * - \bc 0, if setting was successful
- * - \bc <0, otherwise
- * @param ChannelName the channel name
- */
- int setChannelName(const char* ChannelName);
- /******** Getter ********/
- /**
- * Get the channel icon
- *
- * This returns the channel icon of the channel.
- *
- * @return the channel icon
- */
- const char* getIcon() const { return this->mIcon; }
- /**
- * Get the region
- *
- * This returns the region, where the channel can be received
- *
- * @return the channel region
- */
- const char* getRegion() const { return this->mRegion; }
- /**
- * Get the channel number
- *
- * This returns the channel number
- *
- * @return the channel number
- */
- int getChannelNr() const { return this->mChannelNr; }
- /**
- * Get the channel name
- *
- * This returns the channel name or provider name respectively
- *
- * @return the channel name
- */
- const char* getChannelName() const { return this->mChannelName; }
-};
-
-/**
- * Mediator interface
- *
- * This is an interface for mediators used to communicate with the database.
- * A mediator is applied to get, create, save or delete an UPnP object.
- */
-class cMediatorInterface {
-public:
- virtual ~cMediatorInterface(){};
- /**
- * Creates an object
- *
- * This creates a new UPnP object with the specific title and the restriction.
- *
- * @return the newly created object
- * @param Title the title of that object
- * @param Restricted the restriction of the object
- */
- virtual cUPnPClassObject* createObject(const char* Title, bool Restricted) = 0;
- /**
- * Get an object
- *
- * Retrieves a UPnP object from the database and stores its information in the
- * object. The object is obtained via its object ID.
- *
- * @return the object, found in the database
- * @param ID the object ID
- */
- virtual cUPnPClassObject* getObject(cUPnPObjectID ID) = 0;
- /**
- * Saves the object
- *
- * This saves the object in the database by updating the values in the database
- * with those in the object.
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- * @param Object the object to be saved
- */
- virtual int saveObject(cUPnPClassObject* Object) = 0;
- /**
- * Deletes the object
- *
- * This deletes the object in the database by removing all its children and then
- * deleting the contents from the database
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- * @param Object the object to be deleted
- */
- virtual int deleteObject(cUPnPClassObject* Object) = 0;
- /**
- * Clears the object
- *
- * This clears the object, i.e. all its children will be removed and deleted
- * from the database
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- * @param Object the object to be cleared
- */
- virtual int clearObject(cUPnPClassObject* Object) = 0;
-};
-
-typedef std::map<const char*, cMediatorInterface*, strCmp> tMediatorMap;
-
-/**
- * The object factory
- *
- * This factory can create, delete, clear or save UPnP objects. It uses mediators
- * to communicate with the persistance database to load or persist the objects.
- *
- * If a new type of object shall be stored in the database an according mediator
- * is needed, which knows the internal database structure. It must implement the
- * cMediatorInterface class to work with this factory.
- */
-class cUPnPObjectFactory {
-private:
- static cUPnPObjectFactory* mInstance;
- cSQLiteDatabase* mDatabase;
- tMediatorMap mMediators;
- cMediatorInterface* findMediatorByID(cUPnPObjectID ID);
- cMediatorInterface* findMediatorByClass(const char* Class);
- cUPnPObjectFactory();
-public:
- /**
- * Return the instance of the factory
- *
- * This returns the instance of the factory. When the media database is
- * initialized successfully, it usally has all known mediators already
- * registered.
- *
- * @return the instance of the factory
- */
- static cUPnPObjectFactory* getInstance();
- /**
- * Register a mediator
- *
- * This registers a new mediator by the associated class. The mediator
- * must implement the cMediatorInterface class to be used with this
- * factory.
- *
- * @param UPnPClass the class of which the mediator is associated to
- * @param Mediator the mediator itself
- */
- void registerMediator(const char* UPnPClass, cMediatorInterface* Mediator);
- /**
- * Unregisters a mediator
- *
- * This unregisters a mediator if it is not needed anylonger. If the optional
- * parameter \c freeMediator is set, the object instance will be free'd after
- * removing it from the list.
- *
- * @param UPnPClass the class of the associated mediator
- * @param freeMediator flag to indicate if the mediator shall be free'd after removing
- */
- void unregisterMediator(const char* UPnPClass, bool freeMediator=true);
- /**
- * @copydoc cMediatorInterface::createObject(const char* Title, bool Restricted)
- *
- * @param UPnPClass the class of the new object
- */
- cUPnPClassObject* createObject(const char* UPnPClass, const char* Title, bool Restricted=true);
- /*! @copydoc cMediatorInterface::getObject(cUPnPObjectID ID) */
- cUPnPClassObject* getObject(cUPnPObjectID ID);
- /*! @copydoc cMediatorInterface::saveObject(cUPnPClassObject* Object) */
- int saveObject(cUPnPClassObject* Object);
- /*! @copydoc cMediatorInterface::deleteObject(cUPnPClassObject* Object) */
- int deleteObject(cUPnPClassObject* Object);
- /*! @copydoc cMediatorInterface::clearObject(cUPnPClassObject* Object) */
- int clearObject(cUPnPClassObject* Object);
-};
-
-class cMediaDatabase;
-
-/**
- * Object Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPObjectMediator : public cMediatorInterface {
-protected:
- cSQLiteDatabase* mDatabase; ///< the SQLite 3 database wrapper
- cMediaDatabase* mMediaDatabase; ///< the media database
- /**
- * Constructor of object mediator
- *
- * This constructs a new object mediator. This is actually not allowed because
- * it is prohibited to create instances of the UPnP class Object
- */
- cUPnPObjectMediator(
- cMediaDatabase* MediaDatabase ///< the media database
- );
- /**
- * Initializes an object
- *
- * This initializes an object, which means, that it will be created in the database with
- * the required details.
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- */
- virtual int initializeObject(
- cUPnPClassObject* Object, ///< the object to be initialized
- const char* Class, ///< the class of the object
- const char* Title, ///< the title of the object
- bool Restricted ///< restriction of the object
- );
- /**
- * Store the object in the database
- *
- * This stores the information of an object in the database
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- * @param Object the object to be saved
- */
- virtual int objectToDatabase(cUPnPClassObject* Object);
- /**
- * Loads an object from database
- *
- * This loads an object from the database
- *
- * @return returns
- * - \bc <0, in case of an error
- * - \bc 0, otherwise
- * @param Object the object to be loaded
- * @param ID the object ID of that object
- */
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- virtual ~cUPnPObjectMediator();
- /*! @copydoc cMediatorInterface::createObject(const char* Title, bool Restricted) */
- virtual cUPnPClassObject* createObject(const char* Title, bool Restricted);
- /*! @copydoc cMediatorInterface::getObject(cUPnPObjectID ID) */
- virtual cUPnPClassObject* getObject(cUPnPObjectID ID);
- /*! @copydoc cMediatorInterface::saveObject(cUPnPClassObject* Object) */
- virtual int saveObject(cUPnPClassObject* Object);
- /*! @copydoc cMediatorInterface::deleteObject(cUPnPClassObject* Object) */
- virtual int deleteObject(cUPnPClassObject* Object);
- /*! @copydoc cMediatorInterface::clearObject(cUPnPClassObject* Object) */
- virtual int clearObject(cUPnPClassObject* Object);
-};
-
-/**
- * Item Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPItemMediator : public cUPnPObjectMediator {
-protected:
- /*! @copydoc cUPnPObjectMediator::objectToDatabase(cUPnPClassObject* Object) */
- virtual int objectToDatabase(cUPnPClassObject* Object);
- /*! @copydoc cUPnPObjectMediator::databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID) */
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- /**
- * Constructor of item mediator
- *
- * This creates a new item mediator with which it is possible to create new
- * instances of Item objects.
- *
- * @param MediaDatabase the media database
- */
- cUPnPItemMediator(cMediaDatabase* MediaDatabase);
- virtual ~cUPnPItemMediator(){};
- /*! @copydoc cUPnPObjectMediator::createObject(const char* Title, bool Restricted) */
- virtual cUPnPClassItem* createObject(const char* Title, bool Restricted);
- /*! @copydoc cUPnPObjectMediator::getObject(cUPnPObjectID ID) */
- virtual cUPnPClassItem* getObject(cUPnPObjectID ID);
-};
-
-/**
- * VideoItem Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPVideoItemMediator : public cUPnPItemMediator {
-protected:
- virtual int objectToDatabase(cUPnPClassObject* Object);
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- /**
- * Constructor of videoitem mediator
- *
- * This creates a new videoitem mediator with which it is possible to create new
- * instances of VideoItem objects.
- *
- * @param MediaDatabase the media database
- */
- cUPnPVideoItemMediator(cMediaDatabase* MediaDatabase);
- virtual ~cUPnPVideoItemMediator(){};
- virtual cUPnPClassVideoItem* createObject(const char* Title, bool Restricted);
- virtual cUPnPClassVideoItem* getObject(cUPnPObjectID ID);
-};
-
-/**
- * VideoBroadcast Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPVideoBroadcastMediator : public cUPnPVideoItemMediator {
-protected:
- virtual int objectToDatabase(cUPnPClassObject* Object);
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- /**
- * Constructor of video broadcast mediator
- *
- * This creates a new video broadcast mediator with which it is possible to create new
- * instances of VideoBroadcast objects.
- *
- * @param MediaDatabase the media database
- */
- cUPnPVideoBroadcastMediator(cMediaDatabase* MediaDatabase);
- virtual ~cUPnPVideoBroadcastMediator(){};
- virtual cUPnPClassVideoBroadcast* createObject(const char* Title, bool Restricted);
- virtual cUPnPClassVideoBroadcast* getObject(cUPnPObjectID ID);
-};
-
-/**
- * Movie Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPMovieMediator : public cUPnPVideoItemMediator {
-protected:
- virtual int objectToDatabase(cUPnPClassObject* Object);
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- /**
- * Constructor of movie mediator
- *
- * This creates a new movie mediator with which it is possible to create new
- * instances of Movie objects.
- *
- * @param MediaDatabase the media database
- */
- cUPnPMovieMediator(cMediaDatabase* MediaDatabase);
- virtual ~cUPnPMovieMediator(){};
- virtual cUPnPClassMovie* createObject(const char* Title, bool Restricted);
- virtual cUPnPClassMovie* getObject(cUPnPObjectID ID);
-};
-
-/**
- * Container Mediator
- *
- * This is the interface between the objects and the database. It is possible to
- * create new objects, stores objects in the database as well as removing them from
- * it.
- */
-class cUPnPContainerMediator : public cUPnPObjectMediator {
-protected:
- virtual int objectToDatabase(cUPnPClassObject* Object);
- virtual int databaseToObject(cUPnPClassObject* Object, cUPnPObjectID ID);
-public:
- /**
- * Constructor of container mediator
- *
- * This creates a new container mediator with which it is possible to create new
- * instances of Container objects.
- *
- * @param MediaDatabase the media database
- */
- cUPnPContainerMediator(cMediaDatabase* MediaDatabase);
- virtual ~cUPnPContainerMediator(){};
- virtual cUPnPClassContainer* createObject(const char* Title, bool Restricted);
- virtual cUPnPClassContainer* getObject(cUPnPObjectID ID);
-};
-
-#endif /* _OBJECT_H */
-
diff --git a/inc/profiles.h b/inc/profiles.h
deleted file mode 100644
index c50e4ee..0000000
--- a/inc/profiles.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * File: profiles.h
- * Author: savop
- *
- * Created on 8. Dezember 2009, 12:45
- */
-
-#ifndef _PROFILES_H
-#define _PROFILES_H
-
-#include "../common.h"
-
-#include "profiles/aac.h"
-#include "profiles/ac3.h"
-#include "profiles/amr.h"
-#include "profiles/atrac3plus.h"
-#include "profiles/jpeg.h"
-#include "profiles/lpcm.h"
-#include "profiles/mpa.h"
-#include "profiles/mpeg1.h"
-#include "profiles/mpeg2.h"
-#include "profiles/mpeg4_p2.h"
-#include "profiles/mpeg4_p10.h"
-#include "profiles/png.h"
-
-#ifdef WITH_WINDOWS_MEDIA
- #include "profiles/wma.h"
- #include "profiles/wmv9.h"
-#endif
-
-#endif /* _PROFILES_H */
-
diff --git a/inc/profiles/aac.h b/inc/profiles/aac.h
deleted file mode 100644
index e3f4dab..0000000
--- a/inc/profiles/aac.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * File: profiles_aac.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:31
- */
-
-#ifndef _PROFILES_AAC_H
-#define _PROFILES_AAC_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_AAC_ADTS; ///< AAC ADTS
-extern DLNAProfile DLNA_PROFILE_AAC_ADTS_320; ///< AAC ADTS
-extern DLNAProfile DLNA_PROFILE_AAC_ISO; ///< AAC ISO (iTunes)
-extern DLNAProfile DLNA_PROFILE_AAC_ISO_320; ///< AAC ISO
-extern DLNAProfile DLNA_PROFILE_AAC_LTP_ISO; ///< AAC LTP ISO
-extern DLNAProfile DLNA_PROFILE_AAC_LTP_MULT5_ISO; ///< AAC LTP Multi 5.1 ISO
-extern DLNAProfile DLNA_PROFILE_AAC_LTP_MULT7_ISO; ///< AAC LTP Multi 7.1 ISO
-extern DLNAProfile DLNA_PROFILE_AAC_MULT5_ADTS; ///< AAC Multi 5.1 ADTS
-extern DLNAProfile DLNA_PROFILE_AAC_MULT5_ISO; ///< AAC Multi 5.1 ISO
-
-extern DLNAProfile DLNA_PROFILE_HEAAC_L2_ADTS; ///< AAC Radio Broadcasts ADTS L2
-extern DLNAProfile DLNA_PROFILE_HEAAC_L2_ISO; ///< AAC Radio Broadcasts ISO L2
-extern DLNAProfile DLNA_PROFILE_HEAAC_L3_ADTS; ///< AAC Radio Broadcasts ADTS L3
-extern DLNAProfile DLNA_PROFILE_HEAAC_L3_ISO; ///< AAC Radio Broadcasts ISO L3
-extern DLNAProfile DLNA_PROFILE_HEAAC_MULT5_ADTS; ///< AAC Music Track 5.1 ADTS
-extern DLNAProfile DLNA_PROFILE_HEAAC_MULT5_ISO; ///< AAC Music Track 5.1 ISO
-extern DLNAProfile DLNA_PROFILE_HEAAC_L2_ADTS_320; ///< AAC Radio Broadcasts ADTS 320 L2
-extern DLNAProfile DLNA_PROFILE_HEAAC_L2_ISO_320; ///< AAC Radio Broadcasts ISO 320 L2
-
-extern DLNAProfile DLNA_PROFILE_BSAC_ISO; ///< BSAC ISO
-extern DLNAProfile DLNA_PROFILE_BSAC_MULT5_ISO; ///< BSAC ISO 5.1
-
-#endif /* _PROFILES_AAC_H */
-
diff --git a/inc/profiles/ac3.h b/inc/profiles/ac3.h
deleted file mode 100644
index 1d1ccf2..0000000
--- a/inc/profiles/ac3.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * File: profiles_ac3.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:04
- */
-
-#ifndef _PROFILES_AC3_H
-#define _PROFILES_AC3_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_AC3; ///< DLNA AC3
-
-class cAC3Profiler : public cDLNAProfiler, public cAudioProfiler {
-public:
- virtual DLNAProfile* probeDLNAProfile(AVFormatContext* FormatCtx);
- virtual AudioPortionProfile probeAudioProfile(AVFormatContext* FormatCtx);
-};
-
-extern cAC3Profiler AC3Profiler;
-
-#endif /* _PROFILES_AC3_H */
-
diff --git a/inc/profiles/amr.h b/inc/profiles/amr.h
deleted file mode 100644
index 73cc9ee..0000000
--- a/inc/profiles/amr.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * File: profiles_amr.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:05
- */
-
-#ifndef _PROFILES_AMR_H
-#define _PROFILES_AMR_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_AMR_3GPP; ///< AMR 3GPP, cell phones
-extern DLNAProfile DLNA_PROFILE_AMR_WBPlus; ///< AMR WB+
-
-#endif /* _PROFILES_AMR_H */
-
diff --git a/inc/profiles/atrac3plus.h b/inc/profiles/atrac3plus.h
deleted file mode 100644
index 64f7c15..0000000
--- a/inc/profiles/atrac3plus.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * File: profiles_atrac3plus.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:06
- */
-
-#ifndef _PROFILES_ATRAC3PLUS_H
-#define _PROFILES_ATRAC3PLUS_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_ATRAC3Plus; ///< Atrac 3+
-
-#endif /* _PROFILES_ATRAC3PLUS_H */
-
diff --git a/inc/profiles/container.h b/inc/profiles/container.h
deleted file mode 100644
index 26cec8e..0000000
--- a/inc/profiles/container.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * File: container.h
- * Author: savop
- *
- * Created on 8. Januar 2010, 10:45
- */
-
-#ifndef _CONTAINER_H
-#define _CONTAINER_H
-
-#include "profile_data.h"
-
-extern "C" {
-#include <libavcodec/avcodec.h>
-#include <libavformat/avformat.h>
-}
-
-class cContainerDetector {
-public:
- static VideoContainerProfile detect(AVFormatContext* Ctx);
-private:
- /**
- * MPEG1
- */
- static VideoContainerProfile detectMPEG1Container(AVFormatContext* Ctx);
- /**
- * MPEG2-PS
- * MPEG2-TS
- * MPEG2-TS-DLNA
- * MPEG2-TS-DLNA-T
- */
- static VideoContainerProfile detectMPEG2Container(AVFormatContext* Ctx);
- /**
- * 3GPP
- * MP4
- */
- static VideoContainerProfile detectMP4Container(AVFormatContext* Ctx);
-#ifdef WITH_WINDOWS_MEDIA
- /**
- * ASF
- */
- static VideoContainerProfile detectWMFContainer(AVFormatContext* Ctx);
-#endif
-};
-
-#endif /* _CONTAINER_H */
-
diff --git a/inc/profiles/jpeg.h b/inc/profiles/jpeg.h
deleted file mode 100644
index 42d2420..0000000
--- a/inc/profiles/jpeg.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * File: profiles_jpeg.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 12:59
- */
-
-#ifndef _PROFILES_JPEG_H
-#define _PROFILES_JPEG_H
-
-#include "profile_data.h"
-
-/* Images */
-extern DLNAProfile DLNA_PROFILE_JPEG_SM; ///< JPEG small resolution
-extern DLNAProfile DLNA_PROFILE_JPEG_MED; ///< JPEG medium resolution
-extern DLNAProfile DLNA_PROFILE_JPEG_LRG; ///< JPEG high resolution
-
-/* Icons */
-extern DLNAIconProfile DLNA_ICON_JEPG_TN; ///< DLNA jpeg thumbnail profile of images
-extern DLNAIconProfile DLNA_ICON_JPEG_SM_24; ///< DLNA icon profile of small jpeg images
-extern DLNAIconProfile DLNA_ICON_JPEG_LRG_24; ///< DLNA icon profile of large jpeg images
-
-#endif /* _PROFILES_JPEG_H */
-
diff --git a/inc/profiles/lpcm.h b/inc/profiles/lpcm.h
deleted file mode 100644
index 0643b77..0000000
--- a/inc/profiles/lpcm.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * File: profiles_lpcm.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:07
- */
-
-#ifndef _PROFILES_LPCM_H
-#define _PROFILES_LPCM_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_LPCM; ///< LPCM Audio
-
-#endif /* _PROFILES_LPCM_H */
-
diff --git a/inc/profiles/mpa.h b/inc/profiles/mpa.h
deleted file mode 100644
index 9110bc0..0000000
--- a/inc/profiles/mpa.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * File: profiles_mp3.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:08
- */
-
-#ifndef _PROFILES_MP3_H
-#define _PROFILES_MP3_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_MP3; ///< DLNA MP3
-extern DLNAProfile DLNA_PROFILE_MP3X; ///< MP3x
-
-class cMPEGAudioProfiler : public cDLNAProfiler, public cAudioProfiler {
-public:
- virtual AudioPortionProfile probeAudioProfile(AVFormatContext* FormatCtx);
- virtual DLNAProfile* probeDLNAProfile(AVFormatContext* FormatCtx);
-};
-
-extern cMPEGAudioProfiler MPEGAudioProfiler;
-
-#endif /* _PROFILES_MP3_H */
-
diff --git a/inc/profiles/mpeg1.h b/inc/profiles/mpeg1.h
deleted file mode 100644
index 7e7637e..0000000
--- a/inc/profiles/mpeg1.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * File: profiles_mpeg1.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:34
- */
-
-#ifndef _PROFILES_MPEG1_H
-#define _PROFILES_MPEG1_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_MPEG1; ///< MPEG 1
-
-#endif /* _PROFILES_MPEG1_H */
-
diff --git a/inc/profiles/mpeg2.h b/inc/profiles/mpeg2.h
deleted file mode 100644
index 6abbbb5..0000000
--- a/inc/profiles/mpeg2.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * File: profiles_mpeg2.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:35
- */
-
-#ifndef _PROFILES_MPEG2_H
-#define _PROFILES_MPEG2_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_MPEG_PS_NTSC; ///< MPEG 2 PS NTSC
-extern DLNAProfile DLNA_PROFILE_MPEG_PS_NTSC_XAC3; ///< MPEG 2 PS NTSC AC3
-extern DLNAProfile DLNA_PROFILE_MPEG_PS_PAL; ///< MPEG 2 PS PAL
-extern DLNAProfile DLNA_PROFILE_MPEG_PS_PAL_XAC3; ///< MPEG 2 PS PAL AC3
-
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA; ///< MPEG 2 TS North America
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_T; ///< MPEG 2 TS North America with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_ISO; ///< MPEG 2 TS North America without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA; ///< MPEG 2 TS North America HD
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_T; ///< MPEG 2 TS North America with time stamp HD
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_ISO; ///< MPEG 2 TS North America without time stamp HD
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3; ///< MPEG 2 TS North America AC3
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_T; ///< MPEG 2 TS North America AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_NA_XAC3_ISO; ///< MPEG 2 TS North America AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3; ///< MPEG 2 TS North America AC3 HD
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_T; ///< MPEG 2 TS North America AC3 with time stamp HD
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_NA_XAC3_ISO; ///< MPEG 2 TS North America AC3 without time stamp HD
-
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU; ///< MPEG 2 TS Europe
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU_T; ///< MPEG 2 TS Europe with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_EU_ISO; ///< MPEG 2 TS Europe without time stamp
-
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO; ///< MPEG 2 TS Korea
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_T; ///< MPEG 2 TS Korea with time stamp
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_ISO; ///< MPEG 2 TS Korea without time stamp
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO; ///< MPEG 2 TS Korea HD
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_T; ///< MPEG 2 TS Korea with time stamp HD
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_ISO; ///< MPEG 2 TS Korea without time stamp HD
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3; ///< MPEG 2 TS Korea AC3
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3_T; ///< MPEG 2 TS Korea AC3 with time stamp
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_SD_KO_XAC3_ISO; ///< MPEG 2 TS Korea AC3 without time stamp
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3; ///< MPEG 2 TS Korea AC3 HD
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3_T; ///< MPEG 2 TS Korea AC3 with time stamp HD
-//extern DLNAProfile DLNA_PROFILE_MPEG_TS_HD_KO_XAC3_ISO; ///< MPEG 2 TS Korea AC3 without time stamp HD
-
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC; ///< Low Level with AAC Audio
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC_T; ///< Low level with AAC Audio with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG_TS_MP_LL_AAC_ISO; ///< Low level with AAC Audio without time stamp
-
-//extern DLNAProfile DLNA_PROFILE_MPEG_ES_PAL; ///< PAL ES over RTP
-//extern DLNAProfile DLNA_PROFILE_MPEG_ES_NTSC; ///< NTSC ES over RTP
-//extern DLNAProfile DLNA_PROFILE_MPEG_ES_PAL_XAC3; ///< PAL AC3 ES over RTP
-//extern DLNAProfile DLNA_PROFILE_MPEG_ES_NTSC_XAC3; ///< NTSC AC3 ES over RTP
-
-class cMPEG2Profiler : public cDLNAProfiler, public cVideoProfiler, public cAudioProfiler {
-public:
- virtual VideoContainerProfile probeContainerProfile(AVFormatContext* FormatCtx);
- virtual VideoPortionProfile probeVideoProfile(AVFormatContext* FormatCtx);
- virtual AudioPortionProfile probeAudioProfile(AVFormatContext* FormatCtx);
- virtual DLNAProfile* probeDLNAProfile(AVFormatContext* FormatCtx);
-};
-
-extern cMPEG2Profiler MPEG2Profiler;
-
-#endif /* _PROFILES_MPEG2_H */
-
diff --git a/inc/profiles/mpeg4_p10.h b/inc/profiles/mpeg4_p10.h
deleted file mode 100644
index f58ac43..0000000
--- a/inc/profiles/mpeg4_p10.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * File: profiles_mpeg4_p10.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:38
- */
-
-#ifndef _PROFILES_MPEG4_P10_H
-#define _PROFILES_MPEG4_P10_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5; ///< AVC main profile AAC 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5_T; ///< AVC main profile AAC 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_MULT5_ISO; ///< AVC main profile AAC 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2; ///< AVC main profile HEAAC L2
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2_T; ///< AVC main profile HEAAC L2 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_HEAAC_L2_ISO; ///< AVC main profile HEAAC L2 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3; ///< AVC main profile MP3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3_T; ///< AVC main profile MP3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_MPEG1_L3_ISO; ///< AVC main profile MP3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3; ///< AVC main profile AC3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3_T; ///< AVC main profile AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AC3_ISO; ///< AVC main profile AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP; ///< AVC main profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_T; ///< AVC main profile AAC LTP with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_ISO; ///< AVC main profile AAC LTP without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5; ///< AVC main profile AAC LTP 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5_T; ///< AVC main profile AAC LTP 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT5_ISO; ///< AVC main profile AAC LTP 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7; ///< AVC main profile AAC LTP 7.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7_T; ///< AVC main profile AAC LTP 7.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_AAC_LTP_MULT7_ISO; ///< AVC main profile AAC LTP 7.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC; ///< AVC main profile BSAC
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC_T; ///< AVC main profile BSAC with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_SD_BSAC_ISO; ///< AVC main profile BSAC without time stamp
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_MULT5; ///< AVC main profile MP4 AAC 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_HEAAC_L2; ///< AVC main profile MP4 HEAAC L2
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_MPEG1_L3; ///< AVC main profile MP4 MP3
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AC3; ///< AVC main profile MP4 AC3
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP; ///< AVC main profile MP4 AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP_MULT5; ///< AVC main profile MP4 AAC LTP 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_AAC_LTP_MULT7; ///< AVC main profile MP4 AAC LTP 7.1
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_ATRAC3plus; ///< AVC main profile MP4 ATRAC3+
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_MP_SD_BSAC; ///< AVC main profile MP4 BSAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3L_SD_AAC; ///< AVC baseline profile MP4 AAC
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3L_SD_HEAAC; ///< AVC baseline profile MP4 HEAAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BP_L3_SD_AAC; ///< AVC baseline profile standard MP4 AAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5; ///< AVC CIF30 baseline profile AAC 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5_T; ///< AVC CIF30 baseline profile AAC 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_MULT5_ISO; ///< AVC CIF30 baseline profile AAC 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2; ///< AVC CIF30 baseline profile HEAAC L2
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2_T; ///< AVC CIF30 baseline profile HEAAC L2 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_HEAAC_L2_ISO; ///< AVC CIF30 baseline profile HEAAC L2 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3; ///< AVC CIF30 baseline profile MP3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3_T; ///< AVC CIF30 baseline profile MP3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_MPEG1_L3_ISO; ///< AVC CIF30 baseline profile MP3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3; ///< AVC CIF30 baseline profile AC3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3_T; ///< AVC CIF30 baseline profile AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AC3_ISO; ///< AVC CIF30 baseline profile AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP; ///< AVC CIF30 baseline profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_T; ///< AVC CIF30 baseline profile AAC LTP with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_ISO; ///< AVC CIF30 baseline profile AAC LTP without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5; ///< AVC CIF30 baseline profile AAC LTP 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5_T; ///< AVC CIF30 baseline profile AAC LTP 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_LTP_MULT5_ISO; ///< AVC CIF30 baseline profile AAC LTP 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940; ///< AVC CIF30 baseline profile AAC 940
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940_T; ///< AVC CIF30 baseline profile AAC 940 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF30_AAC_940_ISO; ///< AVC CIF30 baseline profile AAC 940 without time stamp
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_MULT5; ///< AVC CIF30 baseline profile MP4 AAC 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_HEAAC_L2; ///< AVC CIF30 baseline profile MP4 HEAAC L2
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_MPEG1_L3; ///< AVC CIF30 baseline profile MP4 MP3
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AC3; ///< AVC CIF30 baseline profile MP4 AC3
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_LTP; ///< AVC CIF30 baseline profile MP4 AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_AAC_LTP_MULT5; ///< AVC CIF30 baseline profile MP4 AAC LTP 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_BSAC; ///< AVC CIF30 baseline profile BSAC
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF30_BSAC_MULT5; ///< AVC CIF30 baseline profile BSAC 5.1
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L2_CIF30_AAC; ///< AVC CIF30 baseline profile L2 AAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_HEAAC; ///< AVC CIF15 baseline profile HEAAC
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AMR; ///< AVC CIF15 baseline profile AMR
-
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5; ///< AVC main profile AAC 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5_T; ///< AVC main profile AAC 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_MULT5_ISO; ///< AVC main profile AAC 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2; ///< AVC main profile HEAAC L2
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2_T; ///< AVC main profile HEAAC L2 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_HEAAC_L2_ISO; ///< AVC main profile HEAAC L2 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3; ///< AVC main profile MP3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3_T; ///< AVC main profile MP3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_MPEG1_L3_ISO; ///< AVC main profile MP3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3; ///< AVC main profile AC3
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3_T; ///< AVC main profile AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AC3_ISO; ///< AVC main profile AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC; ///< AVC main profile AAC
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_T; ///< AVC main profile AAC with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_ISO; ///< AVC main profile AAC without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP; ///< AVC main profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_T; ///< AVC main profile AAC LTP with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_ISO; ///< AVC main profile AAC LTP without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5; ///< AVC main profile AAC LTP 5.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5_T; ///< AVC main profile AAC LTP 5.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT5_ISO; ///< AVC main prpfile AAC LTP 5.1 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7; ///< AVC main profile AAC LTP 7.1
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7_T; ///< AVC main profile AAC LTP 7.1 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_MP_HD_AAC_LTP_MULT7_ISO; ///< AVC main prpfile AAC LTP 7.1 without time stamp
-
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC; ///< AVC baseline profile AAC
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_T; ///< AVC baseline profile AAC with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_ISO; ///< AVC baseline profile AAC without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540; ///< AVC baseline profile AAC 540
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540_T; ///< AVC baseline profile AAC 540 with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_540_ISO; ///< AVC baseline profile AAC 540 without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP; ///< AVC baseline profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP_T; ///< AVC baseline profile AAC LTP with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_AAC_LTP_IS0; ///< AVC baseline profile AAC LTP without time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC; ///< AVC baseline profile BSAC
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC_T; ///< AVC baseline profile BSAC with time stamp
-extern DLNAProfile DLNA_PROFILE_AVC_TS_BL_CIF15_BSAC_ISO; ///< AVC baseline profile BSAC without time stamp
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC; ///< AVC baseline profile AAC
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_520; ///< AVC baseline profile AAC 520
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_LTP; ///< AVC baseline profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_AAC_LTP_520; ///< AVC baseline profile AAC LTP 520
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_CIF15_BSAC; ///< AVC baseline profile BSAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L12_CIF15_HEAAC; ///< AVC baseline profile HEAAC
-
-extern DLNAProfile DLNA_PROFILE_AVC_MP4_BL_L1B_QCIF15_HEAAC; ///< AVC baseline profile QCIF15
-
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_CIF30_AMR_WBplus; ///< AVC 3GPP baseline profile CIF30 AMR WB+
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_CIF15_AMR_WBplus; ///< AVC 3GPP baseline profile CIF15 AMR WB+
-
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AAC; ///< AVC 3GPP baseline profile QCIF15 AAC
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AAC_LTP; ///< AVC 3GPP baseline profile QCIF15 AAC LTP
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_HEAAC; ///< AVC 3GPP baseline profile QCIF15 HEAAC
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AMR_WBplus; ///< AVC 3GPP baseline profile QCIF15 AMR WB+
-extern DLNAProfile DLNA_PROFILE_AVC_3GPP_BL_QCIF15_AMR; ///< AVC 3GPP baseline profile QCIF15 AMR
-
-extern DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU; ///< DLNA Profile for HD DVB Television broadcasts
-extern DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU_T;
-extern DLNAProfile DLNA_PROFILE_AVC_TS_HD_EU_ISO; ///< DLNA Profile for HD DVB Television broadcasts without timestamp
-
-extern DLNAVideoMapping MPEG4_P10_VIDEO_MAP[];
-
-#endif /* _PROFILES_MPEG4_P10_H */
-
diff --git a/inc/profiles/mpeg4_p2.h b/inc/profiles/mpeg4_p2.h
deleted file mode 100644
index 7437afd..0000000
--- a/inc/profiles/mpeg4_p2.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * File: profiles_mpeg4_p2.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:36
- */
-
-#ifndef _PROFILES_MPEG4_P2_H
-#define _PROFILES_MPEG4_P2_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC; ///< MPEG 4 Part 2 Simple Profile AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_HEAAC; ///< MPEG 4 Part 2 Simple Profile HEAAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_ATRAC3plus; ///< MPEG 4 Part 2 Simple Profile ATRAC3+
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_AAC_LTP; ///< MPEG 4 Part 2 Simple Profile AAC LTP
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AAC; ///< MPEG 4 Part 2 Simple Profile L2 AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_L2_AMR; ///< MPEG 4 Part 2 Simple Profile L2 AMR
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_AAC; ///< MPEG 4 Part 2 Simple Profile MP4 VGA AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_SP_VGA_HEAAC; ///< MPEG 4 Part 2 Simple Profile MP4 VGA HEAAC
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_AAC; ///< MPEG 4 Part 2 Advanced Simple Profile AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC; ///< MPEG 4 Part 2 Advanded Simple Profile HEAAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_HEAAC_MULT5; ///< MPEG 4 Part 2 Advanced Simple Profile HEAAC 5.1
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_ATRAC3plus; ///< MPEG 4 Part 2 Advanced Simple Profile Atrac3+
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_AAC; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 HEAAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_HEAAC_MULT5; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 HEAAC 5.1
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L5_SO_G726; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 G726
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_AAC; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 HEAAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_HEAAC_MULT5; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 HEAAC 5.1
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_MP4_ASP_L4_SO_G726; ///< MPEG 4 Part 2 Advanced Simple Profile Simple Object < Level 5 G726
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC; ///< MPEG 4 Part 2 Simple Profile AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_T; ///< MPEG 4 Part 2 Simple Profile AAC with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AAC_ISO; ///< MPEG 4 Part 2 Simple Profile AAC without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3; ///< MPEG 4 Part 2 Simple Profile MP3
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_T; ///< MPEG 4 Part 2 Simple Profile MP3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG1_L3_ISO; ///< MPEG 4 Part 2 Simple Profile MP3 without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3; ///< MPEG 4 Part 2 Simple Profile AC3
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_T; ///< MPEG 4 Part 2 Simple Profile AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_AC3_ISO; ///< MPEG 4 Part 2 Simple Profile AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2; ///< MPEG 4 Part 2 Simple Profile MP2 1/2
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_T; ///< MPEG 4 Part 2 Simple Profile MP2 1/2 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_SP_MPEG2_L2_IS0; ///< MPEG 4 Part 2 Simple Profile MP2 1/2 without time stamp
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3; ///< MPEG 4 Part 2 Core AC3
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_T; ///< MPEG 4 Part 2 Core AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_AC3_ISO; ///< MPEG 4 Part 2 Core AC3 without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2; ///< MPEG 4 Part 2 Core MPEG 2 1/2
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_T; ///< MPEG 4 Part 2 Core MPEG 2 1/2 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_CO_MPEG2_L2_ISO; ///< MPEG 4 Part 2 Core MPEG 2 1/2 without time stamp
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC; ///< MPEG 4 Part 2 Advanced Simple Profile AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_T; ///< MPEG 4 Part 2 Advanced Simple Profile AAC with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AAC_ISO; ///< MPEG 4 Part 2 Advanced Simple Profile AAC without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3; ///< MPEG 4 Part 2 Advanced Simple Profile MP3
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_T; ///< MPEG 4 Part 2 Advanced Simple Profile MP3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_MPEG1_L3_ISO; ///< MPEG 4 Part 2 Advanced Simple Profile MP3 without time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3; ///< MPEG 4 Part 2 Advanced Simple Profile AC3
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_T; ///< MPEG 4 Part 2 Advanced Simple Profile AC3 with time stamp
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_TS_ASP_AC3_ISO; ///< MPEG 4 Part 2 Advanced Simple Profile AC3 without time stamp
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_SP_G726; ///< ASF Simple Profile G726
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_ASP_L5_SO_G726; ///< ASF Advanced Simple Prpfile G726 < Level 5
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_ASF_ASP_L4_SO_G726; ///< ASF Advanced Simple Prpfile G726 < Level 4
-
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC; ///< H263 Profile 0 Level 10 AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_H263_MP4_P0_L10_AAC_LTP; ///< H263 Profile 0 Level 10 AAC LTP
-extern DLNAProfile DLNA_PROFILE_MPEG4_H263_3GPP_P0_L10_AMR_WBplus; ///< H263 3GPP Profile 0 Level 10 AMR-WB+
-extern DLNAProfile DLNA_PROFILE_MPEG4_H263_3GPP_P3_L10_AMR; ///< H263 Profile 3 Level 10 AMR
-
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AAC; ///< MPEG 4 Part 2 3GPP Simple Profile Level 0b AAC
-extern DLNAProfile DLNA_PROFILE_MPEG4_P2_3GPP_SP_L0B_AMR; ///< MPEG 4 Part 2 3GPP Simple Profile Level 0b AMR
-
-extern DLNAVideoMapping MPEG4_P2_VIDEO_MAP[];
-#endif /* _PROFILES_MPEG4_P2_H */
-
diff --git a/inc/profiles/png.h b/inc/profiles/png.h
deleted file mode 100644
index 69d4bcd..0000000
--- a/inc/profiles/png.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * File: profiles_png.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:01
- */
-
-#ifndef _PROFILES_PNG_H
-#define _PROFILES_PNG_H
-
-#include "profile_data.h"
-
-/* Images */
-extern DLNAProfile DLNA_PROFILE_PNG_LRG; ///< PNG high resolution
-
-/* Icons */
-extern DLNAIconProfile DLNA_ICON_PNG_SM_24A; ///< DLNA icon profile of small png images
-extern DLNAIconProfile DLNA_ICON_PNG_LRG_24A; ///< DLNA icon profile of large png images
-extern DLNAIconProfile DLNA_ICON_PNG_TN; ///< DLNA png thumbnail profile of images
-
-#endif /* _PROFILES_PNG_H */
-
diff --git a/inc/profiles/profile_data.h b/inc/profiles/profile_data.h
deleted file mode 100644
index 7ae01d2..0000000
--- a/inc/profiles/profile_data.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * File: profile_data.h
- * Author: savop
- *
- * Created on 5. Januar 2010, 12:27
- */
-
-#ifndef _PROFILE_DATA_H
-#define _PROFILE_DATA_H
-
-#ifdef __cplusplus
-#include <vdr/tools.h>
-extern "C" {
-#include <libavformat/avformat.h>
-#include <libavcodec/avcodec.h>
-}
-#endif
-
-#define MAX_BITRATES 32 ///< maximum amount of different CBR bitrates
-#define MAX_CHANNEL_LAYOUTS 20 ///< maximum amount of different channel layout modes
-#define MAX_SAMPLE_RATES 16 ///< maximum amount of different sampling rates
-
-#define Kbps(x) x*1000 ///< Kbit per second
-#define Mbps(x) x*1000*1000 ///< Mbit per second
-#define KHz(x) x*1000
-#define MHz(x) x*1000*1000
-
-#define CHANNEL_LAYOUT_10 CH_LAYOUT_MONO ///< 1/0 1
-#define CHANNEL_LAYOUT_10_1 (CHANNEL_LAYOUT_10|CH_LOW_FREQUENCY)///< 1/0 1.1 (incl. LFE)
-#define CHANNEL_LAYOUT_20 CH_LAYOUT_STEREO ///< 2/0 2
-#define CHANNEL_LAYOUT_20_1 (CHANNEL_LAYOUT_20|CH_LOW_FREQUENCY)///< 2/0 2.1 (incl. LFE)
-#define CHANNEL_LAYOUT_21 (CH_LAYOUT_STEREO|CH_BACK_CENTER) ///< 2/1 3
-#define CHANNEL_LAYOUT_21_1 (CHANNEL_LAYOUT_21|CH_LOW_FREQUENCY)///< 2/1 3.1 (incl. LFE)
-#define CHANNEL_LAYOUT_22 CH_LAYOUT_QUAD ///< 2/2 4
-#define CHANNEL_LAYOUT_22_1 (CHANNEL_LAYOUT_22|CH_LOW_FREQUENCY)///< 2/2 4.1 (incl. LFE)
-#define CHANNEL_LAYOUT_30 CH_LAYOUT_SURROUND ///< 3/0 3
-#define CHANNEL_LAYOUT_30_1 (CHANNEL_LAYOUT_30|CH_LOW_FREQUENCY)///< 3/0 3.1 (incl. LFE)
-#define CHANNEL_LAYOUT_31 (CH_LAYOUT_SURROUND|CH_BACK_CENTER) ///< 3/1 4
-#define CHANNEL_LAYOUT_31_1 (CHANNEL_LAYOUT_31|CH_LOW_FREQUENCY)///< 3/1 4.1 (incl. LFE)
-#define CHANNEL_LAYOUT_32 CH_LAYOUT_5POINT0 ///< 3/2 5
-#define CHANNEL_LAYOUT_5_1 CH_LAYOUT_5POINT1 ///< 5.1 5.1 (incl. LFE)
-#define CHANNEL_LAYOUT_7_1 CH_LAYOUT_7POINT1 ///< 7.1 7.1 (incl. LFE)
-
-/**
- * The combination of DLNA profile ID and the corresponding mime type
- *
- * This complies with the DLNA media format guidelines. Though this is very
- * similar to the profile structure of libdlna, it comes without the additional
- * label field as it seams to be not needed.
- */
-struct DLNAProfile {
- const char* ID; ///< the DLNA profile ID
- const char* mime; ///< the mime type of the resource
-};
-
-/**
- * The DLNA profile for a icon image
- *
- * This complies with the DLNA media format guidelines. It contains a valid
- * mime type, the resolution of the image and the corresponding bit depth
- */
-struct DLNAIconProfile {
- const char* mime; ///< the mime type of the image
- unsigned short width; ///< image width in pixel
- unsigned short height; ///< image height in pixel
- unsigned char bitDepth; ///< bit depth in bits per pixel
-};
-
-enum VideoContainerProfile {
- DLNA_VCP_UNKNOWN=-1,
- DLNA_VCP_MPEG1=0,
- DLNA_VCP_MPEG2_PS,
- DLNA_VCP_MPEG2_TS,
- DLNA_VCP_MPEG2_TS_T,
- DLNA_VCP_MPEG2_TS_ISO,
- DLNA_VCP_MP4,
- DLNA_VCP_3GPP,
- DLNA_VCP_ASF,
-};
-
-enum VideoPortionProfile {
- DLNA_VPP_UNKNOWN=-1,
- DLNA_VPP_MPEG1=0,
- DLNA_VPP_MPEG2_PAL_SD,
- DLNA_VPP_MPEG2_PAL_HD,
- DLNA_VPP_MPEG2_NTSC_SD,
- DLNA_VPP_MPEG2_NTSC_HD,
- DLNA_VPP_MPEG2_SP,
- DLNA_VPP_MPEG2_MP_LL,
- DLNA_VPP_MPEG4_P2_SP_L0B,
- DLNA_VPP_MPEG4_P2_SP_L2,
- DLNA_VPP_MPEG4_P2_SP_L3,
- DLNA_VPP_MPEG4_P2_SP_L3_VGA,
- DLNA_VPP_MPEG4_P2_ASP_L5,
- DLNA_VPP_MPEG4_P2_ASP_L5_SO,
- DLNA_VPP_MPEG4_P2_ASP_L4_SO,
- DLNA_VPP_MPEG4_P2_H263_P0_L10,
- DLNA_VPP_MPEG4_P2_H263_P3_L10,
- DLNA_VPP_MPEG4_P2_CO,
- DLNA_VPP_MPEG4_P10_MP_SD,
- DLNA_VPP_MPEG4_P10_MP_HD,
- DLNA_VPP_MPEG4_P10_BL_L3_SD,
- DLNA_VPP_MPEG4_P10_BL_L3L_SD,
- DLNA_VPP_MPEG4_P10_BL_CIF30,
- DLNA_VPP_MPEG4_P10_BL_L2_CIF30,
- DLNA_VPP_MPEG4_P10_BL_CIF15,
- DLNA_VPP_MPEG4_P10_BL_L12_CIF15,
- DLNA_VPP_MPEG4_P10_BL_L1B_QCIF
-};
-
-enum AudioPortionProfile {
- DLNA_APP_UNKNOWN=-1,
- DLNA_APP_LPCM=0,
- DLNA_APP_MPEG1_L1,
- DLNA_APP_MPEG1_L2,
- DLNA_APP_MPEG1_L3,
- DLNA_APP_MPEG1_L3X,
- DLNA_APP_MPEG2_L2, //TODO: Distinguish MPEG1 oder MPEG2 audio with FFMPEG
- DLNA_APP_AAC,
- DLNA_APP_AAC_MULT5,
- DLNA_APP_AAC_LTP,
- DLNA_APP_AAC_LTP_MULT5,
- DLNA_APP_AAC_LTP_MULT7,
- DLNA_APP_HEAAC,
- DLNA_APP_HEAAC_L2,
- DLNA_APP_HEAAC_MULT5,
- DLNA_APP_ATRAC3plus,
- DLNA_APP_AC3,
- DLNA_APP_XAC3,
- DLNA_APP_G726,
- DLNA_APP_AMR,
- DLNA_APP_AMR_WBplus,
- DLNA_APP_BL_QCIF15,
- DLNA_APP_BSAC,
- DLNA_APP_BSAC_MULT5
-};
-
-struct DLNAVideoMapping {
- DLNAProfile* Profile;
- VideoContainerProfile VideoContainer;
- VideoPortionProfile VideoProfile;
- AudioPortionProfile AudioProfile;
-};
-
-struct AcceptedBitrates {
- /**
- * <b>true</b> if VBR, <b>false</b> otherwise
- */
- bool VBR;
- /**
- * list of valid bitrates.
- *
- * if VBR is true, the array must contain exactly two items.
- * The first item is the minimum and the second item is the maximum bitrate
- *
- * The bitrate unit is bps. So, if you have 15bps, it is 15000000bps
- */
- int bitrates[MAX_BITRATES];
-};
-
-struct AcceptedResolution {
- /**
- * Screen width
- */
- int width;
- /**
- * Screen height
- */
- int height;
- /**
- * Frames per second
- *
- * this value may contain a higher value which is divided by the multiplier
- * given in <b>multiplier</b>
- */
- int fps;
- /**
- * Multiplier for calculating FPS
- *
- * The multiplier typically contains values like 1 or 1001 to calculate
- * the exact frame rate of 29,97 FPS in most NTSC systems
- */
- int multiplier;
-};
-
-struct AcceptedAudioChannels {
- int max_channels;
- int64_t layouts[MAX_CHANNEL_LAYOUTS];
- bool supportsLFE;
-};
-
-struct AcceptedSamplingRates {
- int rates[MAX_SAMPLE_RATES];
-};
-
-class cDLNAProfiler {
-public:
- virtual DLNAProfile* probeDLNAProfile(AVFormatContext* FormatCtx) = 0;
-};
-
-class cAudioProfiler {
-public:
- virtual AudioPortionProfile probeAudioProfile(AVFormatContext* FormatCtx) = 0;
-};
-
-class cVideoProfiler {
-public:
- virtual VideoPortionProfile probeVideoProfile(AVFormatContext* FormatCtx) = 0;
- virtual VideoContainerProfile probeContainerProfile(AVFormatContext* FormatCtx) = 0;
-};
-
-#endif /* _PROFILE_DATA_H */
-
diff --git a/inc/profiles/wma.h b/inc/profiles/wma.h
deleted file mode 100644
index 80e25ec..0000000
--- a/inc/profiles/wma.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * File: profiles_wma.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 13:32
- */
-
-#ifndef _PROFILES_WMA_H
-#define _PROFILES_WMA_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_WMABASE; ///< WMA with less than 193Kbit/s
-extern DLNAProfile DLNA_PROFILE_WMAFULL; ///< WMA
-extern DLNAProfile DLNA_PROFILE_WMAPRO; ///< WMA Professional
-
-#endif /* _PROFILES_WMA_H */
-
diff --git a/inc/profiles/wmv9.h b/inc/profiles/wmv9.h
deleted file mode 100644
index fd69499..0000000
--- a/inc/profiles/wmv9.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * File: profiles_wmv9.h
- * Author: savop
- *
- * Created on 7. Dezember 2009, 14:53
- */
-
-#ifndef _PROFILES_WMV9_H
-#define _PROFILES_WMV9_H
-
-#include "profile_data.h"
-
-extern DLNAProfile DLNA_PROFILE_WMVMED_BASE; ///< WMV medium resolution baseline audio
-extern DLNAProfile DLNA_PROFILE_WMVMED_FULL; ///< WMV medium resolution full audio
-extern DLNAProfile DLNA_PROFILE_WMVMED_PRO; ///< WMV medium resolution professional audio
-extern DLNAProfile DLNA_PROFILE_WMVHIGH_FULL; ///< WMV high resolution full audio
-extern DLNAProfile DLNA_PROFILE_WMVHIGH_PRO; ///< WMV high resolution professional audio
-extern DLNAProfile DLNA_PROFILE_WMVHM_BASE; ///< WMV HighMAT profile
-extern DLNAProfile DLNA_PROFILE_WMVSPLL_BASE; ///< WMV Low resolution simple profile low level
-extern DLNAProfile DLNA_PROFILE_WMVSPML_BASE; ///< WMV Low resolution simple profile medium level
-extern DLNAProfile DLNA_PROFILE_WMVSPML_MP3; ///< WMV Low resolution simple profile medium level MP3 audio
-
-#endif /* _PROFILES_WMV9_H */
-
diff --git a/inc/recplayer.h b/inc/recplayer.h
deleted file mode 100644
index 376ca3c..0000000
--- a/inc/recplayer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * File: recplayer.h
- * Author: savop
- *
- * Created on 8. Juni 2009, 11:57
- */
-
-#ifndef _RECPLAYER_H
-#define _RECPLAYER_H
-
-#include "../common.h"
-#include "filehandle.h"
-#include <vdr/recording.h>
-
-/**
- * The recording player
- *
- * This class provides the ability to play VDR records. The difference between
- * usual files and VDR recording files is, that recordings are possibly splitted
- * into multiple files. The class will scan those files and tries to dynamically
- * navigate in them like it would do, if it is a single file.
- *
- */
-class cRecordingPlayer : public cFileHandle {
-public:
- /**
- * Get a new instance of a recording player
- *
- * This returns a new instance of a recording player which plays the
- * specified VDR recording.
- *
- * @param Recording the recording to play
- * @return the new instance of the recording player
- */
- static cRecordingPlayer *newInstance(cRecording *Recording);
- virtual ~cRecordingPlayer();
- virtual void open(UpnpOpenFileMode mode);
- virtual int read(char* buf, size_t buflen);
- virtual int write(char* buf, size_t buflen);
- virtual int seek(off_t offset, int origin);
- virtual void close();
-private:
- void scanLastOffsets();
- cRecordingPlayer(cRecording *Recording);
- off_t* mLastOffsets;
- int mLastFileNumber;
- cRecording *mRecording;
- cFileName *mRecordingFile;
- cUnbufferedFile *mCurrentFile;
-};
-
-#endif /* _RECPLAYER_H */
-
diff --git a/inc/resources.h b/inc/resources.h
deleted file mode 100644
index a655de8..0000000
--- a/inc/resources.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * File: resources.h
- * Author: savop
- *
- * Created on 30. September 2009, 15:17
- */
-
-#ifndef _RESOURCES_H
-#define _RESOURCES_H
-
-#include "database.h"
-#include "object.h"
-#include <vdr/channels.h>
-#include <vdr/recording.h>
-
-class cUPnPResourceMediator;
-class cMediaDatabase;
-
-/**
- * UPnP Resource
- *
- * This contains all details about a resource
- */
-class cUPnPResource : public cListObject {
- friend class cUPnPResourceMediator;
- friend class cUPnPResources;
-private:
- unsigned int mResourceID;
- int mResourceType;
- cString mResource;
- cString mDuration;
- cString mResolution;
- cString mProtocolInfo;
- cString mContentType;
- cString mImportURI;
- off64_t mSize;
- unsigned int mBitrate;
- unsigned int mSampleFrequency;
- unsigned int mBitsPerSample;
- unsigned int mNrAudioChannels;
- unsigned int mColorDepth;
- cUPnPResource();
-public:
- /**
- * Get resource ID
- *
- * Gets the resource ID
- *
- * @return the resource ID
- */
- unsigned int getID() const { return this->mResourceID; }
- /**
- * Get the resources
- *
- * Returns the resource. This is in most cases the file name or resource locator
- * where to find the resource
- *
- * @return the resource string
- */
- const char* getResource() const { return this->mResource; }
- /**
- * Get the duration
- *
- * Returns a date time string with the duration of the resource
- *
- * @return the duration of the resource
- */
- const char* getDuration() const { return this->mDuration; }
- /**
- * Get the resolution
- *
- * Returns the resolution string with the pattern width x height in pixels
- *
- * @return the resolution of the resource
- */
- const char* getResolution() const { return this->mResolution; }
- /**
- * Get the protocol info
- *
- * This returns the protocol info field of a resource
- *
- * @return the protocol info string
- */
- const char* getProtocolInfo() const { return this->mProtocolInfo; }
- /**
- * Get the content type
- *
- * Returns the mime type of the content of the resource
- *
- * @return the content type of the resource
- */
- const char* getContentType() const { return this->mContentType; }
- /**
- * Get the import URI
- *
- * This returns the import URI where the resource was located before importing
- * it
- *
- * @return the import URI
- */
- const char* getImportURI() const { return this->mImportURI; }
- /**
- * Get the resource type
- *
- * This returns the resource type of the resource.
- *
- * @return the resource type
- */
- int getResourceType() const { return this->mResourceType; }
- /**
- * Get the file size
- *
- * Returns the file size in bytes of the resource or 0 if its unknown or a
- * stream
- *
- * @return the file size
- */
- off64_t getFileSize() const { return this->mSize; };
- /**
- * Get the last modification
- *
- * This returns the timestamp of the last modification to the file. If it
- * is a stream, then its the current time.
- *
- * @return the timestamp with the last modification of the resource
- */
- time_t getLastModification() const;
- /**
- * Get the bitrate
- *
- * This returns the bitrate of the resource in bits per second.
- *
- * @return the bitrate of the resource
- */
- unsigned int getBitrate() const { return this->mBitrate; }
- /**
- * Get the sample frequency
- *
- * Returns the sample frequency in samples per second.
- *
- * @return the sample frequency of the resource
- */
- unsigned int getSampleFrequency() const { return this->mSampleFrequency; }
- /**
- * Get the bits per sample
- *
- * Returns the number of bits per sample.
- *
- * @return the bits per sample of the resource
- */
- unsigned int getBitsPerSample() const { return this->mBitsPerSample; }
- /**
- * Get number of audio channels
- *
- * Returns the number of audio channels of the audio stream in a video
- *
- * @return the number of audio channels
- */
- unsigned int getNrAudioChannels() const { return this->mNrAudioChannels; }
- /**
- * Get the color depth
- *
- * Returns the color depth of the resource in pits per pixel
- *
- * @return the color depth of the resource
- */
- unsigned int getColorDepth() const { return this->mColorDepth; }
-};
-
-class cUPnPClassObject;
-class cUPnPClassItem;
-class cUPnPClassVideoItem;
-class cUPnPClassVideoBroadcast;
-
-/**
- * The resource manager
- *
- * This manages the resources in an internal cache. It may create a new resource
- * from a channel, a recording or a custom file.
- */
-class cUPnPResources {
-private:
- cHash<cUPnPResource>* mResources;
- static cUPnPResources* mInstance;
- cUPnPResourceMediator* mMediator;
- cSQLiteDatabase* mDatabase;
- cUPnPResources();
-public:
- /**
- * Fill object with its resources
- *
- * This will load all the resources from the database, which are associated
- * to the given object
- *
- * @param Object the object, which shall be filled
- * @return returns
- * - \bc 0, if loading was successful
- * - \bc <0, otherwise
- */
- int getResourcesOfObject(cUPnPClassObject* Object);
- /**
- * Loads all resources from database
- *
- * This loads all resources from the database into the internal cache.
- *
- * @return returns
- * - \bc 0, if loading was successful
- * - \bc <0, otherwise
- */
- int loadResources();
- /*! @copydoc cUPnPResourceMediator::getResource */
- cUPnPResource* getResource(unsigned int ResourceID);
- virtual ~cUPnPResources();
- /**
- * Get the instance of the resource manager
- *
- * This returns the instance of the resource manager.
- *
- * @return the instance of the manager
- */
- static cUPnPResources* getInstance();
- /**
- * Create resource from channel
- *
- * This creates a new resource from the given channel. It determines what
- * kind of video stream it is and further details if available. It stores
- * the resource in the database after creating it.
- *
- * @param Object the videoBroadcast item which holds the resource
- * @param Channel the VDR TV channel
- * @return returns
- * - \bc 0, if loading was successful
- * - \bc <0, otherwise
- */
- int createFromChannel(cUPnPClassVideoBroadcast* Object, cChannel* Channel);
- /**
- * Create resource from recording
- *
- * This creates a new resource from the given recording. It determines what
- * kind of video stream it is and further details if available. It stores
- * the resource in the database after creating it.
- *
- * @param Object the videoItem item which holds the resource
- * @param Recording the VDR TV recording
- * @return returns
- * - \bc 0, if loading was successful
- * - \bc <0, otherwise
- */
- int createFromRecording(cUPnPClassVideoItem* Object, cRecording* Recording);
- /**
- * Create resource from file
- *
- * This creates a new resource from the given file. It determines all available
- * information about the resource by analizing the content. It stores
- * the resource in the database after creating it.
- *
- * @param Object the item which holds the resource
- * @param File the file name
- * @return returns
- * - \bc 0, if loading was successful
- * - \bc <0, otherwise
- */
- int createFromFile(cUPnPClassItem* Object, cString File);
-};
-
-/**
- * The resource mediator
- *
- * This is another mediator which communicates with the database. It manages the
- * resources in the database
- */
-class cUPnPResourceMediator {
- friend class cUPnPResources;
-private:
- cSQLiteDatabase* mDatabase;
- cUPnPResourceMediator();
- unsigned int getNextResourceID();
-public:
- virtual ~cUPnPResourceMediator();
- /**
- * Get a resource by ID
- *
- * This returns a resource by its resource ID
- *
- * @param ResourceID the resource ID of the demanded resource
- * @return the requested resource
- */
- cUPnPResource* getResource(unsigned int ResourceID);
- /**
- * Saves the resource
- *
- * This updates the information in the database with those in the resource
- * object
- *
- * @param Resource the resource which shall be saved
- * @return returns
- * - \bc 0, if saving was successful
- * - \bc <0, if an error occured
- */
- int saveResource(cUPnPClassObject* Object, cUPnPResource* Resource);
- /**
- * Create new resource
- *
- * This creates a new resource and stores the skeleton in the database. The
- * newly created resource will only contain all required information.
- *
- * @param Object the Object which will hold the resource
- * @param ResourceType the type of the resource
- * @param ResourceFile the file or URL, where the resource can be located
- * @param ContentType the mime type of the content
- * @param ProtocolInfo the protocol information of the resource
- * @return the newly created resource
- */
- cUPnPResource* newResource(cUPnPClassObject* Object, int ResourceType, cString ResourceFile, cString ContentType, cString ProtocolInfo);
-};
-
-#endif /* _RESOURCES_H */
-
diff --git a/inc/search.h b/inc/search.h
deleted file mode 100644
index ef162b1..0000000
--- a/inc/search.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * File: search.h
- * Author: savop
- *
- * Created on 27. August 2009, 21:21
- */
-
-#ifndef _SEARCH_H
-#define _SEARCH_H
-
-#include <map>
-#include <vdr/tools.h>
-#include "util.h"
-
-/**
- * Sort criteria
- *
- * This is a structure for sorting objects. It has a certain property and
- * a direction flag.
- */
-struct cSortCrit : public cListObject {
- const char* Property; ///< the Property, which shall be sorted
- bool SortDescending; ///< sort the objects in descending order
-};
-
-typedef std::map<const char*, const char*, strCmp> propertyMap;
-
-/**
- * Web path parser
- *
- * Parses paths which came from the webserver. It splits the path into
- * a section, a certain method and its properties.
- *
- * This can be used to easily determine which file was requested by a client
- */
-class cPathParser {
-private:
- cString mKey;
- propertyMap mProperties;
- int mSection;
- int mMethod;
- bool parsePath(const char* Path, int* Section, int* Method, propertyMap* Properties);
- void pushPropertyKey(const char* Start, const char* End);
- void pushPropertyValue(const char* Start, const char* End);
- void pushMethod(int Method);
- void pushSection(int Section);
- cPathParser();
-public:
- virtual ~cPathParser();
- /**
- * Parses the path
- *
- * This will parse the path and stores the result in the pointers given.
- *
- * @return returns
- * - \bc true, if the parsing was successful
- * - \bc false, otherwise
- */
- static bool parse(
- const char* Path, ///< the path which is parsed
- int* Section, ///< the number of the registered section
- int* Method, ///< the number of the registered method
- propertyMap* Properties ///< the properties found in the path
- );
-};
-
-/**
- * Creates a list with sort criteria
- *
- * This parser creates a list of sort criteria. It parses the sort criteria string
- * from a \em Browse or \em Search request and stores the information in a \c cSortCrit
- * structure.
- */
-class cSortCriteria {
-private:
- cSortCrit* mCurrentCrit;
- cList<cSortCrit>* mCriteriaList;
- bool parseSort(const char* Sort);
- void pushProperty(const char* Property);
- void pushDirection(const char Direction);
- cList<cSortCrit>* getSortList() const { return this->mCriteriaList; }
- cSortCriteria();
-public:
- virtual ~cSortCriteria();
- /**
- * Parses the sort criteria
- *
- * This parses the sort criteria and returns a list with valid criterias
- *
- * @return returns
- * - a list with valid sort criterias
- * - \bc null, otherwise
- */
- static cList<cSortCrit>* parse(
- const char* Sort ///< the string container the sort criteria
- );
-};
-
-/**
- * Parses the filter criteria
- *
- * This parses the filter criteria which comes from a \em Browse or \em Search
- * request.
- */
-class cFilterCriteria {
-private:
- cStringList* mFilterList;
- cFilterCriteria();
- bool parseFilter(const char* Filter);
- void pushProperty(const char* Property);
- void pushAsterisk(const char Asterisk);
- cStringList* getFilterList() const { return this->mFilterList; }
-public:
- virtual ~cFilterCriteria();
- /**
- * Parses the filter criteria
- *
- * This parses the filter criteria. It may be a empty string list, a \bc NULL
- * pointer or a list with properties which shall be shown in the \em DIDL-Lite fragment.
- *
- * @return the stringlist containing the filter
- */
- static cStringList* parse(
- const char* Filter ///< the filter string
- );
-};
-
-/**
- * @private
- * @todo This is implemented very soon
- */
-class cSearch {
-private:
- char* SQLWhereStmt;
- const char* CurrentProperty;
- const char* CurrentOperator;
- const char* CurrentValue;
- static cSearch* mInstance;
- cSearch();
- bool parseCriteria(const char* Search);
- void pushExistance (const char* Exists);
- void pushProperty (const char* Property);
- void pushOperator (const char* Operator);
- void pushConcatOp (const char* Operator);
- void pushStartBrackedExp(const char);
- void pushEndBrackedExp(const char);
- void pushValue (const char* Start, const char* End);
- void pushExpression(const char* Start, const char* End);
-public:
- virtual ~cSearch();
- static const char* parse(const char* Search);
-};
-
-
-#endif /* _SEARCH_H */
-
diff --git a/inc/server.h b/inc/server.h
deleted file mode 100644
index 260ac57..0000000
--- a/inc/server.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * File: server.h
- * Author: savop
- *
- * Created on 19. April 2009, 17:42
- */
-
-#ifndef _SERVER_H
-#define _SERVER_H
-
-#include <netinet/in.h>
-#include <vdr/recording.h>
-#include <vdr/thread.h>
-#include <upnp/upnp.h>
-#include "util.h"
-#include "../common.h"
-#include "webserver.h"
-#include "metadata.h"
-#include "upnp/connectionmanager.h"
-#include "upnp/contentdirectory.h"
-#include "../upnp.h"
-
-/**
- * The UPnP Server
- *
- * This is the core of the UPnP server. This handles all the components which
- * are needed for a UPnP media server. Incoming messages are passed through it
- * and it determines what to do.
- */
-class cUPnPServer {
- friend class cPluginUpnp;
-public:
- /**
- * Constructor
- *
- * This will create a new server and initializes the main functionalities
- * The server has to be started manually by invoking cUPnPServer::start().
- */
- cUPnPServer();
- /**
- * Destructor
- *
- * This will destroy the server object. Open ports and connections will be
- * closed.
- */
- virtual ~cUPnPServer();
- /**
- * Enable the server
- *
- * This switch indicates if the server is startable or not
- *
- * If it is set to false, any invocation of start() will do nothing.
- *
- * @param enabled if \bc true, the server will be enabled. If \bc false it is
- * disabled.
- */
- void enable(bool enabled);
- /**
- * Start the UPnP server
- *
- * This will start the UPnP server activities as a background task.
- *
- * @return returns
- * - \bc true, when the server started successfully
- * - \bc false, otherwise
- */
- bool start(void);
- /**
- * Restart the server
- *
- * When the server is not operating properly it can be restarted.
- * It will stop the server functionalities, clear everything and
- * start it again.
- *
- * @return returns
- * - \bc true, when the server restarted successfully
- * - \bc false, otherwise
- */
- bool restart(void);
- /**
- * Stop the server
- *
- * This will stop the server. This means that open connections to
- * any clients and open ports will be closed.
- */
- void stop(void);
- /**
- * Automatically detect settings
- *
- * This will automatically detect the network settings if the autodetection
- * is turned on.
- *
- * @return returns
- * - \bc true, if autoDetection was successful
- * - \bc false, otherwise
- */
- bool autoDetectSettings(void);
- /**
- * Get the server address
- *
- * Returns a server address structure including IP address and port
- *
- * @return The server socket address
- */
- sockaddr_in* getServerAddress(void);
- /**
- * Get the interface the server listens to
- *
- * @return the network interface
- */
- const char* getInterface(void) const { return this->mInterface; }
- /**
- * Set the server port
- *
- * The port must be in the scope of user definied ports (49152 - 65535). If
- * the port is 0, it is autoassigned. You can retrieve the actual port by
- * calling getServerAddress(), which will give you a structure with the port
- * in it.
- *
- * The server must be restarted if the IP or port changes.
- *
- * Returns 1 when the port is valid, 0 otherwise
- *
- * @param port The port of the server
- * @return returns
- * - \bc true, if the new server port is set
- * - \bc false, otherwise
- */
- bool setServerPort(unsigned short port);
- /**
- * The Interface to listen on
- *
- * Sets the listener interface, for instance 'eth1' or 'wlan0'
- *
- * @param Interface The interface of the server
- * @return returns
- * - \bc true, if the new server address is set
- * - \bc false, otherwise
- */
- bool setInterface(const char* Interface);
- /**
- * Set the server address
- *
- * Specifies the servers IP address. The server needs to restart
- * when the IP is changed. However, it's not possible to detect
- * changes through the system.
- *
- * This method should only be used in cases of fixed IP addresses
- * for example when no DHCP server is available.
- *
- * @param Address The address of the server
- * @return returns
- * - \bc true, if the new server address is set
- * - \bc false, otherwise
- */
- bool setAddress(const char* Address);
- /**
- * Enables oder Disables auto detection mode
- *
- * If this is set to true, the setup will get it's information via
- * auto detection
- *
- * @param enable \bc true enables and \bc false disables the auto detection
- * @return returns
- * - \bc true, if the new server address is set
- * - \bc false, otherwise
- */
- bool setAutoDetection(bool enable);
- /**
- * Checks if the server is enabled
- *
- * This indicates if the server is currently enabled.
- *
- * @return returns
- * - \bc true, if the server is enabled
- * - \bc false, otherwise
- */
- bool isEnabled(void) const { return this->mIsEnabled; }
- /**
- * Checks if the server is running
- *
- * If the server is enabled, this indicates if it is running.
- *
- * @return returns
- * - \bc true if the server is running
- * - \bc false, otherwise
- */
- bool isRunning(void) const { return this->mIsRunning; }
- /**
- * Is auto detection enabled or not
- *
- * Returns true or false if auto detection is enabled or not
- *
- * @return returns
- * - \bc true, if autodetection is enabled
- * - \bc false, otherwise
- */
- bool isAutoDetectionEnabled() { return this->mIsAutoDetectionEnabled; }
-protected:
-private:
- /**
- * Inits the server
- *
- * This method initializes all member variables with default values
- */
- bool init(void);
- bool uninit(void);
- static int upnpActionCallback(Upnp_EventType eventtype, void *event, void *cookie);
- bool mIsRunning;
- bool mIsEnabled;
- sockaddr_in* mServerAddr;
- cString mInterface;
- bool mIsAutoDetectionEnabled;
- cString mDeviceDescription;
- cUPnPWebServer* mWebServer;
- cMediaDatabase* mMediaDatabase;
- UpnpDevice_Handle mDeviceHandle;
- static cConnectionManager* mConnectionManager;
- static cContentDirectory* mContentDirectory;
-};
-#endif /* _SERVER_H */ \ No newline at end of file
diff --git a/inc/upnp/connectionmanager.h b/inc/upnp/connectionmanager.h
deleted file mode 100644
index 6ed2987..0000000
--- a/inc/upnp/connectionmanager.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * File: connectionmanager.h
- * Author: savop
- *
- * Created on 21. August 2009, 18:35
- */
-
-#ifndef _CONNECTIONMANAGER_H
-#define _CONNECTIONMANAGER_H
-
-#include "service.h"
-
-/**
- * Connection status
- *
- * The connection status of a certain virtual connection
- */
-enum eConnectionStatus {
- OK,
- CONTENT_FORMAT_MISMATCH,
- INSUFFICIENT_BANDWIDTH,
- UNRELIABLE_CHANNEL,
- UNKNOWN
-};
-
-/**
- * Direction
- *
- * The direction of a virtual connection. Input means client to server, Output
- * server to client
- */
-enum eDirection {
- OUTPUT,
- INPUT
-};
-
-/**
- * Virtual connection
- *
- * A virtual connection managed by the connection manager service
- */
-class cVirtualConnection : public cListObject {
- friend class cConnectionManager;
-private:
- cString mRemoteProtocolInfo;
- cString mRemoteConnectionManager;
- eDirection mDirection;
- int mRemoteConnectionID;
- int mConnectionID;
- int mAVTransportID;
- const int mRcsID;
- eConnectionStatus mStatus;
- cVirtualConnection();
- static const char* getStatusString(eConnectionStatus Status);
- static const char* getDirectionString(eDirection Direction);
- static int getDirection(const char* Direction);
- static int getConnectionStatus(const char* ConnectionStatus);
-};
-
-/**
- * The connection manager service
- *
- * This is the connection manager service which handles all incoming connection,
- * creates and destroys connections to clients.
- */
-class cConnectionManager : public cUpnpService {
-public:
- /**
- * Constructor of a Connection manager
- *
- * This creates an instance of a <em>Connection Manager Service</em> and provides
- * interfaces for executing actions and subscribing on events.
- */
- cConnectionManager(
- UpnpDevice_Handle DeviceHandle ///< the UPnP device handle of this root device
- );
- virtual ~cConnectionManager();
- /*! @copydoc cUpnpService::subscribe(Upnp_Subscription_Request* Request) */
- virtual int subscribe(Upnp_Subscription_Request* Request);
- /*! @copydoc cUpnpService::execute(Upnp_Action_Request* Request) */
- virtual int execute(Upnp_Action_Request* Request);
- /*! @copydoc cUpnpService::setError(Upnp_Action_Request* Request, int Error) */
- virtual void setError(Upnp_Action_Request* Request, int Error);
-private:
- int getProtocolInfo(Upnp_Action_Request* Request);
- int getCurrentConnectionIDs(Upnp_Action_Request* Request);
- int getCurrentConnectionInfo(Upnp_Action_Request* Request);
- int prepareForConnection(Upnp_Action_Request* Request);
- int connectionComplete(Upnp_Action_Request* Request);
- cVirtualConnection* createVirtualConnection(const char* RemoteProtocolInfo = NULL, const char* RemoteConnectionManager = NULL, int RemoteConnectionID = -1, eDirection Direction = OUTPUT);
- bool destroyVirtualConnection(int ConnectionID);
- const char* getConnectionIDsCVS();
- cVirtualConnection* mDefaultConnection;
- cList<cVirtualConnection>* mVirtualConnections;
- cString mSupportedProtocols;
-};
-
-#endif /* _CONNECTIONMANAGER_H */
-
diff --git a/inc/upnp/contentdirectory.h b/inc/upnp/contentdirectory.h
deleted file mode 100644
index ec32dfa..0000000
--- a/inc/upnp/contentdirectory.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * File: contentdirectory.h
- * Author: savop
- *
- * Created on 21. August 2009, 16:12
- */
-
-#ifndef _CONTENTDIRECTORY_H
-#define _CONTENTDIRECTORY_H
-
-#include <upnp/upnp.h>
-#include "service.h"
-#include "metadata.h"
-
-/**
- * The content directory service
- *
- * This is the content directory service which handles all incoming requests
- * for contents managed by the media server.
- */
-class cContentDirectory : public cUpnpService, public cThread {
-public:
- /**
- * Constructor of a Content Directory
- *
- * This creates an instance of a <em>Content Directory Service</em> and provides
- * interfaces for executing actions and subscribing on events.
- */
- cContentDirectory(
- UpnpDevice_Handle DeviceHandle, ///< The UPnP device handle of the root device
- cMediaDatabase* MediaDatabase ///< the media database where requests are processed
- );
- virtual ~cContentDirectory();
- /*! @copydoc cUpnpService::subscribe(Upnp_Subscription_Request* Request) */
- virtual int subscribe(Upnp_Subscription_Request* Request);
- /*! @copydoc cUpnpService::execute(Upnp_Action_Request* Request) */
- virtual int execute(Upnp_Action_Request* Request);
- /*! @copydoc cUpnpService::setError(Upnp_Action_Request* Request, int Error) */
- virtual void setError(Upnp_Action_Request* Request, int Error);
-private:
- cMediaDatabase* mMediaDatabase;
- void Action();
- int getSearchCapabilities(Upnp_Action_Request* Request);
- int getSortCapabilities(Upnp_Action_Request* Request);
- int getSystemUpdateID(Upnp_Action_Request* Request);
- int browse(Upnp_Action_Request* Request);
-// int search(Upnp_Action_Request* Request);
-// int createObject(Upnp_Action_Request* Request);
-// int destroyObject(Upnp_Action_Request* Request);
-// int updateObject(Upnp_Action_Request* Request);
-// int deleteResource(Upnp_Action_Request* Request);
-// int createReference(Upnp_Action_Request* Request);
-};
-
-#endif /* _CONTENTDIRECTORY_H */
-
diff --git a/inc/upnp/dlna.h b/inc/upnp/dlna.h
deleted file mode 100644
index c61c39f..0000000
--- a/inc/upnp/dlna.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * File: dlna.h
- * Author: savop
- *
- * Created on 18. April 2009, 23:27
- */
-
-#ifndef _DLNA_H
-#define _DLNA_H
-
-#include "../common.h"
-#include "profiles.h"
-#include <list>
-
-using namespace std;
-
-/**
- * Enable DLNA compliant media transfer
- *
- * This class enables media transmission with DLNA conformity. Its compliant with
- * version 1.5 of the DLNA guidelines.
- *
- */
-class cDlna {
- friend class cUPnPServer;
-public:
- /**
- * Returns the instance of DLNA object
- *
- * This will create a DLNA object instance. It will return the same instance
- * on subsequent calls.
- *
- * @return the DLNA object instance
- */
- static cDlna* getInstance(void);
- virtual ~cDlna();
- //const char* getProtocolInfo(UPnPObjectID OID);
- /**
- * Device description document
- *
- * This will return the device description document with service type
- * definitions as well as some DLNA specific information
- *
- * @return The description document
- */
- const char* getDeviceDescription(
- const char* URLBase ///< the URLBase to be set in the document
- );
- /**
- * Registeres a DLNA profile
- *
- * Registeres a DLNA profile with specific optional options
- *
- * @see common.h
- */
- void registerProfile(
- DLNAProfile* Profile ///< the DLNA profile
- );
- /**
- * Registeres all known DLNA profiles
- *
- * Registeres all well known DLNA profiles with its known options
- */
- void registerProfiles();
- /**
- * CSV list of supported protocols
- *
- * Returns a comma separated list with all supported protocols. This
- * means, it returns the list of protocols of the registered profiles.
- *
- * @return CSV list of registered protocols
- */
- const char* getSupportedProtocols();
- /**
- * Protocol info of a specific DLNA profile
- *
- * Returns the protocol info string of a specific DLNA profile with its
- * options and flags.
- *
- * @return the protocol info string of the profile
- */
- const char* getProtocolInfo(
- DLNAProfile *Prof, ///< the Profile of which the protocol info shall be returned
- int Op = -1, ///< operation mode
- const char* Ps = NULL, ///< play speed (CSV list)
- int Ci = -1, ///< conversion indication flag
- unsigned int Flags = 0 ///< DLNA flags
- );
-private:
- cDlna();
- void init(void);
- static cDlna* mInstance;
- list<DLNAProfile*> mRegisteredProfiles;
-};
-
-#endif /* _DLNA_H */
-
diff --git a/inc/upnp/service.h b/inc/upnp/service.h
deleted file mode 100644
index df74d9b..0000000
--- a/inc/upnp/service.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * File: upnpservice.h
- * Author: savop
- *
- * Created on 21. August 2009, 18:38
- */
-
-#ifndef _UPNPSERVICE_H
-#define _UPNPSERVICE_H
-
-#include <upnp/upnp.h>
-
-/**
- * UPnP Service interface
- *
- * This is a service interface implemented by a UPnP service like CDS oder CMS
- *
- * It comes with some tool functions which are commonly useful for processing
- * an event or action.
- */
-class cUpnpService {
-public:
- /**
- * Constructor of a service
- *
- * @private
- * @param DeviceHandle the UPnP device handle of this root device
- */
- cUpnpService(
- UpnpDevice_Handle DeviceHandle ///< the UPnP device handle of this root device
- );
- virtual ~cUpnpService(){};
- /**
- * Subscribes to an event
- *
- * This is a callback function to register a new subscriber for an event.
- *
- * @return An integer representing one of the following:
- * - \bc UPNP_E_SUCCESS, if subscription was okay
- * - or any other non null value in case of an error
- *
- * @param Request Information about the subscription
- */
- virtual int subscribe(
- Upnp_Subscription_Request* Request ///< Information about the subscription
- ) = 0;
- /**
- * Executes an action
- *
- * This executes an action initialized by a control point. The result is
- * stored in the first parameter.
- *
- * @return An integer representing one of the following:
- * - \bc UPNP_E_SUCCESS, if subscription was okay
- * - or any other non null value in case of an error
- *
- * @param Request Input and output parameters of an action
- */
- virtual int execute(
- Upnp_Action_Request* Request ///< Input and output parameters of an action
- ) = 0;
-protected:
- /**
- * Sets an error on an action request
- *
- * This function puts a error message into the action request structure
- * according to its error code
- *
- * @param Request the action request, to set the error for
- * @param Error the error code of which the message should be obtained
- */
- virtual void setError(
- Upnp_Action_Request* Request, ///< the action request, to set the error for
- int Error ///< the error code of which the message should be obtained
- );
- /**
- * Parses an integer value
- *
- * This tool function parses an integer value from a given \em IXML document. It is searching
- * for the very first occurance of the demanded item.
- *
- * @return Returns
- * - \bc 0, if parsing was successful
- * - \bc <0, if an error occured
- *
- * @param Document the document, which is parsed
- * @param Item the demanded item
- * @param Value the value of the item
- */
- int parseIntegerValue(
- IN IXML_Document* Document, ///< the document, which is parsed
- IN const char* Item, ///< the demanded item
- OUT int* Value ///< the value of the item
- );
- /**
- * Parses a string value
- *
- * This tool function parses a string value from a given \em IXML document. It is searching
- * for the very first occurance of the demanded item.
- *
- * @return Returns
- * - \bc 0, if parsing was successful
- * - \bc <0, if an error occured
- *
- * @param Document the document, which is parsed
- * @param Item the demanded item
- * @param Value the value of the item
- */
- int parseStringValue(
- IN IXML_Document* Document, ///< the document, which is parsed
- IN const char* Item, ///< the demanded item
- OUT char** Value ///< the value of the item
- );
-
- UpnpDevice_Handle mDeviceHandle; ///< the UPnP device handle of the root device
-};
-
-#endif /* _UPNPSERVICE_H */
-
diff --git a/inc/util.h b/inc/util.h
deleted file mode 100644
index f194186..0000000
--- a/inc/util.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * File: util.h
- * Author: savop
- *
- * Created on 21. Mai 2009, 21:25
- */
-
-#ifndef _UTIL_H
-#define _UTIL_H
-
-#include <vdr/tools.h>
-#include <vdr/plugin.h>
-#include <upnp/ixml.h>
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-}
-#endif
-
-#include <libavformat/avformat.h>
-#include <libavcodec/avcodec.h>
-/**
- * Compares two strings
- *
- * This struct compares two strings and returns true on equality or false otherwise
- * It is used in conjuction with hashmaps
- */
-struct strCmp {
- /**
- * Compares two strings
- * @return returns
- * - \bc true, in case of equality
- * - \bc false, otherwise
- * @param s1 the first string
- * @param s2 the second string
- */
- bool operator()(const char* s1, const char* s2) const { return (strcmp(s1,s2) < 0); }
-};
-/**
- * Gets the IP address
- *
- * Returns the IP address of a given interface. The interface must be a valid interface
- * identifier like eth0 or wlan1.
- *
- * @return a structure containing the IP address
- * @param Interface to obtain the IP from
- */
-const sockaddr_in* getIPFromInterface(const char* Interface);
-/**
- * Gets the MAC address
- *
- * Returns a string representation of the MAC address of a given interface. The interface
- * must be a valid interface identifier like eth0 or wlan1.
- *
- * The pattern of the address is sixth byte hex number separated with ":"
- *
- * @return a string containing the MAC
- * @param Interface to obtain the MAC from
- */
-const char* getMACFromInterface(const char* Interface);
-/**
- * List with interfaces
- *
- * Returns an array with interfaces found on the system. The number of items
- * in the array is stored in the parameter \c count.
- *
- * @return array list of interfaces
- * @param count number of interfaces in the array
- */
-char** getNetworkInterfaces(int *count);
-/**
- * First occurance of item
- *
- * Finds the first occurance of a specified item in a given \bc IXML document and returns its value.
- * If an error occures, its code is stored in the last parameter \c 'error'.
- *
- * @return the value of the item
- * @param doc the \c IXML document to be parsed
- * @param item the item which shall be found
- * @param error the error code in case of an error
- */
-char* ixmlGetFirstDocumentItem( IN IXML_Document * doc, IN const char *item, int* error );
-/**
- * Adds a property
- *
- * This adds a UPnP property to an \bc IXML document.
- * The property must have the pattern "namespace:property@attribute".
- *
- * @return returns
- * - \bc NULL, in case of an error
- * - \bc the newly created property node or the node at which the attribute was
- * appended to
- * @param document the \c IXML document to put the parameter in
- * @param node the specific node where to put the parameter
- * @param upnpproperty the upnp property
- * @param value the value of the upnp property
- */
-IXML_Element* ixmlAddProperty(IN IXML_Document* document, IN IXML_Element* node, IN const char* upnpproperty, IN const char* value );
-
-IXML_Element* ixmlAddFilteredProperty(IN cStringList* Filter, IN IXML_Document* document, IN IXML_Element* node, IN const char* upnpproperty, IN const char* value );
-/**
- * creates a part of a string
- *
- * This creates a substring of a string which begins at the given offset and has the
- * specified lenght.
- *
- * @return the new string
- * @param str the full string
- * @param offset the starting index
- * @param length the length of the new string
- */
-char* substr(const char* str, unsigned int offset, unsigned int length);
-
-char* duration(off64_t duration, unsigned int timeBase = 1);
-
-#if 0
-{
-#endif
-}
-#endif
-
-/**
- * Escapes XML special characters
- *
- * This function escapes XML special characters, which must be transformed before
- * inserting it into another XML document.
- *
- * @return the escaped document
- * @param Data the data to escape
- * @param Buf the pointer where the escaped document shall be stored
- */
-const char* escapeXMLCharacters(const char* Data, char** Buf);
-
-/** @private */
-class cMenuEditIpItem: public cMenuEditItem {
-private:
- char *value;
- int curNum;
- int pos;
- bool step;
-protected:
- virtual void Set(void);
-public:
- cMenuEditIpItem(const char *Name, char *Value); // Value must be 16 bytes
- ~cMenuEditIpItem();
- virtual eOSState ProcessKey(eKeys Key);
-};
-
-#endif /* _UTIL_H */
-
diff --git a/inc/webserver.h b/inc/webserver.h
deleted file mode 100644
index 0a49cf9..0000000
--- a/inc/webserver.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * File: upnpwebserver.h
- * Author: savop
- *
- * Created on 30. Mai 2009, 18:13
- */
-
-#ifndef _UPNPWEBSERVER_H
-#define _UPNPWEBSERVER_H
-
-#include "../common.h"
-#include <upnp/upnp.h>
-
-/**
- * The internal webserver
- *
- * This is the internal webserver. It distributes all the contents of the
- * UPnP-Server.
- *
- */
-class cUPnPWebServer {
- friend class cUPnPServer;
-private:
- static cUPnPWebServer *mInstance;
- static UpnpVirtualDirCallbacks mVirtualDirCallbacks;
- const char* mRootdir;
- cUPnPWebServer(const char* root = "/");
-protected:
-public:
- /**
- * Initializes the webserver
- *
- * It enables the webserver which comes with the <em>Intel SDK</em> and creates
- * virtual directories for shares media.
- *
- * @return returns
- * - \bc true, if initializing was successful
- * - \bc false, otherwise
- */
- bool init();
- /**
- * Uninitializes the webserver
- *
- * This stops the webserver.
- *
- * @return returns
- * - \bc true, if initializing was successful
- * - \bc false, otherwise
- */
- bool uninit();
- /**
- * Returns the instance of the webserver
- *
- * Returns the instance of the webserver. This will create a single
- * instance of none is existing on the very first call. A subsequent call
- * will return the same instance.
- *
- * @return the instance of webserver
- */
- static cUPnPWebServer* getInstance(
- const char* rootdir = "/" /**< the root directory of the webserver */
- );
- virtual ~cUPnPWebServer();
-//};
-
- /****************************************************
- *
- * The callback functions for the webserver
- *
- ****************************************************/
-
- /**
- * Retrieve file information
- *
- * Returns file related information for an virtual directory file
- *
- * @return 0 on success, -1 otherwise
- * @param filename The filename of which the information is gathered
- * @param info The File_Info structure with the data
- */
- static int getInfo(const char* filename, struct File_Info* info);
- /**
- * Opens a virtual directory file
- *
- * Opens a file in a virtual directory with the specified mode.
- *
- * Possible modes are:
- * - \b UPNP_READ, Opens the file for reading
- * - \b UPNP_WRITE, Opens the file for writing
- *
- * It returns a file handle to the opened file, NULL otherwise
- *
- * @return FileHandle to the opened file, NULL otherwise
- * @param filename The file to open
- * @param mode UPNP_WRITE for writing, UPNP_READ for reading.
- */
- static UpnpWebFileHandle open(const char* filename, UpnpOpenFileMode mode);
- /**
- * Reads from the opened file
- *
- * Reads <code>buflen</code> bytes from the file and stores the content
- * to the buffer
- *
- * Returns 0 no more bytes read (EOF)
- * >0 bytes read from file
- *
- * @return number of bytes read, 0 on EOF
- * @param fh the file handle of the opened file
- * @param buf the buffer to write the bytes to
- * @param buflen the maximum count of bytes to read
- *
- */
- static int read(UpnpWebFileHandle fh, char* buf, size_t buflen);
- /**
- * Writes to the opened file
- *
- * Writes <code>buflen</code> bytes from the buffer and stores the content
- * in the file
- *
- * Returns >0 bytes wrote to file, maybe less the buflen in case of write
- * errors
- *
- * @return number of bytes read, 0 on EOF
- * @param fh the file handle of the opened file
- * @param buf the buffer to read the bytes from
- * @param buflen the maximum count of bytes to write
- *
- */
- static int write(UpnpWebFileHandle fh, char* buf, size_t buflen);
- /**
- * Seek in the file
- *
- * Seeks in the opened file and sets the file pointer to the specified offset
- *
- * Returns 0 on success, non-zero value otherwise
- *
- * @return 0 on success, non-zero value otherwise
- * @param fh the file handle of the opened file
- * @param offset a negative oder positive value which moves the pointer
- * forward or backward
- * @param origin SEEK_CUR, SEEK_END or SEEK_SET
- *
- */
- static int seek(UpnpWebFileHandle fh, off_t offset, int origin);
- /**
- * Closes the file
- *
- * closes the opened file
- *
- * Returns 0 on success, non-zero value otherwise
- *
- * @return 0 on success, non-zero value otherwise
- * @param fh the file handle of the opened file
- *
- */
- static int close(UpnpWebFileHandle fh);
-};
-
-#endif /* _UPNPWEBSERVER_H */
-
diff --git a/misc/config.cpp b/misc/config.cpp
deleted file mode 100644
index 10ed166..0000000
--- a/misc/config.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * File: config.cpp
- * Author: savop
- *
- * Created on 15. August 2009, 13:03
- */
-
-#include <stdio.h>
-#include <vdr/tools.h>
-#include <getopt.h>
-#include "config.h"
-#include "../common.h"
-#include "../upnp.h"
-
-cUPnPConfig::cUPnPConfig(){
- this->mDatabaseFolder = NULL;
- this->mHTTPFolder = NULL;
- this->mParsedArgs = NULL;
- this->mInterface = NULL;
- this->mAddress = NULL;
- this->mAutoSetup = 0;
- this->mEnable = 0;
- this->mPort = 0;
-}
-
-cUPnPConfig::~cUPnPConfig(){}
-
-cUPnPConfig* cUPnPConfig::get(){
- if(cUPnPConfig::mInstance == NULL)
- cUPnPConfig::mInstance = new cUPnPConfig();
-
- if(cUPnPConfig::mInstance)
- return cUPnPConfig::mInstance;
- else return NULL;
-}
-
-cUPnPConfig* cUPnPConfig::mInstance = NULL;
-int cUPnPConfig::verbosity = 0;
-
-bool cUPnPConfig::processArgs(int argc, char* argv[]){
- // Implement command line argument processing here if applicable.
- static struct option long_options[] = {
- {"int", required_argument, NULL, 'i'},
- {"address", required_argument, NULL, 'a'},
- {"port", required_argument, NULL, 'p'},
- {"autodetect", no_argument, NULL, 'd'},
- {"verbose", no_argument, NULL, 'v'},
- {"httpdir", required_argument, NULL, 0},
- {"dbdir", required_argument, NULL, 0},
- {0, 0, 0, 0}
- };
-
- int c = 0; int index = -1;
- struct option* opt = NULL;
-
- // Check if anything went wrong by setting 'success' to false
- // As there are multiple tests you may get a faulty behavior
- // if the current value is not considered in latter tests.
- // Asume that: Success = true;
- // success && false = false; --> new value of success is false
- // success && true = true; --> still true.
- // So, in the case of true and only true, success contains the
- // desired value.
- bool success = true;
- bool ifaceExcistent = false;
- bool addExcistent = false;
- static int verbose = 0;
-
- while((c = getopt_long(argc, argv, "i:a:p:dv",long_options, &index)) != -1){
- switch(c){
- case 'i':
- if(addExcistent) { ERROR("Address given but must be absent!"); return false; }
- success = this->parseSetup(SETUP_SERVER_INT, optarg) && success;
- success = this->parseSetup(SETUP_SERVER_ADDRESS, NULL) && success;
- success = this->parseSetup(SETUP_SERVER_AUTO, "0") && success;
- ifaceExcistent = true;
- break;
- case 'a':
- if(ifaceExcistent) { ERROR("Interface given but must be absent!"); return false; }
- success = this->parseSetup(SETUP_SERVER_ADDRESS, optarg) && success;
- success = this->parseSetup(SETUP_SERVER_INT, NULL) && success;
- success = this->parseSetup(SETUP_SERVER_AUTO, "0") && success;
- addExcistent = true;
- break;
- case 'p':
- success = this->parseSetup(SETUP_SERVER_PORT, optarg) && success;
- success = this->parseSetup(SETUP_SERVER_AUTO, "0") && success;
- break;
- case 'd':
- success = this->parseSetup(SETUP_SERVER_AUTO, optarg) && success;
- break;
- case 'v':
- cUPnPConfig::verbosity++;
- verbose++;
- break;
- case 0:
- opt = &long_options[index];
- if(!strcasecmp("httpdir", opt->name)){
- success = this->parseSetup(SETUP_WEBSERVER_DIR, optarg) && success;
- }
- else if(!strcasecmp("dbdir", opt->name)){
- success = this->parseSetup(SETUP_DATABASE_DIR, optarg) && success;
- }
- break;
- default:
- return false;
- }
- }
-
- return success;
-}
-
-bool cUPnPConfig::parseSetup(const char *Name, const char *Value)
-{
- const char* ptr;
- if(*this->mParsedArgs && (ptr = strstr(this->mParsedArgs,Name))!=NULL){
- MESSAGE(VERBOSE_SDK, "Skipping %s=%s, was overridden in command line.",Name, Value);
- return true;
- }
-
- MESSAGE(VERBOSE_SDK, "VARIABLE %s has value %s", Name, Value);
- // Parse your own setup parameters and store their values.
- if (!strcasecmp(Name, SETUP_SERVER_ENABLED)) this->mEnable = atoi(Value);
- else if (!strcasecmp(Name, SETUP_SERVER_AUTO)) this->mAutoSetup = atoi(Value);
- else if (!strcasecmp(Name, SETUP_SERVER_INT)) this->mInterface = strdup0(Value); // (Value) ? strn0cpy(this->mInterface, Value, strlen(this->mInterface)) : NULL;
- else if (!strcasecmp(Name, SETUP_SERVER_ADDRESS)) this->mAddress = strdup0(Value); //(Value) ? strn0cpy(this->mAddress, Value, strlen(this->mAddress)) : NULL;
- else if (!strcasecmp(Name, SETUP_SERVER_PORT)) this->mPort = atoi(Value);
- else if (!strcasecmp(Name, SETUP_WEBSERVER_DIR)) this->mHTTPFolder = strdup0(Value);
- else if (!strcasecmp(Name, SETUP_DATABASE_DIR)) this->mDatabaseFolder = strdup0(Value);
- else return false;
-
- this->mParsedArgs = cString::sprintf("%s%s",*this->mParsedArgs,Name);
-
- return true;
-} \ No newline at end of file
diff --git a/misc/menusetup.cpp b/misc/menusetup.cpp
deleted file mode 100644
index c385b2d..0000000
--- a/misc/menusetup.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * File: menusetup.cpp
- * Author: savop
- *
- * Created on 19. April 2009, 16:50
- */
-
-#include "config.h"
-#include <vdr/osdbase.h>
-#include "menusetup.h"
-#include "../common.h"
-#include "util.h"
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <vdr/menuitems.h>
-
-
-cMenuSetupUPnP::cMenuSetupUPnP(){
- // Get server acitve state
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Creating menu");
- this->mCtrlBind = NULL;
- this->mCtrlAutoMode = NULL;
- this->mCtrlEnabled = NULL;
- this->mCtrlPort = NULL;
- this->mEnable = 0;
- this->mDetectPort = 0;
- this->mAutoSetup = 0;
- this->mPort = 0;
- this->mAddress = NULL;
- this->mInterfaceIndex = 0;
- this->Load();
- this->Update();
-}
-
-//cMenuSetupUPnP::~cMenuSetupUPnP() {
-// delete this->mCtrlAutoMode;
-// delete this->mCtrlEnabled;
-// delete this->mCtrlPort;
-// free(this->mAddress);
-//}
-
-void cMenuSetupUPnP::Load(void){
- cUPnPConfig* Config = cUPnPConfig::get();
- this->mEnable = Config->mEnable;
- this->mAutoSetup = Config->mAutoSetup;
- this->mInterfaceIndex = this->getInterfaceIndex(Config->mInterface);
- this->mAddress = strdup(Config->mAddress?Config->mAddress:"0.0.0.0");
- this->mPort = Config->mPort;
-
- if(Config->mPort==0) this->mDetectPort = 1;
-}
-
-const char* const* cMenuSetupUPnP::getInterfaceList(int* count){
- char** Ifaces = getNetworkInterfaces(count);
- char** IfaceList = new char*[++(*count)];
- IfaceList[0] = strdup(_("User defined"));
- for(int i=0; i < *count-1; i++){
- IfaceList[i+1] = strdup(Ifaces[i]);
- }
- delete [] Ifaces;
- return IfaceList;
-}
-
-int cMenuSetupUPnP::getInterfaceIndex(const char* Interface){
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Getting Index of %s", Interface);
- if(!Interface) return 0;
- int count;
- int Index = 0;
- const char* const* Ifaces = this->getInterfaceList(&count);
-
- for(int i=1; i < count; i++){
- if(!strcmp(Interface, Ifaces[i])){
- Index = i;
- break;
- }
- }
- delete [] Ifaces;
- return Index;
-}
-
-const char* cMenuSetupUPnP::getInterface(int Index){
- int count;
- const char* const* Ifaces = this->getInterfaceList(&count);
-
- if(count < Index || Index < 1) return NULL;
- const char* Interface = strdup0(Ifaces[Index]);
- delete [] Ifaces;
- return Interface;
-}
-
-void cMenuSetupUPnP::Update(void){
- int Current = this->Current();
- this->Clear();
- // Add OSD menu item for enabling UPnP Server
- this->Add(mCtrlEnabled = new cMenuEditBoolItem(_("Enable UPnP Server"),&this->mEnable,_("disabled"),_("enabled")));
- if(this->mEnable){
- cMenuEditIntItem* editPortItem = NULL;
- this->Add(mCtrlAutoMode = new cMenuEditBoolItem(_("Auto detect settings"),&this->mAutoSetup,_("no"),_("yes")));
- // Add OSD menu item for IP address
- int Count;
- const char* const* Interfaces = this->getInterfaceList(&Count);
- this->Add(mCtrlBind = new cMenuEditStraItem(_("Bind to network interface"), &this->mInterfaceIndex, Count, Interfaces));
-
- cMenuEditIpItem* editIpItem;
- if(this->mInterfaceIndex){
- const sockaddr_in* addr = getIPFromInterface(this->getInterface(this->mInterfaceIndex));
- char* IP = strdup(inet_ntoa(addr->sin_addr));
- editIpItem = new cMenuEditIpItem(_("Current IP address"),IP);
- editIpItem->SetSelectable(false);
- free(IP);
- }
- else {
- editIpItem = new cMenuEditIpItem(_("Set IP address"),this->mAddress);
- }
- this->Add(editIpItem);
- this->Add(mCtrlPort = new cMenuEditBoolItem(_("Select port"), &this->mDetectPort, _("auto"), _("user definied")));
- if(this->mDetectPort){
- this->Add(editPortItem = new cMenuEditIntItem(_("User specified port"),
- &this->mPort,
- SERVER_MIN_PORT,
- SERVER_MAX_PORT
- ));
- }
-
- if(this->mAutoSetup){
- if(mCtrlPort) mCtrlPort->SetSelectable(false);
- if(mCtrlBind) mCtrlBind->SetSelectable(false);
- if(editPortItem) editPortItem->SetSelectable(false);
- if(editIpItem) editIpItem->SetSelectable(false);
- }
- else {
- if(mCtrlPort) mCtrlPort->SetSelectable(true);
- if(mCtrlBind) mCtrlBind->SetSelectable(true);
- if(editPortItem) editPortItem->SetSelectable(true);
- if(editIpItem && !this->mInterfaceIndex) editIpItem->SetSelectable(true);
- }
- }
- this->SetCurrent(this->Get(Current));
- this->Display();
-}
-
-eOSState cMenuSetupUPnP::ProcessKey(eKeys Key){
-
- cOsdItem *Item = this->Get(this->Current());
-
- eOSState State = cMenuSetupPage::ProcessKey(Key);
-
- Key = NORMALKEY(Key);
-
- if(Key != kRight && Key != kLeft){
- return State;
- }
-
- if(Item == this->mCtrlEnabled){
- if(this->mEnable){
- this->Update();
- }
- else if (!this->mEnable) {
- this->Update();
- }
- }
- else if (Item == this->mCtrlPort){
- if(this->mDetectPort){
- this->Update();
- }
- else if(!this->mDetectPort) {
- this->Update();
- }
- }
- else if (Item == this->mCtrlAutoMode){
- if(this->mAutoSetup){
- this->Update();
- }
- else if(!this->mAutoSetup) {
- this->Update();
- }
- }
- else if(Item == this->mCtrlBind){
-// if(!this->mInterfaceIndex){
-// this->Update();
-// }
-// else if(!this->mInterfaceIndex){
-// this->Update();
-// }
- this->Update();
- }
- return State;
-}
-
-void cMenuSetupUPnP::Store(void){
- cUPnPConfig* Config = cUPnPConfig::get();
- Config->mAddress = strdup0(this->mAddress);
- Config->mAutoSetup = this->mAutoSetup;
- Config->mEnable = this->mEnable;
- Config->mInterface = strdup0(this->getInterface(this->mInterfaceIndex));
- Config->mPort = (this->mDetectPort) ? 0 : this->mPort;
-
- this->SetupStore(SETUP_SERVER_AUTO, this->mAutoSetup);
- this->SetupStore(SETUP_SERVER_ENABLED, this->mEnable);
- this->SetupStore(SETUP_SERVER_INT, this->getInterface(this->mInterfaceIndex));
- this->SetupStore(SETUP_SERVER_ADDRESS, this->mAddress);
- this->SetupStore(SETUP_SERVER_PORT, this->mPort);
-
-}
diff --git a/misc/search.cpp b/misc/search.cpp
deleted file mode 100644
index b3534f1..0000000
--- a/misc/search.cpp
+++ /dev/null
@@ -1,809 +0,0 @@
-/*
- * File: search.cpp
- * Author: savop
- *
- * Created on 27. August 2009, 21:21
- */
-
-// uncomment this to enable debuging of the grammar
-//#define BOOST_SPIRIT_DEBUG
-
-#include <string>
-#include "search.h"
-#include "../common.h"
-#include <boost/spirit.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-
-using namespace std;
-using namespace boost;
-using namespace boost::spirit;
-
-// This is the standard callback function which will be overloaded
-// with all the specific callbacks
-typedef function2<void, const char*, const char*> expCallback;
-typedef function1<void, const char*> propCallback;
-typedef function1<void, const char*> opCallback;
-typedef function1<void, const char> charCallback;
-typedef function1<void, int> intCallback;
-
-// The defined ColumnNames
-/** @private */
-struct cProperties : symbols<const char*> {
-//struct cProperties : symbols<> {
- cProperties(){
- add
-// (UPNP_PROP_OBJECTID, UPNP_PROP_OBJECTID)
-// (UPNP_PROP_PARENTID, UPNP_PROP_PARENTID)
-// (UPNP_PROP_RESTRICTED, UPNP_PROP_RESTRICTED)
-// (UPNP_PROP_CLASS, UPNP_PROP_CLASS)
-// (UPNP_PROP_CLASSNAME, UPNP_PROP_CLASSNAME)
-// (UPNP_PROP_WRITESTATUS, UPNP_PROP_WRITESTATUS)
-// (UPNP_PROP_CHILDCOUNT, UPNP_PROP_CHILDCOUNT)
-// (UPNP_PROP_REFERENCEID, UPNP_PROP_REFERENCEID)
-// (UPNP_PROP_TITLE, UPNP_PROP_TITLE)
-// (UPNP_PROP_CREATOR, UPNP_PROP_CREATOR)
-// ("dc:description", "Description")
-// ("dc:date", "Date")
-// ("res", "Resource")
-// ("res@bitrate", "Bitrate")
-// ("res@duration", "Duration")
-// ("res@size", "Size")
-// ("res@sampleFrequency", "SampleFrequency")
-// ("res@resolution", "Resolution")
-// ("res@protocolInfo", "ProtocolInfo")
-// ;
- (UPNP_PROP_OBJECTID,UPNP_PROP_OBJECTID)
- (UPNP_PROP_PARENTID,UPNP_PROP_PARENTID)
- (UPNP_PROP_TITLE,UPNP_PROP_TITLE)
- (UPNP_PROP_CREATOR,UPNP_PROP_CREATOR)
- (UPNP_PROP_RESTRICTED,UPNP_PROP_RESTRICTED)
- (UPNP_PROP_WRITESTATUS,UPNP_PROP_WRITESTATUS)
- (UPNP_PROP_CLASS,UPNP_PROP_CLASS)
- (UPNP_PROP_CLASSNAME,UPNP_PROP_CLASSNAME)
- (UPNP_PROP_SEARCHCLASS,UPNP_PROP_SEARCHCLASS)
- (UPNP_PROP_SCLASSDERIVED,UPNP_PROP_SCLASSDERIVED)
- (UPNP_PROP_REFERENCEID,UPNP_PROP_REFERENCEID)
- (UPNP_PROP_SCLASSNAME,UPNP_PROP_SCLASSNAME)
- (UPNP_PROP_SEARCHABLE,UPNP_PROP_SEARCHABLE)
- (UPNP_PROP_CHILDCOUNT,UPNP_PROP_CHILDCOUNT)
- (UPNP_PROP_RESOURCE,UPNP_PROP_RESOURCE)
- (UPNP_PROP_PROTOCOLINFO,UPNP_PROP_PROTOCOLINFO)
- (UPNP_PROP_SIZE,UPNP_PROP_SIZE)
- (UPNP_PROP_DURATION,UPNP_PROP_DURATION)
- (UPNP_PROP_BITRATE,UPNP_PROP_BITRATE)
- (UPNP_PROP_SAMPLEFREQUENCE,UPNP_PROP_SAMPLEFREQUENCE)
- (UPNP_PROP_BITSPERSAMPLE,UPNP_PROP_BITSPERSAMPLE)
- (UPNP_PROP_NOAUDIOCHANNELS,UPNP_PROP_NOAUDIOCHANNELS)
- (UPNP_PROP_COLORDEPTH,UPNP_PROP_COLORDEPTH)
- (UPNP_PROP_RESOLUTION,UPNP_PROP_RESOLUTION)
- (UPNP_PROP_GENRE,UPNP_PROP_GENRE)
- (UPNP_PROP_LONGDESCRIPTION,UPNP_PROP_LONGDESCRIPTION)
- (UPNP_PROP_PRODUCER,UPNP_PROP_PRODUCER)
- (UPNP_PROP_RATING,UPNP_PROP_RATING)
- (UPNP_PROP_ACTOR,UPNP_PROP_ACTOR)
- (UPNP_PROP_DIRECTOR,UPNP_PROP_DIRECTOR)
- (UPNP_PROP_DESCRIPTION,UPNP_PROP_DESCRIPTION)
- (UPNP_PROP_PUBLISHER,UPNP_PROP_PUBLISHER)
- (UPNP_PROP_LANGUAGE,UPNP_PROP_LANGUAGE)
- (UPNP_PROP_RELATION,UPNP_PROP_RELATION)
- (UPNP_PROP_STORAGEMEDIUM,UPNP_PROP_STORAGEMEDIUM)
- (UPNP_PROP_DVDREGIONCODE,UPNP_PROP_DVDREGIONCODE)
- (UPNP_PROP_CHANNELNAME,UPNP_PROP_CHANNELNAME)
- (UPNP_PROP_SCHEDULEDSTARTTIME,UPNP_PROP_SCHEDULEDSTARTTIME)
- (UPNP_PROP_SCHEDULEDENDTIME,UPNP_PROP_SCHEDULEDENDTIME)
- (UPNP_PROP_ICON,UPNP_PROP_ICON)
- (UPNP_PROP_REGION,UPNP_PROP_REGION)
- (UPNP_PROP_CHANNELNR,UPNP_PROP_CHANNELNR)
- (UPNP_PROP_RIGHTS,UPNP_PROP_RIGHTS)
- (UPNP_PROP_RADIOCALLSIGN,UPNP_PROP_RADIOCALLSIGN)
- (UPNP_PROP_RADIOSTATIONID,UPNP_PROP_RADIOSTATIONID)
- (UPNP_PROP_RADIOBAND,UPNP_PROP_RADIOBAND)
- (UPNP_PROP_CONTRIBUTOR,UPNP_PROP_CONTRIBUTOR)
- (UPNP_PROP_DATE,UPNP_PROP_DATE)
- (UPNP_PROP_ALBUM,UPNP_PROP_ALBUM)
- (UPNP_PROP_ARTIST,UPNP_PROP_ARTIST)
- (UPNP_PROP_DLNA_CONTAINERTYPE,UPNP_PROP_DLNA_CONTAINERTYPE)
- ;
- }
-} Properties;
-
-/** @private */
-struct cOperators : symbols<const char*> {
- cOperators(){
- add
- ("=", "==")
- ("!=", "!=")
- ("<", "<")
- (">", ">")
- ("<=", "<=")
- (">=", ">=")
- ("contains", "LIKE")
- ("doesNotContain", "NOT LIKE")
- ("derivedfrom", "derivedFrom")
- ;
- }
-} Operators;
-
-/** @private */
-struct cConcatOperators : symbols<const char*> {
- cConcatOperators(){
- add
- ("and", "AND")
- ("or", "OR")
- ;
- }
-} ConcatOperators;
-
-/** @private */
-struct cExistanceOperator : symbols<const char*> {
- cExistanceOperator(){
- add
- ("true", "NOT NULL")
- ("false", "NULL")
- ;
- }
-} Existance;
-
-// THE GRAMMAR!
-// This is the grammar including the functors which calls the member functions
-// of search. The callback definitions at the end of the constructor are
-// essential. DO NOT MODIFY if you don't know how!
-/** @private */
-struct cSearchGrammar : public boost::spirit::grammar<cSearchGrammar> {
- // The callbacks members
- charCallback &endBrackedExp;
- expCallback &pushSimpleExp;
- opCallback &pushOperator;
- expCallback &pushQuotedValue;
- opCallback &pushExistance;
- propCallback &pushProperty;
- opCallback &pushConcatOp;
- charCallback &startBrackedExp;
-
- // Constructor with the callback functions
- cSearchGrammar(
- charCallback &endBrackedExp,
- expCallback &pushSimpleExp,
- opCallback &pushOperator,
- expCallback &pushQuotedValue,
- opCallback &pushExistance,
- propCallback &pushProperty,
- opCallback &pushConcatOp,
- charCallback &startBrackedExp):
- endBrackedExp(endBrackedExp),
- pushSimpleExp(pushSimpleExp),
- pushOperator(pushOperator),
- pushQuotedValue(pushQuotedValue),
- pushExistance(pushExistance),
- pushProperty(pushProperty),
- pushConcatOp(pushConcatOp),
- startBrackedExp(startBrackedExp){}
-
- template <typename scanner>
- /** @private */
- struct definition {
- boost::spirit::rule<scanner> searchCrit, searchExp, logOp, \
- relExp, binOp, relOp, stringOp, \
- existsOp, boolVal, quotedVal, \
- wChar, property, brackedExp, exp;
- const boost::spirit::rule<scanner> &start(){
- return searchCrit;
- }
- definition(const cSearchGrammar &self){
- /*************************************************************************\
- * *
- * The grammar of a UPnP search expression *
- * *
- * searchCrit ::= searchExp | asterisk *
- * *
- * searchExp ::= relExp | *
- * searchExp wChar+ logOp wChar+ searchExp | *
- * '(' wChar* searchExp wChar* ')' *
- * *
- * logOp ::= 'and' | 'or' *
- * *
- * relExp ::= property wChar+ binOp wChar+ quotedVal | *
- * property wChar* existsOp wChar+ boolVal *
- * *
- * binOp ::= relOp | stringOp *
- * *
- * relOp ::= '=' | '!=' | '<' | '<=' | '>' | '>=' *
- * *
- * stringOp ::= 'contains' | 'doesNotContain' | 'derivedfrom' *
- * *
- * existsOp ::= 'exists' *
- * *
- * boolVal ::= 'true' | 'false' *
- * *
- * quotedVal ::= dQuote escapedQuote dQuote *
- * *
- * wChar ::= space | hTab | lineFeed | *
- * vTab | formFeed | return *
- * *
- * property ::= See ContentDirectory Section 2.4 *
- * *
- * escapedQuote ::= See ContentDirectory Section 2.3.1 *
- * *
- \*************************************************************************/
- searchCrit = searchExp | "*";
-
- searchExp = exp >> *(+wChar >> logOp >> +wChar >> exp);
- ;
-
- exp = relExp
- | brackedExp
- ;
-
- brackedExp = confix_p(
- ch_p('(')[self.startBrackedExp],
- *wChar >> searchExp >> *wChar,
- ch_p(')')[self.endBrackedExp]
- )
- ;
-
- logOp = ConcatOperators[self.pushConcatOp]
- ;
-
- relExp = (property >> +wChar >> binOp >> +wChar >> quotedVal) [self.pushSimpleExp]
- | (property >> +wChar >> existsOp >> +wChar >> boolVal) [self.pushSimpleExp]
- ;
-
- binOp = Operators[self.pushOperator]
- ;
-
- existsOp = str_p("exists")
- ;
-
- boolVal = Existance[self.pushExistance]
- ;
-
- quotedVal = confix_p('"', (*c_escape_ch_p)[self.pushQuotedValue], '"');
-
- wChar = space_p;
-
- property = Properties[self.pushProperty]
- ;
-
- // Debug mode
- #ifdef BOOST_SPIRIT_DEBUG
- BOOST_SPIRIT_DEBUG_NODE(searchCrit);
- BOOST_SPIRIT_DEBUG_NODE(searchExp);
- BOOST_SPIRIT_DEBUG_NODE(logOp);
- BOOST_SPIRIT_DEBUG_NODE(relExp);
- BOOST_SPIRIT_DEBUG_NODE(binOp);
- BOOST_SPIRIT_DEBUG_NODE(relOp);
- BOOST_SPIRIT_DEBUG_NODE(stringOp);
- BOOST_SPIRIT_DEBUG_NODE(existsOp);
- BOOST_SPIRIT_DEBUG_NODE(boolVal);
- BOOST_SPIRIT_DEBUG_NODE(quotedVal);
- BOOST_SPIRIT_DEBUG_NODE(wChar);
- BOOST_SPIRIT_DEBUG_NODE(property);
- #endif
- }
- };
-};
-
-/** @private */
-struct cSortGrammar : public boost::spirit::grammar<cSortGrammar> {
- // The callback members
- propCallback &pushProperty;
- charCallback &pushDirection;
-
- cSortGrammar(
- propCallback &pushProperty,
- charCallback &pushDirection):
- pushProperty(pushProperty),
- pushDirection(pushDirection){}
-
- template <typename scanner>
- /** @private */
- struct definition {
- boost::spirit::rule<scanner> sortCrit, sortExp, property, direction;
-
- const boost::spirit::rule<scanner> &start(){
- return sortCrit;
- }
- definition(const cSortGrammar &self){
- sortCrit = sortExp
- ;
-
- sortExp = direction >> property >> *(ch_p(',') >> sortExp)
- ;
-
- direction = sign_p[self.pushDirection]
- ;
-
- property = Properties[self.pushProperty]
- ;
- }
- };
-};
-
-/** @private */
-struct cFilterGrammar : public boost::spirit::grammar<cFilterGrammar> {
- // The callback members
- propCallback &pushProperty;
- charCallback &pushAsterisk;
-
- cFilterGrammar(
- propCallback &pushProperty,
- charCallback &pushAsterisk):
- pushProperty(pushProperty),
- pushAsterisk(pushAsterisk){}
-
- template <typename scanner>
- /** @private */
- struct definition {
- boost::spirit::rule<scanner> filterCrit, filterExp, property;
-
- const boost::spirit::rule<scanner> &start(){
- return filterCrit;
- }
- definition(const cFilterGrammar &self){
- filterCrit = filterExp
- | ch_p('*')[self.pushAsterisk]
- ;
-
- filterExp = property >> *(ch_p(',') >> filterExp)
- ;
-
- property = Properties[self.pushProperty]
- ;
- }
- };
-};
-
- /**********************************************\
- * *
- * The actors *
- * *
- \**********************************************/
-
-void cSearch::pushEndBrackedExp(const char){
- MESSAGE(VERBOSE_PARSERS, "Pushing closing bracket");
- if(asprintf(&this->SQLWhereStmt, "%s)", this->SQLWhereStmt)==-1){
- ERROR("Unable to allocate SQL Statement");
- return;
- }
-}
-
-void cSearch::pushExpression(const char*, const char*){
-
- const char* Property = this->CurrentProperty;
- const char* Operator = this->CurrentOperator;
- const char* Value = this->CurrentValue;
-
- if(Property && Operator && Value){
- char* Statement;
- long int IntegerValue;
-
- if(sscanf(Value, "%ld", &IntegerValue)!=EOF && sscanf(Value, "%*4d-%*2d-%*2d")==EOF){
- MESSAGE(VERBOSE_PARSERS, "Popping '%s %s %ld'",Property, Operator, IntegerValue);
- if(asprintf(&Statement, "%s %s %ld", Property, Operator, IntegerValue)==-1){
- ERROR("Failed to allocated memory for statement.");
- return;
- }
- }
- else if(!strcasecmp(Operator, "IS")){
- MESSAGE(VERBOSE_PARSERS, "Popping '%s %s %s'", Property, Operator, Value);
- if(asprintf(&Statement, "%s %s %s", Property, Operator, Value)==-1){
- ERROR("Failed to allocated memory for statement.");
- return;
- }
- }
- else {
- MESSAGE(VERBOSE_PARSERS, "Popping '%s %s \"%s\"'",Property, Operator, Value);
- if(asprintf(&Statement, "%s %s '%s'", Property, Operator, Value)==-1){
- ERROR("Failed to allocated memory for statement.");
- return;
- }
- }
-
- if(asprintf(&this->SQLWhereStmt, "%s %s", this->SQLWhereStmt, Statement)==-1){
- ERROR("Unable to allocate SQL Statement");
- return;
- }
-
- }
- return;
-}
-
-void cSearch::pushProperty(const char* Property){
- this->CurrentProperty = strdup(Property);
- MESSAGE(VERBOSE_PARSERS, "Property %s added",Property);
-}
-
-void cSearch::pushOperator(const char* Operator){
- this->CurrentOperator = strdup(Operator);
- MESSAGE(VERBOSE_PARSERS, "Operator %s added",Operator);
-}
-
-void cSearch::pushValue(const char* Start, const char* End){
- const char* Value = string(Start,End).c_str();
- if(!Value || !strcmp(Value,"")) return;
-
- this->CurrentValue = strdup(Value);
- MESSAGE(VERBOSE_PARSERS, "Value %s added", Value);
-}
-
-void cSearch::pushExistance(const char* Exists){
- this->CurrentValue = strdup(Exists);
- this->CurrentOperator = strdup("IS");
- MESSAGE(VERBOSE_PARSERS, "Existance expression called. '%s'", Exists);
-}
-
-void cSearch::pushConcatOp(const char* Operator){
- if(asprintf(&this->SQLWhereStmt, "%s %s ", this->SQLWhereStmt, Operator)==-1){
- ERROR("Unable to allocate SQL Statement");
- return;
- }
-
- MESSAGE(VERBOSE_PARSERS, "Concatenation expression called. '%s'", Operator);
-}
-
-void cSearch::pushStartBrackedExp(const char){
- MESSAGE(VERBOSE_PARSERS, "Pushing opening bracket");
- if(asprintf(&this->SQLWhereStmt, "%s(", this->SQLWhereStmt)==-1){
- ERROR("Unable to allocate SQL Statement");
- return;
- }
-}
-
- /**********************************************\
- * *
- * The rest *
- * *
- \**********************************************/
-
-cSearch* cSearch::mInstance = NULL;
-
-const char* cSearch::parse(const char* Search){
- if(!cSearch::mInstance) cSearch::mInstance = new cSearch();
-
- if(cSearch::mInstance && cSearch::mInstance->parseCriteria(Search)){
- return cSearch::mInstance->SQLWhereStmt;
- }
- return NULL;
-}
-
-bool cSearch::parseCriteria(const char* Search){
-
- charCallback endBrackedExpCB(bind(&cSearch::pushEndBrackedExp, this, _1));
- expCallback pushSimpleExpCB(bind(&cSearch::pushExpression, this, _1, _2));
- opCallback pushOperatorCB(bind(&cSearch::pushOperator, this, _1));
- expCallback pushQuotedValueCB(bind(&cSearch::pushValue, this, _1, _2));
- opCallback pushExistanceCB(bind(&cSearch::pushExistance, this, _1));
- propCallback pushPropertyCB(bind(&cSearch::pushProperty, this, _1));
- opCallback pushConcatOpCB(bind(&cSearch::pushConcatOp, this, _1));
- charCallback startBrackedExpCB(bind(&cSearch::pushStartBrackedExp, this, _1));
-
- // Craft the grammar
- cSearchGrammar Grammar(endBrackedExpCB,
- pushSimpleExpCB,
- pushOperatorCB,
- pushQuotedValueCB,
- pushExistanceCB,
- pushPropertyCB,
- pushConcatOpCB,
- startBrackedExpCB);
-
- MESSAGE(VERBOSE_PARSERS, "Starting search parsing");
-
- if(boost::spirit::parse(Search, Grammar).full){
- MESSAGE(VERBOSE_DIDL, "Parsed search expression successfuly");
- }
- else {
- ERROR("Parsing search expression failed");
- return false;
- }
- return true;
-}
-
-cSearch::cSearch(){
- this->CurrentOperator = NULL;
- this->CurrentProperty = NULL;
- this->CurrentValue = NULL;
- this->SQLWhereStmt = strdup("");
-}
-
-cSearch::~cSearch(){
- delete this->CurrentOperator;
- delete this->CurrentProperty;
- delete this->CurrentValue;
-}
-
- /**********************************************\
- * *
- * The filter *
- * *
- \**********************************************/
-
-cFilterCriteria::cFilterCriteria(){
- this->mFilterList = NULL;
-}
-
-cFilterCriteria::~cFilterCriteria(){}
-
-cStringList* cFilterCriteria::parse(const char* Filter){
- cFilterCriteria* FilterParser = new cFilterCriteria;
- cStringList* List = NULL;
-
- if(FilterParser && FilterParser->parseFilter(Filter)){
- List = FilterParser->getFilterList();
- }
-
- delete FilterParser;
-
- return List;
-}
-
-bool cFilterCriteria::parseFilter(const char* Filter){
- this->mFilterList = new cStringList;
-
- if(Filter && !strcasecmp(Filter, "")){
- MESSAGE(VERBOSE_PARSERS, "Empty filter");
- return true;
- }
-
- charCallback pushAsteriskCB(bind(&cFilterCriteria::pushAsterisk,this,_1));
- propCallback pushPropertyCB(bind(&cFilterCriteria::pushProperty,this,_1));
-
- cFilterGrammar Grammar(pushPropertyCB, pushAsteriskCB);
-
- if(boost::spirit::parse(Filter, Grammar).full){
- MESSAGE(VERBOSE_PARSERS, "Parse filter successful");
- }
- else {
- ERROR("Parsing filter failed");
- return false;
- }
- return true;
-}
-
- /**********************************************\
- * *
- * The actors *
- * *
- \**********************************************/
-
-void cFilterCriteria::pushProperty(const char* Property){
- MESSAGE(VERBOSE_PARSERS, "Pushing property");
- this->mFilterList->Append(strdup(Property));
-}
-
-void cFilterCriteria::pushAsterisk(const char){
- MESSAGE(VERBOSE_PARSERS, "Pushing asterisk (*)");
- if(this->mFilterList) delete this->mFilterList;
- this->mFilterList = NULL;
- return;
-}
-
- /**********************************************\
- * *
- * The sorter *
- * *
- \**********************************************/
-
-cSortCriteria::cSortCriteria(){
- this->mCriteriaList = new cList<cSortCrit>;
- this->mCurrentCrit = NULL;
-}
-
-cSortCriteria::~cSortCriteria(){}
-
-cList<cSortCrit>* cSortCriteria::parse(const char* Sort){
- cSortCriteria* SortParser = new cSortCriteria;
- cList<cSortCrit>* List = NULL;
- if(SortParser && SortParser->parseSort(Sort)){
- List = SortParser->getSortList();
- }
-
- delete SortParser;
-
- return List;
-}
-
-bool cSortCriteria::parseSort(const char* Sort){
- if(!Sort || !strcasecmp(Sort, "")){
- MESSAGE(VERBOSE_PARSERS, "Empty Sort");
- return true;
- }
-
- charCallback pushDirectionCB(bind(&cSortCriteria::pushDirection,this,_1));
- propCallback pushPropertyCB(bind(&cSortCriteria::pushProperty,this,_1));
-
- cSortGrammar Grammar(pushPropertyCB, pushDirectionCB);
-
- if(boost::spirit::parse(Sort, Grammar).full){
- MESSAGE(VERBOSE_PARSERS, "Parse Sort successful");
- }
- else {
- ERROR("Parsing Sort failed");
- return false;
- }
- return true;
-}
-
- /**********************************************\
- * *
- * The actors *
- * *
- \**********************************************/
-
-void cSortCriteria::pushProperty(const char* Property){
- MESSAGE(VERBOSE_PARSERS, "Pushing property '%s'", Property);
- this->mCurrentCrit->Property = strdup(Property);
- this->mCriteriaList->Add(this->mCurrentCrit);
- return;
-}
-
-void cSortCriteria::pushDirection(const char Direction){
- MESSAGE(VERBOSE_PARSERS, "Pushing direction '%c'", Direction);
- this->mCurrentCrit = new cSortCrit;
- this->mCurrentCrit->SortDescending = (Direction=='-')?true:false;
- return;
-}
-
- /**********************************************\
- * *
- * The pathparser *
- * *
- \**********************************************/
-
-/** @private */
-struct cWebserverSections : symbols<> {
- cWebserverSections(){
- add
- (UPNP_DIR_SHARES)
- ;
- }
-} WebserverSections;
-
-/** @private */
-struct cWebserverMethods : symbols<int> {
- cWebserverMethods(){
- add
- ("browse", UPNP_WEB_METHOD_BROWSE)
- ("download", UPNP_WEB_METHOD_DOWNLOAD)
- ("search", UPNP_WEB_METHOD_SEARCH)
- ("show", UPNP_WEB_METHOD_SHOW)
- ("get", UPNP_WEB_METHOD_STREAM)
- ;
- }
-} WebserverMethods;
-
-/** @private */
-struct cPathParserGrammar : public boost::spirit::grammar<cPathParserGrammar> {
-
- intCallback &pushSection;
- intCallback &pushMethod;
- expCallback &pushPropertyKey;
- expCallback &pushPropertyValue;
-
- cPathParserGrammar(intCallback &pushSection,
- intCallback &pushMethod,
- expCallback &pushPropertyKey,
- expCallback &pushPropertyValue):
- pushSection(pushSection),
- pushMethod(pushMethod),
- pushPropertyKey(pushPropertyKey),
- pushPropertyValue(pushPropertyValue){}
-
- template <typename scanner>
- /** @private */
- struct definition {
- boost::spirit::rule<scanner> pathExp, section, method, methodProperties,
- property, key, value, uncriticalChar;
-
- const boost::spirit::rule<scanner> &start(){
- return pathExp;
- }
- definition(const cPathParserGrammar &self){
- pathExp = section >> ch_p('/') >> method >> ch_p('?') >> methodProperties
- ;
-
- section = WebserverSections[self.pushSection]
- ;
-
- method = WebserverMethods[self.pushMethod]
- ;
-
- methodProperties = property >> *(ch_p('&') >> methodProperties)
- ;
-
- property = key >> ch_p('=') >> value
- ;
-
- key = (+alnum_p)[self.pushPropertyKey]
- ;
-
- value = (*uncriticalChar)[self.pushPropertyValue]
- ;
-
- uncriticalChar = chset_p("-_.%~0-9A-Za-z")
- ;
- }
- };
-};
-
-cPathParser::cPathParser(){
- this->mSection = 0;
- this->mMethod = 0;
-}
-
-cPathParser::~cPathParser(){}
-
-bool cPathParser::parse(const char* Path, int* Section, int* Method, propertyMap* Properties){
- cPathParser* Parser = new cPathParser();
- bool ret = (Parser && Parser->parsePath(Path, Section, Method, Properties)) ? true : false;
-
- delete Parser;
-
- return ret;
-}
-
-bool cPathParser::parsePath(const char* Path, int* Section, int* Method, propertyMap* Properties){
- if(!Path){
- return false;
- }
-
- intCallback pushSectionCB(bind(&cPathParser::pushSection,this,_1));
- intCallback pushMethodCB(bind(&cPathParser::pushMethod,this,_1));
- expCallback pushPropertyKeyCB(bind(&cPathParser::pushPropertyKey, this, _1, _2));
- expCallback pushPropertyValueCB(bind(&cPathParser::pushPropertyValue, this, _1, _2));
-
- cPathParserGrammar Grammar(pushSectionCB, pushMethodCB, pushPropertyKeyCB, pushPropertyValueCB);
-
- if(boost::spirit::parse(Path, Grammar).full){
- MESSAGE(VERBOSE_PARSERS, "Parse path successful");
- *Section = this->mSection;
- *Method = this->mMethod;
- *Properties = this->mProperties;
- return true;
- }
- else {
- ERROR("Parsing path failed");
- return false;
- }
-
- return true;
-}
-
- /**********************************************\
- * *
- * The actors *
- * *
- \**********************************************/
-
-void cPathParser::pushPropertyKey(const char* Start, const char* End){
- char* Key = strndup(Start, End-Start);
-
- MESSAGE(VERBOSE_PARSERS, "Pushing key '%s'", Key);
-
- this->mKey = Key;
-
- free(Key);
-}
-
-void cPathParser::pushPropertyValue(const char* Start, const char* End){
- char* Value = strndup(Start, End-Start);
-
- MESSAGE(VERBOSE_PARSERS, "Pushing value '%s'", Value);
- // TODO: urlDecode Value
-
- if(*this->mKey){
- char* Key = strdup(this->mKey);
- this->mProperties[Key] = Value;
- }
-}
-
-void cPathParser::pushMethod(int Method){
- MESSAGE(VERBOSE_PARSERS, "Pushing method '%d'", Method);
- this->mMethod = Method;
-}
-
-void cPathParser::pushSection(int Section){
- MESSAGE(VERBOSE_PARSERS, "Pushing section '%d'", Section);
- this->mSection = Section;
-} \ No newline at end of file
diff --git a/misc/util.cpp b/misc/util.cpp
deleted file mode 100644
index 0781307..0000000
--- a/misc/util.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * File: util.cpp
- * Author: savop, andreas
- *
- * Created on 21. Mai 2009, 21:25
- *
- * Extracted from streamdev-server plugin common.c
- * $Id: common.c,v 1.6 2008/03/31 10:34:26 schmirl Exp $
- */
-#include "util.h"
-#include "../common.h"
-#include <string.h>
-#include <string>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <upnp/ixml.h>
-#include <arpa/inet.h>
-#include <iosfwd>
-#include <time.h>
-
-#define DURATION_MAX_STRING_LENGTH 16 // DLNA: 1-5 DIGIT hours :
- // 2 DIGIT minutes :
- // 2 DIGIT seconds .
- // 3 DIGIT fraction
-
-char* duration(off64_t duration, unsigned int timeBase){
- if(!timeBase){
- timeBase = 1;
- }
-
- int seconds, minutes, hours, fraction;
-
- seconds = duration / timeBase;
- fraction = duration % timeBase;
- minutes = seconds / 60;
- seconds %= 60;
- hours = minutes / 60;
- minutes %= 60;
-
- char* output = new char[DURATION_MAX_STRING_LENGTH];
-
- if(timeBase > 1){
- if(!snprintf(
- output,
- DURATION_MAX_STRING_LENGTH,
- UPNP_DURATION_FRAME_FORMAT,
- hours, minutes, seconds, fraction) < 0
- ){
- delete [] output;
- return NULL;
- }
- }
- else {
- if(snprintf(
- output,
- DURATION_MAX_STRING_LENGTH,
- UPNP_DURATION_FORMAT,
- hours, minutes, seconds) < 0
- ){
- delete [] output;
- return NULL;
- }
- }
- return output;
-}
-
-char* substr(const char* str, unsigned int offset, unsigned int length){
- if(offset > strlen(str)) return NULL;
- if(length > strlen(str+offset)) length = strlen(str+offset);
- char* substring = (char*)malloc(sizeof(substring)*length+1);
- strncpy(substring, str+offset, length);
- substring[length] = '\0';
- return substring;
-}
-
-const char* getMACFromInterface(const char* Interface) {
- int fd;
- struct ifreq ifr;
-
- fd = socket(AF_INET, SOCK_DGRAM, 0);
-
- ifr.ifr_addr.sa_family = AF_INET;
- strncpy(ifr.ifr_name, Interface, IFNAMSIZ-1);
-
- ioctl(fd, SIOCGIFHWADDR, &ifr);
-
- close(fd);
-
- char *ret = new char[18];
-
- sprintf(ret, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
- (unsigned char)ifr.ifr_hwaddr.sa_data[0],
- (unsigned char)ifr.ifr_hwaddr.sa_data[1],
- (unsigned char)ifr.ifr_hwaddr.sa_data[2],
- (unsigned char)ifr.ifr_hwaddr.sa_data[3],
- (unsigned char)ifr.ifr_hwaddr.sa_data[4],
- (unsigned char)ifr.ifr_hwaddr.sa_data[5]);
-
- return ret;
-}
-
-char** getNetworkInterfaces(int *count){
- int fd;
- struct ifconf ifc;
- struct ifreq ifr[10];
- int nifaces, i;
- char** ifaces;
- *count = 0;
-
- memset(&ifc,0,sizeof(ifc));
- ifc.ifc_buf = (char*) (ifr);
- ifc.ifc_len = sizeof(ifr);
-
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- int ret = ioctl(fd, SIOCGIFCONF, &ifc);
- close(fd);
- if(ret==0){
- nifaces = ifc.ifc_len/sizeof(struct ifreq);
- ifaces = new char* [nifaces+1];
- for(i = 0; i < nifaces; i++){
- ifaces[i] = new char[IFNAMSIZ];
- ifaces[i] = strdup(ifr[i].ifr_name);
- }
- ifaces[i] = NULL;
- *count = nifaces;
- return ifaces;
- }
- else {
- return NULL;
- }
-}
-
-const sockaddr_in* getIPFromInterface(const char* Interface){
- if(Interface==NULL) return NULL;
- int fd;
- struct ifreq ifr;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- /* I want to get an IPv4 IP address */
- ifr.ifr_addr.sa_family = AF_INET;
- /* I want IP address attached to "eth0" */
- strncpy(ifr.ifr_name, Interface, IFNAMSIZ-1);
- int ret = ioctl(fd, SIOCGIFADDR, &ifr);
- close(fd);
- const sockaddr_in* IpAddress = new sockaddr_in;
- if(ret==0){
- IpAddress = (sockaddr_in *)&ifr.ifr_addr;
- return IpAddress;
- }
- else {
- delete IpAddress;
- return NULL;
- }
-}
-
-cMenuEditIpItem::cMenuEditIpItem(const char *Name, char *Value):cMenuEditItem(Name) {
- value = Value;
- curNum = -1;
- pos = -1;
- step = false;
- Set();
-}
-
-cMenuEditIpItem::~cMenuEditIpItem() {
-}
-
-void cMenuEditIpItem::Set(void) {
- char buf[1000];
- if (pos >= 0) {
- in_addr_t addr = inet_addr(value);
- if ((int)addr == -1)
- addr = 0;
- int p = 0;
- for (int i = 0; i < 4; ++i) {
- p += snprintf(buf + p, sizeof(buf) - p, pos == i ? "[%d]" : "%d",
- pos == i ? curNum : (addr >> (i * 8)) & 0xff);
- if (i < 3)
- buf[p++] = '.';
- }
- SetValue(buf);
- } else
- SetValue(value);
-}
-
-eOSState cMenuEditIpItem::ProcessKey(eKeys Key) {
- in_addr addr;
- addr.s_addr = inet_addr(value);
- if ((int)addr.s_addr == -1)
- addr.s_addr = 0;
-
- switch (Key) {
- case kUp:
- if (pos >= 0) {
- if (curNum < 255) ++curNum;
- } else
- return cMenuEditItem::ProcessKey(Key);
- break;
-
- case kDown:
- if (pos >= 0) {
- if (curNum > 0) --curNum;
- } else
- return cMenuEditItem::ProcessKey(Key);
- break;
-
- case kOk:
- if (pos >= 0) {
- addr.s_addr = inet_addr(value);
- if ((int)addr.s_addr == -1)
- addr.s_addr = 0;
- addr.s_addr &= ~(0xff << (pos * 8));
- addr.s_addr |= curNum << (pos * 8);
- strcpy(value, inet_ntoa(addr));
- } else
- return cMenuEditItem::ProcessKey(Key);
- curNum = -1;
- pos = -1;
- break;
-
- case kRight:
- if (pos >= 0) {
- addr.s_addr = inet_addr(value);
- if ((int)addr.s_addr == -1)
- addr.s_addr = 0;
- addr.s_addr &= ~(0xff << (pos * 8));
- addr.s_addr |= curNum << (pos * 8);
- strcpy(value, inet_ntoa(addr));
- }
-
- if (pos == -1 || pos == 3)
- pos = 0;
- else
- ++pos;
-
- curNum = (addr.s_addr >> (pos * 8)) & 0xff;
- step = true;
- break;
-
- case kLeft:
- if (pos >= 0) {
- addr.s_addr = inet_addr(value);
- if ((int)addr.s_addr == -1)
- addr.s_addr = 0;
- addr.s_addr &= ~(0xff << (pos * 8));
- addr.s_addr |= curNum << (pos * 8);
- strcpy(value, inet_ntoa(addr));
- }
-
- if (pos <= 0)
- pos = 3;
- else
- --pos;
-
- curNum = (addr.s_addr >> (pos * 8)) & 0xff;
- step = true;
- break;
-
- case k0 ... k9: /* Netbeans reports error with this line (.. is okay but wrong) */
- if (pos == -1)
- pos = 0;
-
- if (curNum == -1 || step) {
- curNum = Key - k0;
- step = false;
- } else
- curNum = curNum * 10 + (Key - k0);
-
- if ((curNum * 10 > 255) || (curNum == 0)) {
- in_addr addr;
- addr.s_addr = inet_addr(value);
- if ((int)addr.s_addr == -1)
- addr.s_addr = 0;
- addr.s_addr &= ~(0xff << (pos * 8));
- addr.s_addr |= curNum << (pos * 8);
- strcpy(value, inet_ntoa(addr));
- if (++pos == 4)
- pos = 0;
- curNum = (addr.s_addr >> (pos * 8)) & 0xff;
- step = true;
- }
- break;
-
- default:
- return cMenuEditItem::ProcessKey(Key);
- }
-
- Set();
- return osContinue;
-}
-
-const char* escapeXMLCharacters(const char* Data, char** Buf){
- if(Data==NULL){
- ERROR("Escape XML: No data to escape");
- return NULL;
- }
- std::string NewData = "";
- int Char = 0;
- for(unsigned int i = 0; i < strlen(Data); i++){
- Char = Data[i];
- switch(Char){
- case L'€': NewData += "&euro;"; break;
- case L'"': NewData += "&quot;"; break;
- case L'&': NewData += "&amp;"; break;
- case L'<': NewData += "&lt;"; break;
- case L'>': NewData += "&gt;"; break;
- case L'¡': NewData += "&iexcl;"; break;
- case L'¢': NewData += "&cent;"; break;
- case L'£': NewData += "&pound;"; break;
- case L'¤': NewData += "&curren;"; break;
- case L'¥': NewData += "&yen;"; break;
- case L'¦': NewData += "&brvbar;"; break;
- case L'§': NewData += "&sect;"; break;
- case L'¨': NewData += "&uml;"; break;
- case L'©': NewData += "&copy;"; break;
- case L'ª': NewData += "&ordf;"; break;
- case L'¬': NewData += "&not;"; break;
- case L'­': NewData += "&shy;"; break;
- case L'®': NewData += "&reg;"; break;
- case L'¯': NewData += "&macr;"; break;
- case L'°': NewData += "&deg;"; break;
- case L'±': NewData += "&plusmn;"; break;
- case L'²': NewData += "&sup2;"; break;
- case L'³': NewData += "&sup3;"; break;
- case L'´': NewData += "&acute;"; break;
- case L'µ': NewData += "&micro;"; break;
- case L'¶': NewData += "&para;"; break;
- case L'·': NewData += "&middot;"; break;
- case L'¸': NewData += "&cedil;"; break;
- case L'¹': NewData += "&sup1;"; break;
- case L'º': NewData += "&ordm;"; break;
- case L'»': NewData += "&raquo;"; break;
- case L'«': NewData += "&laquo;"; break;
- case L'¼': NewData += "&frac14;"; break;
- case L'½': NewData += "&frac12;"; break;
- case L'¾': NewData += "&frac34;"; break;
- case L'¿': NewData += "&iquest;"; break;
- case L'À': NewData += "&Agrave;"; break;
- case L'Á': NewData += "&Aacute;"; break;
- case L'Â': NewData += "&Acirc;"; break;
- case L'Ã': NewData += "&Atilde;"; break;
- case L'Ä': NewData += "&Auml;"; break;
- case L'Å': NewData += "&Aring;"; break;
- case L'Æ': NewData += "&AElig;"; break;
- case L'Ç': NewData += "&Ccedil;"; break;
- case L'È': NewData += "&Egrave;"; break;
- case L'É': NewData += "&Eacute;"; break;
- case L'Ê': NewData += "&Ecirc;"; break;
- case L'Ë': NewData += "&Euml;"; break;
- case L'Ì': NewData += "&Igrave;"; break;
- case L'Í': NewData += "&Iacute;"; break;
- case L'Î': NewData += "&Icirc;"; break;
- case L'Ï': NewData += "&Iuml;"; break;
- case L'Ð': NewData += "&ETH;"; break;
- case L'Ñ': NewData += "&Ntilde;"; break;
- case L'Ò': NewData += "&Ograve;"; break;
- case L'Ó': NewData += "&Oacute;"; break;
- case L'Ô': NewData += "&Ocirc;"; break;
- case L'Õ': NewData += "&Otilde;"; break;
- case L'Ö': NewData += "&Ouml;"; break;
- case L'×': NewData += "&times;"; break;
- case L'Ø': NewData += "&Oslash;"; break;
- case L'Ù': NewData += "&Ugrave;"; break;
- case L'Ú': NewData += "&Uacute;"; break;
- case L'Û': NewData += "&Ucirc;"; break;
- case L'Ü': NewData += "&Uuml;"; break;
- case L'Ý': NewData += "&Yacute;"; break;
- case L'Þ': NewData += "&THORN;"; break;
- case L'ß': NewData += "&szlig;"; break;
- case L'à': NewData += "&agrave;"; break;
- case L'á': NewData += "&aacute;"; break;
- case L'â': NewData += "&acirc;"; break;
- case L'ã': NewData += "&atilde;"; break;
- case L'ä': NewData += "&auml;"; break;
- case L'å': NewData += "&aring;"; break;
- case L'æ': NewData += "&aelig;"; break;
- case L'ç': NewData += "&ccedil;"; break;
- case L'è': NewData += "&egrave;"; break;
- case L'é': NewData += "&eacute;"; break;
- case L'ê': NewData += "&ecirc;"; break;
- case L'ë': NewData += "&euml;"; break;
- case L'ì': NewData += "&igrave;"; break;
- case L'í': NewData += "&iacute;"; break;
- case L'î': NewData += "&icirc;"; break;
- case L'ï': NewData += "&iuml;"; break;
- case L'ð': NewData += "&eth;"; break;
- case L'ñ': NewData += "&ntilde;"; break;
- case L'ò': NewData += "&ograve;"; break;
- case L'ó': NewData += "&oacute;"; break;
- case L'ô': NewData += "&ocirc;"; break;
- case L'õ': NewData += "&otilde;"; break;
- case L'ö': NewData += "&ouml;"; break;
- case L'÷': NewData += "&divide;"; break;
- case L'ø': NewData += "&oslash;"; break;
- case L'ù': NewData += "&ugrave;"; break;
- case L'ú': NewData += "&uacute;"; break;
- case L'û': NewData += "&ucirc;"; break;
- case L'ü': NewData += "&uuml;"; break;
- case L'ý': NewData += "&yacute;"; break;
- case L'þ': NewData += "&thorn;"; break;
- default: NewData += Data[i]; break;
- }
- }
- *Buf = strdup(NewData.c_str());
- return (*Buf);
-}
-
-//Function copied from Intel SDK
-///////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2003 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-// * Neither name of Intel Corporation nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-///////////////////////////////////////////////////////////////////////////
-/********************************************************************************
- * SampleUtil_GetFirstDocumentItem
- *
- * Description:
- * Given a document node, this routine searches for the first element
- * named by the input string item, and returns its value as a string.
- * String must be freed by caller using free.
- * Parameters:
- * doc -- The DOM document from which to extract the value
- * item -- The item to search for
- *
- *
- ********************************************************************************/
-char* ixmlGetFirstDocumentItem( IN IXML_Document * doc, IN const char *item, int* error ) {
- IXML_NodeList *nodeList = NULL;
- IXML_Node *textNode = NULL;
- IXML_Node *tmpNode = NULL;
-
- char *ret = NULL;
- *error = 0;
-
- nodeList = ixmlDocument_getElementsByTagName( doc, ( char * )item );
-
- if( nodeList != NULL ) {
- if( ( tmpNode = ixmlNodeList_item( nodeList, 0 ) ) ) {
-
- textNode = ixmlNode_getFirstChild( tmpNode );
-
- if(textNode != NULL){
- ret = strdup( ixmlNode_getNodeValue( textNode ) );
- }
- }
- } else {
- *error = -1;
- }
-
- if( nodeList != NULL) {
- ixmlNodeList_free( nodeList );
- }
-
-
- return ret;
-}
-
-IXML_Element* ixmlAddProperty(IXML_Document* document, IXML_Element* node, const char* upnpproperty, const char* value){
- if(!node) return NULL;
- IXML_Element* PropertyNode = NULL;
-
- char tvalue[UPNP_MAX_METADATA_LENGTH];
- // trim the value to max metadata size
- if(value){
- strncpy(tvalue, value, UPNP_MAX_METADATA_LENGTH);
- }
-
- const char* attribute = att(upnpproperty);
- const char* property = prop(upnpproperty);
- if(attribute){
- if(!strcmp(property,"")){
- ixmlElement_setAttribute(node, attribute, tvalue);
- }
- else {
- IXML_NodeList* NodeList = ixmlElement_getElementsByTagName(node, property);
- if(NodeList!=NULL){
- PropertyNode = (IXML_Element*) ixmlNodeList_item(NodeList, 0);
- if(PropertyNode){
- if(ixmlElement_setAttribute(PropertyNode, attribute, tvalue)!=IXML_SUCCESS){
- return NULL;
- }
- }
- else {
- ixmlNodeList_free(NodeList);
- return NULL;
- }
- }
- else {
- return NULL;
- }
- }
- }
- else {
- PropertyNode = ixmlDocument_createElement(document, property);
- IXML_Node* PropertyText = ixmlDocument_createTextNode(document, tvalue);
- ixmlNode_appendChild((IXML_Node*) PropertyNode, PropertyText);
- ixmlNode_appendChild((IXML_Node*) node, (IXML_Node*) PropertyNode);
- }
- return PropertyNode;
-}
-
-IXML_Element* ixmlAddFilteredProperty(cStringList* Filter, IXML_Document* document, IXML_Element* node, const char* upnpproperty, const char* value){
- // leave out empty values.
- if(!value || !strcmp(value, "") || !strcmp(value, "0")){
- return NULL;
- }
-
- if(!Filter || Filter->Find(upnpproperty))
- return ixmlAddProperty(document, node, upnpproperty, value);
- else
- return NULL;
-} \ No newline at end of file
diff --git a/po/de-DE.po b/po/de-DE.po
deleted file mode 100644
index 59ece6b..0000000
--- a/po/de-DE.po
+++ /dev/null
@@ -1,271 +0,0 @@
-# Language de-DE translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# savop <denis.loh@hft-leipzig.de>, 2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: 0.0.2\n"
-"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-01-24 20:48+0100\n"
-"PO-Revision-Date: 2010-01-24 20:14+0100\n"
-"Last-Translator: savop <denis.loh@hft-leipzig.de>\n"
-"Language-Team: Language de-DE\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#, c-format
-msgid ""
-" The server can automatically detect both IP address and an\n"
-" appropriate port, assuming that the first network interface\n"
-" is connected to the internal network. However, it is possible\n"
-" to specify alternative settings with the following options:\n"
-"\n"
-" -i <interface> --int=<interface> The server network\n"
-" interface\n"
-" e.g: eth0, wlan1 etc.\n"
-" If given option '-a' must\n"
-" be absent.\n"
-" -a <address> --address=<address> The server IPv4 address.\n"
-" If given option '-i' must\n"
-" be absent.\n"
-" -p <port> --port=<port> The server port\n"
-" Supported ports:\n"
-" %5d (auto detect)\n"
-" %5d-%5d (user defined)\n"
-" -d --autodetect Force auto detection\n"
-" Use this option to\n"
-" overwrite the setup menu\n"
-" options.\n"
-" -v --verbose Increase verbosity level\n"
-" The more v options the\n"
-" higher the output level\n"
-" --dbdir=<directory> The directory in which the\n"
-" metadata database is stored\n"
-" --httpdir=<directory> The directory where the\n"
-" http documents are located\n"
-msgstr ""
-" Der Server kann automatisch sowohl die IP-Adresse als auch einen\n"
-" passenden Port erkennen. Dabei wird davon ausgegangen, dass die\n"
-" erste Netzwerkkarte zum internen Netz verbunden ist. Dennoch ist\n"
-" ist es möglich, alternative Einstellungen mit den folgenden\n"
-" Optionen anzugeben:\n"
-"\n"
-" -i <interface> --int=<interface> Die Servernetzwerkkarte\n"
-" z.B: eth0, wlan1 etc.\n"
-" Wenn angegeben, darf '-a'\n"
-" nicht angegeben werden.\n"
-" -a <address> --address=<address> Die Server-IPv4-Adresse.\n"
-" Wenn angegeben, darf '-i'\n"
-" nicht angegeben werden.\n"
-" -p <port> --port=<port> Der Serverport\n"
-" Unterstützte Ports:\n"
-" %5d (Autoerkennung)\n"
-" %5d-%5d (benutzerdefiniert)\n"
-" -d --autodetect Erzwinge Autoerkennung\n"
-" Diese Option verwenden, um\n"
-" die Einstellungen im Setup-\n"
-" menü zu überschreiben.\n"
-" -v --verbose Erhöht den Ausgabelevel\n"
-" Je mehr v-Optionen\n"
-" desto mehr Ausgaben\n"
-" --dbdir=<directory> Das Verzeichnis, worin die\n"
-" Metadatenbank abgelegt ist\n"
-" --httpdir=<directory> Das Verzeichnis in dem\n"
-" die HTTP Dokumente liegen\n"
-
-msgid "The UPnP server is still running."
-msgstr "Der UPnP server läuft noch."
-
-msgid "User defined"
-msgstr "Benutzerdefiniert"
-
-msgid "Enable UPnP Server"
-msgstr "UPnP-Server einschalten"
-
-msgid "disabled"
-msgstr "ausgeschaltet"
-
-msgid "enabled"
-msgstr "eingeschaltet"
-
-msgid "Auto detect settings"
-msgstr "Einstellungen erkennen"
-
-msgid "no"
-msgstr "nein"
-
-msgid "yes"
-msgstr "ja"
-
-msgid "Bind to network interface"
-msgstr "An aktuelle Netzwerkkarte binden"
-
-msgid "Current IP address"
-msgstr "Aktuelle IP-Adresse"
-
-msgid "Set IP address"
-msgstr "IP-Adresse setzen"
-
-msgid "Select port"
-msgstr "Port auswählen"
-
-msgid "auto"
-msgstr "auto"
-
-msgid "user definied"
-msgstr "benutzerdefiniert"
-
-msgid "User specified port"
-msgstr "benutzerdefinierter Port"
-
-msgid "Video"
-msgstr "Video"
-
-msgid "Audio"
-msgstr "Audio"
-
-msgid "TV"
-msgstr "TV"
-
-msgid "Records"
-msgstr "Aufnahmen"
-
-msgid "Radio"
-msgstr "Radio"
-
-msgid "User videos"
-msgstr "Benutzervideos"
-
-msgid "Invalid action"
-msgstr "Ungültige Aktion"
-
-msgid "Invalid args"
-msgstr "Ungültige Argumente"
-
-msgid "Invalid var"
-msgstr "Ungültige Variable"
-
-msgid "Action failed"
-msgstr "Aktion fehlgeschlagen"
-
-msgid "Argument value invalid"
-msgstr "Argumentenwert ungültig"
-
-msgid "Argument value out of range"
-msgstr "Argumentenwert außerhalb der Gültigkeit"
-
-msgid "Optional action not implemented"
-msgstr "Optionale Aktion nicht implementiert"
-
-msgid "Out of memory"
-msgstr "Kein Speicher verfügbar"
-
-msgid "Human intervention required"
-msgstr "Benutzereingriff notwendig"
-
-msgid "String argument to long"
-msgstr "Zeichenkettenargument zu lang"
-
-msgid "Action not authorized"
-msgstr "Aktion nicht authorisiert"
-
-msgid "Signature failure"
-msgstr "Signaturfehler"
-
-msgid "Signature missing"
-msgstr "Signatur fehlt"
-
-msgid "Not encrypted"
-msgstr "Nicht verschlüsselt"
-
-msgid "Invalid sequence"
-msgstr "Ungültige Sequenz"
-
-msgid "Invalid control URL"
-msgstr "Ungültige Steuer-URL"
-
-msgid "No such session"
-msgstr "Keine solche Sitzung"
-
-msgid "Unknown error code. Contact the device manufacturer"
-msgstr "Unbekannter Fehlercode. Kontaktieren Sie den Hersteller"
-
-msgid "Incompatible protocol info"
-msgstr "Inkompatible Protokollinfo"
-
-msgid "Incompatible directions"
-msgstr "Inkompatible Richtungen"
-
-msgid "Insufficient network resources"
-msgstr "Nicht ausreichende Netzwerkressourcen"
-
-msgid "Local restrictions"
-msgstr "Lokale Restriktionen"
-
-msgid "Access denied"
-msgstr "Zugriff verweigert"
-
-msgid "Invalid connection reference"
-msgstr "Ungültige Verbindungsreferenz"
-
-msgid "Not in network"
-msgstr "Nicht in diesem Netzwerk"
-
-msgid "Bad metadata"
-msgstr "Falsche Metadaten"
-
-msgid "Cannot process the request"
-msgstr "Kann Anfrage nicht bearbeiten"
-
-msgid "Destination resource access denied"
-msgstr "Zugriff auf Zielressource verweigert"
-
-msgid "Invalid current tag"
-msgstr "Ungültiger aktueller Tag"
-
-msgid "Invalid new tag"
-msgstr "Ungültiger neuer Tag"
-
-msgid "Invalid or unsupported search criteria"
-msgstr "Ungültige oder nicht unterstütze Suchkriterie"
-
-msgid "Invalid or unsupported sort criteria"
-msgstr "Ungültige oder nicht unterstützte Sortierkriterie"
-
-msgid "No such container"
-msgstr "Kein solcher Container"
-
-msgid "No such destination resource"
-msgstr "Keine solche Zielressource"
-
-msgid "No such file transfer"
-msgstr "Kein solcher Datentransfer"
-
-msgid "No such objectID"
-msgstr "Keine solche ObjektID"
-
-msgid "No such source resource"
-msgstr "Keine solche Quellressource"
-
-msgid "Parameter mismatch"
-msgstr "Parameter nicht passend"
-
-msgid "Read only tag"
-msgstr "Nur lesbarer Tag"
-
-msgid "Required tag"
-msgstr "Notwendiger Tag"
-
-msgid "Resource access denied"
-msgstr "Zugriff auf Ressource verweigert"
-
-msgid "Restricted object"
-msgstr "Beschränktes Objekt"
-
-msgid "Restricted parent"
-msgstr "Beschränktes Elternobjekt"
-
-msgid "Transfer busy"
-msgstr "Datentransfer ausgelastet"
diff --git a/po/de-DE.po~ b/po/de-DE.po~
deleted file mode 100644
index 92bef90..0000000
--- a/po/de-DE.po~
+++ /dev/null
@@ -1,273 +0,0 @@
-# Language de-DE translations for PACKAGE package.
-# Copyright (C) 2009 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# savop <denis.loh@hft-leipzig.de>, 2009.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: vdr-upnp 0.0.1\n"
-"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-01-24 20:11+0100\n"
-"PO-Revision-Date: 2009-12-30 22:17+0100\n"
-"Last-Translator: Denis <denis.loh@hft-leipzig.de>\n"
-"Language-Team: Language de-DE\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#, fuzzy, c-format
-msgid ""
-" The server can automatically detect both IP address and an\n"
-" appropriate port, assuming that the first network interface\n"
-" is connected to the internal network. However, it is possible\n"
-" to specify alternative settings with the following options:\n"
-"\n"
-" -i <interface> --int=<interface> The server network\n"
-" interface\n"
-" e.g: eth0, wlan1 etc.\n"
-" If given option '-a' must\n"
-" be absent.\n"
-" -a <address> --address=<address> The server IPv4 address.\n"
-" If given option '-i' must\n"
-" be absent.\n"
-" -p <port> --port=<port> The server port\n"
-" Supported ports:\n"
-" %5d (auto detect)\n"
-" %5d-%5d (user defined)\n"
-" -d --autodetect Force auto detection\n"
-" Use this option to\n"
-" overwrite the setup menu\n"
-" options.\n"
-" -v --verbose Increase verbosity level\n"
-" The more v options the\n"
-" higher the output level\n"
-" --dbdir=<directory> The directory in which the\n"
-" metadata database is stored\n"
-" --httpdir=<directory> The directory where the\n"
-" http documents are located\n"
-msgstr ""
-" Der Server kann automatisch sowohl die IP-Adresse als auch einen\n"
-" passenden Port erkennen. Dabei wird davon ausgegangen, dass die\n"
-" erste Netzwerkkarte mit dem internen Netzwerk verbunden ist.\n"
-" Es ist aber auch möglich dieses Verhalten über folgende Optionen\n"
-" zu steuern:\n"
-"\n"
-" -i <interface> --int=<interface> Die Servernetzwerkkarte\n"
-" z.B.: eth0, wlan1 etc.\n"
-" Falls angegeben, muss '-a'\n"
-" weggelassen werden.\n"
-" -a <address> --address=<address> Die Server-IPv4-Adresse.\n"
-" Falls angegeben, muss '-i'\n"
-" weggelassen werden.\n"
-" -p <port> --port=<port> Der Serverport\n"
-" Unterstützte ports:\n"
-" %5d (automatisch)\n"
-" %5d-%5d (benutzerdefiniert)\n"
-" -d --autodetect Automatische Erkennung\n"
-" erzwingen\n"
-" Die Option verwenden, um\n"
-" die Einstellungen des\n"
-" Setupmenüs zu überschreiben.\n"
-" -v --verbose Ausgabelevel erhöhen\n"
-" Je öfter diese Option\n"
-" desto höher der Ausgabelevel\n"
-" --dbdir=<pfad> Das Verzeichnis, worin die\n"
-" Metadatenbank gespeichert ist\n"
-" --httpdir=<pfad> Das Verzeichnis für alle\n"
-" HTTP Dokumente\n"
-
-msgid "The UPnP server is still running."
-msgstr "Der UPnP-Server läuft noch."
-
-#, fuzzy
-#~ msgid "user defined"
-#~ msgstr "benutzerdefiniert"
-
-#~ msgid "Enable UPnP Server"
-#~ msgstr "UPnP-Server aktivieren"
-
-#~ msgid "disabled"
-#~ msgstr "aktiviert"
-
-#~ msgid "enabled"
-#~ msgstr "deaktiviert"
-
-#~ msgid "Auto detect settings"
-#~ msgstr "Einstellungen erkennen"
-
-#~ msgid "no"
-#~ msgstr "nein"
-
-#~ msgid "yes"
-#~ msgstr "ja"
-
-#~ msgid "Bind to network interface"
-#~ msgstr "An Netzwerkkarte binden"
-
-#~ msgid "Current IP address"
-#~ msgstr "Aktuelle IP-Adresse"
-
-#~ msgid "Set IP address"
-#~ msgstr "IP-Adresse setzen"
-
-#~ msgid "Select port"
-#~ msgstr "Port wählen"
-
-#~ msgid "auto"
-#~ msgstr "auto"
-
-#~ msgid "user definied"
-#~ msgstr "benutzerdefiniert"
-
-#~ msgid "User specified port"
-#~ msgstr "benutzerdefinierter Port"
-
-#~ msgid "Video"
-#~ msgstr "Video"
-
-#~ msgid "Audio"
-#~ msgstr "Audio"
-
-#~ msgid "TV"
-#~ msgstr "TV"
-
-#~ msgid "Records"
-#~ msgstr "Aufnahmen"
-
-#~ msgid "Radio"
-#~ msgstr "Radio"
-
-#~ msgid "User videos"
-#~ msgstr "Benutzervideos"
-
-#~ msgid "Invalid action"
-#~ msgstr "Ungültige Aktion"
-
-#~ msgid "Invalid args"
-#~ msgstr "Ungültige Argumente"
-
-#~ msgid "Invalid var"
-#~ msgstr "Ungültige Variable"
-
-#~ msgid "Action failed"
-#~ msgstr "Aktion fehlgeschlagen"
-
-#~ msgid "Argument value invalid"
-#~ msgstr "Argumentenwert ungültig"
-
-#~ msgid "Argument value out of range"
-#~ msgstr "Argumentenwert außerhalb des Bereichs"
-
-#~ msgid "Optional action not implemented"
-#~ msgstr "Optionale Aktion nicht implementiert"
-
-#~ msgid "Out of memory"
-#~ msgstr "kein Speicher verfügbar"
-
-#~ msgid "Human intervention required"
-#~ msgstr "Benutzereingriff notwendig"
-
-#~ msgid "String argument to long"
-#~ msgstr "Zeichenkette zu lang"
-
-#~ msgid "Action not authorized"
-#~ msgstr "Aktion nicht authorisiert"
-
-#~ msgid "Signature failure"
-#~ msgstr "Signaturfehler"
-
-#~ msgid "Signature missing"
-#~ msgstr "Signatur fehlt"
-
-#~ msgid "Not encrypted"
-#~ msgstr "Nicht verschlüsselt"
-
-#~ msgid "Invalid sequence"
-#~ msgstr "Ungültige Sequenz"
-
-#~ msgid "Invalid control URL"
-#~ msgstr "Ungültige Steuer-URL"
-
-#~ msgid "No such session"
-#~ msgstr "Sitzung unbekannt"
-
-#~ msgid "Unknown error code. Contact the device manufacturer"
-#~ msgstr "Unbekannter Fehlercode. Bitte kontaktieren Sie den Hersteller"
-
-#~ msgid "Incompatible protocol info"
-#~ msgstr "Inkompatible Protokollinformation"
-
-#~ msgid "Incompatible directions"
-#~ msgstr "Inkompatible Richtung"
-
-#~ msgid "Insufficient network resources"
-#~ msgstr "Nicht genügend Netzwerkbandbreite"
-
-#~ msgid "Local restrictions"
-#~ msgstr "Lokale Beschränkungen"
-
-#~ msgid "Access denied"
-#~ msgstr "Zugriff verweigert"
-
-#~ msgid "Invalid connection reference"
-#~ msgstr "Ungültige Verbundungsreferenz"
-
-#~ msgid "Not in network"
-#~ msgstr "Nicht in diesem Netzwerk"
-
-#~ msgid "Bad metadata"
-#~ msgstr "Fehlerhafte Metadaten"
-
-#~ msgid "Cannot process the request"
-#~ msgstr "Kann Anfrage nicht ausführen"
-
-#~ msgid "Destination resource access denied"
-#~ msgstr "Zugriff auf Zielressource verweigert"
-
-#~ msgid "Invalid current tag"
-#~ msgstr "Ungültiger aktueller Tag"
-
-#~ msgid "Invalid new tag"
-#~ msgstr "Ungültiger neuer Tag"
-
-#~ msgid "Invalid or unsupported search criteria"
-#~ msgstr "Ungültige oder nicht unterstützte Suchanfrage"
-
-#~ msgid "Invalid or unsupported sort criteria"
-#~ msgstr "Ungültige oder nicht unterstützte Sortieranfrage"
-
-#~ msgid "No such container"
-#~ msgstr "Container existiert nicht"
-
-#~ msgid "No such destination resource"
-#~ msgstr "Zielressource existiert nicht"
-
-#~ msgid "No such file transfer"
-#~ msgstr "Datentransfer existiert nicht"
-
-#~ msgid "No such objectID"
-#~ msgstr "Objekt-ID existiert nicht"
-
-#~ msgid "No such source resource"
-#~ msgstr "Quellressource existiert nicht"
-
-#~ msgid "Parameter mismatch"
-#~ msgstr "Parameter passen nicht"
-
-#~ msgid "Read only tag"
-#~ msgstr "nur Lesezugriff auf Tag"
-
-#~ msgid "Required tag"
-#~ msgstr "Benötigter Tag"
-
-#~ msgid "Resource access denied"
-#~ msgstr "Zugriff auf Ressource verweigert"
-
-#~ msgid "Restricted object"
-#~ msgstr "Beschränktes Objekt"
-
-#~ msgid "Restricted parent"
-#~ msgstr "Beschränktes Elternobjekt"
-
-#~ msgid "Transfer busy"
-#~ msgstr "Datenübertragung ausgelastet"
diff --git a/receiver/livereceiver.cpp b/receiver/livereceiver.cpp
deleted file mode 100644
index a43d197..0000000
--- a/receiver/livereceiver.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * File: livereceiver.cpp
- * Author: savop
- *
- * Created on 4. Juni 2009, 13:28
- */
-
-#include <vdr/thread.h>
-#include <vdr/remux.h>
-#include <vdr/device.h>
-#include <vdr/channels.h>
-#include <vdr/ringbuffer.h>
-#include "livereceiver.h"
-
-cLiveReceiver* cLiveReceiver::newInstance(cChannel* Channel, int Priority){
- cDevice *Device = cDevice::GetDevice(Channel, Priority, true);
-
- if(!Device){
- ERROR("No matching device found to serve this channel!");
- return NULL;
- }
-
- cLiveReceiver *Receiver = new cLiveReceiver(Channel, Device);
- if(Receiver){
- MESSAGE(VERBOSE_SDK, "Receiver for channel \"%s\" created successfully.", Channel->Name());
- return Receiver;
- }
- else {
- ERROR("Failed to create receiver!");
- return NULL;
- }
-}
-
-cLiveReceiver::cLiveReceiver(cChannel *Channel, cDevice *Device)
-: cReceiver( Channel->GetChannelID(), 0, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids()),
- mDevice(Device), mChannel(Channel){
- this->mLiveBuffer = NULL;
- this->mOutputBuffer = NULL;
- this->mFrameDetector = NULL;
-}
-
-cLiveReceiver::~cLiveReceiver(void){
- if(this->IsAttached())
- this->Detach();
-}
-
-void cLiveReceiver::open(UpnpOpenFileMode){
- this->mLiveBuffer = new cRingBufferLinear(RECEIVER_LIVEBUFFER_SIZE, RECEIVER_RINGBUFFER_MARGIN, true, "Live TV buffer");
- this->mOutputBuffer = new cRingBufferLinear(RECEIVER_OUTPUTBUFFER_SIZE, RECEIVER_RINGBUFFER_MARGIN, true, "Streaming buffer");
-
- this->mLiveBuffer->SetTimeouts(0, 100);
- this->mOutputBuffer->SetTimeouts(0, 500);
-
- this->mFrameDetector = new cFrameDetector(this->mChannel->Vpid(), this->mChannel->Vtype());
-
- this->mPatPmtGenerator.SetChannel(this->mChannel);
-
- this->mDevice->SwitchChannel(this->mChannel, false);
- this->mDevice->AttachReceiver(this);
-}
-
-void cLiveReceiver::Activate(bool On){
- if(On){
- this->Start();
- MESSAGE(VERBOSE_LIVE_TV, "Live receiver started.");
- }
- else {
- if(this->Running()){
- this->Cancel(2);
- }
- MESSAGE(VERBOSE_LIVE_TV, "Live receiver stopped");
- }
-}
-
-void cLiveReceiver::Receive(uchar* Data, int Length){
- if(this->Running()){
- int bytesWrote = this->mLiveBuffer->Put(Data, Length);
- if(bytesWrote != Length && this->Running()){
- this->mLiveBuffer->ReportOverflow(Length - bytesWrote);
- }
- }
-}
-
-void cLiveReceiver::Action(void){
- MESSAGE(VERBOSE_LIVE_TV, "Started buffering...");
- while(this->Running()){
- int bytesRead;
- MESSAGE(VERBOSE_BUFFERS, "Buffer is filled with %d bytes", this->mLiveBuffer->Available());
- uchar* bytes = this->mLiveBuffer->Get(bytesRead);
- if(bytes){
- int count = this->mFrameDetector->Analyze(bytes, bytesRead);
- if(count){
- MESSAGE(VERBOSE_BUFFERS, "%d bytes analyzed", count);
- MESSAGE(VERBOSE_BUFFERS, "%2.2f FPS", this->mFrameDetector->FramesPerSecond());
- if(!this->Running() && this->mFrameDetector->IndependentFrame())
- break;
- if(this->mFrameDetector->Synced()){
- MESSAGE(VERBOSE_BUFFERS, "Frame detector synced to data stream");
- if(this->mFrameDetector->IndependentFrame()){
- this->mOutputBuffer->Put(this->mPatPmtGenerator.GetPat(), TS_SIZE);
- int i = 0;
- while(uchar* pmt = this->mPatPmtGenerator.GetPmt(i)){
- this->mOutputBuffer->Put(pmt, TS_SIZE);
- }
- }
- int bytesWrote = this->mOutputBuffer->Put(bytes, count);
- if(bytesWrote != count){
- this->mLiveBuffer->ReportOverflow(count - bytesWrote);
- }
- MESSAGE(VERBOSE_BUFFERS, "Wrote %d to output buffer", bytesWrote);
- if(bytesWrote){
- this->mLiveBuffer->Del(bytesWrote);
- }
- else {
- cCondWait::SleepMs(100);
- }
- }
- else {
- ERROR("Cannot sync to stream");
- }
- }
- }
- }
- MESSAGE(VERBOSE_LIVE_TV, "Receiver was detached from device");
-}
-
-int cLiveReceiver::read(char* buf, size_t buflen){
- int bytesRead = 0;
- if(!this->IsAttached())
- bytesRead = -1;
- else {
- int WaitTimeout = RECEIVER_WAIT_ON_NODATA_TIMEOUT;
- // Wait until the buffer size is at least half the requested buffer length
-
- double MinBufSize = buflen * RECEIVER_MIN_BUFFER_FILLAGE/100;
- int Available = 0;
- while((double)(Available = this->mOutputBuffer->Available()) < MinBufSize){
- WARNING("Too few data, waiting...");
- WARNING("Only %d bytes available, need %10f more bytes.", Available, (double)(MinBufSize-Available));
- cCondWait::SleepMs(RECEIVER_WAIT_ON_NODATA);
- if(!this->IsAttached()){
- MESSAGE(VERBOSE_LIVE_TV, "Lost device...");
- return 0;
- }
- WaitTimeout-=RECEIVER_WAIT_ON_NODATA;
- if(WaitTimeout<=0){
- double seconds = (RECEIVER_WAIT_ON_NODATA_TIMEOUT/1000);
- ERROR("No data received for %4.2f seconds, aborting.", seconds);
- this->Activate(false);
- return 0;
- }
- }
-
- uchar* buffer = this->mOutputBuffer->Get(bytesRead);
- if(buffer){
- if(buflen > (size_t)bytesRead){
- memcpy(buf,(char*)buffer,bytesRead);
- this->mOutputBuffer->Del(bytesRead);
- }
- else {
- memcpy(buf,(char*)buffer,buflen);
- this->mOutputBuffer->Del(buflen);
- }
- }
-
- }
- MESSAGE(VERBOSE_BUFFERS, "Read %d bytes from live feed", bytesRead);
- return bytesRead;
-}
-
-int cLiveReceiver::seek(off_t, int){
- ERROR("Seeking not supported on broadcasts");
- return 0;
-}
-
-int cLiveReceiver::write(char*, size_t){
- ERROR("Writing not allowed on broadcasts");
- return 0;
-}
-
-void cLiveReceiver::close(){
- MESSAGE(VERBOSE_SDK, "Closing live receiver");
- this->Detach();
- delete this->mOutputBuffer; this->mOutputBuffer = NULL;
- delete this->mLiveBuffer; this->mLiveBuffer = NULL;
- this->mFrameDetector = NULL;
- MESSAGE(VERBOSE_LIVE_TV, "Live receiver closed.");
-} \ No newline at end of file
diff --git a/receiver/recplayer.cpp b/receiver/recplayer.cpp
deleted file mode 100644
index 8bf73d4..0000000
--- a/receiver/recplayer.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * File: recplayer.cpp
- * Author: savop
- *
- * Created on 8. Juni 2009, 11:57
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <vdr/recording.h>
-#include <vdr/tools.h>
-#include "recplayer.h"
-
-cRecordingPlayer *cRecordingPlayer::newInstance(cRecording* Recording){
- if(Recording->IsPesRecording()){
- ERROR("Sorry, but only TS is supported, yet!");
- return NULL;
- }
-
- cRecordingPlayer *Player = new cRecordingPlayer(Recording);
- return Player;
-}
-cRecordingPlayer::~cRecordingPlayer() {
- delete this->mRecordingFile;
- delete [] this->mLastOffsets;
-}
-
-cRecordingPlayer::cRecordingPlayer(cRecording *Recording) : mRecording(Recording) {
- MESSAGE(VERBOSE_SDK, "Created Recplayer");
-
- this->mRecordingFile = new cFileName(this->mRecording->FileName(), false, false, this->mRecording->IsPesRecording());
- this->mLastOffsets = new off_t[((this->mRecording->IsPesRecording())?VDR_MAX_FILES_PER_PESRECORDING:VDR_MAX_FILES_PER_TSRECORDING)+1];
- this->scanLastOffsets();
-}
-
-void cRecordingPlayer::open(UpnpOpenFileMode){
- // Open() does not work?!
- this->mCurrentFile = this->mRecordingFile->SetOffset(1);
- if(this->mCurrentFile){
- MESSAGE(VERBOSE_RECORDS, "Record player opened");
- }
- else {
- ERROR("Error while opening record player file");
- }
-}
-
-void cRecordingPlayer::close(){
- this->mRecordingFile->Close();
-}
-
-int cRecordingPlayer::write(char*, size_t){
- ERROR("Writing not allowed on recordings");
- return 0;
-}
-
-int cRecordingPlayer::read(char* buf, size_t buflen){
- if(!this->mCurrentFile){
- ERROR("Current part of record is not open");
- return -1;
- }
- MESSAGE(VERBOSE_RECORDS, "Reading %d from record", buflen);
- int bytesread = 0;
- while((bytesread = this->mCurrentFile->Read(buf, buflen)) == 0){ // EOF, try next file
- if(!(this->mCurrentFile = this->mRecordingFile->NextFile())){
- // no more files to read... finished!
- break;
- }
- }
- return bytesread;
-}
-
-int cRecordingPlayer::seek(off_t offset, int origin){
- if(!this->mCurrentFile){
- ERROR("Current part of record is not open");
- return -1;
- }
-
- MESSAGE(VERBOSE_RECORDS, "Seeking...");
-
- off_t relativeOffset;
- off_t curpos = this->mCurrentFile->Seek(0, SEEK_CUR); // this should not change anything
- int index;
- // recalculate the absolute position in the record
- switch(origin){
- case SEEK_END:
- offset = this->mLastOffsets[this->mLastFileNumber] + offset;
- break;
- case SEEK_CUR:
- offset = this->mLastOffsets[this->mRecordingFile->Number()-1] + curpos + offset;
- break;
- case SEEK_SET:
- // Nothing to change
- break;
- default:
- ERROR("Seek operation invalid");
- return -1;
- }
- // finally, we can seek
- // TODO: binary search
- for(index = 1; this->mLastOffsets[index]; index++){
- if(this->mLastOffsets[index-1] <= offset && offset <= this->mLastOffsets[index]){
- relativeOffset = offset - this->mLastOffsets[index-1];
- break;
- }
- }
- if(!(this->mCurrentFile = this->mRecordingFile->SetOffset(index, relativeOffset))){
- // seeking failed!!! should never happen.
- this->mCurrentFile = this->mRecordingFile->SetOffset(1);
- return -1;
- }
-
- return 0;
-}
-
-void cRecordingPlayer::scanLastOffsets(){
- // rewind
- this->mCurrentFile = this->mRecordingFile->SetOffset(1);
- for(int i = 1; (this->mCurrentFile = this->mRecordingFile->NextFile()); i++){
- this->mLastOffsets[i] = this->mLastOffsets[i-1] + this->mCurrentFile->Seek(0, SEEK_END);
- this->mLastFileNumber = this->mRecordingFile->Number();
- }
-}
-
diff --git a/server/server.cpp b/server/server.cpp
deleted file mode 100644
index 56bf442..0000000
--- a/server/server.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * File: server.cpp
- * Author: savop
- *
- * Created on 19. April 2009, 17:42
- */
-
-#include <vdr/plugin.h>
-#include <stdlib.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <upnp/upnp.h>
-#include "server.h"
-#include "util.h"
-#include "config.h"
-#include "../common.h"
-#include "upnp/dlna.h"
-#include "object.h"
-
-/****************************************************
- *
- * The UPnP Server
- *
- * Handles incoming messages, UPnP connections
- * and so on.
- *
- ****************************************************/
-
-cConnectionManager* cUPnPServer::mConnectionManager = NULL;
-cContentDirectory* cUPnPServer::mContentDirectory = NULL;
-
-cUPnPServer::cUPnPServer() {
- this->mServerAddr = new sockaddr_in;
- // Bugfix: this was necessary because there were
- // some uninitialised bytes in the structure (Please recheck this!)
- memset(this->mServerAddr,0,sizeof(sockaddr_in));
- this->mServerAddr->sin_family = AF_INET;
- this->mServerAddr->sin_port = 0;
- this->mIsRunning = false;
- this->mIsAutoDetectionEnabled = true;
- this->mIsEnabled = false;
- this->mDeviceHandle = NULL;
- this->mMediaDatabase = NULL;
-}
-
-cUPnPServer::~cUPnPServer() {
- delete this->mServerAddr; this->mServerAddr = NULL;
- delete this->mMediaDatabase;
-}
-
-bool cUPnPServer::init(void){
-
- MESSAGE(VERBOSE_SDK, "Loading configuration...");
- cUPnPConfig* config = cUPnPConfig::get();
- this->enable(config->mEnable == 1 ? true : false);
- if(!config->mAutoSetup){
- if(config->mInterface)
- if(!this->setInterface(config->mInterface)){
- ERROR("Invalid network interface: %s", config->mInterface);
- return false;
- }
- if(config->mAddress)
- if(!this->setAddress(config->mAddress)){
- ERROR("Invalid IP address: %s", config->mAddress);
- return false;
- }
- if(!this->setServerPort((short)config->mPort)){
- ERROR("Invalid port: %d", config->mPort);
- return false;
- }
- }
- else {
- if(!this->setAutoDetection(config->mAutoSetup == 1 ? true : false)){
- ERROR("Invalid auto detection setting: %d", config->mAutoSetup);
- return false;
- }
- if(!this->autoDetectSettings()){
- ERROR("Error while auto detecting settings.");
- return false;
- }
- }
-
- MESSAGE(VERBOSE_SDK, "Initializing Intel UPnP SDK on %s:%d",inet_ntoa(this->mServerAddr->sin_addr), ntohs(this->mServerAddr->sin_port));
- int ret = 0;
- ret = UpnpInit(inet_ntoa(this->mServerAddr->sin_addr), ntohs(this->mServerAddr->sin_port));
-
- if (ret != UPNP_E_SUCCESS) {
- // test if SDK was allready initiated
- if (ret == UPNP_E_INIT) {
- WARNING("SDK was allready initiated (no problem) - Errorcode: %d", ret);
- } else {
- ERROR("Error while init Intel SDK - Errorcode: %d", ret);
- return false;
- }
- }
- else {
- if(!inet_aton(UpnpGetServerIpAddress(),&this->mServerAddr->sin_addr)){
- ERROR("Unable to set IP address");
- }
- this->mServerAddr->sin_port = htons(UpnpGetServerPort());
- MESSAGE(VERBOSE_SDK, "Initializing succesfully at %s:%d", UpnpGetServerIpAddress(), UpnpGetServerPort());
- }
-
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Setting maximum packet size for SOAP requests");
- UpnpSetMaxContentLength(UPNP_SOAP_MAX_LEN);
-
- const char* httpdir = (cUPnPConfig::get()->mHTTPFolder) ? cUPnPConfig::get()->mHTTPFolder : cPluginUpnp::getConfigDirectory();
- //set the root directory of the webserver
- cString WebserverRootDir = cString::sprintf("%s%s", httpdir, UPNP_WEB_SERVER_ROOT_DIR);
-
- MESSAGE(VERBOSE_SDK, "Set web server root dir: %s", *WebserverRootDir );
- this->mWebServer = cUPnPWebServer::getInstance(WebserverRootDir);
- MESSAGE(VERBOSE_SDK, "Initializing web server.");
- if (!this->mWebServer->init()) {
- ERROR("Error while setting web server root dir - Errorcode: %d", ret);
- return false;
- }
-
- //register media server device to SDK
- cString URLBase = cString::sprintf("http://%s:%d", UpnpGetServerIpAddress(), UpnpGetServerPort());
-
- this->mDeviceDescription = cString(cDlna::getInstance()->getDeviceDescription(URLBase),true);
-
- MESSAGE(VERBOSE_SDK, "Register Media Server Device");
- ret = UpnpRegisterRootDevice2(UPNPREG_BUF_DESC,
- this->mDeviceDescription, sizeof(this->mDeviceDescription), 1,
- &cUPnPServer::upnpActionCallback,
- &this->mDeviceHandle,
- &this->mDeviceHandle);
- if (ret != UPNP_E_SUCCESS) {
- ERROR("Error while registering device - Errorcode: %d", ret);
- return false;
- }
-
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Unregister server to cleanup previously started servers");
- ret = UpnpUnRegisterRootDevice(this->mDeviceHandle);
- if (ret != UPNP_E_SUCCESS) {
- WARNING("Unregistering old devices failed");
- return false;
- }
-
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Register Media Server Device");
- ret = UpnpRegisterRootDevice2(UPNPREG_BUF_DESC,
- this->mDeviceDescription, sizeof(this->mDeviceDescription), 1,
- &cUPnPServer::upnpActionCallback,
- &this->mDeviceHandle,
- &this->mDeviceHandle);
- if (ret != UPNP_E_SUCCESS) {
- ERROR("Error while registering device - Errorcode: %d", ret);
- return false;
- }
-
- MESSAGE(VERBOSE_SDK, "Initializing media database");
- this->mMediaDatabase = new cMediaDatabase;
- if(!this->mMediaDatabase->init()){
- ERROR("Error while initializing database");
- return false;
- }
-
- MESSAGE(VERBOSE_SDK, "Initializing connection manager");
- cUPnPServer::mConnectionManager = new cConnectionManager(this->mDeviceHandle);
- MESSAGE(VERBOSE_SDK, "Initializing content directory");
- cUPnPServer::mContentDirectory = new cContentDirectory(this->mDeviceHandle, this->mMediaDatabase);
- if(!cUPnPServer::mContentDirectory->Start()){
- ERROR("Unable to start content directory thread");
- return false;
- }
-
- //send first advertisments
- MESSAGE(VERBOSE_SDK, "Send first advertisements to publish start in network");
- ret = UpnpSendAdvertisement(this->mDeviceHandle, UPNP_ANNOUNCE_MAX_AGE);
- if (ret != UPNP_E_SUCCESS) {
- ERROR("Error while sending first advertisments - Errorcode: %d", ret);
- return false;
- }
-
- return true;
-}
-
-bool cUPnPServer::uninit(void) {
- MESSAGE(VERBOSE_SDK, "Shuting down content directory");
- delete cUPnPServer::mContentDirectory; cUPnPServer::mContentDirectory = NULL;
-
- MESSAGE(VERBOSE_SDK, "Shuting down connection manager");
- delete cUPnPServer::mConnectionManager; cUPnPServer::mConnectionManager = NULL;
-
- MESSAGE(VERBOSE_SDK, "Closing metadata database");
- delete this->mMediaDatabase; this->mMediaDatabase = NULL;
-
- MESSAGE(VERBOSE_SDK, "Closing the web server");
- this->mWebServer->uninit();
- delete this->mWebServer;
-
- MESSAGE(VERBOSE_SDK, "Close Intel SDK");
- // unregiser media server device from UPnP SDK
- int ret = UpnpUnRegisterRootDevice(this->mDeviceHandle);
- if (ret != UPNP_E_SUCCESS) {
- WARNING("No device registered");
- }
- // send intel sdk message to shutdown
- ret = UpnpFinish();
-
- if (ret == UPNP_E_SUCCESS) {
- MESSAGE(VERBOSE_SDK, "Close Intel SDK Successfull");
- return true;
- } else {
- ERROR("Intel SDK unintialized or already closed - Errorcode: %d", ret);
- return false;
- }
-}
-
-int cUPnPServer::upnpActionCallback(Upnp_EventType eventtype, void *event, void *cookie) {
- // only to remove warning while compiling because cookie is unused
- cookie = NULL;
- Upnp_Subscription_Request* eventRequest = NULL;
- Upnp_Action_Request* actionRequest = NULL;
-
- //check committed event variable
- if (event == NULL) {
- ERROR("UPnP Callback - NULL request");
- return UPNP_E_BAD_REQUEST;
- }
-
- switch (eventtype) {
- case UPNP_CONTROL_ACTION_REQUEST:
- actionRequest = (Upnp_Action_Request*) event;
-
- //check that request is for this device
- if (strcmp(actionRequest->DevUDN, UPNP_DEVICE_UDN) != 0) {
- ERROR("UPnP Callback - actions request not for this device");
- return UPNP_E_BAD_REQUEST;
- }
-
- //find out which service was called
- if (strcmp(actionRequest->ServiceID, UPNP_CMS_SERVICE_ID) == 0) {
- // proceed action
- return cUPnPServer::mConnectionManager->execute(actionRequest);
-
- } else if (strcmp(actionRequest->ServiceID, UPNP_CDS_SERVICE_ID) == 0) {
- // proceed action
- return cUPnPServer::mContentDirectory->execute(actionRequest);
- } else {
- ERROR("UPnP Callback - unsupported service called for control");
- return UPNP_E_BAD_REQUEST;
- }
- case UPNP_EVENT_SUBSCRIPTION_REQUEST:
- eventRequest = (Upnp_Subscription_Request*) event;
-
- //check that request is for this device
- if (strcmp(eventRequest->UDN, UPNP_DEVICE_UDN) != 0) {
- ERROR("UPnP Callback - event request not for this device");
- return UPNP_E_BAD_REQUEST;
- }
-
- if (strcmp(eventRequest->ServiceId, UPNP_CMS_SERVICE_ID) == 0) {
- // handle event request
- return cUPnPServer::mConnectionManager->subscribe(eventRequest);
-
- } else if (strcmp(eventRequest->ServiceId, UPNP_CDS_SERVICE_ID) == 0) {
- // handle event request
- return cUPnPServer::mContentDirectory->subscribe(eventRequest);
- } else {
- ERROR("UPnP Callback - unsupported service called for eventing");
- return UPNP_E_BAD_REQUEST;
- }
-
- return UPNP_E_BAD_REQUEST;
- default:
- ERROR("UPnP Action Callback - Unsupported Event");
- return UPNP_E_BAD_REQUEST;
- }
-
- return UPNP_E_BAD_REQUEST;
-}
-
-bool cUPnPServer::autoDetectSettings(void){
- int count;
- char** Ifaces = getNetworkInterfaces(&count);
- int i=0;
- bool ret = false;
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "AUTODETECT: Found %d possible interfaces.", sizeof(Ifaces));
- while(Ifaces[i]){
- if(strcmp(Ifaces[i],"lo")!=0){
- // true || false == true
- // false || false == false
- ret = this->setInterface(strdup(Ifaces[i])) || ret;
- }
- i++;
- }
- delete [] Ifaces;
- if(!ret){
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "AUTODETECT: No suitable interface. Giving up.");
- return false;
- }
- this->setServerPort(0);
- return true;
-}
-
-bool cUPnPServer::start(void){
- if(!this->isRunning()){
- // Put all the stuff which shall be started with the server in here
- // if the startup failed due any reason return false!
- MESSAGE(VERBOSE_SDK, "Starting UPnP Server on %s:%d",inet_ntoa(this->getServerAddress()->sin_addr), ntohs(this->getServerAddress()->sin_port));
- MESSAGE(VERBOSE_SDK, "Using DLNA version: %s", DLNA_PROTOCOL_VERSION_STR);
- this->mIsRunning = true;
- // Start Media database thread
- this->mMediaDatabase->Start();
- }
- return true;
-}
-
-void cUPnPServer::stop(void){
- if(this->isRunning()){
- MESSAGE(VERBOSE_SDK, "Call upnpServer STOP");
- this->uninit();
- this->mIsRunning = false;
- }
- return;
-}
-
-bool cUPnPServer::restart(void){
- MESSAGE(VERBOSE_SDK, "Call upnpServer RESTART");
- this->stop();
- return this->start();
-}
-
-void cUPnPServer::enable(bool enabled){
- this->mIsEnabled = enabled;
-}
-
-bool cUPnPServer::setInterface(const char* Interface){
- if(Interface != NULL) this->mInterface = Interface;
-
- if(*this->mInterface!=NULL){
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "Try to retrieve address for NIC %s",Interface);
- const sockaddr_in* ipAddress = getIPFromInterface(Interface);
- if(ipAddress!=NULL){
- memcpy(&this->mServerAddr->sin_addr,&ipAddress->sin_addr,sizeof(ipAddress->sin_addr));
- MESSAGE(VERBOSE_CUSTOM_OUTPUT, "NIC %s has the following IP: %s", *this->mInterface, inet_ntoa(this->mServerAddr->sin_addr));
- this->stop();
- return true;
- }
- delete ipAddress;
- ERROR("Unable to obtain a valid IP address for NIC %s!",Interface);
- }
- this->mServerAddr = NULL;
- return false;
-}
-
-bool cUPnPServer::setServerPort(unsigned short port){
- // check if the port is in user range or 0
- if(port != 0 && port < SERVER_MIN_PORT) return false;
- this->stop();
- this->mServerAddr->sin_port = htons(port);
- return true;
-}
-
-bool cUPnPServer::setAddress(const char* Address){
- if(inet_aton(Address, &this->mServerAddr->sin_addr) == 0) return false;
- this->stop();
- return true;
-}
-
-bool cUPnPServer::setAutoDetection(bool enable){
- this->mIsAutoDetectionEnabled = enable;
- return true;
-}
-
-sockaddr_in* cUPnPServer::getServerAddress() {
- return this->mServerAddr;
-} \ No newline at end of file
diff --git a/server/webserver.cpp b/server/webserver.cpp
deleted file mode 100644
index 04fb44a..0000000
--- a/server/webserver.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * File: upnpwebserver.cpp
- * Author: savop
- *
- * Created on 30. Mai 2009, 18:13
- */
-
-#include <time.h>
-#include <vdr/channels.h>
-#include <map>
-#include <upnp/upnp.h>
-#include "webserver.h"
-#include "server.h"
-#include "livereceiver.h"
-#include "recplayer.h"
-#include "search.h"
-
-/* COPIED FROM INTEL UPNP TOOLS */
-/*******************************************************************************
- *
- * Copyright (c) 2000-2003 Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************/
-/** @private */
-struct File_Info_
-{
- /** The length of the file. A length less than 0 indicates the size
- * is unknown, and data will be sent until 0 bytes are returned from
- * a read call. */
- off64_t file_length;
-
- /** The time at which the contents of the file was modified;
- * The time system is always local (not GMT). */
- time_t last_modified;
-
- /** If the file is a directory, {\bf is_directory} contains
- * a non-zero value. For a regular file, it should be 0. */
- int is_directory;
-
- /** If the file or directory is readable, this contains
- * a non-zero value. If unreadable, it should be set to 0. */
- int is_readable;
-
- /** The content type of the file. This string needs to be allocated
- * by the caller using {\bf ixmlCloneDOMString}. When finished
- * with it, the SDK frees the {\bf DOMString}. */
-
- DOMString content_type;
-
-};
-
-/** @private */
-struct cWebFileHandle {
- cString Filename;
- off64_t Size;
- cFileHandle* FileHandle;
-};
-
-/****************************************************
- *
- * The web server
- *
- * Handles the virtual directories and the
- * provision of data
- *
- * Interface between the channels/recordings of the
- * VDR and the outer world
- *
- ****************************************************/
-
-cUPnPWebServer::cUPnPWebServer(const char* root) : mRootdir(root) {
-}
-
-cUPnPWebServer::~cUPnPWebServer(){}
-
-cUPnPWebServer* cUPnPWebServer::mInstance = NULL;
-
-UpnpVirtualDirCallbacks cUPnPWebServer::mVirtualDirCallbacks = {
- cUPnPWebServer::getInfo,
- cUPnPWebServer::open,
- cUPnPWebServer::read,
- cUPnPWebServer::write,
- cUPnPWebServer::seek,
- cUPnPWebServer::close
-};
-
-bool cUPnPWebServer::init(){
- MESSAGE(VERBOSE_WEBSERVER, "Initialize callbacks for virtual directories.");
-
- if(UpnpSetWebServerRootDir(this->mRootdir) == UPNP_E_INVALID_ARGUMENT){
- ERROR("The root directory of the webserver is invalid.");
- return false;
- }
- MESSAGE(VERBOSE_WEBSERVER, "Setting up callbacks");
-
- if(UpnpSetVirtualDirCallbacks(&cUPnPWebServer::mVirtualDirCallbacks) == UPNP_E_INVALID_ARGUMENT){
- ERROR("The virtual directory callbacks are invalid.");
- return false;
- }
-
- if(UpnpIsWebserverEnabled() == FALSE){
- WARNING("The webserver has not been started. For whatever reason...");
- return false;
- }
-
- MESSAGE(VERBOSE_WEBSERVER, "Add virtual directories.");
- if(UpnpAddVirtualDir(UPNP_DIR_SHARES) == UPNP_E_INVALID_ARGUMENT){
- ERROR("The virtual directory %s is invalid.",UPNP_DIR_SHARES);
- return false;
- }
- return true;
-}
-
-bool cUPnPWebServer::uninit(){
- MESSAGE(VERBOSE_WEBSERVER, "Disabling the internal webserver");
- UpnpEnableWebserver(FALSE);
-
- return true;
-}
-
-cUPnPWebServer* cUPnPWebServer::getInstance(const char* rootdir){
- if(cUPnPWebServer::mInstance == NULL)
- cUPnPWebServer::mInstance = new cUPnPWebServer(rootdir);
-
- if(cUPnPWebServer::mInstance){
- return cUPnPWebServer::mInstance;
- }
- else return NULL;
-}
-
-int cUPnPWebServer::getInfo(const char* filename, File_Info* info){
- MESSAGE(VERBOSE_WEBSERVER, "Getting information of file '%s'", filename);
-
- propertyMap Properties;
- int Method;
- int Section;
-
- if(cPathParser::parse(filename, &Section, &Method, &Properties)){
- switch(Section){
- case 0:
- switch(Method){
- case UPNP_WEB_METHOD_STREAM:
- {
- MESSAGE(VERBOSE_WEBSERVER, "Stream request");
- propertyMap::iterator It = Properties.find("resId");
- unsigned int ResourceID = 0;
- if(It == Properties.end()){
- ERROR("No resourceID for stream request");
- return -1;
- }
- else {
- ResourceID = (unsigned)atoi(It->second);
- cUPnPResource* Resource = cUPnPResources::getInstance()->getResource(ResourceID);
- if(!Resource){
- ERROR("No such resource with ID (%d)", ResourceID);
- return -1;
- }
- else {
- File_Info_ finfo;
-
- finfo.content_type = ixmlCloneDOMString(Resource->getContentType());
- finfo.file_length = Resource->getFileSize();
- finfo.is_directory = 0;
- finfo.is_readable = 1;
- finfo.last_modified = Resource->getLastModification();
- memcpy(info, &finfo, sizeof(File_Info_));
-
- MESSAGE(VERBOSE_METADATA, "==== File info of Resource #%d ====", Resource->getID());
- MESSAGE(VERBOSE_METADATA, "Size: %lld", finfo.file_length);
- MESSAGE(VERBOSE_METADATA, "Dir: %s", finfo.is_directory?"yes":"no");
- MESSAGE(VERBOSE_METADATA, "Read: %s", finfo.is_readable?"allowed":"not allowed");
- MESSAGE(VERBOSE_METADATA, "Last modified: %s", ctime(&(finfo.last_modified)));
- MESSAGE(VERBOSE_METADATA, "Content-type: %s", finfo.content_type);
-
-#ifdef UPNP_HAVE_CUSTOMHEADERS
- UpnpAddCustomHTTPHeader("transferMode.dlna.org: Streaming");
- UpnpAddCustomHTTPHeader(
- "contentFeatures.dlna.org: "
- "DLNA.ORG_OP=00;"
- "DLNA.ORG_CI=0;"
- "DLNA.ORG_FLAGS=01700000000000000000000000000000"
- );
-#endif
- }
- }
- }
- break;
- case UPNP_WEB_METHOD_BROWSE:
- // break;
- case UPNP_WEB_METHOD_SHOW:
- // break;
- case UPNP_WEB_METHOD_SEARCH:
- case UPNP_WEB_METHOD_DOWNLOAD:
- default:
- ERROR("Unknown or unsupported method ID (%d)", Method);
- return -1;
- }
- break;
- default:
- ERROR("Unknown or unsupported section ID (%d).", Section);
- return -1;
- }
- }
- else {
- return -1;
- }
-
- return 0;
-}
-
-UpnpWebFileHandle cUPnPWebServer::open(const char* filename, UpnpOpenFileMode mode){
- MESSAGE(VERBOSE_WEBSERVER, "File %s was opened for %s.",filename,mode==UPNP_READ ? "reading" : "writing");
-
- propertyMap Properties;
- int Method;
- int Section;
- cWebFileHandle* WebFileHandle = NULL;
-
- if(cPathParser::parse(filename, &Section, &Method, &Properties)){
- switch(Section){
- case 0:
- switch(Method){
- case UPNP_WEB_METHOD_STREAM:
- {
- MESSAGE(VERBOSE_WEBSERVER, "Stream request");
- propertyMap::iterator It = Properties.find("resId");
- unsigned int ResourceID = 0;
- if(It == Properties.end()){
- ERROR("No resourceID for stream request");
- return NULL;
- }
- else {
- ResourceID = (unsigned)atoi(It->second);
- cUPnPResource* Resource = cUPnPResources::getInstance()->getResource(ResourceID);
- if(!Resource){
- ERROR("No such resource with ID (%d)", ResourceID);
- return NULL;
- }
- else {
- WebFileHandle = new cWebFileHandle;
- WebFileHandle->Filename = Resource->getResource();
- WebFileHandle->Size = Resource->getFileSize();
- switch(Resource->getResourceType()){
- case UPNP_RESOURCE_CHANNEL:
- {
- char* ChannelID = strtok(strdup(Resource->getResource()),":");
- int StreamID = atoi(strtok(NULL,":"));
- MESSAGE(VERBOSE_LIVE_TV, "Try to create Receiver for Channel %s with Stream ID %d", ChannelID, StreamID);
- cChannel* Channel = Channels.GetByChannelID(tChannelID::FromString(ChannelID));
- if(!Channel){
- ERROR("No such channel with ID %s", ChannelID);
- return NULL;
- }
- cLiveReceiver* Receiver = cLiveReceiver::newInstance(Channel,0);
- if(!Receiver){
- ERROR("Unable to tune channel. No available tuners?");
- return NULL;
- }
- WebFileHandle->FileHandle = Receiver;
- }
- break;
- case UPNP_RESOURCE_RECORDING:
- {
- const char* RecordFile = Resource->getResource();
- MESSAGE(VERBOSE_RECORDS, "Try to create Player for Record %s", RecordFile);
- cRecording* Recording = Recordings.GetByName(RecordFile);
- if(!Recording){
- ERROR("No such recording with file name %s", RecordFile);
- return NULL;
- }
- cRecordingPlayer* RecPlayer = cRecordingPlayer::newInstance(Recording);
- if(!RecPlayer){
- ERROR("Unable to start record player. No access?!");
- return NULL;
- }
- WebFileHandle->FileHandle = RecPlayer;
- }
- break;
- case UPNP_RESOURCE_FILE:
- // break;
- case UPNP_RESOURCE_URL:
- default:
- return NULL;
- }
- }
- }
- }
- break;
- case UPNP_WEB_METHOD_BROWSE:
- // break;
- case UPNP_WEB_METHOD_SHOW:
- // break;
- case UPNP_WEB_METHOD_SEARCH:
- case UPNP_WEB_METHOD_DOWNLOAD:
- default:
- ERROR("Unknown or unsupported method ID (%d)", Method);
- return NULL;
- }
- break;
- default:
- ERROR("Unknown or unsupported section ID (%d).", Section);
- return NULL;
- }
- }
- else {
- return NULL;
- }
- MESSAGE(VERBOSE_WEBSERVER, "Open the file handle");
- WebFileHandle->FileHandle->open(mode);
- return (UpnpWebFileHandle)WebFileHandle;
-}
-
-int cUPnPWebServer::write(UpnpWebFileHandle fh, char* buf, size_t buflen){
- cWebFileHandle* FileHandle = (cWebFileHandle*)fh;
- MESSAGE(VERBOSE_BUFFERS, "Writing to %s", *FileHandle->Filename);
- return FileHandle->FileHandle->write(buf, buflen);
-}
-
-int cUPnPWebServer::read(UpnpWebFileHandle fh, char* buf, size_t buflen){
- cWebFileHandle* FileHandle = (cWebFileHandle*)fh;
- MESSAGE(VERBOSE_BUFFERS, "Reading from %s", *FileHandle->Filename);
- return FileHandle->FileHandle->read(buf, buflen);
-}
-
-int cUPnPWebServer::seek(UpnpWebFileHandle fh, off_t offset, int origin){
- cWebFileHandle* FileHandle = (cWebFileHandle*)fh;
- MESSAGE(VERBOSE_BUFFERS, "Seeking on %s", *FileHandle->Filename);
- return FileHandle->FileHandle->seek(offset, origin);
-}
-
-int cUPnPWebServer::close(UpnpWebFileHandle fh){
- cWebFileHandle *FileHandle = (cWebFileHandle *)fh;
- MESSAGE(VERBOSE_WEBSERVER, "Closing file %s", *FileHandle->Filename);
- FileHandle->FileHandle->close();
- delete FileHandle->FileHandle;
- delete FileHandle;
- return 0;
-} \ No newline at end of file
diff --git a/upnp.cpp b/upnp.cpp
deleted file mode 100644
index e454b1d..0000000
--- a/upnp.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * upnp.c: A plugin for the Video Disk Recorder
- *
- * See the README file for copyright information and how to reach the author.
- *
- * $Id$
- */
-
-#include <stdio.h>
-#include "upnp.h"
-#include "menusetup.h"
-#include "config.h"
-
-cCondWait DatabaseLocker;
-
-static const char *VERSION = "0.0.2";
-static const char *DESCRIPTION = PLUGIN_DESCRIPTION;
-
-const char* cPluginUpnp::mConfigDirectory = NULL;
-
-cPluginUpnp::cPluginUpnp(void)
-{
- // Initialize any member variables here.
- // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
- // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
- this->mUpnpServer = new cUPnPServer();
-}
-
-cPluginUpnp::~cPluginUpnp()
-{
- // Clean up after yourself!
- delete this->mUpnpServer;
-}
-
-const char* cPluginUpnp::getConfigDirectory(){
- return cPluginUpnp::mConfigDirectory;
-}
-
-const char *cPluginUpnp::Version(void){
- return VERSION;
-}
-
-const char *cPluginUpnp::Description(void) {
- return DESCRIPTION;
-}
-
-const char *cPluginUpnp::CommandLineHelp(void)
-{
- // Return a string that describes all known command line options.
- cString cmdHelp;
-
- cmdHelp = cString::sprintf(_(
- " The server can automatically detect both IP address and an\n"
- " appropriate port, assuming that the first network interface\n"
- " is connected to the internal network. However, it is possible\n"
- " to specify alternative settings with the following options:\n\n"
- " -i <interface> --int=<interface> The server network\n"
- " interface\n"
- " e.g: eth0, wlan1 etc.\n"
- " If given option '-a' must\n"
- " be absent.\n"
- " -a <address> --address=<address> The server IPv4 address.\n"
- " If given option '-i' must\n"
- " be absent.\n"
- " -p <port> --port=<port> The server port\n"
- " Supported ports:\n"
- " %5d (auto detect)\n"
- " %5d-%5d (user defined)\n"
- " -d --autodetect Force auto detection\n"
- " Use this option to\n"
- " overwrite the setup menu\n"
- " options.\n"
- " -v --verbose Increase verbosity level\n"
- " The more v options the\n"
- " higher the output level\n"
- " --dbdir=<directory> The directory in which the\n"
- " metadata database is stored\n"
- " --httpdir=<directory> The directory where the\n"
- " http documents are located\n"),
- 0,
- SERVER_MIN_PORT,
- SERVER_MAX_PORT
- );
- return cmdHelp;
-}
-
-bool cPluginUpnp::ProcessArgs(int argc, char *argv[])
-{
- return cUPnPConfig::get()->processArgs(argc, argv);
-}
-
-bool cPluginUpnp::Initialize(void)
-{
- // Initialize any background activities the plugin shall perform.
- MESSAGE(VERBOSE_SDK, "######### LETS GET READY TO RUMBLE #########");
-
- cPluginUpnp::mConfigDirectory = strdup(cPlugin::ConfigDirectory(this->Name()));
- if(!cPluginUpnp::getConfigDirectory()){
- ERROR("Cannot set configuration directory");
- return false;
- }
- MESSAGE(VERBOSE_SDK, "Configuration directory: %s", cPluginUpnp::getConfigDirectory());
- DatabaseLocker.Signal();
- return this->mUpnpServer->init();
-}
-
-bool cPluginUpnp::Start(void)
-{
- MESSAGE(VERBOSE_SDK, "Call plugin START");
- // Start any background activities the plugin shall perform.
- return this->mUpnpServer->start();
- //return true;
-}
-
-void cPluginUpnp::Stop(void)
-{
- MESSAGE(VERBOSE_SDK, "Call plugin STOP");
- // Stop any background activities the plugin is performing.
- this->mUpnpServer->stop();
-}
-
-cString cPluginUpnp::Active(void)
-{
- // Return a message string if shutdown should be postponed
- return this->mUpnpServer->isRunning() ? _("The UPnP server is still running."): NULL;
-}
-
-cMenuSetupPage *cPluginUpnp::SetupMenu(void)
-{
- // Return a setup menu in case the plugin supports one.
- return new cMenuSetupUPnP();
-}
-
-bool cPluginUpnp::SetupParse(const char *Name, const char *Value)
-{
- return cUPnPConfig::get()->parseSetup(Name, Value);
-}
-
-VDRPLUGINCREATOR(cPluginUpnp); // Don't touch this!
-
diff --git a/upnp.h b/upnp.h
deleted file mode 100644
index 45c7c22..0000000
--- a/upnp.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * File: upnp.h
- * Author: savop
- *
- * Created on 17. April 2009, 20:53
- */
-
-#ifndef _UPNP_H
-#define _UPNP_H
-
-#include <vdr/thread.h>
-#include <vdr/plugin.h>
-#include "common.h"
-#include "server.h"
-
-class cUPnPServer;
-
-/**
- * The UPnP/DLNA plugin
- *
- * This is a UPnP/DLNA media server plugin. It supports live-TV and recordings
- * of the VDR as well as custom video files.
- */
-class cPluginUpnp : public cPlugin {
-private:
- // Add any member variables or functions you may need here.
- cUPnPServer* mUpnpServer;
- static const char* mConfigDirectory;
-public:
- cPluginUpnp(void);
- virtual ~cPluginUpnp();
- /**
- * Get the version of the plugin
- *
- * Returns the version string of the plugin
- *
- * @return a string representation of the plugin version
- */
- virtual const char *Version(void);
- /**
- * Get the description
- *
- * This returns a brief description of the plugin and what it does.
- *
- * @return the description of the plugin
- */
- virtual const char *Description(void);
- /**
- * Get the command line help
- *
- * This returns the command line help output, which comes, when the user
- * types \c --help into the command line.
- *
- * @return the command line help
- */
- virtual const char *CommandLineHelp(void);
- /*! @copydoc cUPnPConfig::processArgs */
- virtual bool ProcessArgs(int argc, char *argv[]);
- /**
- * Initializes the plugin
- *
- * This initializes any background activities of the plugin.
- *
- * @return returns
- * - \bc true, if initializing was successful
- * - \bc false, otherwise
- */
- virtual bool Initialize(void);
- /**
- * Starts the plugin
- *
- * This starts the plugin. It starts additional threads, which are required
- * by the plugin.
- *
- * @return returns
- * - \bc true, if starting was successful
- * - \bc false, otherwise
- */
- virtual bool Start(void);
- /**
- * Stops the plugin
- *
- * This stops the plugin and all its components
- */
- virtual void Stop(void);
- /**
- * Message if still active
- *
- * This returns a message if the plugin is still active when a user attempts
- * to shut down the VDR.
- *
- * @return the message shown on the screen.
- */
- virtual cString Active(void);
- /**
- * Setup menu
- *
- * This creates a new instance of the setup menu, which is shown to the user
- * when he enters the VDR plugin setup menu
- *
- * @return the menu of the plugin
- */
- virtual cMenuSetupPage *SetupMenu(void);
- /*! @copydoc cUPnPConfig::parseSetup */
- virtual bool SetupParse(const char *Name, const char *Value);
- /**
- * Get the configuration directory
- *
- * This returns the directory, where configuration files are stored.
- *
- * @return the directory of the configuration files.
- */
- static const char* getConfigDirectory();
-};
-
-extern cCondWait DatabaseLocker; ///< Locks the database to be loaded only if
- ///< the configuration file directory is set
-
-#endif /* _UPNP_H */
-
diff --git a/upnp/connectionmanager.cpp b/upnp/connectionmanager.cpp
deleted file mode 100644
index 4d1f97b..0000000
--- a/upnp/connectionmanager.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * File: connectionmanager.cpp
- * Author: savop
- *
- * Created on 21. August 2009, 18:35
- */
-
-#include <string.h>
-#include <upnp/ixml.h>
-#include <upnp/upnptools.h>
-#include <vdr/tools.h>
-#include "upnp/connectionmanager.h"
-#include "../common.h"
-#include "upnp/dlna.h"
-
-cVirtualConnection::cVirtualConnection() : mRcsID(-1) {}
-
-cConnectionManager::cConnectionManager(UpnpDevice_Handle DeviceHandle) : cUpnpService(DeviceHandle) {
- this->mVirtualConnections = new cList<cVirtualConnection>;
- this->mDefaultConnection = this->createVirtualConnection();
- this->mSupportedProtocols = cDlna::getInstance()->getSupportedProtocols();
-}
-
-cConnectionManager::~cConnectionManager() {
- delete this->mDefaultConnection;
- delete this->mVirtualConnections;
-}
-
-int cConnectionManager::subscribe(Upnp_Subscription_Request* Request){
- IXML_Document* PropertySet = NULL;
- /* The protocol infos which this server supports */
- UpnpAddToPropertySet(&PropertySet, "SourceProtocolInfo", this->mSupportedProtocols);
- /* Not set, this field is only used by Media Renderers */
- UpnpAddToPropertySet(&PropertySet, "SinkProtocolInfo", "");
- /* The current connection IDs of all virtual connections */
- const char* IDs = this->getConnectionIDsCVS();
- if(!IDs){
- return UPNP_E_INTERNAL_ERROR;
- }
- UpnpAddToPropertySet(&PropertySet, "CurrentConnectionIDs", IDs);
- // Accept subscription
- int ret = UpnpAcceptSubscriptionExt(this->mDeviceHandle, Request->UDN, Request->ServiceId, PropertySet, Request->Sid);
-
- if(ret != UPNP_E_SUCCESS){
- ERROR("Subscription failed (Error code: %d)", ret);
- }
-
- ixmlDocument_free(PropertySet);
- return ret;
-}
-
-int cConnectionManager::execute(Upnp_Action_Request* Request){
- if (Request == NULL) {
- ERROR("CMS Action Handler - request is null");
- return UPNP_E_BAD_REQUEST;
- }
-
- if(!strcmp(Request->ActionName, UPNP_CMS_ACTION_GETPROTOCOLINFO))
- return this->getProtocolInfo(Request);
- if(!strcmp(Request->ActionName, UPNP_CMS_ACTION_GETCURRENTCONNECTIONIDS))
- return this->getCurrentConnectionIDs(Request);
- if(!strcmp(Request->ActionName, UPNP_CMS_ACTION_GETCURRENTCONNECTIONINFO))
- return this->getCurrentConnectionInfo(Request);
- if(!strcmp(Request->ActionName, UPNP_CMS_ACTION_PREPAREFORCONNECTION))
- return this->prepareForConnection(Request);
- if(!strcmp(Request->ActionName, UPNP_CMS_ACTION_CONNECTIONCOMPLETE))
- return this->connectionComplete(Request);
-
- return UPNP_E_BAD_REQUEST;
-}
-
-int cConnectionManager::getProtocolInfo(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CMS, "Protocol info requested by %s.", inet_ntoa(Request->CtrlPtIPAddr));
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <Source>%s</Source> \
- <Sink></Sink> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CMS_SERVICE_TYPE,
- *this->mSupportedProtocols,
- Request->ActionName
- );
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
- return Request->ErrCode;
-}
-
-int cConnectionManager::getCurrentConnectionIDs(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CMS, "Current connection IDs requested by %s.", inet_ntoa(Request->CtrlPtIPAddr));
- cString Result;
- const char* IDs = this->getConnectionIDsCVS();
- if(!IDs){
- Request->ErrCode = UPNP_E_INTERNAL_ERROR;
- return Request->ErrCode;
- }
- Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <ConnectionIDs>%s</ConnectionIDs> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CMS_SERVICE_TYPE,
- IDs,
- Request->ActionName
- );
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
- return Request->ErrCode;
-}
-
-int cConnectionManager::getCurrentConnectionInfo(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CMS, "Current connection info requested by %s.", inet_ntoa(Request->CtrlPtIPAddr));
- int ConnectionID;
-
- if(this->parseIntegerValue(Request->ActionRequest, "ConnectionID", &ConnectionID) != 0){
- ERROR("Invalid arguments. ConnectionID missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
- cVirtualConnection* Connection;
- for(Connection = this->mVirtualConnections->First(); Connection && Connection->mConnectionID != ConnectionID; Connection = this->mVirtualConnections->Next(Connection)){}
-
- if(Connection){
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\">\
- <ProtocolInfo>%s</ProtocolInfo>\
- <PeerConnectionManager>%s</PeerConnectionManager>\
- <PeerConnectionID>%d</PeerConnectionID>\
- <Direction>%s</Direction>\
- <RcsID>%d</RcsID>\
- <AVTransportID>%d</AVTransportID>\
- <Status>%s</Status>\
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CMS_SERVICE_TYPE,
- *Connection->mRemoteProtocolInfo,
- *Connection->mRemoteConnectionManager,
- -1,
- cVirtualConnection::getDirectionString(OUTPUT),
- Connection->mRcsID,
- Connection->mAVTransportID,
- cVirtualConnection::getStatusString(Connection->mStatus),
- Request->ActionName
- );
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
- }
- else {
- ERROR("No valid connection found with given ID=%d!", ConnectionID);
- this->setError(Request, 706);
- }
-
- return Request->ErrCode;
-
-}
-
-int cConnectionManager::prepareForConnection(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CMS, "Request for a new connection by %s.", inet_ntoa(Request->CtrlPtIPAddr));
- //char* Result = NULL;
- char* RemoteProtocolInfo = NULL;
- char* PeerConnectionManager = NULL;
- int PeerConnectionID = 0;
- char* DirectionStr = NULL;
- int Direction;
-
- if(this->parseStringValue(Request->ActionRequest, "RemoteProtocolInfo", &RemoteProtocolInfo) != 0){
- ERROR("Invalid argument RemoteProtocolInfo: Missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
- if(this->parseStringValue(Request->ActionRequest, "PeerConnectionManager", &PeerConnectionManager) != 0){
- ERROR("Invalid argument PeerConnectionManager: Missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
- if(this->parseStringValue(Request->ActionRequest, "Direction", &DirectionStr) != 0 && (Direction = cVirtualConnection::getDirection(DirectionStr)) == -1){
- ERROR("Invalid argument Direction: Missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
- if(this->parseIntegerValue(Request->ActionRequest, "PeerConnectionID", &PeerConnectionID) != 0){
- ERROR("Invalid argument PeerConnectionID: Missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
-
- /* TODO:
- Create Connection
- Notify AVTransport that a new connection was established
- Send back the response */
- this->setError(Request, UPNP_SOAP_E_ACTION_NOT_IMPLEMENTED);
- return Request->ErrCode;
-}
-
-int cConnectionManager::connectionComplete(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CMS, "Request for closing an open connection by %s.", inet_ntoa(Request->CtrlPtIPAddr));
- //char* Result = NULL;
- int ConnectionID;
-
- if(this->parseIntegerValue(Request->ActionRequest, "ConnectionID", &ConnectionID) != 0){
- ERROR("Invalid argument ConnectionID: Missing or wrong");
- this->setError(Request, 402);
- return Request->ErrCode;
- }
-
- // TODO:
- // Close and clear any open resources
- // Close and delete the connection
- // Free other resources left
- this->setError(Request, UPNP_SOAP_E_ACTION_NOT_IMPLEMENTED);
- return Request->ErrCode;
-}
-
-//bool cConnectionManager::setProtocolInfo(const char* ProtocolInfo){
-// if(strcmp(this->mSupportedProtocols, ProtocolInfo)){
-// // ProtocolInfo changed, save and invoke a event notification
-// this->mSupportedProtocols = ProtocolInfo;
-//
-// IXML_Document* PropertySet = NULL;
-// UpnpAddToPropertySet(&PropertySet, "SourceProtocolInfo", this->mSupportedProtocols);
-// int ret = UpnpNotifyExt(this->mDeviceHandle, UPNP_DEVICE_UDN, UPNP_CMS_SERVICE_ID, PropertySet);
-// ixmlDocument_free(PropertySet);
-//
-// if(ret != UPNP_E_SUCCESS){
-// ERROR("State change notification failed (Error code: %d)",ret);
-// return false;
-// }
-// }
-// return true;
-//}
-
-cVirtualConnection* cConnectionManager::createVirtualConnection(const char* RemoteProtocolInfo, const char* RemoteConnectionManager, int RemoteConnectionID, eDirection Direction){
- static int lastConnectionID = 0;
- MESSAGE(VERBOSE_CMS, "Create virtual connection");
- if(lastConnectionID == 2147483647) lastConnectionID = 1;
- cVirtualConnection* Connection = new cVirtualConnection;
- // AVT is available
- Connection->mAVTransportID = 0;
- // The ProtocolInfo of the remote device (i.e. Media Renderer)
- Connection->mRemoteProtocolInfo = RemoteProtocolInfo;
- // The responsible connection manager
- Connection->mRemoteConnectionManager = RemoteConnectionManager;
- // The virtual connection direction is output
- Connection->mDirection = Direction;
- // The remote connection ID, -1 says ID is unknown
- Connection->mRemoteConnectionID = RemoteConnectionID;
- // Connection status, assume that its ok.
- Connection->mStatus = OK;
- // new assigned ConnectionID
- Connection->mConnectionID = lastConnectionID++;
-
- // Notify the subscribers
- IXML_Document* PropertySet = NULL;
- const char* IDs = this->getConnectionIDsCVS();
- if(!IDs){
- return NULL;
- }
- UpnpAddToPropertySet(&PropertySet, "CurrentConnectionIDs", IDs);
- int ret = UpnpNotifyExt(this->mDeviceHandle, UPNP_DEVICE_UDN, UPNP_CMS_SERVICE_ID, PropertySet);
- ixmlDocument_free(PropertySet);
-
- if(ret != UPNP_E_SUCCESS){
- ERROR("State change notification failed (Error code: %d)",ret);
- return NULL;
- }
- MESSAGE(VERBOSE_CMS, "Notification of connection creation sent");
- this->mVirtualConnections->Add(Connection);
- return Connection;
-}
-
-bool cConnectionManager::destroyVirtualConnection(int ConnectionID){
- if(ConnectionID == 0){
- ERROR("Cannot delete default connection with ID 0!");
- return false;
- }
-
- cVirtualConnection* Connection;
- for(Connection = this->mVirtualConnections->First(); Connection && Connection->mConnectionID != ConnectionID; Connection = this->mVirtualConnections->Next(Connection)){}
-
- if(Connection){
- this->mVirtualConnections->Del(Connection);
- // Notify the subscribers
- IXML_Document* PropertySet = NULL;
- const char* IDs = this->getConnectionIDsCVS();
- if(!IDs){
- return false;
- }
- UpnpAddToPropertySet(&PropertySet, "CurrentConnectionIDs", IDs);
- int ret = UpnpNotifyExt(this->mDeviceHandle, UPNP_DEVICE_UDN, UPNP_CMS_SERVICE_ID, PropertySet);
- ixmlDocument_free(PropertySet);
-
- if(ret != UPNP_E_SUCCESS){
- ERROR("State change notification failed (Error code: %d)",ret);
- return false;
- }
- return true;
- }
- ERROR("No connection with ID=%d found!", ConnectionID);
- return false;
-}
-
-const char* cConnectionManager::getConnectionIDsCVS(){
- cString IDs;
- for(cVirtualConnection* Connection = this->mVirtualConnections->First(); Connection; Connection = this->mVirtualConnections->Next(Connection)){
- IDs = cString::sprintf("%s,%d", (*IDs)?*IDs:"", Connection->mConnectionID);
- }
- return IDs;
-}
-
-void cConnectionManager::setError(Upnp_Action_Request* Request, int Error){
- Request->ErrCode = Error;
- switch(Error){
- case 701:
- strn0cpy(Request->ErrStr,_("Incompatible protocol info"),LINE_SIZE);
- break;
- case 702:
- strn0cpy(Request->ErrStr,_("Incompatible directions"),LINE_SIZE);
- break;
- case 703:
- strn0cpy(Request->ErrStr,_("Insufficient network resources"),LINE_SIZE);
- break;
- case 704:
- strn0cpy(Request->ErrStr,_("Local restrictions"),LINE_SIZE);
- break;
- case 705:
- strn0cpy(Request->ErrStr,_("Access denied"),LINE_SIZE);
- break;
- case 706:
- strn0cpy(Request->ErrStr,_("Invalid connection reference"),LINE_SIZE);
- break;
- case 707:
- strn0cpy(Request->ErrStr,_("Not in network"),LINE_SIZE);
- break;
- default:
- cUpnpService::setError(Request, Error);
- break;
- }
-}
-
-const char* cVirtualConnection::getDirectionString(eDirection Direction){
- switch(Direction){
- case INPUT:
- return "Input";
- case OUTPUT:
- return "Output";
- default:
- return NULL;
- }
-}
-
-const char* cVirtualConnection::getStatusString(eConnectionStatus Status){
- switch(Status){
- case OK:
- return "OK";
- case CONTENT_FORMAT_MISMATCH:
- return "ContentFormatMismatch";
- case INSUFFICIENT_BANDWIDTH:
- return "InsufficientBandwidth";
- case UNRELIABLE_CHANNEL:
- return "UnreliableChannel";
- case UNKNOWN:
- return "Unknown";
- default:
- return NULL;
- }
-}
-
-int cVirtualConnection::getConnectionStatus(const char* eConnectionStatus){
- if(!strcasecmp(eConnectionStatus,"OK"))
- return OK;
- if(!strcasecmp(eConnectionStatus,"ContentFormatMismatch"))
- return CONTENT_FORMAT_MISMATCH;
- if(!strcasecmp(eConnectionStatus,"InsufficientBandwidth"))
- return INSUFFICIENT_BANDWIDTH;
- if(!strcasecmp(eConnectionStatus,"UnreliableChannel"))
- return UNRELIABLE_CHANNEL;
- if(!strcasecmp(eConnectionStatus,"Unknown"))
- return UNKNOWN;
- return -1;
-}
-
-int cVirtualConnection::getDirection(const char* Direction){
- if(!strcasecmp(Direction, "Output"))
- return OUTPUT;
- if(!strcasecmp(Direction, "Input"))
- return INPUT;
- return -1;
-} \ No newline at end of file
diff --git a/upnp/contentdirectory.cpp b/upnp/contentdirectory.cpp
deleted file mode 100644
index 954f001..0000000
--- a/upnp/contentdirectory.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * File: contentdirectory.cpp
- * Author: savop
- *
- * Created on 21. August 2009, 16:12
- */
-
-#include <upnp/ixml.h>
-#include <upnp/upnptools.h>
-#include "upnp/contentdirectory.h"
-#include "../common.h"
-#include "util.h"
-
-cContentDirectory::cContentDirectory(UpnpDevice_Handle DeviceHandle, cMediaDatabase* MediaDatabase)
-: cUpnpService(DeviceHandle) {
- this->mMediaDatabase = MediaDatabase;
-}
-
-cContentDirectory::~cContentDirectory() {}
-
-int cContentDirectory::subscribe(Upnp_Subscription_Request* Request){
- IXML_Document* PropertySet = NULL;
-
- /* The system update ID */
- UpnpAddToPropertySet(&PropertySet, "SystemUpdateID", itoa(this->mMediaDatabase->getSystemUpdateID()));
- /* The container update IDs as CSV list */
- UpnpAddToPropertySet(&PropertySet, "ContainerUpdateIDs", this->mMediaDatabase->getContainerUpdateIDs());
- /* The transfer IDs, which are not supported, i.e. empty */
- UpnpAddToPropertySet(&PropertySet, "TransferIDs", "");
- // Accept subscription
- int ret = UpnpAcceptSubscriptionExt(this->mDeviceHandle, Request->UDN, Request->ServiceId, PropertySet, Request->Sid);
-
- if(ret != UPNP_E_SUCCESS){
- ERROR("Subscription failed (Error code: %d)", ret);
- }
-
- ixmlDocument_free(PropertySet);
- return ret;
-}
-
-void cContentDirectory::Action(){
- static int Retry = 5;
- MESSAGE(VERBOSE_CDS, "Start Content directory thread");
- while(this->Running()){
- IXML_Document* PropertySet = NULL;
- UpnpAddToPropertySet(&PropertySet, "SystemUpdateID", itoa(this->mMediaDatabase->getSystemUpdateID()));
- int ret = UpnpNotifyExt(this->mDeviceHandle, UPNP_DEVICE_UDN, UPNP_CMS_SERVICE_ID, PropertySet);
- ixmlDocument_free(PropertySet);
-
- if(ret != UPNP_E_SUCCESS){
- Retry--;
- ERROR("State change notification failed (Error code: %d)",ret);
- ERROR("%d of %d notifications failed", (5-Retry), 5);
- }
- else {
- Retry = 5;
- }
- if (!Retry){
- ERROR("Maximum retries of notifications reached. Stopping...");
- this->Cancel();
- }
- // Sleep 2 seconds
- cCondWait::SleepMs(2000);
- }
-}
-
-int cContentDirectory::execute(Upnp_Action_Request* Request){
- if (Request == NULL) {
- ERROR("CMS Action Handler - request is null");
- return UPNP_E_BAD_REQUEST;
- }
-
- if(!strcmp(Request->ActionName, UPNP_CDS_ACTION_BROWSE))
- return this->browse(Request);
- if(!strcmp(Request->ActionName, UPNP_CDS_ACTION_SEARCHCAPABILITIES))
- return this->getSearchCapabilities(Request);
- if(!strcmp(Request->ActionName, UPNP_CDS_ACTION_SORTCAPABILITIES))
- return this->getSortCapabilities(Request);
- if(!strcmp(Request->ActionName, UPNP_CDS_ACTION_SYSTEMUPDATEID))
- return this->getSystemUpdateID(Request);
-
- return UPNP_E_BAD_REQUEST;
-}
-
-
-int cContentDirectory::browse(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CDS, "Browse requested by %s.", inet_ntoa(Request->CtrlPtIPAddr));
-
- char* ObjectID = NULL;
- if(this->parseStringValue(Request->ActionRequest, "ObjectID", &ObjectID)){
- ERROR("Invalid arguments. ObjectID missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- char* BrowseFlag = NULL;
- bool BrowseMetadata = false;
- if(this->parseStringValue(Request->ActionRequest, "BrowseFlag", &BrowseFlag)){
- ERROR("Invalid arguments. Browse flag missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
- if(!strcasecmp(BrowseFlag, "BrowseMetadata")){
- BrowseMetadata = true;
- }
- else if(!strcasecmp(BrowseFlag, "BrowseDirectChildren")){
- BrowseMetadata = false;
- }
- else {
- ERROR("Invalid argument. Browse flag invalid");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- char* Filter = NULL;
- if(this->parseStringValue(Request->ActionRequest, "Filter", &Filter)){
- ERROR("Invalid arguments. Filter missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- int StartingIndex = 0;
- if(this->parseIntegerValue(Request->ActionRequest, "StartingIndex", &StartingIndex)){
- ERROR("Invalid arguments. Starting index missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- int RequestedCount = 0;
- if(this->parseIntegerValue(Request->ActionRequest, "RequestedCount", &RequestedCount)){
- ERROR("Invalid arguments. Requested count missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- char* SortCriteria = NULL;
- if(this->parseStringValue(Request->ActionRequest, "SortCriteria", &SortCriteria)){
- ERROR("Invalid arguments. Sort criteria missing or wrong");
- this->setError(Request, UPNP_SOAP_E_INVALID_ARGS);
- return Request->ErrCode;
- }
-
- cUPnPResultSet* ResultSet;
-
- int ret = this->mMediaDatabase->browse(&ResultSet, ObjectID, BrowseMetadata, Filter, StartingIndex, RequestedCount, SortCriteria);
- if(ret!=UPNP_E_SUCCESS){
- ERROR("Error while browsing. Code: %d", ret);
- this->setError(Request, ret);
- return Request->ErrCode;
- }
-
- char* escapedResult = NULL;
- escapeXMLCharacters(ResultSet->mResult, &escapedResult);
-
- if(!escapedResult){
- ERROR("Escaping XML data failed");
- this->setError(Request, UPNP_SOAP_E_ACTION_FAILED);
- return Request->ErrCode;
- }
-
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <Result>%s</Result> \
- <NumberReturned>%d</NumberReturned> \
- <TotalMatches>%d</TotalMatches> \
- <UpdateID>%d</UpdateID> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CDS_SERVICE_TYPE,
- escapedResult,
- ResultSet->mNumberReturned,
- ResultSet->mTotalMatches,
- this->mMediaDatabase->getSystemUpdateID(),
- Request->ActionName
- );
-
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
-
- free(escapedResult);
-
- return Request->ErrCode;
-
-}
-
-int cContentDirectory::getSystemUpdateID(Upnp_Action_Request* Request){
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <Id>%d</Id> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CDS_SERVICE_TYPE,
- this->mMediaDatabase->getSystemUpdateID(),
- Request->ActionName
- );
-
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
-
- return Request->ErrCode;
-}
-
-int cContentDirectory::getSearchCapabilities(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CDS, "Sorry, no search capabilities yet");
-
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <SearchCaps>%s</SearchCaps> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CDS_SERVICE_TYPE,
- UPNP_CDS_SEARCH_CAPABILITIES,
- Request->ActionName
- );
-
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
-
- return Request->ErrCode;
-}
-
-int cContentDirectory::getSortCapabilities(Upnp_Action_Request* Request){
- MESSAGE(VERBOSE_CDS, "Sorry, no sort capabilities yet");
-
- cString Result = cString::sprintf(
- "<u:%sResponse xmlns:u=\"%s\"> \
- <SortCaps>%s</SortCaps> \
- </u:%sResponse>",
- Request->ActionName,
- UPNP_CDS_SERVICE_TYPE,
- UPNP_CDS_SORT_CAPABILITIES,
- Request->ActionName
- );
-
- Request->ActionResult = ixmlParseBuffer(Result);
- Request->ErrCode = UPNP_E_SUCCESS;
-
- return Request->ErrCode;
-}
-
-void cContentDirectory::setError(Upnp_Action_Request* Request, int Error){
- Request->ErrCode = Error;
- switch(Error){
- case UPNP_CDS_E_BAD_METADATA:
- strn0cpy(Request->ErrStr,_("Bad metadata"),LINE_SIZE);
- break;
- case UPNP_CDS_E_CANT_PROCESS_REQUEST:
- strn0cpy(Request->ErrStr,_("Cannot process the request"),LINE_SIZE);
- break;
- case UPNP_CDS_E_DEST_RESOURCE_ACCESS_DENIED:
- strn0cpy(Request->ErrStr,_("Destination resource access denied"),LINE_SIZE);
- break;
- case UPNP_CDS_E_INVALID_CURRENT_TAG:
- strn0cpy(Request->ErrStr,_("Invalid current tag"),LINE_SIZE);
- break;
- case UPNP_CDS_E_INVALID_NEW_TAG:
- strn0cpy(Request->ErrStr,_("Invalid new tag"),LINE_SIZE);
- break;
- case UPNP_CDS_E_INVALID_SEARCH_CRITERIA:
- strn0cpy(Request->ErrStr,_("Invalid or unsupported search criteria"),LINE_SIZE);
- break;
- case UPNP_CDS_E_INVALID_SORT_CRITERIA:
- strn0cpy(Request->ErrStr,_("Invalid or unsupported sort criteria"),LINE_SIZE);
- break;
- case UPNP_CDS_E_NO_SUCH_CONTAINER:
- strn0cpy(Request->ErrStr,_("No such container"),LINE_SIZE);
- break;
- case UPNP_CDS_E_NO_SUCH_DESTINATION_RESOURCE:
- strn0cpy(Request->ErrStr,_("No such destination resource"),LINE_SIZE);
- break;
- case UPNP_CDS_E_NO_SUCH_FILE_TRANSFER:
- strn0cpy(Request->ErrStr,_("No such file transfer"),LINE_SIZE);
- break;
- case UPNP_CDS_E_NO_SUCH_OBJECT:
- strn0cpy(Request->ErrStr,_("No such objectID"),LINE_SIZE);
- break;
- case UPNP_CDS_E_NO_SUCH_SOURCE_RESOURCE:
- strn0cpy(Request->ErrStr,_("No such source resource"),LINE_SIZE);
- break;
- case UPNP_CDS_E_PARAMETER_MISMATCH:
- strn0cpy(Request->ErrStr,_("Parameter mismatch"),LINE_SIZE);
- break;
- case UPNP_CDS_E_READ_ONLY_TAG:
- strn0cpy(Request->ErrStr,_("Read only tag"),LINE_SIZE);
- break;
- case UPNP_CDS_E_REQUIRED_TAG:
- strn0cpy(Request->ErrStr,_("Required tag"),LINE_SIZE);
- break;
- case UPNP_CDS_E_RESOURCE_ACCESS_DENIED:
- strn0cpy(Request->ErrStr,_("Resource access denied"),LINE_SIZE);
- break;
- case UPNP_CDS_E_RESTRICTED_OBJECT:
- strn0cpy(Request->ErrStr,_("Restricted object"),LINE_SIZE);
- break;
- case UPNP_CDS_E_RESTRICTED_PARENT:
- strn0cpy(Request->ErrStr,_("Restricted parent"),LINE_SIZE);
- break;
- case UPNP_CDS_E_TRANSFER_BUSY:
- strn0cpy(Request->ErrStr,_("Transfer busy"),LINE_SIZE);
- break;
- default:
- cUpnpService::setError(Request, Error);
- break;
- }
- return;
-} \ No newline at end of file
diff --git a/upnp/service.cpp b/upnp/service.cpp
deleted file mode 100644
index 4d17af1..0000000
--- a/upnp/service.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * File: upnpservice.cpp
- * Author: savop
- *
- * Created on 21. August 2009, 18:38
- */
-
-#include "upnp/service.h"
-#include "../common.h"
-#include "util.h"
-
-cUpnpService::cUpnpService(UpnpDevice_Handle DeviceHandle) {
- this->mDeviceHandle = DeviceHandle;
-}
-
-int cUpnpService::parseIntegerValue(IN IXML_Document* Document, IN const char* Item, OUT int* Value){
- char* Val = NULL;
- int Error = 0;
-
- Val = ixmlGetFirstDocumentItem(Document, Item, &Error);
-
- if(Error != 0){
- ERROR("Error while parsing integer value for item=%s", Item);
- Error = -1;
- }
- else if(!Value){
- WARNING("Value %s empty!", Item);
- *Value = 0;
- }
- else {
- *Value = atoi(Val);
- free(Val);
- }
- return Error;
-}
-
-int cUpnpService::parseStringValue(IN IXML_Document* Document, IN const char* Item, OUT char** Value){
- char* Val = NULL;
- int Error = 0;
-
- Val = ixmlGetFirstDocumentItem(Document, Item, &Error);
-
- if(Error != 0){
- ERROR("Error while parsing string value for item=%s", Item);
- Error = -1;
- }
- else if(!Val){
- WARNING("Value %s empty!", Item);
- *Value = NULL;
- }
- else {
- *Value = strdup(Val);
- free(Val);
- }
-
- return Error;
-}
-
-void cUpnpService::setError(Upnp_Action_Request* Request, int Error){
- Request->ErrCode = Error;
- switch(Error){
- case UPNP_SOAP_E_INVALID_ACTION:
- strn0cpy(Request->ErrStr,_("Invalid action"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_INVALID_ARGS:
- strn0cpy(Request->ErrStr,_("Invalid args"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_INVALID_VAR:
- strn0cpy(Request->ErrStr,_("Invalid var"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_ACTION_FAILED:
- strn0cpy(Request->ErrStr,_("Action failed"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_ARGUMENT_INVALID:
- strn0cpy(Request->ErrStr,_("Argument value invalid"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_ARGUMENT_OUT_OF_RANGE:
- strn0cpy(Request->ErrStr,_("Argument value out of range"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_ACTION_NOT_IMPLEMENTED:
- strn0cpy(Request->ErrStr,_("Optional action not implemented"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_OUT_OF_MEMORY:
- strn0cpy(Request->ErrStr,_("Out of memory"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_HUMAN_INTERVENTION:
- strn0cpy(Request->ErrStr,_("Human intervention required"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_STRING_TO_LONG:
- strn0cpy(Request->ErrStr,_("String argument to long"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_NOT_AUTHORIZED:
- strn0cpy(Request->ErrStr,_("Action not authorized"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_SIGNATURE_FAILURE:
- strn0cpy(Request->ErrStr,_("Signature failure"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_SIGNATURE_MISSING:
- strn0cpy(Request->ErrStr,_("Signature missing"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_NOT_ENCRYPTED:
- strn0cpy(Request->ErrStr,_("Not encrypted"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_INVALID_SEQUENCE:
- strn0cpy(Request->ErrStr,_("Invalid sequence"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_INVALID_CONTROL_URL:
- strn0cpy(Request->ErrStr,_("Invalid control URL"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_NO_SUCH_SESSION:
- strn0cpy(Request->ErrStr,_("No such session"),LINE_SIZE);
- break;
- case UPNP_SOAP_E_OUT_OF_SYNC:
- default:
- strn0cpy(Request->ErrStr,_("Unknown error code. Contact the device manufacturer"),LINE_SIZE);
- break;
- }
-} \ No newline at end of file