annotate stream/tvi_dummy.c @ 32182:c40f52d5d4c3

Add _XOPEN_SOURCE >= 500 #define to mkstemp check; mkstemp() requires it.
author diego
date Thu, 16 Sep 2010 14:38:03 +0000
parents 2802b8095bf7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
1 /*
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
2 * Only a sample!
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
4 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
5 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
7 * it under the terms of the GNU General Public License as published by
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
9 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
10 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
14 * GNU General Public License for more details.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
15 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
16 * You should have received a copy of the GNU General Public License along
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 26756
diff changeset
19 */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
20
98769cea155c added tv subsystem
alex
parents:
diff changeset
21 #include "config.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
22
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
23 #include <stdio.h>
19431
ac69ba536915 Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents: 19271
diff changeset
24 #include "libmpcodecs/img_format.h"
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
25 #include "tv.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
26
23883
d65439444b75 Removing global variables from tv://
voroshil
parents: 23362
diff changeset
27 static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
28 /* information about this file */
25689
7d5823bd4517 Make all tvi_info_t const
reimar
parents: 23883
diff changeset
29 const tvi_info_t tvi_info_dummy = {
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 19431
diff changeset
30 tvi_init_dummy,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
31 "NULL-TV",
98769cea155c added tv subsystem
alex
parents:
diff changeset
32 "dummy",
98769cea155c added tv subsystem
alex
parents:
diff changeset
33 "alex",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
34 NULL
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
35 };
98769cea155c added tv subsystem
alex
parents:
diff changeset
36
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
37 /* private data's */
31322
016194f71de3 Fix function pointer types in tvi_functions struct
reimar
parents: 30426
diff changeset
38 typedef struct priv {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
39 int width;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
40 int height;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
41 } priv_t;
98769cea155c added tv subsystem
alex
parents:
diff changeset
42
98769cea155c added tv subsystem
alex
parents:
diff changeset
43 #include "tvi_def.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
44
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
45 /* handler creator - entry point ! */
23883
d65439444b75 Removing global variables from tv://
voroshil
parents: 23362
diff changeset
46 static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
47 {
32141
2802b8095bf7 Move TV input new_handle static function to tv.c and make it non-static.
diego
parents: 31322
diff changeset
48 return tv_new_handle(sizeof(priv_t), &functions);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
49 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
50
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
51 /* initialisation */
3815
622a9ade4517 updated
alex
parents: 3375
diff changeset
52 static int init(priv_t *priv)
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
53 {
3375
5fb624943c90 default size 320x200
alex
parents: 2837
diff changeset
54 priv->width = 320;
5fb624943c90 default size 320x200
alex
parents: 2837
diff changeset
55 priv->height = 200;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
56 return 1;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
57 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
58
09d5c9834580 tv update
alex
parents: 2790
diff changeset
59 /* that's the real start, we'got the format parameters (checked with control) */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
60 static int start(priv_t *priv)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
61 {
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
62 return 1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
63 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
64
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
65 static int uninit(priv_t *priv)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
66 {
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
67 return 1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
68 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
69
98769cea155c added tv subsystem
alex
parents:
diff changeset
70 static int control(priv_t *priv, int cmd, void *arg)
98769cea155c added tv subsystem
alex
parents:
diff changeset
71 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
72 switch(cmd)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
73 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
74 case TVI_CONTROL_IS_VIDEO:
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
75 return TVI_CONTROL_TRUE;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
76 case TVI_CONTROL_VID_GET_FORMAT:
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
77 // *(int *)arg = IMGFMT_YV12;
7319
20acd78d1239 fixed get_format/set_format
alex
parents: 5572
diff changeset
78 *(int *)arg = IMGFMT_YV12;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
79 return TVI_CONTROL_TRUE;
2815
alex
parents: 2802
diff changeset
80 case TVI_CONTROL_VID_SET_FORMAT:
alex
parents: 2802
diff changeset
81 {
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
82 // int req_fmt = *(int *)arg;
7319
20acd78d1239 fixed get_format/set_format
alex
parents: 5572
diff changeset
83 int req_fmt = *(int *)arg;
2815
alex
parents: 2802
diff changeset
84 if (req_fmt != IMGFMT_YV12)
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
85 return TVI_CONTROL_FALSE;
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
86 return TVI_CONTROL_TRUE;
2815
alex
parents: 2802
diff changeset
87 }
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
88 case TVI_CONTROL_VID_SET_WIDTH:
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
89 priv->width = *(int *)arg;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
90 return TVI_CONTROL_TRUE;
3375
5fb624943c90 default size 320x200
alex
parents: 2837
diff changeset
91 case TVI_CONTROL_VID_GET_WIDTH:
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
92 *(int *)arg = priv->width;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
93 return TVI_CONTROL_TRUE;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
94 case TVI_CONTROL_VID_SET_HEIGHT:
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
95 priv->height = *(int *)arg;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
96 return TVI_CONTROL_TRUE;
3375
5fb624943c90 default size 320x200
alex
parents: 2837
diff changeset
97 case TVI_CONTROL_VID_GET_HEIGHT:
12375
48a655d09522 and more and more stupidity
rfelker
parents: 9094
diff changeset
98 *(int *)arg = priv->height;
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
99 return TVI_CONTROL_TRUE;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
100 case TVI_CONTROL_VID_CHK_WIDTH:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
101 case TVI_CONTROL_VID_CHK_HEIGHT:
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
102 return TVI_CONTROL_TRUE;
9094
84012782d313 added TVI_CONTROL_TUN_SET_NORM
gabucino
parents: 7319
diff changeset
103 case TVI_CONTROL_TUN_SET_NORM:
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
104 return TVI_CONTROL_TRUE;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
105 }
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
106 return TVI_CONTROL_UNKNOWN;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
107 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
108
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 3815
diff changeset
109 static double grab_video_frame(priv_t *priv, char *buffer, int len)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
110 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
111 memset(buffer, 0x42, len);
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
112 return 1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
113 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
114
98769cea155c added tv subsystem
alex
parents:
diff changeset
115 static int get_video_framesize(priv_t *priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
116 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
117 /* YV12 */
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
118 return priv->width * priv->height * 12 / 8;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
119 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
120
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 3815
diff changeset
121 static double grab_audio_frame(priv_t *priv, char *buffer, int len)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
122 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
123 memset(buffer, 0x42, len);
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
124 return 1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
125 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
126
98769cea155c added tv subsystem
alex
parents:
diff changeset
127 static int get_audio_framesize(priv_t *priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
128 {
26756
c43ce7268677 cosmetics: Remove useless parentheses from return statements.
diego
parents: 25689
diff changeset
129 return 1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
130 }