annotate stream/tvi_def.h @ 25038:b2ae4a355a54

AV_WB16(..., 1000) more obviously represents one second that assigning 0x03 and 0xe8 (0x3e8 = 1000).
author reimar
date Sat, 17 Nov 2007 18:22:42 +0000
parents 9e71e0345c35
children c6c7a09bf439
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3815
622a9ade4517 updated
alex
parents: 3611
diff changeset
1 #include <stdlib.h> /* malloc */
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 5572
diff changeset
2 #include <string.h> /* memset */
3815
622a9ade4517 updated
alex
parents: 3611
diff changeset
3
622a9ade4517 updated
alex
parents: 3611
diff changeset
4 static int init(priv_t *priv);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
5 static int uninit(priv_t *priv);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
6 static int control(priv_t *priv, int cmd, void *arg);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
7 static int start(priv_t *priv);
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 3815
diff changeset
8 static double grab_video_frame(priv_t *priv, char *buffer, int len);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
9 static int get_video_framesize(priv_t *priv);
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 3815
diff changeset
10 static double grab_audio_frame(priv_t *priv, char *buffer, int len);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
11 static int get_audio_framesize(priv_t *priv);
98769cea155c added tv subsystem
alex
parents:
diff changeset
12
24017
d7bd74869672 Define teletext_control() in tvi_v4l.c and tvi_v4l2.c.
cehoyos
parents: 23423
diff changeset
13 int teletext_control(void* p, int cmd, void *arg);
d7bd74869672 Define teletext_control() in tvi_v4l.c and tvi_v4l2.c.
cehoyos
parents: 23423
diff changeset
14
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
15 static tvi_functions_t functions =
98769cea155c added tv subsystem
alex
parents:
diff changeset
16 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
17 init,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
18 uninit,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
19 control,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
20 start,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
21 grab_video_frame,
98769cea155c added tv subsystem
alex
parents:
diff changeset
22 get_video_framesize,
98769cea155c added tv subsystem
alex
parents:
diff changeset
23 grab_audio_frame,
98769cea155c added tv subsystem
alex
parents:
diff changeset
24 get_audio_framesize
98769cea155c added tv subsystem
alex
parents:
diff changeset
25 };
98769cea155c added tv subsystem
alex
parents:
diff changeset
26
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 8123
diff changeset
27 static tvi_handle_t *new_handle(void)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
28 {
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2802
diff changeset
29 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
30
98769cea155c added tv subsystem
alex
parents:
diff changeset
31 if (!h)
98769cea155c added tv subsystem
alex
parents:
diff changeset
32 return(NULL);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
33 h->priv = (priv_t *)malloc(sizeof(priv_t));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
34 if (!h->priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
35 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
36 free(h);
98769cea155c added tv subsystem
alex
parents:
diff changeset
37 return(NULL);
98769cea155c added tv subsystem
alex
parents:
diff changeset
38 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
39 memset(h->priv, 0, sizeof(priv_t));
98769cea155c added tv subsystem
alex
parents:
diff changeset
40 h->functions = &functions;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
41 h->seq = 0;
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
42 h->chanlist = -1;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
43 h->chanlist_s = NULL;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
44 h->norm = -1;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
45 h->channel = -1;
24105
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 24104
diff changeset
46 h->scan = NULL;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
47 return(h);
98769cea155c added tv subsystem
alex
parents:
diff changeset
48 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
49
98769cea155c added tv subsystem
alex
parents:
diff changeset
50 static void free_handle(tvi_handle_t *h)
98769cea155c added tv subsystem
alex
parents:
diff changeset
51 {
3611
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
52 if (h) {
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
53 if (h->priv)
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
54 free(h->priv);
24105
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 24104
diff changeset
55 if (h->scan)
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 24104
diff changeset
56 free(h->scan);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
57 free(h);
3611
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
58 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
59 }
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
60
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
61 /**
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
62 Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2.
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
63 Other formats will be filled with 0xC0
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
64 */
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
65 static inline void fill_blank_frame(char* buffer,int len,int fmt){
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
66 int i;
24104
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
67 // RGB(0,0,255) <-> YVU(41,110,240)
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
68
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
69 switch(fmt){
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
70 case IMGFMT_YV12:
24104
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
71 memset(buffer, 41,4*len/6); //Y
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
72 memset(buffer+4*len/6, 110,len/6);//V
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
73 memset(buffer+5*len/6, 240,len/6);//U
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
74 break;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
75 case IMGFMT_I420:
24104
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
76 memset(buffer, 41,4*len/6); //Y
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
77 memset(buffer+4*len/6, 240,len/6);//U
b0a47d3bf2f3 Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents: 24017
diff changeset
78 memset(buffer+5*len/6, 110,len/6);//V
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
79 break;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
80 case IMGFMT_UYVY:
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
81 for(i=0;i<len;i+=4){
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
82 buffer[i]=0xFF;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
83 buffer[i+1]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
84 buffer[i+2]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
85 buffer[i+3]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
86 }
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
87 break;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
88 case IMGFMT_YUY2:
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
89 for(i=0;i<len;i+=4){
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
90 buffer[i]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
91 buffer[i+1]=0xFF;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
92 buffer[i+2]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
93 buffer[i+3]=0;
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
94 }
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
95 break;
23423
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
96 case IMGFMT_MJPEG:
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
97 /*
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
98 This is compressed format. I don't know yet how to fill such frame with blue color.
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
99 Keeping frame unchanged.
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
100 */
6b18c979dd45 mjpeg support for v4l2 tv:// driver
voroshil
parents: 23422
diff changeset
101 break;
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
102 default:
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
103 memset(buffer,0xC0,len);
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
104 }
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23362
diff changeset
105 }