delete obsolete and unused files in src/drivers/ dir

Origin commit data
------------------
Commit: 99269da058
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-06-14 (Thu, 14 Jun 2012)
This commit is contained in:
[CST] Focus
2012-06-14 11:02:22 +04:00
parent 88a92f9948
commit 62d2802286
23 changed files with 0 additions and 5132 deletions

View File

@@ -1,170 +0,0 @@
/*
LCD-Daemon - DBoxII-Project
Copyright (C) 2004 Zwen@tuxbox.org
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#if 1
#include <dbox/aviaEXT.h>
#include <driver/aviaext.h>
#define AVIAEXT_DEV "/dev/dbox/aviaEXT"
CAViAExt* CAViAExt::getInstance()
{
static CAViAExt* AViAExt = NULL;
if(AViAExt == NULL)
{
AViAExt = new CAViAExt();
}
return AViAExt;
}
void CAViAExt::iecOn()
{
int res,fd;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return;
}
res = ioctl(fd, AVIA_EXT_IEC_SET, 1);
if (res<0)
perror("aviaext: ioctl");
close(fd);
}
void CAViAExt::iecOff()
{
int res,fd;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return;
}
res = ioctl(fd, AVIA_EXT_IEC_SET, 0);
if (res<0)
perror("aviaext: ioctl");
close(fd);
}
int CAViAExt::iecState()
{
int res,fd;
unsigned int param;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return -1;
}
res = ioctl(fd, AVIA_EXT_IEC_GET, &param);
close(fd);
if (res<0)
{
perror("aviaext: ioctl");
return -1;
}
return param;
}
void CAViAExt::playbackSPTS()
{
int res,fd;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return;
}
res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_SET, 1);
if (res<0)
perror("aviaext: ioctl");
close(fd);
}
void CAViAExt::playbackPES()
{
int res,fd;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return;
}
res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_SET, 0);
if (res<0)
perror("aviaext: ioctl");
close(fd);
}
int CAViAExt::playbackState()
{
int res,fd;
unsigned int param;
if ((fd = open(AVIAEXT_DEV,O_RDWR))<0)
{
if (errno==ENOENT)
fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV);
else
perror ("aviaext: error opening /dev/dbox/aviaEXT");
return -1;
}
res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_GET, &param);
close(fd);
if (res<0)
{
perror("aviaext: ioctl");
return -1;
}
return param;
}
#endif

View File

@@ -1,125 +0,0 @@
/*
LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "bigclock.h"
void doppelpunkt(CLCDDisplay* display, int pos)
{
int i,j;
for (i=1;i<=4;i++)
for (j=1;j<=4;j++)
display->draw_point(i+10+pos*24-3,j+23,CLCDDisplay::PIXEL_ON);
for (i=1;i<=4;i++)
for (j=1;j<=4;j++)
display->draw_point(i+10+pos*24-3,j+37,CLCDDisplay::PIXEL_ON);
}
void balken(CLCDDisplay* display, int pos, int balken)
{
int i,j;
if (balken==3||balken==6||balken==7)
{
//horizontaler balken
if (balken == 6) for (i=1;i<=14;i++) for (j=1;j<=4;j++) display->draw_point(i+5+pos*24-3,j+14,CLCDDisplay::PIXEL_ON);
if (balken == 7) for (i=1;i<=8;i++) for (j=1;j<=4;j++) display->draw_point(i+8+pos*24-3,j+30,CLCDDisplay::PIXEL_ON);
} if (balken == 3) for (i=1;i<=14;i++) for (j=1;j<=4;j++) display->draw_point(i+5+pos*24-3,j+46,CLCDDisplay::PIXEL_ON);
else
{
//vertikaler balken
if (balken == 1) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+19+pos*24-3,j+18,CLCDDisplay::PIXEL_ON);
if (balken == 2) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+19+pos*24-3,j+33,CLCDDisplay::PIXEL_ON);
if (balken == 5) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+1+pos*24-3,j+18,CLCDDisplay::PIXEL_ON);
if (balken == 4) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+1+pos*24-3,j+33,CLCDDisplay::PIXEL_ON);
}
}
void showBigClock(CLCDDisplay* display, int h, int m)
{
//stunden einer
if (h==0||h==10||h==20)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6);}
if (h==1||h==11||h==21)
{ balken(display, 1,1); balken(display, 1,2);}
if (h==2||h==12||h==22)
{ balken(display, 1,1); balken(display, 1,7); balken(display, 1,3); balken(display, 1,4); balken(display, 1,6);}
if (h==3||h==13||h==23)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,7); balken(display, 1,6);}
if (h==4||h==14)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,7); balken(display, 1,5);}
if (h==5||h==15)
{ balken(display, 1,2); balken(display, 1,3); balken(display, 1,5); balken(display, 1,6); balken(display, 1,7);}
if (h==6||h==16)
{ balken(display, 1,7); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6);}
if (h==7||h==17)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,6);}
if (h==8||h==18)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6); balken(display, 1,7);}
if (h==9||h==19)
{ balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,7); balken(display, 1,5); balken(display, 1,6);}
//stunden zehner
if (h>9&&h<20){ balken(display, 0,1); balken(display, 0,2);}
if (h>19) { balken(display, 0,1); balken(display, 0,7); balken(display, 0,3); balken(display, 0,4); balken(display, 0,6);}
//minuten einer
if (m==0||m==10||m==20||m==30||m==40||m==50)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6);}
if (m==1||m==11||m==21||m==31||m==41||m==51)
{ balken(display, 4,1); balken(display, 4,2);}
if (m==2||m==12||m==22||m==32||m==42||m==52)
{ balken(display, 4,1); balken(display, 4,7); balken(display, 4,3); balken(display, 4,4); balken(display, 4,6);}
if (m==3||m==13||m==23||m==33||m==43||m==53)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,7); balken(display, 4,6);}
if (m==4||m==14||m==24||m==34||m==44||m==54)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,7); balken(display, 4,5);}
if (m==5||m==15||m==25||m==35||m==45||m==55)
{ balken(display, 4,2); balken(display, 4,3); balken(display, 4,5); balken(display, 4,6); balken(display, 4,7);}
if (m==6||m==16||m==26||m==36||m==46||m==56)
{ balken(display, 4,7); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6);}
if (m==7||m==17||m==27||m==37||m==47||m==57)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,6);}
if (m==8||m==18||m==28||m==38||m==48||m==58)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6); balken(display, 4,7);}
if (m==9||m==19||m==29||m==39||m==49||m==59)
{ balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,7); balken(display, 4,5); balken(display, 4,6);}
//minuten zehner
if (m<10)
{ balken(display, 3,1); balken(display, 3,2); balken(display, 3,3); balken(display, 3,4); balken(display, 3,5); balken(display, 3,6);}
if (m>9&&m<20){ balken(display, 3,1); balken(display, 3,2);}
if (m>19&&m<30){ balken(display, 3,1); balken(display, 3,7); balken(display, 3,3); balken(display, 3,4); balken(display, 3,6);}
if (m>29&&m<40){ balken(display, 3,1); balken(display, 3,2); balken(display, 3,3); balken(display, 3,7); balken(display, 3,6);}
if (m>39&&m<50){ balken(display, 3,1); balken(display, 3,2); balken(display, 3,7); balken(display, 3,5);}
if (m>=50) { balken(display, 3,2); balken(display, 3,3); balken(display, 3,5); balken(display, 3,6); balken(display, 3,7);}
doppelpunkt(display, 2);
}

View File

@@ -1,35 +0,0 @@
/*
LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __bigclock__
#define __bigclock__
#include <lcddisplay/lcddisplay.h>
void showBigClock(CLCDDisplay* display, int h,int m);
#endif

View File

@@ -1,308 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <error.h>
#include <stdlib.h>
#include "capture.h"
#include <stdio.h>
#warning "experimental..."
//
// -- TV Picture Capture
// -- This module is a class to provide a capture abstraction layer
// --
// -- 2003-12 rasc
//
//
// -- Constructor
//
CCAPTURE::CCAPTURE()
{
fd = -1;
}
CCAPTURE::CCAPTURE(int capture_nr)
{
fd = -1;
fd = captureopen(capture_nr);
}
CCAPTURE::CCAPTURE(int capture_nr, int x, int y, int w, int h)
{
fd = -1;
fd = captureopen (capture_nr);
set_coord (x,y, w,h);
}
CCAPTURE::~CCAPTURE()
{
captureclose (); // cleanup anyway!!
}
//
// -- open Capture device
// -- return >=0: ok
//
int CCAPTURE::captureopen (int cap_nr)
{
char *capturedevs[] = {
CAPTURE_DEV "0" // CAPTURE device 0
// CAPTURE_DEV "1", // CAPTURE device 1
// CAPTURE_DEV "2", // CAPTURE device 2
// CAPTURE_DEV "3" // CAPTURE device 3
};
if ( (cap_nr>0) || (cap_nr < (int)(sizeof (capturedevs)/sizeof(char *))) ) {
if (fd < 0) {
fd = open( capturedevs[cap_nr], O_RDWR );
if (fd >= 0) {
cx = cy = cw = ch = 0;
out_w = out_h = 0;
stride = 0;
} else perror (capturedevs[cap_nr]);
return fd;
}
}
return -1;
}
//
// -- close Capture Device
//
void CCAPTURE::captureclose ()
{
if (fd >=0 ) {
close (fd);
fd = -1;
cx = cy = cw = ch = 0;
out_w = out_h = 0;
stride = 0;
}
return;
}
/*
-- Coordination routines...
*/
void CCAPTURE::set_coord (int x, int y, int w, int h)
{
if (( x != cx ) || ( y != cy )) {
cx = x;
cy = y;
cw = w;
ch = h;
_set_window (cx,cy,cw,ch);
}
}
void CCAPTURE::set_xy (int x, int y)
{
if (( x != cx ) || ( y != cy )) {
cx = x;
cy = y;
_set_window (cx,cy,cw,ch);
}
}
void CCAPTURE::set_size (int w, int h)
{
if (( w != cw ) || ( h != ch )) {
cw = w;
ch = h;
_set_window (cx,cy,cw,ch);
}
}
//
// -- set Capture Position
//
void CCAPTURE::_set_window (int x, int y, int w, int h)
{
#ifdef __v4l_capture
struct v4l2_crop crop;
crop.c.left = x;
crop.c.top = y;
crop.c.width = w;
crop.c.height = h;
if( ioctl(fd, VIDIOC_S_CROP, &crop) < 0)
perror ("error VIDIOC_S_CROP");
#else
capture_set_input_pos(fd, x, y);
capture_set_input_size(fd, w, h);
#endif
}
void CCAPTURE::set_output_size (int w, int h)
{
#ifdef __v4l_capture
struct v4l2_format format;
out_w = w;
out_h = h;
format.fmt.pix.width = w;
format.fmt.pix.height = h;
if (ioctl(fd, VIDIOC_S_FMT, &format) < 0)
perror ("error VIDIOC_S_FMT");
#else
out_w = w;
out_h = h;
capture_set_output_size(fd, w, h);
#endif
}
//
// -- capture a frame
// -- if buffer == NULL, routine will alloc memory!
// -- destroy will not free this allocated memory!
// -- otherwise buffer has to be large enough!
//
u_char *CCAPTURE::readframe (u_char *buf)
{
#ifdef __v4l_capture
struct v4l2_format vid;
int n;
u_char *b;
if (fd >= 0) {
// get capture information
vid.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd, VIDIOC_G_FMT, &vid) < 0)
perror ("Error getting info with VIDIOC_G_FMT");
printf ("reported bytesperline: %d, height: %d, sizeimage: %d\n",
vid.fmt.pix.bytesperline,
vid.fmt.pix.height,
vid.fmt.pix.sizeimage);
b = (buf != NULL)
? buf
: (u_char *) malloc (vid.fmt.pix.bytesperline *
vid.fmt.pix.height);
n = read (fd, b, vid.fmt.pix.bytesperline*vid.fmt.pix.height);
if (n < 0) {
perror ("Error reading capture buffer");
if (!buf) free (b);
return (u_char *)NULL;
}
return b;
}
return (u_char *) NULL;
#else
u_char *b;
int stride;
int n;
if (fd >= 0) {
stride = capture_start(fd);
b = (buf != NULL)
? buf
: (u_char *) malloc (stride * out_h);
n = read(fd, b, stride * out_h);
capture_stop(fd);
if (n < 0) {
perror ("Error reading capture buffer");
if (!buf) free (b);
return (u_char *)NULL;
}
return b;
}
return (u_char *) NULL;
#endif
}

