source: titan/titan/showiframe.h @ 10994

Last change on this file since 10994 was 10380, checked in by nit, 12 years ago

[titan] update TS

File size: 1.3 KB
Line 
1#ifndef SHOWIFRAME_H
2#define SHOWIFRAME_H
3
4int singlepicstart(const char *filename)
5{
6        debug(1000, "in -> %s", filename);
7        int ret = 0;
8
9        if(status.aktservice->type != STILLPIC)
10        {
11                ret = servicestop(status.aktservice, 0, 1);
12                if(ret == 1) return 1;
13        }
14
15        int fd = open(filename, O_RDONLY);
16        if(fd >= 0)
17        {
18                struct dvbdev* videonode = NULL;
19                struct stat s;
20                fstat(fd, &s);
21
22                if(status.aktservice->type != STILLPIC)
23                {
24                        videonode = videoopen(0);
25                        videoselectsource(videonode, VIDEO_SOURCE_MEMORY);
26
27                        videosetformat(videonode, VIDEO_FORMAT_16_9);
28                        videosetstreamtype(videonode, MPEGV);
29                        videoplay(videonode);
30                }       
31                else
32                        videonode = status.aktservice->videodev;
33
34                if(videonode != NULL)
35                {
36                        struct video_still_picture stillpic;
37                        char* iframe = NULL;
38
39                        iframe = malloc(s.st_size);
40                        if(iframe == NULL)
41                        {
42                                err("no mem");
43                                close(fd);
44                                return 1;
45                        }
46
47                        status.aktservice->type = STILLPIC;
48                        status.aktservice->videodev = videonode;
49
50                        TEMP_FAILURE_RETRY(read(fd, iframe, s.st_size));
51                        stillpic.iFrame = iframe;
52                        stillpic.size = s.st_size;
53
54                        videoclearbuffer(videonode);
55                        videostillpicture(videonode, &stillpic);
56
57                        free(iframe); iframe = NULL;
58                }
59                close(fd);
60        }
61        else
62        {
63                err("open %s\n", filename);
64                return 1;
65        }
66        debug(1000, "out");
67        return 0;
68}
69
70#endif
Note: See TracBrowser for help on using the repository browser.