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