View File

@@ -1,81 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CAPTURE_CONTROL__
#define __CAPTURE_CONTROL__
#define __v4l_capture
using namespace std;
//
// -- Picture Capture Control
// -- 2003-12 rasc
//
#ifdef __v4l_capture
#include <linux/videodev.h>
#define CAPTURE_DEV "/dev/v4l/video" // CaptureNr will be appended!
#else
#include <dbox/avia_gt_capture.h>
#define CAPTURE_DEV "/dev/dbox/capture" // CaptureNr will be appended!
#endif
class CCAPTURE
{
public:
CCAPTURE ();
CCAPTURE (int capture_nr); // incl. open
CCAPTURE (int capture_nr, int x, int y, int w, int h); // open + set_coord
~CCAPTURE ();
int captureopen (int capture_nr);
void captureclose (void);
void set_coord (int x, int y, int w, int h);
void set_xy (int x, int y);
void set_size (int w, int h);
void set_output_size (int w, int h);
u_char *readframe (u_char *buf);
private:
void _set_window (int x, int y, int w, int h);
int fd; // io descriptor
int cx, cy, cw, ch; // capture size
int out_w, out_h; // capture output size
int stride;
};
#endif

View File

@@ -1,44 +0,0 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/encoding.cpp,v 1.2 2003/09/27 11:48:09 thegoodguy Exp $
*
* conversion of character encodings - d-box2 linux project
*
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <driver/encoding.h>
std::string Latin1_to_UTF8(const std::string & s)
{
std::string r;
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it)
{
unsigned char c = *it;
if (c < 0x80)
r += c;
else
{
unsigned char d = 0xc0 | (c >> 6);
r += d;
d = 0x80 | (c & 0x3f);
r += d;
}
}
return r;
}

View File

@@ -1,31 +0,0 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/encoding.h,v 1.2 2003/09/27 11:48:09 thegoodguy Exp $
*
* conversion of character encodings - d-box2 linux project
*
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __neutrino__encoding_h__
#define __neutrino__encoding_h__
#include <string>
std::string Latin1_to_UTF8(const std::string & s);
#endif /* __neutrino__encoding_h__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,256 +0,0 @@
/*
$Id$
LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __lcdd__
#define __lcdd__
#ifndef LCD_UPDATE
#define LCD_UPDATE 1
#endif
#define LCDDIR_VAR "/var/share/tuxbox/neutrino/lcdd"
typedef enum
{
VFD_ICON_BAR8 = 0x00000004,
VFD_ICON_BAR7 = 0x00000008,
VFD_ICON_BAR6 = 0x00000010,
VFD_ICON_BAR5 = 0x00000020,
VFD_ICON_BAR4 = 0x00000040,
VFD_ICON_BAR3 = 0x00000080,
VFD_ICON_BAR2 = 0x00000100,
VFD_ICON_BAR1 = 0x00000200,
VFD_ICON_FRAME = 0x00000400,
VFD_ICON_HDD = 0x00000800,
VFD_ICON_MUTE = 0x00001000,
VFD_ICON_DOLBY = 0x00002000,
VFD_ICON_POWER = 0x00004000,
VFD_ICON_TIMESHIFT = 0x00008000,
VFD_ICON_SIGNAL = 0x00010000,
VFD_ICON_TV = 0x00020000,
VFD_ICON_RADIO = 0x00040000,
VFD_ICON_HD = 0x01000001,
VFD_ICON_1080P = 0x02000001,
VFD_ICON_1080I = 0x03000001,
VFD_ICON_720P = 0x04000001,
VFD_ICON_480P = 0x05000001,
VFD_ICON_480I = 0x06000001,
VFD_ICON_USB = 0x07000001,
VFD_ICON_MP3 = 0x08000001,
VFD_ICON_PLAY = 0x09000001,
VFD_ICON_COL1 = 0x09000002,
VFD_ICON_PAUSE = 0x0A000001,
VFD_ICON_CAM1 = 0x0B000001,
VFD_ICON_COL2 = 0x0B000002,
VFD_ICON_CAM2 = 0x0C000001
} vfd_icon;
#ifdef LCD_UPDATE
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// TODO Why is USE_FILE_OFFSET64 not defined, if file.h is included here????
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64 1
#endif
#include "driver/file.h"
#endif // LCD_UPDATE
#include <configfile.h>
#include <pthread.h>
#include <lcddisplay/fontrenderer.h>
class CLCDPainter;
class LcdFontRenderClass;
class CLCD
{
public:
enum MODES
{
MODE_TVRADIO,
MODE_SCART,
MODE_SHUTDOWN,
MODE_STANDBY,
MODE_MENU_UTF8,
MODE_AUDIO,
MODE_MOVIE
#ifdef LCD_UPDATE
, MODE_FILEBROWSER,
MODE_PROGRESSBAR,
MODE_PROGRESSBAR2,
MODE_INFOBOX
#endif // LCD_UPDATE
};
enum AUDIOMODES
{
AUDIO_MODE_PLAY,
AUDIO_MODE_STOP,
AUDIO_MODE_FF,
AUDIO_MODE_PAUSE,
AUDIO_MODE_REV
};
private:
class FontsDef
{
public:
LcdFont *channelname;
LcdFont *time;
LcdFont *menutitle;
LcdFont *menu;
};
CLCDDisplay display;
LcdFontRenderClass *fontRenderer;
FontsDef fonts;
#define LCD_NUMBER_OF_BACKGROUNDS 5
raw_display_t background[LCD_NUMBER_OF_BACKGROUNDS];
MODES mode;
AUDIOMODES movie_playmode;
std::string servicename;
std::string epg_title;
std::string movie_big;
std::string movie_small;
std::string menutitle;
char volume;
unsigned char percentOver;
bool muted;
bool showclock;
bool movie_centered;
bool movie_is_ac3;
CConfigFile configfile;
pthread_t thrTime;
int last_toggle_state_power;
int clearClock;
unsigned int timeout_cnt;
void count_down();
CLCD();
static void* TimeThread(void*);
bool lcdInit(const char * fontfile1, const char * fontname1,
const char * fontfile2=NULL, const char * fontname2=NULL,
const char * fontfile3=NULL, const char * fontname3=NULL);
void setlcdparameter(int dimm, int contrast, int power, int inverse, int bias);
void displayUpdate();
void showTextScreen(const std::string & big, const std::string & small, int showmode, bool perform_wakeup, bool centered = false);
public:
bool has_lcd;
void wake_up();
void setled(void) { return; };
void setlcdparameter(void);
static CLCD* getInstance();
void init(const char * fontfile, const char * fontname,
const char * fontfile2=NULL, const char * fontname2=NULL,
const char * fontfile3=NULL, const char * fontname3=NULL);
void setMode(const MODES m, const char * const title = "");
MODES getMode() { return mode; };
void showServicename(const std::string name, const bool perform_wakeup = true); // UTF-8
void setEPGTitle(const std::string title);
void setMovieInfo(const AUDIOMODES playmode, const std::string big, const std::string small, const bool centered = false);
void setMovieAudio(const bool is_ac3);
std::string getMenutitle() { return menutitle; };
void showTime();
/** blocks for duration seconds */
void showRCLock(int duration = 2);
void showVolume(const char vol, const bool perform_update = true);
void showPercentOver(const unsigned char perc, const bool perform_update = true, const MODES m = MODE_TVRADIO);
void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false);
void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album);
void showAudioPlayMode(AUDIOMODES m=AUDIO_MODE_PLAY);
void showAudioProgress(const char perc, bool isMuted);
void setBrightness(int);
int getBrightness();
void setBrightnessStandby(int);
int getBrightnessStandby();
void setContrast(int);
int getContrast();
void setPower(int);
int getPower();
void togglePower(void);
void setInverse(int);
int getInverse();
void setAutoDimm(int);
int getAutoDimm();
void setBrightnessDeepStandby(int) { return ; };
int getBrightnessDeepStandby() { return 0; };
void setMuted(bool);
void resume();
void pause();
void Lock();
void Unlock();
void Clear();
void ShowIcon(vfd_icon icon, bool show);
void ShowText(const char *s) { showServicename(std::string(s)); };
#ifdef LCD_UPDATE
private:
CFileList* m_fileList;
int m_fileListPos;
std::string m_fileListHeader;
std::string m_infoBoxText;
std::string m_infoBoxTitle;
int m_infoBoxTimer; // for later use
bool m_infoBoxAutoNewline;
bool m_progressShowEscape;
std::string m_progressHeaderGlobal;
std::string m_progressHeaderLocal;
int m_progressGlobal;
int m_progressLocal;
public:
void showFilelist(int flist_pos = -1,CFileList* flist = NULL,const char * const mainDir=NULL);
void showInfoBox(const char * const title = NULL,const char * const text = NULL,int autoNewline = -1,int timer = -1);
void showProgressBar(int global = -1,const char * const text = NULL,int show_escape = -1,int timer = -1);
void showProgressBar2(int local = -1,const char * const text_local = NULL,int global = -1,const char * const text_global = NULL,int show_escape = -1);
#endif // LCD_UPDATE
};
#endif

