@@ -303,6 +303,7 @@
sc.backupHack = -1;
sc.backupInterval = -1;
sc.fastdigibox_change = -1;
+ fd_radio = -1;
}
cPluginAnalogtv::~cPluginAnalogtv()
@@ -284,11 +284,17 @@
firstVideoPts = 0;
-
- if (pids[2] == -1) {
- Apid = pids[1]; // ptAudio
- Vpid = pids[0]; // ptVideo
- Ppid = -1; // ptPcr
+ if (fd_radio >= 0) {
+ Apid = pids[0];
+ Vpid = -1;
+ Ppid = -1;
+ dropAudio = false;
+ d(1, "NEW Audio-PID=%d", Apid);
+ }
+ else if (pids[2] == -1) {
+ Apid = pids[1]; // ptAudio
+ Vpid = pids[0]; // ptVideo
+ Ppid = -1; // ptPcr
d(1, "NEW Audio-PID=%d, Video-PID=%d", Apid, Vpid);
}
@@ -300,12 +306,14 @@
d(1, "NEW Audio-PID=%d, Video-PID=%d, PCR-PID=%d", Apid, Vpid, Ppid);
}
+#if 0
if (isPVR) {
if (setPVRpids(Apid, Vpid, Ppid)) {
d(0, "Cannot set Pids on PVR-card%s", ciao);
return false;
}
}
+#endif
#ifdef DBG
log = fopen("/tmp/mpeg.log", "w");
@@ -28,6 +28,7 @@
#include <sys/soundcard.h>
#include <transform.h>
+#include <ctools.h>
extern void pes_in_ts(p2p *p);
#undef MIN
#undef MAX
@@ -40,6 +41,7 @@
#define MAXRETRIES 3
static p2p p2t;
+static p2t_t p2t_coque;
static UC *rbuffer[NUM_BUFS];
@@ -863,6 +865,26 @@
return cc;
}
+UC buffer_coque[BUFFSIZE];
+int r_coque;
+
+void pes_filt_coque(p2p *p)
+{
+ int factor = p->mpeg-1;
+ int aux;
+
+ if ( p->cid == 0xc0) {
+ aux = p->plength+6;
+ memcpy(buffer_coque + r_coque, p->buf, aux);
+ r_coque += aux;
+ }
+}
+
+void twrite_coque(uint8_t const *buf)
+{
+ write_buffer((UC*)buf, TS_SIZE, &p2t);
+}
+
int readPVR(int Apid, int Vpid)
{
register int f, r = 0, rv, rmax = 0, cc = 0, i;
@@ -880,6 +902,7 @@
p2t.vcounter = 0;
p2t.count1 = 0;
p2t.count0 = 0;
+ init_p2t(&p2t_coque,twrite_coque);
while (ReaderLoopRunning) {
if (dropPES) {
@@ -936,8 +959,16 @@
pes++;
spes += r;
- if (r > 0)
- get_pes(buffer, r, &p2t, pes_in_ts); // PES -> TS
+ if (r > 0) {
+ if (fd_radio >= 0) {
+ r_coque = 0;
+ get_pes(buffer, r, &p2t, pes_filt_coque); // SOLO AUDIO
+ if (r_coque > 0)
+ pes_to_ts(buffer_coque, r_coque, Apid, &p2t_coque); // PES -> TS
+ }
+ else
+ get_pes(buffer, r, &p2t, pes_in_ts); // PES -> TS
+ }
}
}
@@ -171,6 +171,8 @@
} CHANNELNAMES;
+_EXTERN int fd_radio;
+
_EXTERN SETUP s, sx, sc, sy;
_EXTERN char video_device[MAX_DEV_NAME];
Sólo en analogtv/: player-analogtv.o
@@ -183,9 +183,27 @@
}
if (opts & FREQUENCY) {
+ if (freq < 108000) {
+ if (fd_radio == -1) {
+ fd_radio = open ("/dev/radio",O_RDONLY);
+ }
+ freq = int((freq/1000.0f + .5/16) * 16);
+ }
+ else {
+ if (fd_radio >=0) {
+ close (fd_radio);
+ fd_radio = -1;
+ }
+ ofs = (ofs - 16) * FREQDELTA; // 16 is "ground zero"
+
+ freq = (freq + ofs) * 16 / 1000;
+ }
+
+#if 0
ofs = (ofs - 16) * FREQDELTA; // 16 is "ground zero"
freq = (freq + ofs) * 16 / 1000;
+#endif
memset(&vf, 0, sizeof(f));
vf.tuner = analogModule; // FIXME??