1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/COPYING Sat Dec 29 11:17:32 2007 +0100
1.3 @@ -0,0 +1,340 @@
1.4 + GNU GENERAL PUBLIC LICENSE
1.5 + Version 2, June 1991
1.6 +
1.7 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
1.8 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.9 + Everyone is permitted to copy and distribute verbatim copies
1.10 + of this license document, but changing it is not allowed.
1.11 +
1.12 + Preamble
1.13 +
1.14 + The licenses for most software are designed to take away your
1.15 +freedom to share and change it. By contrast, the GNU General Public
1.16 +License is intended to guarantee your freedom to share and change free
1.17 +software--to make sure the software is free for all its users. This
1.18 +General Public License applies to most of the Free Software
1.19 +Foundation's software and to any other program whose authors commit to
1.20 +using it. (Some other Free Software Foundation software is covered by
1.21 +the GNU Library General Public License instead.) You can apply it to
1.22 +your programs, too.
1.23 +
1.24 + When we speak of free software, we are referring to freedom, not
1.25 +price. Our General Public Licenses are designed to make sure that you
1.26 +have the freedom to distribute copies of free software (and charge for
1.27 +this service if you wish), that you receive source code or can get it
1.28 +if you want it, that you can change the software or use pieces of it
1.29 +in new free programs; and that you know you can do these things.
1.30 +
1.31 + To protect your rights, we need to make restrictions that forbid
1.32 +anyone to deny you these rights or to ask you to surrender the rights.
1.33 +These restrictions translate to certain responsibilities for you if you
1.34 +distribute copies of the software, or if you modify it.
1.35 +
1.36 + For example, if you distribute copies of such a program, whether
1.37 +gratis or for a fee, you must give the recipients all the rights that
1.38 +you have. You must make sure that they, too, receive or can get the
1.39 +source code. And you must show them these terms so they know their
1.40 +rights.
1.41 +
1.42 + We protect your rights with two steps: (1) copyright the software, and
1.43 +(2) offer you this license which gives you legal permission to copy,
1.44 +distribute and/or modify the software.
1.45 +
1.46 + Also, for each author's protection and ours, we want to make certain
1.47 +that everyone understands that there is no warranty for this free
1.48 +software. If the software is modified by someone else and passed on, we
1.49 +want its recipients to know that what they have is not the original, so
1.50 +that any problems introduced by others will not reflect on the original
1.51 +authors' reputations.
1.52 +
1.53 + Finally, any free program is threatened constantly by software
1.54 +patents. We wish to avoid the danger that redistributors of a free
1.55 +program will individually obtain patent licenses, in effect making the
1.56 +program proprietary. To prevent this, we have made it clear that any
1.57 +patent must be licensed for everyone's free use or not licensed at all.
1.58 +
1.59 + The precise terms and conditions for copying, distribution and
1.60 +modification follow.
1.61 +
1.62 + GNU GENERAL PUBLIC LICENSE
1.63 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1.64 +
1.65 + 0. This License applies to any program or other work which contains
1.66 +a notice placed by the copyright holder saying it may be distributed
1.67 +under the terms of this General Public License. The "Program", below,
1.68 +refers to any such program or work, and a "work based on the Program"
1.69 +means either the Program or any derivative work under copyright law:
1.70 +that is to say, a work containing the Program or a portion of it,
1.71 +either verbatim or with modifications and/or translated into another
1.72 +language. (Hereinafter, translation is included without limitation in
1.73 +the term "modification".) Each licensee is addressed as "you".
1.74 +
1.75 +Activities other than copying, distribution and modification are not
1.76 +covered by this License; they are outside its scope. The act of
1.77 +running the Program is not restricted, and the output from the Program
1.78 +is covered only if its contents constitute a work based on the
1.79 +Program (independent of having been made by running the Program).
1.80 +Whether that is true depends on what the Program does.
1.81 +
1.82 + 1. You may copy and distribute verbatim copies of the Program's
1.83 +source code as you receive it, in any medium, provided that you
1.84 +conspicuously and appropriately publish on each copy an appropriate
1.85 +copyright notice and disclaimer of warranty; keep intact all the
1.86 +notices that refer to this License and to the absence of any warranty;
1.87 +and give any other recipients of the Program a copy of this License
1.88 +along with the Program.
1.89 +
1.90 +You may charge a fee for the physical act of transferring a copy, and
1.91 +you may at your option offer warranty protection in exchange for a fee.
1.92 +
1.93 + 2. You may modify your copy or copies of the Program or any portion
1.94 +of it, thus forming a work based on the Program, and copy and
1.95 +distribute such modifications or work under the terms of Section 1
1.96 +above, provided that you also meet all of these conditions:
1.97 +
1.98 + a) You must cause the modified files to carry prominent notices
1.99 + stating that you changed the files and the date of any change.
1.100 +
1.101 + b) You must cause any work that you distribute or publish, that in
1.102 + whole or in part contains or is derived from the Program or any
1.103 + part thereof, to be licensed as a whole at no charge to all third
1.104 + parties under the terms of this License.
1.105 +
1.106 + c) If the modified program normally reads commands interactively
1.107 + when run, you must cause it, when started running for such
1.108 + interactive use in the most ordinary way, to print or display an
1.109 + announcement including an appropriate copyright notice and a
1.110 + notice that there is no warranty (or else, saying that you provide
1.111 + a warranty) and that users may redistribute the program under
1.112 + these conditions, and telling the user how to view a copy of this
1.113 + License. (Exception: if the Program itself is interactive but
1.114 + does not normally print such an announcement, your work based on
1.115 + the Program is not required to print an announcement.)
1.116 +
1.117 +These requirements apply to the modified work as a whole. If
1.118 +identifiable sections of that work are not derived from the Program,
1.119 +and can be reasonably considered independent and separate works in
1.120 +themselves, then this License, and its terms, do not apply to those
1.121 +sections when you distribute them as separate works. But when you
1.122 +distribute the same sections as part of a whole which is a work based
1.123 +on the Program, the distribution of the whole must be on the terms of
1.124 +this License, whose permissions for other licensees extend to the
1.125 +entire whole, and thus to each and every part regardless of who wrote it.
1.126 +
1.127 +Thus, it is not the intent of this section to claim rights or contest
1.128 +your rights to work written entirely by you; rather, the intent is to
1.129 +exercise the right to control the distribution of derivative or
1.130 +collective works based on the Program.
1.131 +
1.132 +In addition, mere aggregation of another work not based on the Program
1.133 +with the Program (or with a work based on the Program) on a volume of
1.134 +a storage or distribution medium does not bring the other work under
1.135 +the scope of this License.
1.136 +
1.137 + 3. You may copy and distribute the Program (or a work based on it,
1.138 +under Section 2) in object code or executable form under the terms of
1.139 +Sections 1 and 2 above provided that you also do one of the following:
1.140 +
1.141 + a) Accompany it with the complete corresponding machine-readable
1.142 + source code, which must be distributed under the terms of Sections
1.143 + 1 and 2 above on a medium customarily used for software interchange; or,
1.144 +
1.145 + b) Accompany it with a written offer, valid for at least three
1.146 + years, to give any third party, for a charge no more than your
1.147 + cost of physically performing source distribution, a complete
1.148 + machine-readable copy of the corresponding source code, to be
1.149 + distributed under the terms of Sections 1 and 2 above on a medium
1.150 + customarily used for software interchange; or,
1.151 +
1.152 + c) Accompany it with the information you received as to the offer
1.153 + to distribute corresponding source code. (This alternative is
1.154 + allowed only for noncommercial distribution and only if you
1.155 + received the program in object code or executable form with such
1.156 + an offer, in accord with Subsection b above.)
1.157 +
1.158 +The source code for a work means the preferred form of the work for
1.159 +making modifications to it. For an executable work, complete source
1.160 +code means all the source code for all modules it contains, plus any
1.161 +associated interface definition files, plus the scripts used to
1.162 +control compilation and installation of the executable. However, as a
1.163 +special exception, the source code distributed need not include
1.164 +anything that is normally distributed (in either source or binary
1.165 +form) with the major components (compiler, kernel, and so on) of the
1.166 +operating system on which the executable runs, unless that component
1.167 +itself accompanies the executable.
1.168 +
1.169 +If distribution of executable or object code is made by offering
1.170 +access to copy from a designated place, then offering equivalent
1.171 +access to copy the source code from the same place counts as
1.172 +distribution of the source code, even though third parties are not
1.173 +compelled to copy the source along with the object code.
1.174 +
1.175 + 4. You may not copy, modify, sublicense, or distribute the Program
1.176 +except as expressly provided under this License. Any attempt
1.177 +otherwise to copy, modify, sublicense or distribute the Program is
1.178 +void, and will automatically terminate your rights under this License.
1.179 +However, parties who have received copies, or rights, from you under
1.180 +this License will not have their licenses terminated so long as such
1.181 +parties remain in full compliance.
1.182 +
1.183 + 5. You are not required to accept this License, since you have not
1.184 +signed it. However, nothing else grants you permission to modify or
1.185 +distribute the Program or its derivative works. These actions are
1.186 +prohibited by law if you do not accept this License. Therefore, by
1.187 +modifying or distributing the Program (or any work based on the
1.188 +Program), you indicate your acceptance of this License to do so, and
1.189 +all its terms and conditions for copying, distributing or modifying
1.190 +the Program or works based on it.
1.191 +
1.192 + 6. Each time you redistribute the Program (or any work based on the
1.193 +Program), the recipient automatically receives a license from the
1.194 +original licensor to copy, distribute or modify the Program subject to
1.195 +these terms and conditions. You may not impose any further
1.196 +restrictions on the recipients' exercise of the rights granted herein.
1.197 +You are not responsible for enforcing compliance by third parties to
1.198 +this License.
1.199 +
1.200 + 7. If, as a consequence of a court judgment or allegation of patent
1.201 +infringement or for any other reason (not limited to patent issues),
1.202 +conditions are imposed on you (whether by court order, agreement or
1.203 +otherwise) that contradict the conditions of this License, they do not
1.204 +excuse you from the conditions of this License. If you cannot
1.205 +distribute so as to satisfy simultaneously your obligations under this
1.206 +License and any other pertinent obligations, then as a consequence you
1.207 +may not distribute the Program at all. For example, if a patent
1.208 +license would not permit royalty-free redistribution of the Program by
1.209 +all those who receive copies directly or indirectly through you, then
1.210 +the only way you could satisfy both it and this License would be to
1.211 +refrain entirely from distribution of the Program.
1.212 +
1.213 +If any portion of this section is held invalid or unenforceable under
1.214 +any particular circumstance, the balance of the section is intended to
1.215 +apply and the section as a whole is intended to apply in other
1.216 +circumstances.
1.217 +
1.218 +It is not the purpose of this section to induce you to infringe any
1.219 +patents or other property right claims or to contest validity of any
1.220 +such claims; this section has the sole purpose of protecting the
1.221 +integrity of the free software distribution system, which is
1.222 +implemented by public license practices. Many people have made
1.223 +generous contributions to the wide range of software distributed
1.224 +through that system in reliance on consistent application of that
1.225 +system; it is up to the author/donor to decide if he or she is willing
1.226 +to distribute software through any other system and a licensee cannot
1.227 +impose that choice.
1.228 +
1.229 +This section is intended to make thoroughly clear what is believed to
1.230 +be a consequence of the rest of this License.
1.231 +
1.232 + 8. If the distribution and/or use of the Program is restricted in
1.233 +certain countries either by patents or by copyrighted interfaces, the
1.234 +original copyright holder who places the Program under this License
1.235 +may add an explicit geographical distribution limitation excluding
1.236 +those countries, so that distribution is permitted only in or among
1.237 +countries not thus excluded. In such case, this License incorporates
1.238 +the limitation as if written in the body of this License.
1.239 +
1.240 + 9. The Free Software Foundation may publish revised and/or new versions
1.241 +of the General Public License from time to time. Such new versions will
1.242 +be similar in spirit to the present version, but may differ in detail to
1.243 +address new problems or concerns.
1.244 +
1.245 +Each version is given a distinguishing version number. If the Program
1.246 +specifies a version number of this License which applies to it and "any
1.247 +later version", you have the option of following the terms and conditions
1.248 +either of that version or of any later version published by the Free
1.249 +Software Foundation. If the Program does not specify a version number of
1.250 +this License, you may choose any version ever published by the Free Software
1.251 +Foundation.
1.252 +
1.253 + 10. If you wish to incorporate parts of the Program into other free
1.254 +programs whose distribution conditions are different, write to the author
1.255 +to ask for permission. For software which is copyrighted by the Free
1.256 +Software Foundation, write to the Free Software Foundation; we sometimes
1.257 +make exceptions for this. Our decision will be guided by the two goals
1.258 +of preserving the free status of all derivatives of our free software and
1.259 +of promoting the sharing and reuse of software generally.
1.260 +
1.261 + NO WARRANTY
1.262 +
1.263 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
1.264 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
1.265 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
1.266 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
1.267 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1.268 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
1.269 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
1.270 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
1.271 +REPAIR OR CORRECTION.
1.272 +
1.273 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1.274 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
1.275 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
1.276 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
1.277 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
1.278 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
1.279 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1.280 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
1.281 +POSSIBILITY OF SUCH DAMAGES.
1.282 +
1.283 + END OF TERMS AND CONDITIONS
1.284 +
1.285 + How to Apply These Terms to Your New Programs
1.286 +
1.287 + If you develop a new program, and you want it to be of the greatest
1.288 +possible use to the public, the best way to achieve this is to make it
1.289 +free software which everyone can redistribute and change under these terms.
1.290 +
1.291 + To do so, attach the following notices to the program. It is safest
1.292 +to attach them to the start of each source file to most effectively
1.293 +convey the exclusion of warranty; and each file should have at least
1.294 +the "copyright" line and a pointer to where the full notice is found.
1.295 +
1.296 + <one line to give the program's name and a brief idea of what it does.>
1.297 + Copyright (C) <year> <name of author>
1.298 +
1.299 + This program is free software; you can redistribute it and/or modify
1.300 + it under the terms of the GNU General Public License as published by
1.301 + the Free Software Foundation; either version 2 of the License, or
1.302 + (at your option) any later version.
1.303 +
1.304 + This program is distributed in the hope that it will be useful,
1.305 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1.306 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.307 + GNU General Public License for more details.
1.308 +
1.309 + You should have received a copy of the GNU General Public License
1.310 + along with this program; if not, write to the Free Software
1.311 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.312 +
1.313 +
1.314 +Also add information on how to contact you by electronic and paper mail.
1.315 +
1.316 +If the program is interactive, make it output a short notice like this
1.317 +when it starts in an interactive mode:
1.318 +
1.319 + Gnomovision version 69, Copyright (C) year name of author
1.320 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
1.321 + This is free software, and you are welcome to redistribute it
1.322 + under certain conditions; type `show c' for details.
1.323 +
1.324 +The hypothetical commands `show w' and `show c' should show the appropriate
1.325 +parts of the General Public License. Of course, the commands you use may
1.326 +be called something other than `show w' and `show c'; they could even be
1.327 +mouse-clicks or menu items--whatever suits your program.
1.328 +
1.329 +You should also get your employer (if you work as a programmer) or your
1.330 +school, if any, to sign a "copyright disclaimer" for the program, if
1.331 +necessary. Here is a sample; alter the names:
1.332 +
1.333 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
1.334 + `Gnomovision' (which makes passes at compilers) written by James Hacker.
1.335 +
1.336 + <signature of Ty Coon>, 1 April 1989
1.337 + Ty Coon, President of Vice
1.338 +
1.339 +This General Public License does not permit incorporating your program into
1.340 +proprietary programs. If your program is a subroutine library, you may
1.341 +consider it more useful to permit linking proprietary applications with the
1.342 +library. If this is what you want to do, use the GNU Library General
1.343 +Public License instead of this License.
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/HISTORY Sat Dec 29 11:17:32 2007 +0100
2.3 @@ -0,0 +1,6 @@
2.4 +VDR Plugin 'premiereepg' Revision History
2.5 +-----------------------------------------
2.6 +
2.7 +24.07.2005: Version 0.0.1
2.8 +
2.9 +- Initial release.
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/Makefile Sat Dec 29 11:17:32 2007 +0100
3.3 @@ -0,0 +1,97 @@
3.4 +#
3.5 +# PremiereEpg plugin to VDR
3.6 +#
3.7 +# (C) 2005 Stefan Huelswitt <s.huelswitt@gmx.de>
3.8 +#
3.9 +# This code is free software; you can redistribute it and/or
3.10 +# modify it under the terms of the GNU General Public License
3.11 +# as published by the Free Software Foundation; either version 2
3.12 +# of the License, or (at your option) any later version.
3.13 +#
3.14 +# This code is distributed in the hope that it will be useful,
3.15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 +# GNU General Public License for more details.
3.18 +#
3.19 +# You should have received a copy of the GNU General Public License
3.20 +# along with this program; if not, write to the Free Software
3.21 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3.22 +# Or, point your browser to http://www.gnu.org/copyleft/gpl.html
3.23 +
3.24 +# The official name of this plugin.
3.25 +# This name will be used in the '-P...' option of VDR to load the plugin.
3.26 +# By default the main source file also carries this name.
3.27 +#
3.28 +PLUGIN = premiereepg
3.29 +
3.30 +### The version number of this plugin (taken from the main source file):
3.31 +
3.32 +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
3.33 +
3.34 +### The C++ compiler and options:
3.35 +
3.36 +CXX ?= g++
3.37 +CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
3.38 +
3.39 +### The directory environment:
3.40 +
3.41 +DVBDIR = ../../../../DVB
3.42 +VDRDIR = ../../..
3.43 +LIBDIR = ../../lib
3.44 +TMPDIR = /tmp
3.45 +
3.46 +### Allow user defined options to overwrite defaults:
3.47 +
3.48 +-include $(VDRDIR)/Make.config
3.49 +
3.50 +### The version number of VDR (taken from VDR's "config.h"):
3.51 +
3.52 +VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
3.53 +
3.54 +### The name of the distribution archive:
3.55 +
3.56 +ARCHIVE = $(PLUGIN)-$(VERSION)
3.57 +PACKAGE = vdr-$(ARCHIVE)
3.58 +
3.59 +### Includes and Defines (add further entries here):
3.60 +
3.61 +INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
3.62 +
3.63 +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
3.64 +
3.65 +### The object files (add further files here):
3.66 +
3.67 +OBJS = $(PLUGIN).o
3.68 +
3.69 +### Implicit rules:
3.70 +
3.71 +%.o: %.c
3.72 + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
3.73 +
3.74 +# Dependencies:
3.75 +
3.76 +MAKEDEP = $(CXX) -MM -MG
3.77 +DEPFILE = .dependencies
3.78 +$(DEPFILE): Makefile
3.79 + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
3.80 +
3.81 +-include $(DEPFILE)
3.82 +
3.83 +### Targets:
3.84 +
3.85 +all: libvdr-$(PLUGIN).so
3.86 +
3.87 +libvdr-$(PLUGIN).so: $(OBJS)
3.88 + $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
3.89 + @cp $@ $(LIBDIR)/$@.$(VDRVERSION)
3.90 +
3.91 +dist: clean
3.92 + @-rm -rf $(TMPDIR)/$(ARCHIVE)
3.93 + @mkdir $(TMPDIR)/$(ARCHIVE)
3.94 + @cp -a * $(TMPDIR)/$(ARCHIVE)
3.95 + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
3.96 + @-rm -rf $(TMPDIR)/$(ARCHIVE)
3.97 + @echo Distribution package created as $(PACKAGE).tgz
3.98 +
3.99 +clean:
3.100 + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/README Sat Dec 29 11:17:32 2007 +0100
4.3 @@ -0,0 +1,35 @@
4.4 +
4.5 +This is the PremiereEpg plugin for VDR.
4.6 +
4.7 +It parses the extended EPG data which is send by Premiere on their option
4.8 +channels.
4.9 +
4.10 +Written by: Stefan Hülswitt <s.huelswitt@gmx.de>
4.11 +Project's homepage: http://www.muempf.de/
4.12 +Latest version available at: http://www.muempf.de/down/
4.13 +
4.14 +See the file COPYING for license information.
4.15 +
4.16 +----------------------------------------------------------------------
4.17 +
4.18 +This plugin parses the extended EPG data which is send by Premiere on their
4.19 +option channels. The EPG data is transmitted in a non-standard format on a
4.20 +non-standard PID.
4.21 +
4.22 +This work is based on the premiereepg2vdr commandline tool, which was written
4.23 +by Axel Katzur software@katzur.de.
4.24 +premiereepg2vdr can be found at:
4.25 +<http://www.katzur.de/download/premiereepg2vdr-0.0.3.tar.gz>
4.26 +
4.27 +Note: the EPG entries created with this plugin aren't fully compatible with
4.28 +entries created by premiereepg2vdr. This plugin used a different sheme (IMO more
4.29 +reliable) to map the EventID. If you're upgrading from premiereepg2vdr you
4.30 +should delete your epg.data file.
4.31 +
4.32 +Beside this, there is nothing big to say:
4.33 +
4.34 +- There are no commandline options for this plugin.
4.35 +- There is no plugin setup menu.
4.36 +- There is no plugin mainmenu entry.
4.37 +- Everything should work automatically. Whenever a device is tuned to a Premiere
4.38 + channel i.e. by EPG scan or manually, the Premiere EPG scan is triggered.
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/premiereepg.c Sat Dec 29 11:17:32 2007 +0100
5.3 @@ -0,0 +1,483 @@
5.4 +/*
5.5 + * PremiereEpg plugin to VDR (C++)
5.6 + *
5.7 + * (C) 2005 Stefan Huelswitt <s.huelswitt@gmx.de>
5.8 + *
5.9 + * This code is base on the commandline tool premiereepg2vdr
5.10 + * (C) 2004-2005 by Axel Katzur software@katzur.de
5.11 + * but has been rewritten from scratch
5.12 + *
5.13 + * This code is free software; you can redistribute it and/or
5.14 + * modify it under the terms of the GNU General Public License
5.15 + * as published by the Free Software Foundation; either version 2
5.16 + * of the License, or (at your option) any later version.
5.17 + *
5.18 + * This code is distributed in the hope that it will be useful,
5.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.21 + * GNU General Public License for more details.
5.22 + *
5.23 + * You should have received a copy of the GNU General Public License
5.24 + * along with this program; if not, write to the Free Software
5.25 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
5.26 + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
5.27 + */
5.28 +
5.29 +#include <vdr/plugin.h>
5.30 +#include <vdr/filter.h>
5.31 +#include <vdr/epg.h>
5.32 +#include <vdr/channels.h>
5.33 +#include <vdr/dvbdevice.h>
5.34 +#include <libsi/section.h>
5.35 +#include <libsi/descriptor.h>
5.36 +
5.37 +//#define DEBUG
5.38 +//#define DEBUG2
5.39 +
5.40 +#ifdef DEBUG
5.41 +#define d(x) { (x); }
5.42 +#else
5.43 +#define d(x) ;
5.44 +#endif
5.45 +#ifdef DEBUG2
5.46 +#define d2(x) { (x); }
5.47 +#else
5.48 +#define d2(x) ;
5.49 +#endif
5.50 +
5.51 +#define PMT_SCAN_TIMEOUT 10 // seconds
5.52 +#define PMT_SCAN_IDLE 300 // seconds
5.53 +
5.54 +static const char *VERSION = "0.0.1";
5.55 +static const char *DESCRIPTION = "Parse extended Premiere EPG data";
5.56 +
5.57 +// --- CIT ---------------------------------------------------------------------
5.58 +
5.59 +namespace SI {
5.60 +
5.61 +#define CIT_LEN 17
5.62 +
5.63 +struct cit {
5.64 + u_char table_id :8;
5.65 +#if BYTE_ORDER == BIG_ENDIAN
5.66 + u_char section_syntax_indicator :1;
5.67 + u_char :3;
5.68 + u_char section_length_hi :4;
5.69 +#else
5.70 + u_char section_length_hi :4;
5.71 + u_char :3;
5.72 + u_char section_syntax_indicator :1;
5.73 +#endif
5.74 + u_char section_length_lo :8;
5.75 + u_char service_id_hi :8;
5.76 + u_char service_id_lo :8;
5.77 +#if BYTE_ORDER == BIG_ENDIAN
5.78 + u_char :2;
5.79 + u_char version_number :5;
5.80 + u_char current_next_indicator :1;
5.81 +#else
5.82 + u_char current_next_indicator :1;
5.83 + u_char version_number :5;
5.84 + u_char :2;
5.85 +#endif
5.86 + u_char section_number :8;
5.87 + u_char last_section_number :8;
5.88 + u_char content_id_hi_hi :8;
5.89 + u_char content_id_hi_lo :8;
5.90 + u_char content_id_lo_hi :8;
5.91 + u_char content_id_lo_lo :8;
5.92 + u_char duration_h :8;
5.93 + u_char duration_m :8;
5.94 + u_char duration_s :8;
5.95 +#if BYTE_ORDER == BIG_ENDIAN
5.96 + u_char reserved :4;
5.97 + u_char descriptors_loop_length_hi :4;
5.98 +#else
5.99 + u_char descriptors_loop_length_hi :4;
5.100 + u_char reserved :4;
5.101 +#endif
5.102 + u_char descriptors_loop_length_lo :8;
5.103 +};
5.104 +
5.105 +class CIT : public NumberedSection {
5.106 +public:
5.107 + CIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
5.108 + CIT() {}
5.109 + int getContentId(void) const;
5.110 + time_t getDuration(void) const;
5.111 + DescriptorLoop eventDescriptors;
5.112 +protected:
5.113 + virtual void Parse(void);
5.114 +private:
5.115 + const cit *s;
5.116 +};
5.117 +
5.118 +int CIT::getContentId(void) const {
5.119 + return (HILO(s->content_id_hi)<<16) | (HILO(s->content_id_lo));
5.120 +}
5.121 +
5.122 +time_t CIT::getDuration(void) const {
5.123 + return DVBTime::getDuration(s->duration_h,s->duration_m,s->duration_s);
5.124 +}
5.125 +
5.126 +void CIT::Parse(void) {
5.127 + unsigned int offset=0;
5.128 + data.setPointerAndOffset<const cit>(s, offset);
5.129 + eventDescriptors.setData(data+offset,HILO(s->descriptors_loop_length));
5.130 +}
5.131 +
5.132 +} // end of namespace
5.133 +
5.134 +// --- cDescrF2 ----------------------------------------------------------------
5.135 +
5.136 +class cDescrF2 {
5.137 +private:
5.138 + SI::Descriptor *d;
5.139 + SI::CharArray data;
5.140 + int idx, loop, nloop, index;
5.141 +public:
5.142 + cDescrF2(SI::Descriptor *D);
5.143 + int TransportStreamId(void) { return data.TwoBytes(2); }
5.144 + int OrgNetworkId(void) { return data.TwoBytes(4); }
5.145 + int ServiceId(void) { return data.TwoBytes(6); }
5.146 + void Start(void);
5.147 + bool Next(void);
5.148 + time_t StartTime(void);
5.149 + int Index(void) { return index; }
5.150 + };
5.151 +
5.152 +cDescrF2::cDescrF2(SI::Descriptor *D)
5.153 +{
5.154 + d=D;
5.155 + data=d->getData();
5.156 + Start();
5.157 +}
5.158 +
5.159 +void cDescrF2::Start(void)
5.160 +{
5.161 + idx=8; loop=0; nloop=-3; index=-1;
5.162 +}
5.163 +
5.164 +bool cDescrF2::Next(void)
5.165 +{
5.166 + loop+=3;
5.167 + if(loop>=nloop) {
5.168 + idx+=nloop+3;
5.169 + if(idx>=d->getLength()) return false;
5.170 + loop=0; nloop=data[idx+2];
5.171 + }
5.172 + index++;
5.173 + return true;
5.174 +}
5.175 +
5.176 +time_t cDescrF2::StartTime(void)
5.177 +{
5.178 + int off=idx+3+loop;
5.179 + return SI::DVBTime::getTime(data[idx+0],data[idx+1],data[off+0],data[off+1],data[off+2]);
5.180 +}
5.181 +
5.182 +// --- cFilterPremiereEpg ------------------------------------------------------
5.183 +
5.184 +class cFilterPremiereEpg : public cFilter {
5.185 +private:
5.186 + int pmtpid, pmtidx, pmtnext;
5.187 + //
5.188 + void NextPmt(void);
5.189 +protected:
5.190 + virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
5.191 +public:
5.192 + cFilterPremiereEpg(void);
5.193 + virtual void SetStatus(bool On);
5.194 + void Trigger(void);
5.195 + };
5.196 +
5.197 +cFilterPremiereEpg::cFilterPremiereEpg(void)
5.198 +{
5.199 + Trigger();
5.200 + Set(0x00,0x00);
5.201 +}
5.202 +
5.203 +void cFilterPremiereEpg::Trigger(void)
5.204 +{
5.205 + d(printf("trigger\n"))
5.206 + pmtpid=0; pmtidx=0; pmtnext=0;
5.207 +}
5.208 +
5.209 +void cFilterPremiereEpg::SetStatus(bool On)
5.210 +{
5.211 + d(printf("setstatus %d\n",On))
5.212 + cFilter::SetStatus(On);
5.213 + Trigger();
5.214 +}
5.215 +
5.216 +void cFilterPremiereEpg::NextPmt(void)
5.217 +{
5.218 + Del(pmtpid,0x02);
5.219 + pmtpid=0;
5.220 + pmtidx++;
5.221 + d(printf("PMT next\n"))
5.222 +}
5.223 +
5.224 +void cFilterPremiereEpg::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
5.225 +{
5.226 + if(Pid==0 && Tid==SI::TableIdPAT) {
5.227 + int now=time(0);
5.228 + if(!pmtnext || now>pmtnext) {
5.229 + if(pmtpid) NextPmt();
5.230 + if(!pmtpid) {
5.231 + SI::PAT pat(Data,false);
5.232 + if(pat.CheckCRCAndParse()) {
5.233 + SI::PAT::Association assoc;
5.234 + int idx=0;
5.235 + for(SI::Loop::Iterator it; pat.associationLoop.getNext(assoc,it);) {
5.236 + if(!assoc.isNITPid()) {
5.237 + if(idx++==pmtidx) {
5.238 + pmtpid=assoc.getPid();
5.239 + Add(pmtpid,0x02);
5.240 + pmtnext=now+PMT_SCAN_TIMEOUT;
5.241 + d(printf("PMT pid now 0x%04x (idx=%d)\n",pmtpid,pmtidx))
5.242 + break;
5.243 + }
5.244 + }
5.245 + }
5.246 + if(!pmtpid) {
5.247 + pmtidx=0;
5.248 + pmtnext=now+PMT_SCAN_IDLE;
5.249 + d(printf("PMT scan idle\n"))
5.250 + }
5.251 + }
5.252 + }
5.253 + }
5.254 + }
5.255 + else if(pmtpid>0 && Pid==pmtpid && Tid==SI::TableIdPMT && Source() && Transponder()) {
5.256 + SI::PMT pmt(Data,false);
5.257 + if(pmt.CheckCRCAndParse()) {
5.258 + SI::PMT::Stream stream;
5.259 + for(SI::Loop::Iterator it; pmt.streamLoop.getNext(stream,it); ) {
5.260 + if(stream.getStreamType()==0x05) {
5.261 + SI::CharArray data=stream.getData();
5.262 + if((data[1]&0xE0)==0xE0 && (data[3]&0xF0)==0xF0) {
5.263 + bool prvData=false, usrData=false;
5.264 + SI::Descriptor *d;
5.265 + for(SI::Loop::Iterator it; (d=stream.streamDescriptors.getNext(it)); ) {
5.266 + switch(d->getDescriptorTag()) {
5.267 + case SI::PrivateDataSpecifierDescriptorTag:
5.268 + d(printf("prv: %d %08x\n",d->getLength(),d->getData().FourBytes(2)))
5.269 + if(d->getLength()==6 && d->getData().FourBytes(2)==0x000000be)
5.270 + prvData=true;
5.271 + break;
5.272 + case 0x90:
5.273 + d(printf("usr: %d %08x\n",d->getLength(),d->getData().FourBytes(2)))
5.274 + if(d->getLength()==6 && d->getData().FourBytes(2)==0x0000ffff)
5.275 + usrData=true;
5.276 + break;
5.277 + default:
5.278 + break;
5.279 + }
5.280 + delete d;
5.281 + }
5.282 + if(prvData && usrData) {
5.283 + int pid=stream.getPid();
5.284 + d(printf("found citpid 0x%04x",pid))
5.285 + if(!Matches(pid,0xA0)) {
5.286 + Add(pid,0xA0);
5.287 + d(printf(" (added)"))
5.288 + }
5.289 + d(printf("\n"))
5.290 + }
5.291 + }
5.292 + }
5.293 + }
5.294 + NextPmt(); pmtnext=0;
5.295 + }
5.296 + }
5.297 + else if(Tid==0xA0 && Source()) {
5.298 + SI::CIT cit(Data,false);
5.299 + if(cit.CheckCRCAndParse()) {
5.300 + cSchedulesLock SchedulesLock(true,10);
5.301 + cSchedules *Schedules=(cSchedules *)cSchedules::Schedules(SchedulesLock);
5.302 + if(Schedules) {
5.303 + int nCount=0;
5.304 + time_t firstTime=0;
5.305 + SI::Descriptor *d;
5.306 + int LanguagePreferenceShort=-1;
5.307 + int LanguagePreferenceExt=-1;
5.308 + bool UseExtendedEventDescriptor=false;
5.309 + SI::ExtendedEventDescriptors *ExtendedEventDescriptors=0;
5.310 + SI::ShortEventDescriptor *ShortEventDescriptor=0;
5.311 + for(SI::Loop::Iterator it; (d=cit.eventDescriptors.getNext(it)); ) {
5.312 + switch(d->getDescriptorTag()) {
5.313 + case 0xF2:
5.314 + if(nCount>=0) {
5.315 + nCount++;
5.316 + cDescrF2 f2(d);
5.317 + if(f2.Next()) {
5.318 + if(nCount==1) firstTime=f2.StartTime();
5.319 + else {
5.320 + time_t time=f2.StartTime();
5.321 + if(firstTime<time-5*50 || firstTime>time+5*60)
5.322 + nCount=-1;
5.323 + }
5.324 + }
5.325 + }
5.326 + break;
5.327 + case SI::ExtendedEventDescriptorTag:
5.328 + {
5.329 + SI::ExtendedEventDescriptor *eed=(SI::ExtendedEventDescriptor *)d;
5.330 + if(I18nIsPreferredLanguage(Setup.EPGLanguages,I18nLanguageIndex(eed->languageCode), LanguagePreferenceExt) || !ExtendedEventDescriptors) {
5.331 + delete ExtendedEventDescriptors;
5.332 + ExtendedEventDescriptors=new SI::ExtendedEventDescriptors;
5.333 + UseExtendedEventDescriptor=true;
5.334 + }
5.335 + if(UseExtendedEventDescriptor) {
5.336 + ExtendedEventDescriptors->Add(eed);
5.337 + d=NULL; // so that it is not deleted
5.338 + }
5.339 + if(eed->getDescriptorNumber()==eed->getLastDescriptorNumber())
5.340 + UseExtendedEventDescriptor=false;
5.341 + }
5.342 + break;
5.343 + case SI::ShortEventDescriptorTag:
5.344 + {
5.345 + SI::ShortEventDescriptor *sed=(SI::ShortEventDescriptor *)d;
5.346 + if(I18nIsPreferredLanguage(Setup.EPGLanguages,I18nLanguageIndex(sed->languageCode), LanguagePreferenceShort) || !ShortEventDescriptor) {
5.347 + delete ShortEventDescriptor;
5.348 + ShortEventDescriptor=sed;
5.349 + d=NULL; // so that it is not deleted
5.350 + }
5.351 + }
5.352 + break;
5.353 + default:
5.354 + break;
5.355 + }
5.356 + delete d;
5.357 + }
5.358 +
5.359 + bool Modified=false;
5.360 + int optCount=0;
5.361 + for(SI::Loop::Iterator it; (d=cit.eventDescriptors.getNext(it)); ) {
5.362 + if(d->getDescriptorTag()==0xF2) {
5.363 + optCount++;
5.364 +
5.365 + cDescrF2 f2(d);
5.366 + tChannelID channelID(Source(),f2.OrgNetworkId(),f2.TransportStreamId(),f2.ServiceId());
5.367 + cChannel *channel=Channels.GetByChannelID(channelID,true);
5.368 + if(!channel) continue;
5.369 +
5.370 + cSchedule *pSchedule=(cSchedule *)Schedules->GetSchedule(channelID);
5.371 + if(!pSchedule) {
5.372 + pSchedule=new cSchedule(channelID);
5.373 + Schedules->Add(pSchedule);
5.374 + }
5.375 +
5.376 + for(f2.Start(); f2.Next();) {
5.377 + u_int16_t EventId=(cit.getContentId()<<4) | f2.Index();
5.378 + time_t StartTime=f2.StartTime();
5.379 +
5.380 + bool isOpt=false;
5.381 + if(f2.Index()==0 && nCount>1) isOpt=true;
5.382 +
5.383 + d2(printf("ch=%s id=%04x/%08x %d opt=%d/%d st=%s ",*channelID.ToString(),EventId,cit.getContentId(),f2.Index(),isOpt,optCount,stripspace(ctime(&StartTime))))
5.384 + if(StartTime+cit.getDuration()+Setup.EPGLinger*60<time(0)) {
5.385 + d2(printf("(old)\n"))
5.386 + continue;
5.387 + }
5.388 +
5.389 + cEvent *pEvent=(cEvent *)pSchedule->GetEvent(EventId,StartTime);
5.390 + if(!pEvent) {
5.391 + d2(printf("(new)\n"))
5.392 + pEvent=pSchedule->AddEvent(new cEvent(channelID,EventId));
5.393 + if(!pEvent) continue;
5.394 + }
5.395 + else {
5.396 + d2(printf("(upd)\n"))
5.397 + pEvent->SetSeen();
5.398 + if(pEvent->TableID()==0x00) continue;
5.399 + if(Tid==pEvent->TableID() && pEvent->Version()==cit.getVersionNumber()) continue;
5.400 + }
5.401 + pEvent->SetEventID(EventId);
5.402 + pEvent->SetTableID(Tid);
5.403 + pEvent->SetVersion(cit.getVersionNumber());
5.404 + pEvent->SetStartTime(StartTime);
5.405 + pEvent->SetDuration(cit.getDuration());
5.406 +
5.407 + if(ShortEventDescriptor) {
5.408 + char buffer[256+32];
5.409 + ShortEventDescriptor->name.getText(buffer,sizeof(buffer)-32);
5.410 + if(isOpt) {
5.411 + char o[32];
5.412 + snprintf(o,sizeof(o)," (Option %d)",optCount);
5.413 + strcat(buffer,o);
5.414 + }
5.415 + pEvent->SetTitle(buffer);
5.416 + pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer,sizeof(buffer)));
5.417 + }
5.418 + if(ExtendedEventDescriptors) {
5.419 + char buffer[ExtendedEventDescriptors->getMaximumTextLength(": ")+1];
5.420 + pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer,sizeof(buffer),": "));
5.421 + }
5.422 +
5.423 + pEvent->SetComponents(NULL);
5.424 + pEvent->FixEpgBugs();
5.425 + Modified=true;
5.426 + }
5.427 + if(Modified) {
5.428 + pSchedule->Sort();
5.429 + Schedules->SetModified(pSchedule);
5.430 + }
5.431 + }
5.432 + delete d;
5.433 + }
5.434 + delete ExtendedEventDescriptors;
5.435 + delete ShortEventDescriptor;
5.436 + }
5.437 + }
5.438 + }
5.439 +}
5.440 +
5.441 +// --- cPluginPremiereEpg ------------------------------------------------------
5.442 +
5.443 +class cPluginPremiereEpg : public cPlugin {
5.444 +private:
5.445 + struct {
5.446 + cFilterPremiereEpg *filter;
5.447 + cDevice *device;
5.448 + } epg[MAXDVBDEVICES];
5.449 +public:
5.450 + cPluginPremiereEpg(void);
5.451 + virtual const char *Version(void) { return VERSION; }
5.452 + virtual const char *Description(void) { return DESCRIPTION; }
5.453 + virtual bool Start(void);
5.454 + virtual void Stop(void);
5.455 + };
5.456 +
5.457 +cPluginPremiereEpg::cPluginPremiereEpg(void)
5.458 +{
5.459 + memset(epg,0,sizeof(epg));
5.460 +}
5.461 +
5.462 +bool cPluginPremiereEpg::Start(void)
5.463 +{
5.464 + for(int i=0; i<MAXDVBDEVICES; i++) {
5.465 + cDevice *dev=cDevice::GetDevice(i);
5.466 + if(dev) {
5.467 + epg[i].device=dev;
5.468 + dev->AttachFilter(epg[i].filter=new cFilterPremiereEpg);
5.469 + isyslog("Attached premiere EPG filter to device %d",i);
5.470 + }
5.471 + }
5.472 + return true;
5.473 +}
5.474 +
5.475 +void cPluginPremiereEpg::Stop(void)
5.476 +{
5.477 + for(int i=0; i<MAXDVBDEVICES; i++) {
5.478 + cDevice *dev=epg[i].device;
5.479 + if(dev) dev->Detach(epg[i].filter);
5.480 + delete epg[i].filter;
5.481 + epg[i].device=0;
5.482 + epg[i].filter=0;
5.483 + }
5.484 +}
5.485 +
5.486 +VDRPLUGINCREATOR(cPluginPremiereEpg); // Don't touch this!