View File

@@ -1,233 +0,0 @@
/*
LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean',
2003 thegoodguy
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <cstdio>
#include <driver/newclock.h>
static bool time_digits[24*32 * 10];
static bool days[24*16 * 7];
static bool date_digits[16*16 * 10];
static bool months[32*16 * 12];
static bool signs[] = {1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 0,
1, 1, 1, 0,
0, 1, 1, 0,
1, 1, 0, 0,
1, 1, 1, 0,
1, 1, 1, 0,
1, 1, 1, 0,
0, 0, 0, 0};
void loadSkin(char * const filename, char * const backup_filename, const unsigned int modify_char_filename, const unsigned int modify_char_backup_filename, bool * const dest, const unsigned int count, const unsigned int width, const unsigned int height, const char * const name)
{
FILE * fd;
int row, bit;
char * file;
unsigned int i ,byte, digit_pos;
unsigned char BMPWidth;
unsigned char BMPHeight;
char line_buffer[4];
file = filename;
digit_pos = modify_char_filename;
for (i = 0; i < count; i++)
{
bool retried = false;
retry:
if ((fd = fopen(file, "rb")) == 0)
{
printf("[lcdd] %s-skin not found (%s) -> using default...\n", name, file);
file = backup_filename;
digit_pos = modify_char_backup_filename;
i = 0;
if (!retried) {
retried = true;
goto retry;
}
break;
}
fseek(fd, 0x12, SEEK_SET);
fread(&BMPWidth, 1, 1, fd);
fseek(fd, 0x16, SEEK_SET);
fread(&BMPHeight, 1, 1, fd);
if ((BMPWidth > width) || (BMPHeight > height))
{
printf("[lcdd] %s-skin not supported -> using default...\n", name);
fclose(fd);
file = backup_filename;
digit_pos = modify_char_backup_filename;
i = 0;
if (!retried) {
retried = true;
goto retry;
}
}
fseek(fd, 0x3E, SEEK_SET);
for (row = height - 1; row >= 0; row--)
{
fread(&line_buffer, 1, sizeof(line_buffer), fd); /* width must not be greater than 32 */
for (byte = 0; byte < (width >> 3); byte++) /* width must be multiple of 8 */
{
for (bit = 7; bit >= 0; bit--)
{
dest[(7 - bit) + (byte << 3) + (row + i * height) * width] = line_buffer[byte] & (1 << bit);
}
}
}
fclose(fd);
file[digit_pos]++;
}
}
void InitNewClock(void)
{
char filename_usr[] = CONFIGDIR "/lcdd/clock/t_a.bmp";
char filename_std[] = DATADIR "/lcdd/clock/t_a.bmp";
loadSkin(filename_usr, filename_std, sizeof(filename_usr) - 6, sizeof(filename_std) - 6, time_digits, 10, 24, 32, "time");
filename_usr[sizeof(filename_usr) - 8] = 'w';
filename_std[sizeof(filename_std) - 8] = 'w';
filename_usr[sizeof(filename_usr) - 6] = 'a';
filename_std[sizeof(filename_std) - 6] = 'a';
loadSkin(filename_usr, filename_std, sizeof(filename_usr) - 6, sizeof(filename_std) - 6, days, 7, 24, 16, "weekday");
filename_usr[sizeof(filename_usr) - 8] = 'd';
filename_std[sizeof(filename_std) - 8] = 'd';
filename_usr[sizeof(filename_usr) - 6] = 'a';
filename_std[sizeof(filename_std) - 6] = 'a';
loadSkin(filename_usr, filename_std, sizeof(filename_usr) - 6, sizeof(filename_std) - 6, date_digits, 10, 16, 16, "date");
filename_usr[sizeof(filename_usr) - 8] = 'm';
filename_std[sizeof(filename_std) - 8] = 'm';
filename_usr[sizeof(filename_usr) - 6] = 'a';
filename_std[sizeof(filename_std) - 6] = 'a';
loadSkin(filename_usr, filename_std, sizeof(filename_usr) - 6, sizeof(filename_std) - 6, months, 12, 32, 16, "month");
}
void RenderSign(CLCDDisplay* const display, int sign, int x_position, int y_position)
{
int x, y;
for(y = 0; y < 4; y++)
{
for(x = 0; x < 4; x++)
{
display->draw_point(x_position + x, y_position + y, signs[x + y*4 + sign*sizeof(signs)/3] ? CLCDDisplay::PIXEL_ON : CLCDDisplay::PIXEL_OFF);
}
}
}
void RenderTimeDigit(CLCDDisplay* const display, int digit, int position)
{
int x, y;
for(y = 0; y < 32; y++)
{
for(x = 0; x < 24; x++)
{
display->draw_point(position + x, 5 + y, time_digits[x + y*24 + digit*sizeof(time_digits)/10] ? CLCDDisplay::PIXEL_ON : CLCDDisplay::PIXEL_OFF);
}
}
}
void RenderDay(CLCDDisplay* const display, int day)
{
int x, y;
for(y = 0; y < 16; y++)
{
for(x = 0; x < 24; x++)
{
display->draw_point(5 + x, 43 + y, days[x + y*24 + day*sizeof(days)/7] ? CLCDDisplay::PIXEL_ON : CLCDDisplay::PIXEL_OFF);
}
}
}
void RenderDateDigit(CLCDDisplay* const display, int digit, int position)
{
int x, y;
for(y = 0; y < 16; y++)
{
for(x = 0; x < 16; x++)
{
display->draw_point(position + x, 43 + y, date_digits[x + y*16 + digit*sizeof(date_digits)/10] ? CLCDDisplay::PIXEL_ON : CLCDDisplay::PIXEL_OFF);
}
}
}
void RenderMonth(CLCDDisplay* const display, int month)
{
int x, y;
for(y = 0; y < 16; y++)
{
for(x = 0; x < 32; x++)
{
display->draw_point(83 + x, 43 + y, months[x + y*32 + month*sizeof(months)/12] ? CLCDDisplay::PIXEL_ON : CLCDDisplay::PIXEL_OFF);
}
}
}
void ShowNewClock(CLCDDisplay* display, int hour, int minute, int second, int day, int date, int month, bool rec)
{
RenderTimeDigit(display, hour/10, 5);
RenderTimeDigit(display, hour%10, 32);
RenderTimeDigit(display, minute/10, 64);
RenderTimeDigit(display, minute%10, 91);
/* blink the date if recording */
if (!rec || !(second & 1))
{
RenderDay(display, day);
RenderDateDigit(display, date/10, 43);
RenderDateDigit(display, date%10, 60);
RenderMonth(display, month);
RenderSign(display, 1, 31, 57);
RenderSign(display, 2, 78, 56);
}
if (second % 2 == 0)
{
RenderSign(display, 0, 58, 15);
RenderSign(display, 0, 58, 23);
}
}

View File

@@ -1,30 +0,0 @@
/*
LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <lcddisplay/lcddisplay.h>
void InitNewClock();
void ShowNewClock(CLCDDisplay* display, int hour, int minute, int second, int day, int date, int month, bool record = false);

View File

@@ -1,319 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "pig.h"
// Video4Linux API for PIG
//
//
// -- Picture in Graphics Control
// -- This module is a Class to provide a PIG abstraction layer
// --
// -- 2002-11 rasc
// -- 2003-06 rasc V4L Api
//
//
// -- Constructor
//
CPIG::CPIG()
{
fd = -1;
status = CLOSED;
}
CPIG::CPIG(int pig_nr)
{
fd = -1;
status = CLOSED;
fd = pigopen (pig_nr);
}
CPIG::CPIG(int pig_nr, int x, int y, int w, int h)
{
fd = -1;
status = CLOSED;
fd = pigopen (pig_nr);
set_coord (x,y, w,h);
}
CPIG::~CPIG()
{
pigclose (); // cleanup anyway!!
}
//
// -- open PIG #nr
// -- return >=0: ok
//
int CPIG::pigopen (int pig_nr)
{
char *pigdevs[] = {
PIG_DEV "0" // PIG device 0
// PIG_DEV "1", // PIG device 1
// PIG_DEV "2", // PIG device ...
// PIG_DEV "3"
};
if ( (pig_nr>0) || (pig_nr < (int)(sizeof (pigdevs)/sizeof(char *))) ) {
if (fd < 0) {
fd = open( pigdevs[pig_nr], O_RDWR );
if (fd >= 0) {
status = HIDE;
px = py = pw = ph = 0;
}
return fd;
}
}
return -1;
}
//
// -- close PIG
//
void CPIG::pigclose ()
{
if (fd >=0 ) {
close (fd);
fd = -1;
status = CLOSED;
px = py = pw = ph = 0;
}
return;
}
//
// -- set PIG Position
// -- routines should be self explaining
//
void CPIG::_set_window (int x, int y, int w, int h)
{
#if 1
// -- Modul interne Routine
struct v4l2_crop crop;
struct v4l2_format coord;
// int err;
crop.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
err = ioctl(fd, VIDIOC_G_CROP, &crop);
// take whole input frame
crop.c.left = 0;
crop.c.top = 0;
crop.c.width = 720;
crop.c.height = 576;
/*err =*/ ioctl(fd, VIDIOC_S_CROP, &crop);
coord.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
/*err = */ioctl(fd, VIDIOC_G_FMT, &coord);
// fit into small window
coord.fmt.win.w.left = x;
coord.fmt.win.w.top = y;
coord.fmt.win.w.width = w;
coord.fmt.win.w.height = h;
err = ioctl(fd, VIDIOC_S_FMT, &coord);
#if 0 // old
struct v4l2_format coord;
int err;
ioctl(fd, VIDIOC_G_FMT, &coord);
coord.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
coord.fmt.win.w.left = x;
coord.fmt.win.w.top = y;
coord.fmt.win.w.width = w;
coord.fmt.win.w.height = h;
int pigmode = 0;
/*err =*/ ioctl(fd, VIDIOC_OVERLAY, &pigmode);
printf("pig::window VIDIOC_OVERLAY %d\n", err);
err = ioctl(fd, VIDIOC_S_FMT, &coord);
printf("pig::window VIDIOC_S_FMT %d\n", err);
#endif
#else
avia_pig_set_pos(fd,x,y);
avia_pig_set_size(fd, w, h);
avia_pig_set_stack(fd,2);
#endif
}
void CPIG::set_coord (int x, int y, int w, int h)
{
if (( x != px ) || ( y != py )) {
px = x;
py = y;
pw = w;
ph = h;
_set_window (px,py,pw,ph);
}
}
void CPIG::set_xy (int x, int y)
{
if (( x != px ) || ( y != py )) {
px = x;
py = y;
_set_window (px,py,pw,ph);
}
}
void CPIG::set_size (int w, int h)
{
if (( w != pw ) || ( h != ph )) {
pw = w;
ph = h;
_set_window (px,py,pw,ph);
}
}
// $$$ ???? what this for?
//void CPIG::set_source (int x, int y)
//{
//
// if (fd >= 0) {
//
// if (( x != px ) || ( y != py )) {
// // avia_pig_set_source(fd,x,y);
// }
//
// }
//
//}
//
// -- routine set's stack position of PIG on display
//
//void CPIG::set_stackpos (int pos)
//
//{
// if (fd >= 0) {
// avia_pig_set_stack(fd,pos);
// stackpos = pos;
// }
//}
//
// -- Show PIG or hide PIG
//
void CPIG::show (int x, int y, int w, int h)
{
set_coord (x,y, w,h);
show ();
}
void CPIG::show (void)
{
if ( fd >= 0 ) {
#if 1
int pigmode = 1;
int err;
err = ioctl(fd, VIDIOC_OVERLAY, &pigmode);
//printf("pig::show err %d\n", err);
#else
avia_pig_show(fd);
#endif
status = SHOW;
}
}
void CPIG::hide (void)
{
if ( fd >= 0 ) {
#if 1
int pigmode = 0;
int err;
err = ioctl(fd, VIDIOC_OVERLAY, &pigmode);
#else
avia_pig_hide(fd);
#endif
status = HIDE;
}
}
CPIG::PigStatus CPIG::getStatus(void)
{
return status;
}
//
// ToDo's:
// -- Capability unavail check/status
// -- Cropping for resizing (possible zoom/scaling?)
// -- Capturing
//

