Skip to content

Commit

Permalink
tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Sep 14, 2024
1 parent 4ef4a74 commit 402d1b8
Show file tree
Hide file tree
Showing 103 changed files with 10,779 additions and 10,779 deletions.
14 changes: 7 additions & 7 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
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
Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Expand Down Expand Up @@ -56,7 +56,7 @@ 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
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains
Expand Down Expand Up @@ -255,7 +255,7 @@ 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
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
Expand All @@ -277,9 +277,9 @@ 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
END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs
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
Expand Down
24 changes: 12 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Requirements:
VDR >= 2.4.0

gcc >= v8, must support -std=c++17
PCRE2 >= 10.38 - https://github.com/PhilipHazel/pcre2/releases
Tntnet >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html
Cxxtools >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html
PCRE2 >= 10.38 - https://github.com/PhilipHazel/pcre2/releases
Tntnet >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html
Cxxtools >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html

Tntnet provides basic Web server functions for live and needs cxxtools.
Boost provides some data structures we need. While currently relying on the
Expand All @@ -52,7 +52,7 @@ If you optionally want to regenerate the i18n-generated.h header file
for backward compatible i18n (VDR version prior to 1.5.7) you also
need: (See also the Internationalization section below)

Locale::PO - Perl module from CPAN www.cpan.org
Locale::PO - Perl module from CPAN www.cpan.org

The default i18n-generated.h header contains all
translations from GIT. Users that just want to stay on bleeding development
Expand Down Expand Up @@ -91,7 +91,7 @@ Setup:
Live provides a username/password protection, so that it can be used from
the internet. The default username and password are:

admin/live
admin/live

The default port is 8008.

Expand All @@ -108,10 +108,10 @@ for SSL connections" section below on hints how to setup SSL.

To display images or channel logos, you can use:

-e <...> --epgimages=/path/to/epgimages use EPG images created by plugins like tvm2vdr
-t <...> --tvscraperimages=/path/to/tvscraperimages use images created by tvscraper DEPRECATED!
-f <...> --ffmpegconf=conf-filename use filename to acquire FFMPEG commands
--chanlogos=/path/to/channellogos use channel logos (PNG only, case sensitive)
-e <...> --epgimages=/path/to/epgimages use EPG images created by plugins like tvm2vdr
-t <...> --tvscraperimages=/path/to/tvscraperimages use images created by tvscraper DEPRECATED!
-f <...> --ffmpegconf=conf-filename use filename to acquire FFMPEG commands
--chanlogos=/path/to/channellogos use channel logos (PNG only, case sensitive)
Example:
--tvscraperimages=/var/cache/vdr/plugins/tvscraper DEPRECATED!
Note: tvscraperimages is not required any more, live uses the internal service interface "GetEnvironment" for plugins to get this information from tvscraper/scraper2vdr
Expand All @@ -135,7 +135,7 @@ How to make LIVE listen for SSL connections:
To make LIVE listen for incoming SSL connections you`ll have to use a
Tntnet version > 1.6.0.6. By default it will listen on port 8443.

* Example: https://localhost:8443
* Example: https://localhost:8443

In order to start the SslListener LIVE requires a SSL certificate. If
no SSL certificate is specified via command-line option, LIVE will try
Expand All @@ -162,9 +162,9 @@ SSL Command-line options:
(default: 8443)
use PORT 0 to disable incoming SSL connections
-c CERT, --cert=CERT path to a custom SSL certificate file
(default: $CONFIGDIR/live.pem)
(default: $CONFIGDIR/live.pem)
-k KEY, --cert=CERT path to a custom SSL certificate key file
(default: $CONFIGDIR/live-key.pem)
(default: $CONFIGDIR/live-key.pem)


Creating a self-signed SSL server certificate:
Expand Down
126 changes: 63 additions & 63 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,76 +20,76 @@ template<typename TKey, typename TValue, typename KeyComp = std::less<TKey>>
class cache
{
public:
typedef TKey key_type;
typedef TValue mapped_type;
typedef std::shared_ptr<mapped_type> ptr_type;
typedef TKey key_type;
typedef TValue mapped_type;
typedef std::shared_ptr<mapped_type> ptr_type;

private:
typedef std::pair<key_type, ptr_type> value_type;
typedef std::pair<key_type, ptr_type> value_type;

typedef std::list<value_type> ValueList;
typedef std::map<key_type, typename ValueList::iterator, KeyComp> KeyMap;
typedef std::list<value_type> ValueList;
typedef std::map<key_type, typename ValueList::iterator, KeyComp> KeyMap;

public:
cache( size_t maxWeight )
: m_maxWeight( maxWeight )
, m_currentWeight( 0 ) {}

size_t weight() const { return m_currentWeight; }
size_t count() const { return m_values.size(); }

ptr_type get( key_type const& key )
{
assert( m_lookup.size() == m_values.size() );

typename KeyMap::iterator it = m_lookup.find( key );
ptr_type result = it != m_lookup.end() ? it->second->second : ptr_type( new mapped_type( key ) );

if ( it != m_lookup.end() ) {
if ( result->is_current() ) {
if ( it->second != m_values.begin() ) {
m_values.erase( it->second );
it->second = m_values.insert( m_values.begin(), std::make_pair( key, result ) );
}
return result;
}

m_currentWeight -= result->weight();
m_values.erase( it->second );
}

if ( !result->load() ) {
if ( it != m_lookup.end() )
m_lookup.erase( it );
return ptr_type();
}

// put new object into cache
if ( result->weight() < m_maxWeight ) {
m_currentWeight += result->weight();

typename ValueList::iterator element = m_values.insert( m_values.begin(), std::make_pair( key, result ) );
if ( it != m_lookup.end() )
it->second = element;
else
m_lookup.insert( std::make_pair( key, element ) );

while ( m_currentWeight > m_maxWeight ) {
value_type& value = m_values.back();
m_currentWeight -= value.second->weight();
m_lookup.erase( m_lookup.find( value.first ) );
m_values.pop_back();
}
}

return result;
}
cache( size_t maxWeight )
: m_maxWeight( maxWeight )
, m_currentWeight( 0 ) {}

size_t weight() const { return m_currentWeight; }
size_t count() const { return m_values.size(); }

ptr_type get( key_type const& key )
{
assert( m_lookup.size() == m_values.size() );

typename KeyMap::iterator it = m_lookup.find( key );
ptr_type result = it != m_lookup.end() ? it->second->second : ptr_type( new mapped_type( key ) );

if ( it != m_lookup.end() ) {
if ( result->is_current() ) {
if ( it->second != m_values.begin() ) {
m_values.erase( it->second );
it->second = m_values.insert( m_values.begin(), std::make_pair( key, result ) );
}
return result;
}

m_currentWeight -= result->weight();
m_values.erase( it->second );
}

if ( !result->load() ) {
if ( it != m_lookup.end() )
m_lookup.erase( it );
return ptr_type();
}

// put new object into cache
if ( result->weight() < m_maxWeight ) {
m_currentWeight += result->weight();

typename ValueList::iterator element = m_values.insert( m_values.begin(), std::make_pair( key, result ) );
if ( it != m_lookup.end() )
it->second = element;
else
m_lookup.insert( std::make_pair( key, element ) );

while ( m_currentWeight > m_maxWeight ) {
value_type& value = m_values.back();
m_currentWeight -= value.second->weight();
m_lookup.erase( m_lookup.find( value.first ) );
m_values.pop_back();
}
}

return result;
}

private:
std::size_t m_maxWeight;
std::size_t m_currentWeight;
ValueList m_values;
KeyMap m_lookup;
std::size_t m_maxWeight;
std::size_t m_currentWeight;
ValueList m_values;
KeyMap m_lookup;
};

} // namespace vgstools
Expand Down
Loading

0 comments on commit 402d1b8

Please sign in to comment.