Mercurial > mplayer.hg
annotate stream/tvi_def.h @ 28667:8363a6c42ace
Accept DVB API 5, patch by Steven Brudenell, steven.brudenell gmail com.
author | diego |
---|---|
date | Sun, 22 Feb 2009 14:12:33 +0000 |
parents | c43ce7268677 |
children | 0f1b5b68af32 |
rev | line source |
---|---|
26029 | 1 #ifndef MPLAYER_TVI_DEF_H |
2 #define MPLAYER_TVI_DEF_H | |
26012 | 3 |
3815 | 4 #include <stdlib.h> /* malloc */ |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
5572
diff
changeset
|
5 #include <string.h> /* memset */ |
26184
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
6 #include "libmpcodecs/img_format.h" |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
7 #include "tv.h" |
3815 | 8 |
9 static int init(priv_t *priv); | |
2802 | 10 static int uninit(priv_t *priv); |
2790 | 11 static int control(priv_t *priv, int cmd, void *arg); |
2802 | 12 static int start(priv_t *priv); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
3815
diff
changeset
|
13 static double grab_video_frame(priv_t *priv, char *buffer, int len); |
2790 | 14 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
|
15 static double grab_audio_frame(priv_t *priv, char *buffer, int len); |
2790 | 16 static int get_audio_framesize(priv_t *priv); |
17 | |
24017
d7bd74869672
Define teletext_control() in tvi_v4l.c and tvi_v4l2.c.
cehoyos
parents:
23423
diff
changeset
|
18 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
|
19 |
25684 | 20 static const tvi_functions_t functions = |
2790 | 21 { |
22 init, | |
2802 | 23 uninit, |
2790 | 24 control, |
2802 | 25 start, |
2790 | 26 grab_video_frame, |
27 get_video_framesize, | |
28 grab_audio_frame, | |
29 get_audio_framesize | |
30 }; | |
31 | |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
8123
diff
changeset
|
32 static tvi_handle_t *new_handle(void) |
2790 | 33 { |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2802
diff
changeset
|
34 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t)); |
2790 | 35 |
36 if (!h) | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
26184
diff
changeset
|
37 return NULL; |
2802 | 38 h->priv = (priv_t *)malloc(sizeof(priv_t)); |
2790 | 39 if (!h->priv) |
40 { | |
41 free(h); | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
26184
diff
changeset
|
42 return NULL; |
2790 | 43 } |
44 memset(h->priv, 0, sizeof(priv_t)); | |
45 h->functions = &functions; | |
2802 | 46 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
|
47 h->chanlist = -1; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2819
diff
changeset
|
48 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
|
49 h->norm = -1; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2819
diff
changeset
|
50 h->channel = -1; |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
24104
diff
changeset
|
51 h->scan = NULL; |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
26184
diff
changeset
|
52 return h; |
2790 | 53 } |
54 | |
55 static void free_handle(tvi_handle_t *h) | |
56 { | |
3611 | 57 if (h) { |
58 if (h->priv) | |
59 free(h->priv); | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
24104
diff
changeset
|
60 if (h->scan) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
24104
diff
changeset
|
61 free(h->scan); |
2790 | 62 free(h); |
3611 | 63 } |
2790 | 64 } |
23422 | 65 |
66 /** | |
67 Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2. | |
68 Other formats will be filled with 0xC0 | |
69 */ | |
70 static inline void fill_blank_frame(char* buffer,int len,int fmt){ | |
71 int i; | |
24104
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
72 // RGB(0,0,255) <-> YVU(41,110,240) |
23422 | 73 |
74 switch(fmt){ | |
75 case IMGFMT_YV12: | |
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, 110,len/6);//V |
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
78 memset(buffer+5*len/6, 240,len/6);//U |
23422 | 79 break; |
80 case IMGFMT_I420: | |
24104
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
81 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
|
82 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
|
83 memset(buffer+5*len/6, 110,len/6);//V |
23422 | 84 break; |
85 case IMGFMT_UYVY: | |
86 for(i=0;i<len;i+=4){ | |
87 buffer[i]=0xFF; | |
88 buffer[i+1]=0; | |
89 buffer[i+2]=0; | |
90 buffer[i+3]=0; | |
91 } | |
92 break; | |
93 case IMGFMT_YUY2: | |
94 for(i=0;i<len;i+=4){ | |
95 buffer[i]=0; | |
96 buffer[i+1]=0xFF; | |
97 buffer[i+2]=0; | |
98 buffer[i+3]=0; | |
99 } | |
100 break; | |
23423 | 101 case IMGFMT_MJPEG: |
102 /* | |
103 This is compressed format. I don't know yet how to fill such frame with blue color. | |
104 Keeping frame unchanged. | |
105 */ | |
106 break; | |
23422 | 107 default: |
108 memset(buffer,0xC0,len); | |
109 } | |
110 } | |
26012 | 111 |
26029 | 112 #endif /* MPLAYER_TVI_DEF_H */ |