View File

@@ -1,83 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __PIG_CONTROL__
#define __PIG_CONTROL__
#include <config.h>
using namespace std;
//
// -- Picture in Graphics Control
// -- 2002-11 rasc
// -- 2003-06 rasc V4L API
//
#if 1
#include <linux/videodev.h>
#define PIG_DEV "/dev/v4l/video" // PigNr will be appended!
#else
#include <dbox/avia_gt_pig.h>
#define PIG_DEV "/dev/dbox/pig"
#endif
class CPIG
{
public:
CPIG ();
CPIG (int pig_nr); // incl. open
CPIG (int pig_nr, int x, int y, int w, int h); // open + set_coord
~CPIG ();
int pigopen (int pig_nr);
void pigclose (void);
void set_coord (int x, int y, int w, int h);
void set_xy (int x, int y);
void set_size (int w, int h);
// void set_source(int x, int y);
// void set_stackpos (int pos);
void show (void);
void show (int x, int y, int w, int h);
void hide (void);
enum PigStatus { CLOSED, HIDE, SHOW };
PigStatus getStatus(void);
private:
void _set_window (int x, int y, int w, int h);
int fd; // io descriptor
int px, py, pw, ph; // pig frame
int stackpos; // Order (Framebuffer, PIGs)
PigStatus status; // on display?
};
#endif

View File

@@ -1,134 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <global.h>
#include <neutrino.h>
#include <system/settings.h>
#include <driver/rfmod.h>
#define RFMOD_DEV "/dev/rfmod0"
#define IOCTL_SET_CHANNEL 0
#define IOCTL_SET_TESTMODE 1
#define IOCTL_SET_SOUNDENABLE 2
#define IOCTL_SET_SOUNDSUBCARRIER 3
#define IOCTL_SET_FINETUNE 4
#define IOCTL_SET_STANDBY 5
#define C0 3
#define C1 2
#define FL 1
#define FM 0
RFmod::RFmod()
{
rfmodfd=open(RFMOD_DEV, O_RDWR);
}
void RFmod::init()
{
soundsubcarrier=g_settings.rf_subcarrier;
soundenable=g_settings.rf_soundenable;
channel = g_settings.rf_channel;
finetune = g_settings.rf_finetune;
standby = g_settings.rf_standby;
setSoundSubCarrier(soundsubcarrier);
setSoundEnable(soundenable);
setChannel(channel);
setFinetune(finetune);
setStandby(standby);
setTestPattern(0);
}
RFmod::~RFmod()
{
if (rfmodfd>=0)
close(rfmodfd);
}
int RFmod::setSoundEnable(int val)
{
soundenable = val;
//printf("RF sound: %d\n", val);
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_SOUNDENABLE,&soundenable);
return 0;
}
int RFmod::setStandby(int val)
{
standby = val;
//printf("RF standby: %d\n", val);
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_STANDBY,&standby);
return 0;
}
int RFmod::setChannel(int val)
{
channel = val;
//printf("RF channel: %d\n", val);
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_CHANNEL,&channel);
return 0;
}
int RFmod::setFinetune(int val)
{
finetune = val;
//printf("RF finetune: %d\n", val);
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_FINETUNE,&finetune);
return 0;
}
int RFmod::setTestPattern(int val)
{
//printf("RF test: %d\n", val);
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_TESTMODE,&val);
return 0;
}
int RFmod::setSoundSubCarrier(int freq) //freq in KHz
{
//printf("RF carrier: %d\n", freq);
soundsubcarrier=freq;
/*
switch(freq)
{
case 4500:
sfd=0;
break;
case 5500:
sfd=1;
break;
case 6000:
sfd=2;
break;
case 6500:
sfd=3;
break;
default:
return -1;
}
*/
if(rfmodfd > 0)
ioctl(rfmodfd,IOCTL_SET_SOUNDSUBCARRIER,&soundsubcarrier);
return 0;
}

View File

@@ -1,23 +0,0 @@
#ifndef __erfmod_h
#define __erfmod_h
class RFmod
{
int channel,soundsubcarrier,soundenable,finetune,standby;
public:
RFmod();
~RFmod();
int rfmodfd;
void init();
int setChannel(int channel);
int setSoundSubCarrier(int val);
int setSoundEnable(int val);
int setStandby(int val);
int setFinetune(int val);
int setTestPattern(int val);
};
#endif

View File

@@ -1,80 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <memory.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
#include </dream/driver/include/ost/dmx.h>
#include </dream/driver/include/ost/video.h>
#define VIDEO_DEV "/dev/dvb/card0/video0"
#define VIDEO_SET_AUTOFLUSH _IOW('o', 2, int)
void showframe(char * fname)
{
int file, size;
char *buffer;
file=open(fname, O_RDONLY);
if (file < 0)
return;
size=lseek(file, 0, SEEK_END);
lseek(file, 0, SEEK_SET);
if (size < 0)
{
close(file);
return;
}
buffer = malloc(size);
read(file, buffer, size);
close(file);
displayIFrame(buffer, size);
free(buffer);
return;
}
static int displayIFrame(const char *frame, int len)
{
int fdv, fdvideo, i;
fdv=open("/dev/video", O_WRONLY);
if (fdv < 0) {
printf("cant open /dev/video\n");
return -1;
}
fdvideo = open(VIDEO_DEV, O_RDWR);
if (fdvideo < 0) {
colose(fdv);//Resource leak: fdv
printf("cant open %s\n", VIDEO_DEV);
return -1;
}
if (ioctl(fdvideo, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY ) <0)
printf("VIDEO_SELECT_SOURCE failed \n");
if (ioctl(fdvideo, VIDEO_CLEAR_BUFFER) <0 )
printf("VIDEO_CLEAR_BUFFER failed \n");
if (ioctl(fdvideo, VIDEO_PLAY) < 0 )
printf("VIDEO_PLAY failed\n");
for (i=0; i < 2; i++ )
write(fdv, frame, len);
unsigned char buf[128];
memset(&buf, 0, 128);
write(fdv, buf, 128);
if ( ioctl(fdv, VIDEO_SET_AUTOFLUSH, 0) < 0 )
printf("VIDEO_SET_AUTOFLUSH off failed\n");
if (ioctl(fdvideo, VIDEO_SET_BLANK, 0) < 0 )
printf("VIDEO_SET_BLANK failed\n");
close(fdvideo);
if ( ioctl(fdv, VIDEO_SET_AUTOFLUSH, 1) < 0 )
printf("VIDEO_SET_AUTOFLUSH on failed\n");
close(fdv);
return 0;
}

View File

@@ -1,107 +0,0 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/slotbuffer.c,v 1.1 2004/06/03 09:51:54 thegoodguy Exp $
*
* (C) 2004 by thegoodguy <thegoodguy@berlios.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* Note: this slotbuffer "wastes" one slot */
#include "slotbuffer.h"
#include <stdlib.h>
slotbuffer_t * slotbuffer_construct(const size_t size)
{
slotbuffer_t * slotbuffer;
slotbuffer = malloc(sizeof(slotbuffer_t));
slotbuffer->buffer = malloc(size);
slotbuffer->size = size;
slotbuffer->read_pointer = 0;
slotbuffer->write_pointer = 0;
return slotbuffer;
}
void slotbuffer_destruct(slotbuffer_t * const slotbuffer)
{
free(slotbuffer->buffer);
free(slotbuffer);
}
size_t slotbuffer_remaining_read_space(slotbuffer_t * const slotbuffer)
{
ssize_t delta;
delta = slotbuffer->write_pointer;
delta -= slotbuffer->read_pointer;
return (delta >= 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size);
}
size_t slotbuffer_remaining_write_space(slotbuffer_t * const slotbuffer)
{
ssize_t delta;
delta = slotbuffer->read_pointer;
delta -= slotbuffer->write_pointer;
return ((delta > 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size)) - 1;
}
size_t slotbuffer_remaining_continuous_read_space(slotbuffer_t * const slotbuffer)
{
ssize_t delta;
size_t read_pointer;
delta = slotbuffer->write_pointer;
read_pointer = slotbuffer->read_pointer;
delta -= read_pointer;
return (delta >= 0) ? (size_t)delta : (size_t)(slotbuffer->size - read_pointer);
}
size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuffer)
{
ssize_t delta;
size_t write_pointer;
delta = slotbuffer->read_pointer;
if (delta == 0)
return (slotbuffer->size - slotbuffer->write_pointer - 1);
write_pointer = slotbuffer->write_pointer;
delta -= write_pointer;
return (delta > 0) ? (size_t)(delta - 1) : (size_t)(slotbuffer->size - write_pointer);
}
void slotbuffer_advance_read_pointer(slotbuffer_t * const slotbuffer, const size_t delta)
{
slotbuffer->read_pointer += delta;
if (slotbuffer->read_pointer >= slotbuffer->size)
slotbuffer->read_pointer = 0;
}
void slotbuffer_advance_write_pointer(slotbuffer_t * const slotbuffer, const size_t delta)
{
slotbuffer->write_pointer += delta;
if (slotbuffer->write_pointer >= slotbuffer->size)
slotbuffer->write_pointer = 0;
}

View File

