summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchang <chang@dev3>2013-01-09 04:34:32 (GMT)
committerchang <chang@dev3>2013-01-10 08:19:09 (GMT)
commit002baca6f449e7e96563300dd3bd8a4647c0b204 (patch)
treee00f9a7cd4143fd3fbb4ac1796db1d81890ad21d
parent5291d60e4531f5f31824f1aceab5b99229722131 (diff)
fix showiframe.
-rwxr-xr-xmeta-openvuplus/recipes-vuplus/showiframe/showiframe.bb21
-rw-r--r--meta-openvuplus/recipes-vuplus/showiframe/showiframe/showiframe.c93
-rw-r--r--meta-openvuplus/recipes-vuplus/showiframe/showiframe_1.8.bb9
3 files changed, 114 insertions, 9 deletions
diff --git a/meta-openvuplus/recipes-vuplus/showiframe/showiframe.bb b/meta-openvuplus/recipes-vuplus/showiframe/showiframe.bb
new file mode 100755
index 0000000..8a4eae1
--- /dev/null
+++ b/meta-openvuplus/recipes-vuplus/showiframe/showiframe.bb
@@ -0,0 +1,21 @@
+DESCRIPTION = "Small utilities specific to the Vuplus dvb receiver (for DVB v3)"
+SECTION = "base"
+PRIORITY = "optional"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://showiframe.c;md5=496e2fde81bc40a9879de703aa926fd6"
+
+PV = "1.81"
+PR = "r2"
+
+SRC_URI = "file://showiframe.c"
+
+S = "${WORKDIR}"
+
+do_compile() {
+ ${CC} -o showiframe showiframe.c
+}
+
+do_install() {
+ install -d ${D}/${bindir}/
+ install -m 0755 ${S}/showiframe ${D}/${bindir}/
+}
diff --git a/meta-openvuplus/recipes-vuplus/showiframe/showiframe/showiframe.c b/meta-openvuplus/recipes-vuplus/showiframe/showiframe/showiframe.c
new file mode 100644
index 0000000..3c99f73
--- /dev/null
+++ b/meta-openvuplus/recipes-vuplus/showiframe/showiframe/showiframe.c
@@ -0,0 +1,93 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+
+#include <linux/dvb/video.h>
+
+void c(int a)
+{
+ if (a < 0)
+ {
+ perror("ioctl");
+ exit(6);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ struct stat s;
+ if (argc != 2)
+ {
+ printf("usage: %s <iframe>\n", *argv);
+ return 3;
+ }
+
+ int f = open(argv[1], O_RDONLY);
+ if (f < 0)
+ {
+ perror(argv[1]);
+ return 4;
+ }
+ fstat(f, &s);
+
+ int fd = open("/dev/dvb/adapter0/video0", O_WRONLY|O_NONBLOCK);
+
+ if (fd <= 0)
+ {
+ perror("/dev/dvb/adapter0/video0");
+ return 2;
+ }
+ else if (fork() != 0)
+ return 0;
+ else
+ {
+ size_t pos=0;
+ int seq_end_avail = 0;
+
+ int count = 7;
+ /* 0x0 0x0 0x1 0xffffffe0 0x10 0x8 0xffffff80 0xffffff80 0x5 0x21 0x0 0x1 0x0 0x1 */
+
+ /* unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 }; */
+
+ unsigned char pes_header[] = {0x0, 0x0, 0x1, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x5, 0x21, 0x0, 0x1, 0x0, 0x1};
+
+ unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
+ unsigned char iframe[s.st_size];
+ unsigned char stuffing[8192];
+ memset(stuffing, 0, 8192);
+ read(f, iframe, s.st_size);
+ ioctl(fd, VIDEO_SET_STREAMTYPE, 0); // set to mpeg2
+ c(ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
+ c(ioctl(fd, VIDEO_PLAY));
+ c(ioctl(fd, VIDEO_CONTINUE));
+ c(ioctl(fd, VIDEO_CLEAR_BUFFER));
+ while(pos <= (s.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
+ ++pos;
+ while(count--){
+ if ((iframe[3] >> 4) != 0xE) // no pes header
+ {
+ write(fd, pes_header, sizeof(pes_header));
+ usleep(8000);
+ }
+ else {
+ iframe[4] = iframe[5] = 0x00;
+ }
+ write(fd, iframe, s.st_size);
+ usleep(8000);
+ }
+ if (!seq_end_avail)
+ write(fd, seq_end, sizeof(seq_end));
+ write(fd, stuffing, 8192);
+ usleep(150000);
+ c(ioctl(fd, VIDEO_STOP, 0));
+ c(ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX));
+ }
+ return 0;
+}
+
diff --git a/meta-openvuplus/recipes-vuplus/showiframe/showiframe_1.8.bb b/meta-openvuplus/recipes-vuplus/showiframe/showiframe_1.8.bb
deleted file mode 100644
index 1176e31..0000000
--- a/meta-openvuplus/recipes-vuplus/showiframe/showiframe_1.8.bb
+++ /dev/null
@@ -1,9 +0,0 @@
-SUMMARY = "Displays an IFrame using a LinuxTV video decoder"
-SECTION = "base"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://src/showiframe.c;endline=10;md5=513a8a3c6a14de8ef311dfa25fb0eaa6"
-PR = "r1"
-
-SRCREV = "f19e4b573ba755ca6300df72b0736e98c967aba5"
-
-inherit autotools opendreambox-git