libspark: experimental pip changes (doesn't work; needs driver support)

Origin commit data
------------------
Branch: master
Commit: 178fac0e8d
Author: martii <m4rtii@gmx.de>
Date: 2013-06-20 (Thu, 20 Jun 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-06-20 13:29:54 +02:00
parent 04c969a8f6
commit 5352649a05
3 changed files with 38 additions and 10 deletions

View File

@@ -71,6 +71,7 @@
/* Ugh... see comment in destructor for details... */ /* Ugh... see comment in destructor for details... */
#include "video_lib.h" #include "video_lib.h"
extern cVideo *videoDecoder; extern cVideo *videoDecoder;
extern cVideo *pipDecoder;
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args)
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args)
@@ -90,6 +91,7 @@ extern cVideo *videoDecoder;
cDemux *videoDemux = NULL; cDemux *videoDemux = NULL;
cDemux *audioDemux = NULL; cDemux *audioDemux = NULL;
//cDemux *pcrDemux = NULL; //cDemux *pcrDemux = NULL;
cDemux *pipDemux = NULL;
static const char *DMX_T[] = { static const char *DMX_T[] = {
"DMX_INVALID", "DMX_INVALID",
@@ -154,6 +156,8 @@ cDemux::~cDemux()
*/ */
if (dmx_type == DMX_VIDEO_CHANNEL) if (dmx_type == DMX_VIDEO_CHANNEL)
videoDecoder = NULL; videoDecoder = NULL;
if (dmx_type == DMX_PIP_CHANNEL)
pipDecoder = NULL;
} }
bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize)
@@ -500,6 +504,9 @@ bool cDemux::pesFilter(const unsigned short pid)
p_flt.pes_type = DMX_PES_OTHER; p_flt.pes_type = DMX_PES_OTHER;
p_flt.output = DMX_OUT_TSDEMUX_TAP; p_flt.output = DMX_OUT_TSDEMUX_TAP;
break; break;
case DMX_PIP_CHANNEL:
p_flt.pes_type = DMX_PES_VIDEO1;
break;
default: default:
lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type);
return false; return false;

View File