@@ -1,44 +0,0 @@
#ifndef __slotbuffer_h__
#define __slotbuffer_h__
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/slotbuffer.h,v 1.1 2004/06/03 09:51:54 thegoodguy Exp $
*
* (C) 2004 by thegoodguy <thegoodguy@berlios.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <sys/types.h>
typedef struct
{
unsigned char * buffer;
size_t size;
volatile size_t read_pointer;
volatile size_t write_pointer;
} slotbuffer_t;
slotbuffer_t * slotbuffer_construct (size_t const size );
void slotbuffer_destruct (slotbuffer_t * const slotbuffer );
size_t slotbuffer_remaining_read_space (slotbuffer_t * const slotbuffer );
size_t slotbuffer_remaining_write_space (slotbuffer_t * const slotbuffer );
size_t slotbuffer_remaining_continuous_read_space (slotbuffer_t * const slotbuffer );
size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuffer );
void slotbuffer_advance_read_pointer (slotbuffer_t * const slotbuffer, size_t const delta);
void slotbuffer_advance_write_pointer (slotbuffer_t * const slotbuffer, size_t const delta);
#endif

View File

@@ -1,93 +0,0 @@
// stacktrace.h (c) 2008, Timo Bingmann from http://idlebox.net/
// published under the WTFPL v2.0
#ifndef _STACKTRACE_H_
#define _STACKTRACE_H_
#include <stdio.h>
#include <stdlib.h>
#include <execinfo.h>
#include <cxxabi.h>
/** Print a demangled stack backtrace of the caller function to FILE* out. */
static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63)
{
fprintf(out, "stack trace:\n");
// storage array for stack trace address data
void* addrlist[max_frames+1];
// retrieve current stack addresses
int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*));
if (addrlen == 0) {
fprintf(out, " <empty, possibly corrupt>\n");
return;
}
// resolve addresses into strings containing "filename(function+address)",
// this array must be free()-ed
char** symbollist = backtrace_symbols(addrlist, addrlen);
// allocate string which will be filled with the demangled function name
size_t funcnamesize = 256;
char* funcname = (char*)malloc(funcnamesize);
// iterate over the returned symbol lines. skip the first, it is the
// address of this function.
for (int i = 1; i < addrlen; i++)
{
char *begin_name = 0, *begin_offset = 0, *end_offset = 0;
// find parentheses and +address offset surrounding the mangled name:
// ./module(function+0x15c) [0x8048a6d]
for (char *p = symbollist[i]; *p; ++p)
{
if (*p == '(')
begin_name = p;
else if (*p == '+')
begin_offset = p;
else if (*p == ')' && begin_offset) {
end_offset = p;
break;
}
}
if (begin_name && begin_offset && end_offset
&& begin_name < begin_offset)
{
*begin_name++ = '\0';
*begin_offset++ = '\0';
*end_offset = '\0';
// mangled name is now in [begin_name, begin_offset) and caller
// offset in [begin_offset, end_offset). now apply
// __cxa_demangle():
int status;
char* ret = abi::__cxa_demangle(begin_name,
funcname, &funcnamesize, &status);
if (status == 0) {
funcname = ret; // use possibly realloc()-ed string
fprintf(out, " %s : %s+%s\n",
symbollist[i], funcname, begin_offset);
}
else {
// demangling failed. Output function name as a C function with
// no arguments.
fprintf(out, " %s : %s()+%s\n",
symbollist[i], begin_name, begin_offset);
}
}
else
{
// couldn't parse the line? print the whole line.
fprintf(out, " %s\n", symbollist[i]);
}
}
free(funcname);
free(symbollist);
}
#endif // _STACKTRACE_H_

View File

@@ -1,218 +0,0 @@
/*
* $Id: stream2file.cpp,v 1.19 2005/01/12 20:40:22 chakazulu Exp $
*
* streaming to file/disc
*
* Copyright (C) 2004 Axel Buehning <diemade@tuxbox.org>,
* thegoodguy <thegoodguy@berlios.de>
*
* based on code which is
* Copyright (C) 2001 TripleDES
* Copyright (C) 2000, 2001 Marcus Metzler <marcus@convergence.de>
* Copyright (C) 2002 Andreas Oberritter <obi@tuxbox.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <stream2file.h>
#include <eventserver.h>
#include <neutrinoMessages.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include <libgen.h>
#if HAVE_COOL_HARDWARE
#include <record_cs.h>
#include <driver/vfd.h>
#endif
#if HAVE_TRIPLEDRAGON
#include <record_td.h>
#include <driver/lcdd.h>
#endif
#include <ca_cs.h>
#include <zapit/cam.h>
#include <zapit/channel.h>
extern "C" {
#include <driver/genpsi.h>
}
static cRecord * record = NULL;
extern CZapitChannel *g_current_channel;
extern CCam *cam0;
extern bool autoshift;
extern bool autoshift_delete;
#define MAXPIDS 64
#define FILENAMEBUFFERSIZE 1024
static stream2file_status_t exit_flag = STREAM2FILE_STATUS_IDLE;
char rec_filename[FILENAMEBUFFERSIZE];
stream2file_error_msg_t start_recording(const char * const filename,
const char * const info, const unsigned short vpid, const unsigned short * const pids,
const unsigned int numpids)
{
int fd;
char buf[FILENAMEBUFFERSIZE];
struct statfs s;
if(autoshift)
sprintf(rec_filename, "%s_temp", filename);
else
sprintf(rec_filename, "%s", filename);
// write stream information (should wakeup the disk from standby, too)
sprintf(buf, "%s.xml", rec_filename);
char * dir = strdup(buf);
int ret = statfs(dirname(dir), &s);
free(dir);
if((ret != 0) || (s.f_type == 0x72b6) || (s.f_type == 0x24051905)) {
return STREAM2FILE_INVALID_DIRECTORY;
}
if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) {
write(fd, info, strlen(info));
fdatasync(fd);
close(fd);
} else {
return STREAM2FILE_INVALID_DIRECTORY;
}
exit_flag = STREAM2FILE_STATUS_RUNNING;
sprintf(buf, "%s.ts", rec_filename);
printf("Record start: file %s vpid %x apid %x\n", buf, vpid, pids[0]);
fd = open(buf, O_CREAT | O_RDWR | O_LARGEFILE | O_TRUNC , S_IRWXO | S_IRWXG | S_IRWXU);
if(fd < 0) {
perror(buf);
return STREAM2FILE_INVALID_DIRECTORY;
}
genpsi(fd);
if(!record)
record = new cRecord(2);
record->Open(numpids);
if(!record->Start(fd, (unsigned short ) vpid, (unsigned short *) pids, numpids)) {
record->Stop();
delete record;
record = NULL;
return STREAM2FILE_INVALID_DIRECTORY;
}
if(g_current_channel) {
cam0->setCaPmt(g_current_channel->getCaPmt(), DEMUX_SOURCE_0, cam0->getCaMask() | DEMUX_DECODE_2 /*5*/, true); // demux 0 + 2, update
int len;
unsigned char * pmt = g_current_channel->getRawPmt(len);
cCA * ca = cCA::GetInstance();
ca->SendPMT(DEMUX_SOURCE_2, pmt, len);
}
CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true);
return STREAM2FILE_OK;
}
stream2file_error_msg_t stop_recording(const char * const info)
{
char buf[FILENAMEBUFFERSIZE];
char buf1[FILENAMEBUFFERSIZE];
int fd;
stream2file_error_msg_t ret = STREAM2FILE_RECORDING_THREADS_FAILED;
//if(!autoshift || autoshift_delete)
{
sprintf(buf, "%s.xml", rec_filename);
if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) {
write(fd, info, strlen(info));
fdatasync(fd);
close(fd);
}
}
if(record) {
record->Stop();
delete record;
record = NULL;
}
if (exit_flag == STREAM2FILE_STATUS_RUNNING) {
exit_flag = STREAM2FILE_STATUS_IDLE;
ret = STREAM2FILE_OK;
}
else
ret = STREAM2FILE_RECORDING_THREADS_FAILED;
if((autoshift && g_settings.auto_delete) || autoshift_delete) {
sprintf(buf, "rm -f %s.ts &", rec_filename);
sprintf(buf1, "%s.xml", rec_filename);
autoshift_delete = false;
system(buf);
unlink(buf1);
}
CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, false);
rec_filename[0] = 0;
return ret;
}
stream2file_error_msg_t update_recording(const char * const info, const unsigned short vpid,
const unsigned short * const pids, const unsigned int numpids)
{
// stream2file_error_msg_t ret;
char buf[FILENAMEBUFFERSIZE];
int fd;
sprintf(buf, "%s.xml", rec_filename);
if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) {
write(fd, info, strlen(info));
fdatasync(fd);
close(fd);
}
if(record)
record->ChangePids((unsigned short) vpid, (unsigned short *) pids, numpids);
if(g_current_channel)
cam0->setCaPmt(g_current_channel->getCaPmt(), DEMUX_SOURCE_0, cam0->getCaMask() | DEMUX_DECODE_0 | DEMUX_DECODE_2, true);
return STREAM2FILE_OK /*ret*/;
}

View File

