ad_ffmpeg: remove incorrect request_sample_fmt setting
[mplayer.git] / stream / tvi_dummy.c
blob95c94890708880910be38064c0dc2df4fd099f4e
1 /*
2 * Only a sample!
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "config.h"
23 #include <stdio.h>
24 #include "libmpcodecs/img_format.h"
25 #include "tv.h"
27 static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param);
28 /* information about this file */
29 const tvi_info_t tvi_info_dummy = {
30 tvi_init_dummy,
31 "NULL-TV",
32 "dummy",
33 "alex",
34 NULL
37 /* private data's */
38 typedef struct priv {
39 int width;
40 int height;
41 } priv_t;
43 #include "tvi_def.h"
45 /* handler creator - entry point ! */
46 static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param)
48 return tv_new_handle(sizeof(priv_t), &functions);
51 /* initialisation */
52 static int init(priv_t *priv)
54 priv->width = 320;
55 priv->height = 200;
56 return 1;
59 /* that's the real start, we'got the format parameters (checked with control) */
60 static int start(priv_t *priv)
62 return 1;
65 static int uninit(priv_t *priv)
67 return 1;
70 static int control(priv_t *priv, int cmd, void *arg)
72 switch(cmd)
74 case TVI_CONTROL_IS_VIDEO:
75 return TVI_CONTROL_TRUE;
76 case TVI_CONTROL_VID_GET_FORMAT:
77 // *(int *)arg = IMGFMT_YV12;
78 *(int *)arg = IMGFMT_YV12;
79 return TVI_CONTROL_TRUE;
80 case TVI_CONTROL_VID_SET_FORMAT:
82 // int req_fmt = *(int *)arg;
83 int req_fmt = *(int *)arg;
84 if (req_fmt != IMGFMT_YV12)
85 return TVI_CONTROL_FALSE;
86 return TVI_CONTROL_TRUE;
88 case TVI_CONTROL_VID_SET_WIDTH:
89 priv->width = *(int *)arg;
90 return TVI_CONTROL_TRUE;
91 case TVI_CONTROL_VID_GET_WIDTH:
92 *(int *)arg = priv->width;
93 return TVI_CONTROL_TRUE;
94 case TVI_CONTROL_VID_SET_HEIGHT:
95 priv->height = *(int *)arg;
96 return TVI_CONTROL_TRUE;
97 case TVI_CONTROL_VID_GET_HEIGHT:
98 *(int *)arg = priv->height;
99 return TVI_CONTROL_TRUE;
100 case TVI_CONTROL_VID_CHK_WIDTH:
101 case TVI_CONTROL_VID_CHK_HEIGHT:
102 return TVI_CONTROL_TRUE;
103 case TVI_CONTROL_TUN_SET_NORM:
104 return TVI_CONTROL_TRUE;
106 return TVI_CONTROL_UNKNOWN;
109 static double grab_video_frame(priv_t *priv, char *buffer, int len)
111 memset(buffer, 0x42, len);
112 return 1;
115 static int get_video_framesize(priv_t *priv)
117 /* YV12 */
118 return priv->width * priv->height * 12 / 8;
121 static double grab_audio_frame(priv_t *priv, char *buffer, int len)
123 memset(buffer, 0x42, len);
124 return 1;
127 static int get_audio_framesize(priv_t *priv)
129 return 1;