| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
#ifdef HAVE_CONFIG_H |
|---|
| 29 |
# include "config.h" |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
#include <vlc_common.h> |
|---|
| 33 |
#include <vlc_vout.h> |
|---|
| 34 |
|
|---|
| 35 |
#define DUMMY_WIDTH 16 |
|---|
| 36 |
#define DUMMY_HEIGHT 16 |
|---|
| 37 |
#define DUMMY_MAX_DIRECTBUFFERS 10 |
|---|
| 38 |
|
|---|
| 39 |
#include "stats.h" |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
static int Init ( vout_thread_t * ); |
|---|
| 45 |
static void End ( vout_thread_t * ); |
|---|
| 46 |
static int Manage ( vout_thread_t * ); |
|---|
| 47 |
static void Render ( vout_thread_t *, picture_t * ); |
|---|
| 48 |
static void Display ( vout_thread_t *, picture_t * ); |
|---|
| 49 |
static void SetPalette ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * ); |
|---|
| 50 |
static int Control ( vout_thread_t *, int, va_list ); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
int OpenVideo ( vlc_object_t *p_this ) |
|---|
| 58 |
{ |
|---|
| 59 |
vout_thread_t * p_vout = (vout_thread_t *)p_this; |
|---|
| 60 |
|
|---|
| 61 |
p_vout->pf_init = Init; |
|---|
| 62 |
p_vout->pf_end = End; |
|---|
| 63 |
p_vout->pf_manage = Manage; |
|---|
| 64 |
p_vout->pf_render = Render; |
|---|
| 65 |
p_vout->pf_display = Display; |
|---|
| 66 |
p_vout->pf_control = Control; |
|---|
| 67 |
|
|---|
| 68 |
return VLC_SUCCESS; |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
static int Control( vout_thread_t *p_vout, int i_query, va_list args ) |
|---|
| 75 |
{ |
|---|
| 76 |
switch( i_query ) |
|---|
| 77 |
{ |
|---|
| 78 |
default: |
|---|
| 79 |
return vout_vaControlDefault( p_vout, i_query, args ); |
|---|
| 80 |
} |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
static int Init( vout_thread_t *p_vout ) |
|---|
| 88 |
{ |
|---|
| 89 |
int i_index, i_chroma; |
|---|
| 90 |
char *psz_chroma; |
|---|
| 91 |
picture_t *p_pic; |
|---|
| 92 |
bool b_chroma = 0; |
|---|
| 93 |
|
|---|
| 94 |
psz_chroma = config_GetPsz( p_vout, "dummy-chroma" ); |
|---|
| 95 |
if( psz_chroma ) |
|---|
| 96 |
{ |
|---|
| 97 |
if( strlen( psz_chroma ) >= 4 ) |
|---|
| 98 |
{ |
|---|
| 99 |
i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1], |
|---|
| 100 |
psz_chroma[2], psz_chroma[3] ); |
|---|
| 101 |
b_chroma = 1; |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
free( psz_chroma ); |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
I_OUTPUTPICTURES = 0; |
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
if( b_chroma ) |
|---|
| 111 |
{ |
|---|
| 112 |
msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)", |
|---|
| 113 |
i_chroma, (char*)&i_chroma ); |
|---|
| 114 |
p_vout->output.i_chroma = i_chroma; |
|---|
| 115 |
if ( i_chroma == VLC_FOURCC( 'R', 'G', 'B', '2' ) ) |
|---|
| 116 |
{ |
|---|
| 117 |
p_vout->output.pf_setpalette = SetPalette; |
|---|
| 118 |
} |
|---|
| 119 |
p_vout->output.i_width = p_vout->render.i_width; |
|---|
| 120 |
p_vout->output.i_height = p_vout->render.i_height; |
|---|
| 121 |
p_vout->output.i_aspect = p_vout->render.i_aspect; |
|---|
| 122 |
} |
|---|
| 123 |
else |
|---|
| 124 |
{ |
|---|
| 125 |
|
|---|
| 126 |
p_vout->output.i_chroma = p_vout->render.i_chroma; |
|---|
| 127 |
p_vout->output.i_rmask = p_vout->render.i_rmask; |
|---|
| 128 |
p_vout->output.i_gmask = p_vout->render.i_gmask; |
|---|
| 129 |
p_vout->output.i_bmask = p_vout->render.i_bmask; |
|---|
| 130 |
p_vout->output.i_width = p_vout->render.i_width; |
|---|
| 131 |
p_vout->output.i_height = p_vout->render.i_height; |
|---|
| 132 |
p_vout->output.i_aspect = p_vout->render.i_aspect; |
|---|
| 133 |
} |
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
while( I_OUTPUTPICTURES < DUMMY_MAX_DIRECTBUFFERS ) |
|---|
| 137 |
{ |
|---|
| 138 |
p_pic = NULL; |
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) |
|---|
| 142 |
{ |
|---|
| 143 |
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE ) |
|---|
| 144 |
{ |
|---|
| 145 |
p_pic = p_vout->p_picture + i_index; |
|---|
| 146 |
break; |
|---|
| 147 |
} |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
if( p_pic == NULL ) |
|---|
| 152 |
{ |
|---|
| 153 |
break; |
|---|
| 154 |
} |
|---|
| 155 |
|
|---|
| 156 |
vout_AllocatePicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, |
|---|
| 157 |
p_vout->output.i_width, p_vout->output.i_height, |
|---|
| 158 |
p_vout->output.i_aspect ); |
|---|
| 159 |
|
|---|
| 160 |
if( p_pic->i_planes == 0 ) |
|---|
| 161 |
{ |
|---|
| 162 |
break; |
|---|
| 163 |
} |
|---|
| 164 |
|
|---|
| 165 |
p_pic->i_status = DESTROYED_PICTURE; |
|---|
| 166 |
p_pic->i_type = DIRECT_PICTURE; |
|---|
| 167 |
|
|---|
| 168 |
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; |
|---|
| 169 |
|
|---|
| 170 |
I_OUTPUTPICTURES++; |
|---|
| 171 |
} |
|---|
| 172 |
|
|---|
| 173 |
return( 0 ); |
|---|
| 174 |
} |
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
static void End( vout_thread_t *p_vout ) |
|---|
| 180 |
{ |
|---|
| 181 |
int i_index; |
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
for( i_index = I_OUTPUTPICTURES ; i_index ; ) |
|---|
| 185 |
{ |
|---|
| 186 |
i_index--; |
|---|
| 187 |
free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig ); |
|---|
| 188 |
} |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
static int Manage( vout_thread_t *p_vout ) |
|---|
| 198 |
{ |
|---|
| 199 |
VLC_UNUSED(p_vout); |
|---|
| 200 |
return( 0 ); |
|---|
| 201 |
} |
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
static void Render( vout_thread_t *p_vout, picture_t *p_pic ) |
|---|
| 207 |
{ |
|---|
| 208 |
VLC_UNUSED(p_vout); VLC_UNUSED(p_pic); |
|---|
| 209 |
|
|---|
| 210 |
} |
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
static void Display( vout_thread_t *p_vout, picture_t *p_pic ) |
|---|
| 216 |
{ |
|---|
| 217 |
msg_Dbg( p_vout, "VOUT got %"PRIu64" ms offset", |
|---|
| 218 |
(mdate() - *(mtime_t *)p_pic->p->p_pixels) / 1000 ); |
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
} |
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
static void SetPalette ( vout_thread_t *p_vout, |
|---|
| 227 |
uint16_t *red, uint16_t *green, uint16_t *blue ) |
|---|
| 228 |
{ |
|---|
| 229 |
VLC_UNUSED(p_vout); VLC_UNUSED(red); VLC_UNUSED(green); VLC_UNUSED(blue); |
|---|
| 230 |
|
|---|
| 231 |
} |
|---|