@@ -1,63 +0,0 @@
/*
* $Id: stream2file.h,v 1.10 2005/01/12 20:40:22 chakazulu Exp $
*
* (C) 2004 by thegoodguy <thegoodguy@berlios.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __stream2file_h__
#define __stream2file_h__
enum stream2file_error_msg_t
{
STREAM2FILE_OK = 0,
STREAM2FILE_BUSY = -1,
STREAM2FILE_INVALID_DIRECTORY = -2,
STREAM2FILE_INVALID_PID = -3,
STREAM2FILE_PES_FILTER_FAILURE = -4,
STREAM2FILE_DVR_OPEN_FAILURE = -5,
STREAM2FILE_RECORDING_THREADS_FAILED = -6
};
enum stream2file_status_t
{
STREAM2FILE_STATUS_RUNNING = 0,
STREAM2FILE_STATUS_IDLE = 1,
STREAM2FILE_STATUS_BUFFER_OVERFLOW = -1,
STREAM2FILE_STATUS_WRITE_OPEN_FAILURE = -2,
STREAM2FILE_STATUS_WRITE_FAILURE = -3,
STREAM2FILE_STATUS_READ_FAILURE = -4
};
struct stream2file_status2_t
{
stream2file_status_t status;
char dir[100];
};
stream2file_error_msg_t start_recording(const char * const filename,
const char * const info,
const unsigned short vpid,
const unsigned short * const apids,
const unsigned int numpids);
stream2file_error_msg_t stop_recording(const char * const info);
stream2file_error_msg_t update_recording(const char * const info,
const unsigned short vpid,
const unsigned short * const apids,
const unsigned int numpids);
#endif

View File

@@ -1,963 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <math.h>
#include <global.h>
#include <neutrino.h>
#include <gui/widget/hintbox.h>
#include <gui/widget/messagebox.h>
#include <driver/vcrcontrol.h>
#include <driver/encoding.h>
#include <driver/stream2file.h>
#include <daemonc/remotecontrol.h>
#include <zapit/client/zapittools.h>
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
int was_record = 0;
extern bool autoshift;
extern bool autoshift_delete;
#define SA struct sockaddr
#define SAI struct sockaddr_in
extern "C" {
#include <driver/genpsi.h>
}
extern t_channel_id rec_channel_id;
static CVCRControl vcrControl;
CVCRControl * CVCRControl::getInstance()
{
return &vcrControl;
}
//-------------------------------------------------------------------------
CVCRControl::CVCRControl()
{
Device = NULL;
}
//-------------------------------------------------------------------------
CVCRControl::~CVCRControl()
{
unregisterDevice();
}
//-------------------------------------------------------------------------
void CVCRControl::unregisterDevice()
{
if (Device)
{
delete Device;
Device = NULL;
}
}
//-------------------------------------------------------------------------
void CVCRControl::registerDevice(CDevice * const device)
{
unregisterDevice();
Device = device;
if(CNeutrinoApp::getInstance()->recordingstatus)
Device->deviceState = CMD_VCR_RECORD;
}
//-------------------------------------------------------------------------
bool CVCRControl::Record(const CTimerd::RecordingInfo * const eventinfo)
{
int mode = g_Zapit->isChannelTVChannel(eventinfo->channel_id) ? NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio;
return Device->Record(eventinfo->channel_id, mode, eventinfo->epgID, eventinfo->epgTitle, eventinfo->apids, eventinfo->epg_starttime);
}
MI_MOVIE_INFO * CVCRControl::GetMovieInfo(void)
{
if(Device)
return Device->recMovieInfo;
return NULL;
}
bool CVCRControl::GetPids(unsigned short *vpid, unsigned short *vtype, unsigned short *apid, unsigned short *atype, unsigned short * apidnum, unsigned short * apids, unsigned short * atypes)
{
if(Device) {
if(vpid)
*vpid = Device->rec_vpid;
if(vtype)
*vtype = Device->rec_vtype;
if(apid)
*apid = Device->rec_currentapid;
if(atype)
*atype = Device->rec_currentac3;
if(apidnum) {
*apidnum = Device->rec_numpida;
for(int i = 0; i < Device->rec_numpida; i++) {
if(apids)
apids[i] = Device->rec_apids[i];
if(atypes)
atypes[i] = Device->rec_ac3flags[i];
}
}
return true;
}
return false;
}
//-------------------------------------------------------------------------
void CVCRControl::CDevice::getAPIDs(const unsigned char _apidmode, APIDList & apid_list)
{
unsigned char apidmode = _apidmode;
if (apidmode == TIMERD_APIDS_CONF)
apidmode = g_settings.recording_audio_pids_default;
apid_list.clear();
//CZapitClient::responseGetPIDs allpids;
g_Zapit->getPIDS(allpids);
// assume smallest apid ist std apid
if (apidmode & TIMERD_APIDS_STD) {
uint32_t apid_min=UINT_MAX;
uint32_t apid_min_idx=0;
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) {
apid_min = allpids.APIDs[i].pid;
apid_min_idx = i;
}
}
if (apid_min != UINT_MAX) {
APIDDesc a = {apid_min, apid_min_idx, false};
apid_list.push_back(a);
}
}
if (apidmode & TIMERD_APIDS_ALT) {
uint32_t apid_min=UINT_MAX;
uint32_t apid_min_idx=0;
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) {
apid_min = allpids.APIDs[i].pid;
apid_min_idx = i;
}
}
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3) {
APIDDesc a = {allpids.APIDs[i].pid, i, false};
apid_list.push_back(a);
}
}
}
if (apidmode & TIMERD_APIDS_AC3) {
bool ac3_found=false;
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].is_ac3) {
APIDDesc a = {allpids.APIDs[i].pid, i, true};
apid_list.push_back(a);
ac3_found=true;
}
}
// add non ac3 apid if ac3 not found
if (!(apidmode & TIMERD_APIDS_STD) && !ac3_found) {
uint32_t apid_min=UINT_MAX;
uint32_t apid_min_idx=0;
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) {
apid_min = allpids.APIDs[i].pid;
apid_min_idx = i;
}
}
if (apid_min != UINT_MAX) {
APIDDesc a = {apid_min, apid_min_idx, false};
apid_list.push_back(a);
}
}
}
// no apid selected use standard
if (apid_list.empty() && !allpids.APIDs.empty()) {
uint32_t apid_min=UINT_MAX;
uint32_t apid_min_idx=0;
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) {
apid_min = allpids.APIDs[i].pid;
apid_min_idx = i;
}
}
if (apid_min != UINT_MAX) {
APIDDesc a = {apid_min, apid_min_idx, false};
apid_list.push_back(a);
}
for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); ++it)
printf("Record APID 0x%X %d\n",it->apid, it->ac3);
}
}
//-------------------------------------------------------------------------
bool CVCRControl::CVCRDevice::Stop()
{
deviceState = CMD_VCR_STOP;
if(last_mode != NeutrinoMessages::mode_scart)
{
g_RCInput->postMsg( NeutrinoMessages::VCR_OFF, 0 );
g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode);
}
return true;
}
//-------------------------------------------------------------------------
bool CVCRControl::CVCRDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& /*epgTitle*/, unsigned char apidmode, const time_t /*epg_time*/)
{
printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx, apidmode 0x%X mode \n",
channel_id, epgid, apidmode);
// leave menu (if in any)
g_RCInput->postMsg( CRCInput::RC_timeout, 0 );
last_mode = CNeutrinoApp::getInstance()->getMode();
if(mode != last_mode)
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
if(channel_id != 0) {
if(g_Zapit->getCurrentServiceID() != channel_id)
g_Zapit->zapTo_serviceID(channel_id);
}
if(! (apidmode & TIMERD_APIDS_STD)) {
APIDList apid_list;
getAPIDs(apidmode,apid_list);
if(!apid_list.empty()) {
if(!apid_list.begin()->ac3)
g_Zapit->setAudioChannel(apid_list.begin()->index);
else
g_Zapit->setAudioChannel(0);
}
else
g_Zapit->setAudioChannel(0);
}
else
g_Zapit->setAudioChannel(0);
if(SwitchToScart) {
// Auf Scart schalten
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::VCR_ON, 0 );
// Das ganze nochmal in die queue, da obiges RC_timeout erst in der naechsten ev. loop ausgeführt wird
// und dann das menu widget das display falsch rücksetzt
g_RCInput->postMsg( NeutrinoMessages::VCR_ON, 0 );
}
deviceState = CMD_VCR_RECORD;
return true;
}
//-------------------------------------------------------------------------
void CVCRControl::CFileAndServerDevice::RestoreNeutrino(void)
{
//printf("RestoreNeutrino\n");fflush(stdout);
/* after this zapit send EVT_RECORDMODE_DEACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */
g_Zapit->setRecordMode( false );
if (!g_Zapit->isPlayBackActive() && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby))
g_Zapit->startPlayBack();
// alten mode wieder herstellen (ausser wen zwischenzeitlich auf oder aus sb geschalten wurde)
if(CNeutrinoApp::getInstance()->getMode() != last_mode &&
CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby &&
last_mode != NeutrinoMessages::mode_standby)
if(!autoshift)
g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode);
if(last_mode == NeutrinoMessages::mode_standby &&
CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby )
{
//Wenn vorher und jetzt standby, dann die zapit wieder auf sb schalten
//g_Zapit->setStandby(true);
//was_record = 1;
}
if((last_mode != NeutrinoMessages::mode_standby) && StopSectionsd)
g_Sectionsd->setPauseScanning(false);
}
void CVCRControl::CFileAndServerDevice::CutBackNeutrino(const t_channel_id channel_id, const int mode)
{
rec_channel_id = channel_id;
//printf("CutBackNeutrino\n");fflush(stdout);
g_Zapit->setStandby(false);
last_mode = CNeutrinoApp::getInstance()->getMode();
if(last_mode == NeutrinoMessages::mode_standby)
was_record = 1;
if (channel_id != 0) {
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
// Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen...
if(last_mode == NeutrinoMessages::mode_standby)
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby);
}
if(g_Zapit->getCurrentServiceID() != channel_id) {
g_Zapit->zapTo_serviceID(channel_id);
}
}
if(StopSectionsd) // wenn sectionsd gestoppt werden soll
g_Sectionsd->setPauseScanning(true); // sectionsd stoppen
/* after this zapit send EVT_RECORDMODE_ACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */
g_Zapit->setRecordMode( true );
if((last_mode == NeutrinoMessages::mode_standby) || (StopPlayBack && g_Zapit->isPlayBackActive()))
g_Zapit->stopPlayBack();
}
bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata);
bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata);
std::string CVCRControl::CFileAndServerDevice::getCommandString(const CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode)
{
char tmp[40];
std::string apids_selected;
const char * extCommand;
std::string info1, info2;
std::string extMessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<neutrino commandversion=\"1\">\n\t<record command=\"";
switch(command)
{
case CMD_VCR_RECORD:
extCommand = "record";
break;
case CMD_VCR_STOP:
extCommand = "stop";
break;
case CMD_VCR_PAUSE:
extCommand = "pause";
break;
case CMD_VCR_RESUME:
extCommand = "resume";
break;
case CMD_VCR_AVAILABLE:
extCommand = "available";
break;
case CMD_VCR_UNKNOWN:
default:
extCommand = "unknown";
printf("[CVCRControl] Unknown Command\n");
}
extMessage += extCommand;
extMessage +=
"\">\n"
"\t\t<channelname>";
CZapitClient::responseGetPIDs pids;
g_Zapit->getPIDS (pids);
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();
APIDList apid_list;
getAPIDs(apidmode,apid_list);
apids_selected="";
for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); ++it)
{
if(it != apid_list.begin())
apids_selected += " ";
sprintf(tmp, "%u", it->apid);
apids_selected += tmp;
}
std::string tmpstring = g_Zapit->getChannelName(channel_id);
if (tmpstring.empty())
extMessage += "unknown";
else
extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
extMessage += "</channelname>\n\t\t<epgtitle>";
tmpstring = "not available";
if (epgid != 0)
{
CShortEPGData epgdata;
//if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) {
if(sectionsd_getEPGidShort(epgid, &epgdata)) {
//#warning fixme sectionsd should deliver data in UTF-8 format
tmpstring = epgdata.title;
info1 = epgdata.info1;
info2 = epgdata.info2;
}
} else if (!epgTitle.empty()) {
tmpstring = epgTitle;
}
extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
extMessage += "</epgtitle>\n\t\t<id>";
sprintf(tmp, PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id);
extMessage += tmp;
extMessage += "</id>\n\t\t<info1>";
extMessage += ZapitTools::UTF8_to_UTF8XML(info1.c_str());
extMessage += "</info1>\n\t\t<info2>";
extMessage += ZapitTools::UTF8_to_UTF8XML(info2.c_str());
extMessage += "</info2>\n\t\t<epgid>";
sprintf(tmp, "%llu", epgid);
extMessage += tmp;
extMessage += "</epgid>\n\t\t<mode>";
sprintf(tmp, "%d", g_Zapit->getMode());
extMessage += tmp;
extMessage += "</mode>\n\t\t<videopid>";
sprintf(tmp, "%u", si.vpid);
extMessage += tmp;
extMessage += "</videopid>\n\t\t<audiopids selected=\"";
extMessage += apids_selected;
extMessage += "\">\n";
// super hack :-), der einfachste weg an die apid descriptions ranzukommen
g_RemoteControl->current_PIDs = pids;
g_RemoteControl->processAPIDnames();
for(unsigned int i= 0; i< pids.APIDs.size(); i++)
{
extMessage += "\t\t\t<audio pid=\"";
sprintf(tmp, "%u", pids.APIDs[i].pid);
extMessage += tmp;
extMessage += "\" name=\"";
extMessage += ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
extMessage += "\"/>\n";
}
extMessage +=
"\t\t</audiopids>\n"
"\t\t<vtxtpid>";
sprintf(tmp, "%u", si.vtxtpid);
extMessage += tmp;
extMessage +=
"</vtxtpid>\n"
"\t</record>\n"
"</neutrino>\n";
return extMessage;
}
bool CVCRControl::CFileDevice::Stop()
{
std::string extMessage = " ";
time_t end_time = time(0);
//printf("[direct] Stop recording, recMovieInfo %lx\n", recMovieInfo); fflush(stdout);
//FIXME why not save info if shift ?
//if(!autoshift || autoshift_delete)
if(recMovieInfo && cMovieInfo) {
// recMovieInfo->length = (end_time - start_time) / 60;
recMovieInfo->length = (int) round((double) (end_time - start_time) / (double) 60);
cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo);
}
bool return_value = (::stop_recording(extMessage.c_str()) == STREAM2FILE_OK);
RestoreNeutrino();
deviceState = CMD_VCR_STOP;
if(recMovieInfo) {
recMovieInfo->audioPids.clear();
delete recMovieInfo;
recMovieInfo = NULL;
}
if(cMovieInfo) {
delete cMovieInfo;
cMovieInfo = NULL;
}
return return_value;
}
bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode, const time_t epg_time)
{
std::string ext_channel_name;
unsigned short apids[REC_MAX_PIDS];
unsigned int numpids = 0;
unsigned int pos;
char filename[512]; // UTF-8
printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx, apidmode 0x%X mode %d\n",
channel_id, epgid, apidmode, mode);
CutBackNeutrino(channel_id, mode);
apids_mode = apidmode;
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo();
if (si.vpid != 0)
transfer_pids(si.vpid, si.vtype ? EN_TYPE_AVC : EN_TYPE_VIDEO, 0);
APIDList apid_list;
getAPIDs(apids_mode, apid_list);
for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); ++it) {
apids[numpids++] = it->apid;
transfer_pids(it->apid, EN_TYPE_AUDIO, it->ac3 ? 1 : 0);
}
#if 0 // FIXME : why this needed ?
if(!apid_list.empty())
g_Zapit->setAudioChannel(apid_list.begin()->index);
#endif
#if 0
CZapitClient::responseGetPIDs allpids;
g_Zapit->getPIDS(allpids);
#endif
if ((StreamVTxtPid) && (si.vtxtpid != 0)) {
apids[numpids++] = si.vtxtpid;
}
if ((StreamPmtPid) && (si.pmtpid != 0)) {
apids[numpids++] = si.pmtpid;
}
// Create filename for recording
pos = Directory.size();
strcpy(filename, Directory.c_str());
if ((pos == 0) || (filename[pos - 1] != '/')) {
filename[pos] = '/';
pos++;
filename[pos] = '\0';
}
pos = strlen(filename);
#if 0
time_t t = time(NULL);
strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
strcat(filename, "_");
pos = strlen(filename);
#endif
ext_channel_name = g_Zapit->getChannelName(channel_id);
if (!(ext_channel_name.empty()))
{
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_channel_name.c_str()));
ZapitTools::replace_char(&filename[pos]);
if (!autoshift && g_settings.recording_save_in_channeldir) {
struct stat statInfo;
int res = stat(filename,&statInfo);
if (res == -1) {
if (errno == ENOENT) {
res = safe_mkdir(filename);
if (res == 0) {
strcat(filename,"/");
} else {
perror("[vcrcontrol] mkdir");
}
} else {
perror("[vcrcontrol] stat");
}
} else {
// directory exists
strcat(filename,"/");
}
} else
strcat(filename, "_");
}
pos = strlen(filename);
if (g_settings.recording_epg_for_filename) {
if(epgid != 0) {
CShortEPGData epgdata;
//if (g_Sectionsd->getEPGidShort(epgid, &epgdata))
if(sectionsd_getEPGidShort(epgid, &epgdata))
{
if (!(epgdata.title.empty()))
{
strcpy(&(filename[pos]), epgdata.title.c_str());
ZapitTools::replace_char(&filename[pos]);
}
}
} else if (!epgTitle.empty()) {
strcpy(&(filename[pos]), epgTitle.c_str());
ZapitTools::replace_char(&filename[pos]);
}
}
#if 1
pos = strlen(filename);
time_t t = time(NULL);
strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
//pos = strlen(filename);
#endif
start_time = time(0);
stream2file_error_msg_t error_msg = ::start_recording(filename,
getMovieInfoString(CMD_VCR_RECORD, channel_id, epgid, epgTitle, apid_list, epg_time).c_str(),
si.vpid, apids, numpids);
if (error_msg == STREAM2FILE_OK) {
deviceState = CMD_VCR_RECORD;
return true;
}
else {
RestoreNeutrino();
printf("[vcrcontrol] stream2file error code: %d\n", error_msg);
//FIXME: Use better error message
DisplayErrorMessage(g_Locale->getText(
error_msg == STREAM2FILE_BUSY ? LOCALE_STREAMING_BUSY :
error_msg == STREAM2FILE_INVALID_DIRECTORY ? LOCALE_STREAMING_DIR_NOT_WRITABLE :
LOCALE_STREAMINGSERVER_NOCONNECT
)); // UTF-8
return false;
}
}
bool CVCRControl::CFileDevice::Update(void)
{
EPG_AUDIO_PIDS audio_pids;
std::string extMessage;
//unsigned short apids[REC_MAX_PIDS];
//unsigned int numpids = 0;
APIDList apid_list;
APIDList::iterator it;
bool update = false;
if(!recMovieInfo || !cMovieInfo)
return false;
getAPIDs(apids_mode, apid_list);
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();
g_RemoteControl->current_PIDs = allpids;
g_RemoteControl->processAPIDnames();
for(it = apid_list.begin(); it != apid_list.end(); ++it) {
bool found = false;
for(unsigned int i = 0; i < rec_numpida; i++) {
if(rec_apids[i] == it->apid) {
found = true;
break;
}
}
if(!found) {
update = true;
printf("CVCRControl::CFileDevice::Update: apid %x not found in recording pids\n", it->apid);
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if(allpids.APIDs[i].pid == it->apid) {
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
audio_pids.selected = (audio_pids.epgAudioPid == (int) rec_currentapid) ? 1 : 0;
recMovieInfo->audioPids.push_back(audio_pids);
if(allpids.APIDs[i].is_ac3)
rec_ac3flags[rec_numpida] = 1;
if(allpids.APIDs[i].is_aac)
rec_ac3flags[rec_numpida] = 5;
rec_apids[rec_numpida] = allpids.APIDs[i].pid;
if(rec_apids[rec_numpida] == rec_currentapid)
rec_currentac3 = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
rec_numpida++;
}
}
}
}
if(!update) {
printf("CVCRControl::CFileDevice::Update: no update needed\n");
return false;
}
cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo);
/* neutrino check if vpid changed, so using 0 to disable vpid restart */
::update_recording(extMessage.c_str(), 0 /*si.vpid*/, rec_apids, rec_numpida);
return true;
}
bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata);
void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname)
{
char filename[512]; // UTF-8
char cmd[512];
std::string channel_name;
CEPGData epgData;
event_id_t epgid = 0;
unsigned int pos;
if(!fname) {
if(safe_mkdir((char *) "/hdd/screenshots/"))
return;
strcpy(filename, "/hdd/screenshots/");
pos = strlen(filename);
channel_name = g_Zapit->getChannelName(channel_id);
if (!(channel_name.empty())) {
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
ZapitTools::replace_char(&filename[pos]);
strcat(filename, "_");
}
pos = strlen(filename);
//if (g_Sectionsd->getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData))
if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData))
{};
epgid = epgData.eventID;
if(epgid != 0) {
CShortEPGData epgdata;
//if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) {
if(sectionsd_getEPGidShort(epgid, &epgdata)) {
if (!(epgdata.title.empty())) {
strcpy(&(filename[pos]), epgdata.title.c_str());
ZapitTools::replace_char(&filename[pos]);
}
}
}
pos = strlen(filename);
time_t t = time(NULL);
strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
strcat(filename, ".bmp");
} else
strcpy(filename, fname);
sprintf(cmd, "grab -v %s", filename);
printf("Executing %s\n", cmd);
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Saving screenshot..");
hintBox->paint();
system(cmd);
hintBox->hide();
delete hintBox;
}
//-------------------------------------------------------------------------
bool CVCRControl::CServerDevice::Stop()
{
printf("Stop\n");
bool return_value = sendCommand(CMD_VCR_STOP);
RestoreNeutrino();
return return_value;
}
//-------------------------------------------------------------------------
bool CVCRControl::CServerDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& epgTitle, unsigned char apids, const time_t /*epg_time*/)
{
printf("Record channel_id: "
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" epg: %llx, apids 0x%X mode %d\n",
channel_id,
epgid,
apids,
mode);
CutBackNeutrino(channel_id, mode);
if(!sendCommand(CMD_VCR_RECORD, channel_id, epgid, epgTitle, apids))
{
RestoreNeutrino();
DisplayErrorMessage(g_Locale->getText(LOCALE_STREAMINGSERVER_NOCONNECT));
return false;
}
else {
//ext_channel_name = g_Zapit->getChannelName(channel_id);
return true;
}
}
//-------------------------------------------------------------------------
void CVCRControl::CServerDevice::serverDisconnect()
{
close(sock_fd);
}
//-------------------------------------------------------------------------
bool CVCRControl::CServerDevice::sendCommand(CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apids)
{
printf("Send command: %d channel_id: "
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" epgid: %llx\n",
command,
channel_id,
epgid);
if(serverConnect())
{
std::string extMessage = getCommandString(command, channel_id, epgid, epgTitle, apids);
printf("sending to vcr-client:\n\n%s\n", extMessage.c_str());
write(sock_fd, extMessage.c_str() , extMessage.length() );
serverDisconnect();
deviceState = command;
return true;
}
else
return false;
}
//-------------------------------------------------------------------------
bool CVCRControl::CServerDevice::serverConnect()
{
printf("connect to server: %s:%d\n",ServerAddress.c_str(),ServerPort);
sock_fd=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
SAI servaddr;
memset(&servaddr,0,sizeof(SAI));
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(ServerPort);
inet_pton(AF_INET, ServerAddress.c_str(), &servaddr.sin_addr);
if(connect(sock_fd, (SA *)&servaddr, sizeof(servaddr))==-1)
{
perror("[cvcr] - cannot connect to streamingserver\n");
return false;
}
return true;
}
//-------------------------------------------------------------------------
std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const CVCRCommand /*command*/, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, APIDList apid_list, const time_t epg_time)
{
std::string extMessage;
std::string info1, info2;
if(!cMovieInfo)
cMovieInfo = new CMovieInfo();
if(!recMovieInfo)
recMovieInfo = new MI_MOVIE_INFO();
cMovieInfo->clearMovieInfo(recMovieInfo);
#if 0
CZapitClient::responseGetPIDs pids;
g_Zapit->getPIDS (pids);
#endif
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();
std::string tmpstring = g_Zapit->getChannelName(channel_id);
if (tmpstring.empty())
recMovieInfo->epgChannel = "unknown";
else
recMovieInfo->epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
tmpstring = "not available";
if (epgid != 0) {
CEPGData epgdata;
if (sectionsd_getEPGid(epgid, epg_time, &epgdata)) {
tmpstring = epgdata.title;
info1 = epgdata.info1;
info2 = epgdata.info2;
recMovieInfo->parentalLockAge = epgdata.fsk;
if(epgdata.contentClassification.size() > 0 )
recMovieInfo->genreMajor = epgdata.contentClassification[0];
recMovieInfo->length = epgdata.epg_times.dauer / 60;
printf("fsk:%d, Genre:%d, Dauer: %d\r\n",recMovieInfo->parentalLockAge,recMovieInfo->genreMajor,recMovieInfo->length);
}
} else if (!epgTitle.empty()) {
tmpstring = epgTitle;
}
recMovieInfo->epgTitle = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
recMovieInfo->epgId = channel_id;
recMovieInfo->epgInfo1 = ZapitTools::UTF8_to_UTF8XML(info1.c_str());
recMovieInfo->epgInfo2 = ZapitTools::UTF8_to_UTF8XML(info2.c_str());
recMovieInfo->epgEpgId = epgid ;
recMovieInfo->epgMode = g_Zapit->getMode();
recMovieInfo->epgVideoPid = si.vpid;
recMovieInfo->VideoType = si.vtype;
rec_vpid = si.vpid;
rec_vtype = si.vtype;
rec_currentapid = si.apid;
memset(rec_apids, 0, sizeof(unsigned short)*REC_MAX_APIDS);
memset(rec_ac3flags, 0, sizeof(unsigned short)*REC_MAX_APIDS);
rec_numpida = 0;
EPG_AUDIO_PIDS audio_pids;
/* super hack :-), der einfachste weg an die apid descriptions ranzukommen */
g_RemoteControl->current_PIDs = allpids;
g_RemoteControl->processAPIDnames();
APIDList::iterator it;
for(unsigned int i= 0; i< allpids.APIDs.size(); i++) {
for(it = apid_list.begin(); it != apid_list.end(); ++it) {
if(allpids.APIDs[i].pid == it->apid) {
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
audio_pids.selected = (audio_pids.epgAudioPid == (int) rec_currentapid) ? 1 : 0;
recMovieInfo->audioPids.push_back(audio_pids);
if(allpids.APIDs[i].is_ac3)
rec_ac3flags[rec_numpida] = 1;
if(allpids.APIDs[i].is_aac)
rec_ac3flags[rec_numpida] = 5;
rec_apids[rec_numpida] = allpids.APIDs[i].pid;
if(rec_apids[rec_numpida] == rec_currentapid)
rec_currentac3 = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
rec_numpida++;
}
}
}
/* FIXME sometimes no apid in xml ?? */
if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) {
int i = 0;
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
audio_pids.selected = 1;
recMovieInfo->audioPids.push_back(audio_pids);
}
recMovieInfo->epgVTXPID = si.vtxtpid;
cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo);
return extMessage;
}