@@ -34,7 +34,7 @@
#include <linux/dvb/video.h> #include <linux/dvb/video.h>
#include <linux/stmfb.h> #include <linux/stmfb.h>
#include "video_lib.h" #include "video_lib.h"
#define VIDEO_DEVICE "/dev/dvb/adapter0/video0" #define VIDEO_DEVICE_FMT "/dev/dvb/adapter0/video%d"
#include "lt_debug.h" #include "lt_debug.h"
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args)
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args)
@@ -53,6 +53,7 @@
_r; \ _r; \
}) })
cVideo * pipDecoder = NULL;
cVideo * videoDecoder = NULL; cVideo * videoDecoder = NULL;
int system_rev = 0; int system_rev = 0;
@@ -141,7 +142,7 @@ out:
} }
cVideo::cVideo(int, void *, void *) cVideo::cVideo(int, void *, void *, int _dev)
{ {
lt_debug("%s\n", __FUNCTION__); lt_debug("%s\n", __FUNCTION__);
@@ -150,6 +151,7 @@ cVideo::cVideo(int, void *, void *)
scartvoltage = -1; scartvoltage = -1;
video_standby = 0; video_standby = 0;
fd = -1; fd = -1;
dev = _dev;
openDevice(); openDevice();
} }
@@ -165,8 +167,10 @@ void cVideo::openDevice(void)
/* todo: this fd checking is racy, should be protected by a lock */ /* todo: this fd checking is racy, should be protected by a lock */
if (fd != -1) /* already open */ if (fd != -1) /* already open */
return; return;
char vd[sizeof(VIDEO_DEVICE_FMT) + 10];
snprintf(vd, sizeof(vd), VIDEO_DEVICE_FMT, dev);
retry: retry:
if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0) if ((fd = open(vd, O_RDWR)) < 0)
{ {
if (errno == EBUSY) if (errno == EBUSY)
{ {
@@ -175,7 +179,7 @@ retry:
if (++n < 10) if (++n < 10)
goto retry; goto retry;
} }
lt_info("%s cannot open %s: %m, retries %d\n", __func__, VIDEO_DEVICE, n); lt_info("%s cannot open %s: %m, retries %d\n", __func__, vd, n);
} }
else else
fcntl(fd, F_SETFD, FD_CLOEXEC); fcntl(fd, F_SETFD, FD_CLOEXEC);
@@ -193,6 +197,12 @@ void cVideo::closeDevice(void)
playstate = VIDEO_STOPPED; playstate = VIDEO_STOPPED;
} }
void cVideo::SetDemux(cDemux * /*dmx*/)
{
lt_debug("%s\n", __func__);
// FIXME, stub only
}
int cVideo::setAspectRatio(int aspect, int mode) int cVideo::setAspectRatio(int aspect, int mode)
{ {
static const char *a[] = { "n/a", "4:3", "14:9", "16:9" }; static const char *a[] = { "n/a", "4:3", "14:9", "16:9" };
@@ -226,7 +236,9 @@ int cVideo::getAspectRatio(void)
if (fd == -1) if (fd == -1)
{ {
/* in movieplayer mode, fd is not opened -> fall back to procfs */ /* in movieplayer mode, fd is not opened -> fall back to procfs */
int n = proc_get_hex("/proc/stb/vmpeg/0/aspect"); char tmp[100];
snprintf(tmp, sizeof(tmp), "/proc/stb/vmpeg/%d/aspect", dev);
int n = proc_get_hex(tmp);
return n * 2 + 1; return n * 2 + 1;
} }
if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0) if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0)
@@ -567,7 +579,9 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, i
} }
lt_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres); lt_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres);
sprintf(buffer, "%x %x %x %x", _x, _y, _w, _h); sprintf(buffer, "%x %x %x %x", _x, _y, _w, _h);
proc_put("/proc/stb/vmpeg/0/dst_all", buffer, strlen(buffer)); char tmp[100];
snprintf(tmp, sizeof(tmp), "/proc/stb/vmpeg/%d/dst_all", dev);
proc_put(tmp, buffer, strlen(buffer));
} }
static inline int rate2csapi(int rate) static inline int rate2csapi(int rate)
@@ -603,9 +617,13 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate)
if (fd == -1) if (fd == -1)
{ {
/* in movieplayer mode, fd is not opened -> fall back to procfs */ /* in movieplayer mode, fd is not opened -> fall back to procfs */
r = proc_get_hex("/proc/stb/vmpeg/0/framerate"); char tmp[100];
width = proc_get_hex("/proc/stb/vmpeg/0/xres"); snprintf(tmp, sizeof(tmp), "/proc/stb/vmpeg/%d/framerate", dev);
height = proc_get_hex("/proc/stb/vmpeg/0/yres"); r = proc_get_hex(tmp);
snprintf(tmp, sizeof(tmp), "/proc/stb/vmpeg/%d/xres", dev);
width = proc_get_hex(tmp);
snprintf(tmp, sizeof(tmp), "/proc/stb/vmpeg/%d/yres", dev);
height = proc_get_hex(tmp);
rate = rate2csapi(r); rate = rate2csapi(r);
return; return;
} }

View File

@@ -3,6 +3,7 @@
#include <linux/dvb/video.h> #include <linux/dvb/video.h>
#include "../common/cs_types.h" #include "../common/cs_types.h"
#include "dmx_lib.h"
typedef enum { typedef enum {
ANALOG_SD_RGB_CINCH = 0x00, ANALOG_SD_RGB_CINCH = 0x00,
@@ -119,6 +120,7 @@ class cVideo
private: private:
/* video device */ /* video device */
int fd; int fd;
int dev;
/* apparently we cannot query the driver's state /* apparently we cannot query the driver's state
=> remember it */ => remember it */
video_play_state_t playstate; video_play_state_t playstate;
@@ -141,7 +143,7 @@ class cVideo
void closeDevice(void); void closeDevice(void);
public: public:
/* constructor & destructor */ /* constructor & destructor */
cVideo(int mode, void *, void *); cVideo(int mode, void *, void *, int dev = 0);
~cVideo(void); ~cVideo(void);
void * GetTVEnc() { return NULL; }; void * GetTVEnc() { return NULL; };
@@ -189,6 +191,7 @@ class cVideo
int CloseVBI(void) { return 0; }; int CloseVBI(void) { return 0; };
int StartVBI(unsigned short) { return 0; }; int StartVBI(unsigned short) { return 0; };
int StopVBI(void) { return 0; }; int StopVBI(void) { return 0; };
void SetDemux(cDemux *dmx);
}; };
#endif #endif