1 diff --git a/.gitignore b/.gitignore
2 index ccfb515..a6f8d11 100644
5 @@ -16,3 +16,4 @@ install-sh
10 diff --git a/main.c b/main.c
11 index 190ff5f..3a2ba51 100644
16 -AiO Dreambox Screengrabber v0.83a
17 +AiO Screengrabber v0.83a
19 written 2006 - 2009 by Seddi
20 Contact: seddi@ihad.tv / http://www.ihad.tv
21 @@ -38,6 +38,7 @@ Feel free to use the code for your own projects. See LICENSE file for details.
23 #include <sys/types.h>
29 @@ -101,10 +102,24 @@ static void combine(unsigned char *output,
30 const unsigned char *video, const unsigned char *osd,
31 unsigned int xres, unsigned int yres);
35 +enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405,BRCM7335,BRCM7325,BRCM7346,BRCM7425,BRCM7362};
36 +char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405","Brcm7335","Brcm7325","Brcm7346","Brcm7425\/7241","Brcm7362"};
38 enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405};
39 static const char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405"};
41 static int stb_type=UNKNOWN;
43 +char* upcase(char* mixedstr)
46 + for (j=0; j< strlen(mixedstr); ++j)
47 + mixedstr[j]=toupper(mixedstr[j]);
51 static const char *file_getline(const char *filename)
53 static char *line = NULL;
54 @@ -184,10 +199,9 @@ static int file_scanf_lines(const char *filename, const char *fmt, ...)
59 int main(int argc, char **argv) {
61 - printf("AiO Dreambox Screengrabber " PACKAGE_VERSION "\n\n");
62 + printf("AiO Screengrabber " PACKAGE_VERSION "\n\n");
64 unsigned int xres_v = 0,yres_v = 0,xres_o,yres_o,xres,yres,aspect,width;
65 int c,osd_only,video_only,use_osd_res,use_png,use_jpg,jpg_quality,no_aspect,use_letterbox;
66 @@ -205,11 +219,33 @@ int main(int argc, char **argv) {
67 char filename[256] = { "/tmp/screenshot.bmp" };
70 - const char *line = file_getline("/proc/fb");
71 + char *line = (char*)file_getline("/proc/fb");
75 if (strstr(line, "bcmfb")) {
77 + if((line=(char*)file_getline("/proc/stb/info/chipset")) == NULL)
79 + if (strstr(upcase(line),"7335"))
81 + else if (strstr(upcase(line),"7325"))
83 + else if (strstr(upcase(line),"7405"))
85 + else if (strstr(upcase(line),"7356"))
87 + else if (strstr(upcase(line),"7346"))
89 + else if (strstr(upcase(line),"7424"))
91 + else if (strstr(upcase(line),"7425"))
93 + else if (strstr(upcase(line),"7241"))
95 + else if (strstr(upcase(line),"7362"))
98 line = file_getline("/proc/stb/info/model");
101 @@ -221,6 +257,7 @@ int main(int argc, char **argv) {
102 !strcmp(line, "dm800se") ||
103 !strcmp(line, "dm7020hd"))
106 } else if (strstr(line, "xilleonfb")) {
108 } else if (strstr(line, "Pallas FB")) {
109 @@ -563,16 +600,34 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
115 + if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425 || stb_type == BRCM7362)
117 if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405)
120 // grab brcm7401 pic from decoder memory
122 + off_t offset_addr = 0x10600000;
128 + case BRCM7325: offset_addr = 0x10100000; break;
130 + unsigned char *memory = mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, offset_addr);
131 + if (memory == MAP_FAILED) {
136 unsigned char *memory = mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10100000);
137 if (memory == MAP_FAILED) {
143 unsigned char data[100];
145 unsigned int adr,adr2,ofs,ofs2,offset/*,vert_start,vert_end*/;
146 @@ -582,12 +637,30 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
147 memcpy(data,memory,100);
148 //vert_start=data[0x1B]<<8|data[0x1A];
149 //vert_end=data[0x19]<<8|data[0x18];
151 + if(stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325) {
152 + stride=data[0x15]<<8|data[0x14];
153 + ofs=(data[0x28]<<8|data[0x27])>>4;
154 + ofs2=(data[0x2c]<<8|data[0x2b])>>4;
155 + adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
156 + adr2=(data[0x23]<<24|data[0x22]<<16|data[0x21]<<8|data[0x20])&0xFFFFFF00;
159 + stride=data[0x15]<<8|data[0x14];
160 + ofs=(data[0x3c]<<8|data[0x3b])>>4;
161 + ofs2=(data[0x40]<<8|data[0x3f])>>4;
162 + adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
163 + adr2=(data[0x37]<<24|data[0x36]<<16|data[0x35]<<8|data[0x34])&0xFFFFFF00;
167 stride=data[0x15]<<8|data[0x14];
168 ofs=(data[0x28]<<8|data[0x27])>>4;
169 ofs2=(data[0x2c]<<8|data[0x2b])>>4;
170 adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
171 adr2=(data[0x23]<<24|data[0x22]<<16|data[0x21]<<8|data[0x20])&0xFFFFFF00;
177 @@ -609,7 +682,11 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
180 // grabbing luma & chroma plane from the decoder memory
182 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425 || stb_type == BRCM7362 ) {
184 if (stb_type == BRCM7401 || stb_type == BRCM7405) {
186 // on dm800/dm500hd we have direct access to the decoder memory
187 memory = mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr);
188 if (memory == MAP_FAILED) {
189 @@ -620,7 +697,11 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
190 usleep(50000); // we try to get a full picture, its not possible to get a sync from the decoder so we use a delay
191 // and hope we get a good timing. dont ask me why, but every DM800 i tested so far produced a good
192 // result with a 50ms delay
194 + } else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
196 } else if (stb_type == BRCM7400) {
198 // on dm8000 we have to use dma, so dont change anything here until you really know what you are doing !
201 @@ -639,7 +720,11 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
204 volatile unsigned long *mem_dma;
206 + mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, (stb_type==BRCM7400)?0x10c02000:0x10c01000);
208 mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, 0x10c02000);
210 if (mem_dma == MAP_FAILED) {
213 @@ -675,8 +760,11 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
214 unsigned int t = 0, t2 = 0, dat1 = 0;
215 unsigned int chr_luma_stride = 0x40;
219 + if (stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425)
221 if (stb_type == BRCM7405)
223 chr_luma_stride *= 2;
225 xsub=chr_luma_stride;
226 @@ -710,10 +798,17 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
232 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425 || stb_type == BRCM7362) {
234 if (stb_type == BRCM7401 || stb_type == BRCM7405)
236 munmap(memory, offset + stride * (ofs2 + 64));
238 + } else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
240 else if (stb_type == BRCM7400) {
243 munmap(memory, DMA_BLOCKSIZE + 0x1000);