View File

@@ -1,230 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __vcrcontrol__
#define __vcrcontrol__
#include <string>
//#include <map>
#include <list>
#include <sectionsdclient/sectionsdclient.h>
#include <timerdclient/timerdclient.h>
#include <neutrinoMessages.h>
#include <gui/movieinfo.h>
#define REC_MAX_APIDS 10
#define REC_MAX_PIDS 13
class CVCRControl
{
public:
typedef enum CVCRStates
{
CMD_VCR_UNKNOWN = 0,
CMD_VCR_RECORD = 1,
CMD_VCR_STOP = 2,
CMD_VCR_PAUSE = 3,
CMD_VCR_RESUME = 4,
CMD_VCR_AVAILABLE = 5
} CVCRCommand;
enum CVCRDevices
{
DEVICE_VCR,
DEVICE_SERVER,
DEVICE_FILE
};
class CDevice // basisklasse f<>r die devices
{
public:
int sock_fd;
int last_mode;
time_t start_time;
virtual CVCRDevices getDeviceType(void) const = 0;
CVCRStates deviceState;
virtual bool Stop() = 0;
virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0) = 0; // epg_time added for .xml (MovieBrowser)
virtual bool Pause() = 0;
virtual bool Resume() = 0;
virtual bool Update() = 0;
virtual bool IsAvailable() = 0;
CDevice() { deviceState = CMD_VCR_STOP; cMovieInfo = NULL; recMovieInfo = NULL; rec_numpida = 0; rec_vpid = 0;};
virtual ~CDevice(){};
typedef struct {
unsigned short apid;
unsigned int index;
bool ac3;
} APIDDesc;
typedef std::list<APIDDesc> APIDList;
virtual void getAPIDs(const unsigned char apidmode, APIDList & apid_list);
CMovieInfo * cMovieInfo;
MI_MOVIE_INFO * recMovieInfo;
unsigned short rec_vpid;
unsigned short rec_vtype;
unsigned short rec_apids[REC_MAX_APIDS];
unsigned short rec_ac3flags[REC_MAX_APIDS];
unsigned short rec_numpida;
unsigned short rec_currentapid, rec_currentac3;
unsigned char apids_mode;
CZapitClient::responseGetPIDs allpids;
};
class CVCRDevice : public CDevice // VCR per IR
{
public:
bool SwitchToScart;
virtual CVCRDevices getDeviceType(void) const
{
return DEVICE_VCR;
};
virtual bool Stop();
virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser)
virtual bool Pause() { return false; };
virtual bool Resume() { return false; };
virtual bool Update() { return false; };
virtual bool IsAvailable() { return true; };
CVCRDevice(bool switchtoscart) { SwitchToScart = switchtoscart; };
virtual ~CVCRDevice(){};
};
class CFileAndServerDevice : public CDevice
{
protected:
void RestoreNeutrino(void);
void CutBackNeutrino(const t_channel_id channel_id, const int mode);
std::string getCommandString(const CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode);
std::string getMovieInfoString(const CVCRCommand command, const t_channel_id channel_id,const event_id_t epgid, const std::string& epgTitle, APIDList apid_list, const time_t epg_time);
public:
bool StopPlayBack;
bool StopSectionsd;
virtual bool Pause() { return false; };
virtual bool Resume() { return false; };
virtual bool Update() { return false; };
virtual bool IsAvailable() { return true; };
};
class CFileDevice : public CFileAndServerDevice
{
public:
std::string Directory;
unsigned int SplitSize;
bool Use_O_Sync;
bool Use_Fdatasync;
bool StreamVTxtPid;
bool StreamPmtPid;
unsigned int RingBuffers;
virtual CVCRDevices getDeviceType(void) const
{
return DEVICE_FILE;
};
virtual bool Stop();
virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser)
virtual bool Update(void);
CFileDevice(const bool stopplayback, const bool stopsectionsd, const char * const directory, const unsigned int splitsize, const bool use_o_sync, const bool use_fdatasync, const bool stream_vtxt_pid, const bool stream_pmt_pid, const unsigned int ringbuffers)
{
StopPlayBack = stopplayback;
StopSectionsd = stopsectionsd;
Directory = directory;
SplitSize = splitsize;
Use_O_Sync = use_o_sync;
Use_Fdatasync = use_fdatasync;
StreamVTxtPid = stream_vtxt_pid;
StreamPmtPid = stream_pmt_pid;
RingBuffers = ringbuffers;
};
virtual ~CFileDevice()
{
};
};
class CServerDevice : public CFileAndServerDevice // externer Streamingserver per tcp
{
private:
bool serverConnect();
void serverDisconnect();
bool sendCommand(CVCRCommand command, const t_channel_id channel_id = 0, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0);
public:
std::string ServerAddress;
unsigned int ServerPort;
virtual CVCRDevices getDeviceType(void) const
{
return DEVICE_SERVER;
};
virtual bool Stop();
virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser)
CServerDevice(const bool stopplayback, const bool stopsectionsd, const char * const serveraddress, const unsigned int serverport)
{
StopPlayBack = stopplayback;
StopSectionsd = stopsectionsd;
ServerAddress = serveraddress;
ServerPort = serverport;
};
virtual ~CServerDevice(){};
};
public:
CVCRControl();
~CVCRControl();
static CVCRControl * getInstance();
CDevice * Device;
void registerDevice(CDevice * const device);
void unregisterDevice();
inline bool isDeviceRegistered(void) const { return (Device != NULL); };
inline CVCRStates getDeviceState(void) const { return Device->deviceState; };
bool Stop(){return Device->Stop();};
bool Record(const CTimerd::RecordingInfo * const eventinfo);
bool Pause(){return Device->Pause();};
bool Resume(){return Device->Resume();};
bool Update() {return Device->Update();};
void Screenshot(const t_channel_id channel_id, char * fname = NULL);
MI_MOVIE_INFO * GetMovieInfo(void);
bool GetPids(unsigned short *vpid, unsigned short *vtype, unsigned short *apid, unsigned short *atype, unsigned short * apidnum, unsigned short * apids, unsigned short * atypes);
};
#endif