mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
system/lastchannel.cpp: increase channel history from 10 to 21
Signed-off-by: Thilo Graf <dbt@novatux.de> No reason given, but shouldn't break anything.
This commit is contained in:
@@ -22,10 +22,10 @@ nicht gespeichert werden.
|
||||
#include <neutrino.h>
|
||||
#include "lastchannel.h"
|
||||
|
||||
CLastChannel::CLastChannel (void)
|
||||
: secs_diff_before_store(3)
|
||||
, maxSize(11)
|
||||
, shallRemoveEqualChannel(true)
|
||||
CLastChannel::CLastChannel(void)
|
||||
: secs_diff_before_store(3)
|
||||
, maxSize(22)
|
||||
, shallRemoveEqualChannel(true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ void CLastChannel::clear (void)
|
||||
|
||||
void CLastChannel::store (t_channel_id channel_id)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timeval tv;
|
||||
unsigned long lastTimestamp(0);
|
||||
unsigned long timeDiff;
|
||||
std::list<_LastCh>::iterator It;
|
||||
@@ -49,7 +49,7 @@ void CLastChannel::store (t_channel_id channel_id)
|
||||
gettimeofday (&tv, NULL);
|
||||
|
||||
if (!this->lastChannels.empty())
|
||||
lastTimestamp = this->lastChannels.front().timestamp;
|
||||
lastTimestamp = this->lastChannels.front().timestamp;
|
||||
|
||||
timeDiff = tv.tv_sec - lastTimestamp;
|
||||
|
||||
@@ -70,8 +70,10 @@ void CLastChannel::store (t_channel_id channel_id)
|
||||
if(this->lastChannels.size() > 1) {
|
||||
It = this->lastChannels.begin();
|
||||
++It;
|
||||
for (; It != this->lastChannels.end() ; ++It) {
|
||||
if (channel_id == It->channel_id) {
|
||||
for (; It != this->lastChannels.end(); ++It)
|
||||
{
|
||||
if (channel_id == It->channel_id)
|
||||
{
|
||||
this->lastChannels.erase(It);
|
||||
break;
|
||||
}
|
||||
@@ -98,9 +100,9 @@ void CLastChannel::clear_storedelay (void)
|
||||
}
|
||||
|
||||
// -- Get last Channel-Entry
|
||||
// -- IN: n number of last channel in queue [0..]
|
||||
// -- 0 = current channel
|
||||
// -- Return: channelnumber or <0 (end of list)
|
||||
// -- IN: n = number of last channel in queue [0..]
|
||||
// -- 0 = current channel
|
||||
// -- Return: channelnumber or < 0 (end of list)
|
||||
|
||||
t_channel_id CLastChannel::getlast (int n)
|
||||
{
|
||||
@@ -111,7 +113,6 @@ t_channel_id CLastChannel::getlast (int n)
|
||||
|
||||
return It->channel_id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -134,7 +135,8 @@ int CLastChannel::get_mode(t_channel_id channel_id)
|
||||
{
|
||||
std::list<_LastCh>::iterator It;
|
||||
|
||||
for (It = this->lastChannels.begin(); It != this->lastChannels.end() ; ++It) {
|
||||
for (It = this->lastChannels.begin(); It != this->lastChannels.end(); ++It)
|
||||
{
|
||||
if (channel_id == It->channel_id)
|
||||
return It->channel_mode;
|
||||
}
|
||||
@@ -145,8 +147,10 @@ bool CLastChannel::set_mode(t_channel_id channel_id)
|
||||
{
|
||||
std::list<_LastCh>::iterator It;
|
||||
|
||||
for (It = this->lastChannels.begin(); It != this->lastChannels.end() ; ++It) {
|
||||
if (channel_id == It->channel_id) {
|
||||
for (It = this->lastChannels.begin(); It != this->lastChannels.end(); ++It)
|
||||
{
|
||||
if (channel_id == It->channel_id)
|
||||
{
|
||||
It->channel_mode = CNeutrinoApp::getInstance()->GetChannelMode();
|
||||
return true;
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ nicht gespeichert werden.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SEEN_LastChannel
|
||||
#define SEEN_LastChannel
|
||||
|
||||
@@ -33,28 +32,27 @@ class CLastChannel
|
||||
struct _LastCh
|
||||
{
|
||||
t_channel_id channel_id;
|
||||
long int timestamp;
|
||||
long int timestamp;
|
||||
int channel_mode;
|
||||
};
|
||||
|
||||
std::list<_LastCh> lastChannels;
|
||||
|
||||
unsigned long secs_diff_before_store;
|
||||
unsigned long secs_diff_before_store;
|
||||
unsigned int maxSize;
|
||||
bool shallRemoveEqualChannel;
|
||||
|
||||
public:
|
||||
CLastChannel (void);
|
||||
void clear (void);
|
||||
void store (t_channel_id channel_id);
|
||||
t_channel_id getlast (int n);
|
||||
unsigned int size () const;
|
||||
void clear_storedelay (void);
|
||||
void set_store_difftime (int secs);
|
||||
int get_store_difftime (void) const;
|
||||
CLastChannel(void);
|
||||
void clear(void);
|
||||
void store(t_channel_id channel_id);
|
||||
t_channel_id getlast(int n);
|
||||
unsigned int size() const;
|
||||
void clear_storedelay(void);
|
||||
void set_store_difftime(int secs);
|
||||
int get_store_difftime(void) const;
|
||||
int get_mode(t_channel_id channel_id);
|
||||
bool set_mode(t_channel_id channel_id);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user