git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1501 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: ec402d9518
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2011-06-02 (Thu, 02 Jun 2011)

Origin message was:
------------------
- add support for radiotext (needs testing) -> http://www.dbox2world.net/board293-coolstream-hd1/board296-coolstream-software/10635-radiotext-einbauen/

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1501 e54a6e83-5905-42d5-8d5c-058d10e6a962


------------------
This commit was generated by Migit
This commit is contained in:
gixxpunk
2011-06-02 15:29:40 +00:00
parent 5a7872195e
commit 18bd823362
24 changed files with 3815 additions and 12 deletions

101
src/driver/radiotools.cpp Normal file
View File

@@ -0,0 +1,101 @@
/*
* radiotools.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* This is a "plugin" for the Video Disk Recorder (VDR).
*
* Written by: Lars Tegeler <email@host.dom>
*
* Project's homepage: www.math.uni-paderborn.de/~tegeler/vdr
*
* Latest version available at: URL
*
* See the file COPYING for license information.
*
* Description:
*
* This Plugin display an background image while the vdr is switcht to radio channels.
*
* $Id: radiotools.cpp,v 1.1 2009/08/07 07:22:31 rhabarber1848 Exp $
*/
#include "radiotools.h"
#include <string.h>
#include <stdio.h>
#include <sys/time.h>
/* for timetest */
//#include <time.h>
//#include <sys/time.h>
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst)
{
/* timetest */
//struct timeval t;
//unsigned long long tstart = 0;
//if (gettimeofday(&t, NULL) == 0)
// tstart = t.tv_sec*1000000 + t.tv_usec;
// CRC16-CCITT: x^16 + x^12 + x^5 + 1
// with start 0xffff and result invers
register unsigned short crc = 0xffff;
if (skipfirst) *daten++;
while (len--) {
crc = (crc >> 8) | (crc << 8);
crc ^= *daten++;
crc ^= (crc & 0xff) >> 4;
crc ^= (crc << 8) << 4;
crc ^= ((crc & 0xff) << 4) << 1;
}
/* timetest */
//if (tstart > 0 && gettimeofday(&t, NULL) == 0)
// printf("vdr-radio: crc-calctime = %d usec\n", (int)((t.tv_sec*1000000 + t.tv_usec) - tstart));
return ~(crc);
}
char *rtrim(char *text)
{
char *s = text + strlen(text) - 1;
while (s >= text && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r'))
*s-- = 0;
return text;
}
// --- cTimeMs ---------------------------------------------------------------
cTimeMs::cTimeMs(void)
{
Set();
}
#if 0
uint64_t cTimeMs::Now(void)
{
struct timeval t;
if (gettimeofday(&t, NULL) == 0)
return (uint64_t(t.tv_sec)) * 1000 + t.tv_usec / 1000;
return 0;
}
void cTimeMs::Set(int Ms)
{
begin = Now() + Ms;
}
bool cTimeMs::TimedOut(void)
{
return Now() >= begin;
}
uint64_t cTimeMs::Elapsed(void)
{
return Now() - begin;
}
#endif
//--------------- End -----------------------------------------------------------------