| 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 |
#ifdef HAVE_CONFIG_H |
|---|
| 28 |
# include "config.h" |
|---|
| 29 |
#endif |
|---|
| 30 |
|
|---|
| 31 |
#include <vlc_common.h> |
|---|
| 32 |
|
|---|
| 33 |
#include <stdio.h> |
|---|
| 34 |
#include <stdlib.h> |
|---|
| 35 |
#include <sys/types.h> |
|---|
| 36 |
#include <sys/stat.h> |
|---|
| 37 |
#include <dirent.h> |
|---|
| 38 |
#include <assert.h> |
|---|
| 39 |
|
|---|
| 40 |
#include <vlc_interface.h> |
|---|
| 41 |
#include <vlc_block.h> |
|---|
| 42 |
#include <vlc_playlist.h> |
|---|
| 43 |
|
|---|
| 44 |
#include <vlc_vout.h> |
|---|
| 45 |
#include <vlc_window.h> |
|---|
| 46 |
#include <vlc_image.h> |
|---|
| 47 |
#include <vlc_osd.h> |
|---|
| 48 |
#include <vlc_charset.h> |
|---|
| 49 |
|
|---|
| 50 |
#include <vlc_strings.h> |
|---|
| 51 |
#include <vlc_charset.h> |
|---|
| 52 |
#include "../libvlc.h" |
|---|
| 53 |
#include "vout_internal.h" |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
static void InitWindowSize( vout_thread_t *, unsigned *, unsigned * ); |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
static int ZoomCallback( vlc_object_t *, char const *, |
|---|
| 62 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 63 |
static int CropCallback( vlc_object_t *, char const *, |
|---|
| 64 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 65 |
static int AspectCallback( vlc_object_t *, char const *, |
|---|
| 66 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 67 |
static int OnTopCallback( vlc_object_t *, char const *, |
|---|
| 68 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 69 |
static int FullscreenCallback( vlc_object_t *, char const *, |
|---|
| 70 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 71 |
static int SnapshotCallback( vlc_object_t *, char const *, |
|---|
| 72 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 73 |
|
|---|
| 74 |
static int TitleShowCallback( vlc_object_t *, char const *, |
|---|
| 75 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 76 |
static int TitleTimeoutCallback( vlc_object_t *, char const *, |
|---|
| 77 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 78 |
static int TitlePositionCallback( vlc_object_t *, char const *, |
|---|
| 79 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
void *vout_RequestWindow( vout_thread_t *p_vout, |
|---|
| 89 |
int *pi_x_hint, int *pi_y_hint, |
|---|
| 90 |
unsigned int *pi_width_hint, |
|---|
| 91 |
unsigned int *pi_height_hint ) |
|---|
| 92 |
{ |
|---|
| 93 |
|
|---|
| 94 |
if( !var_Type( p_vout, "aspect-ratio" ) ) vout_IntfInit( p_vout ); |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
*pi_x_hint = var_GetInteger( p_vout, "video-x" ); |
|---|
| 98 |
*pi_y_hint = var_GetInteger( p_vout, "video-y" ); |
|---|
| 99 |
|
|---|
| 100 |
*pi_width_hint = p_vout->i_window_width; |
|---|
| 101 |
*pi_height_hint = p_vout->i_window_height; |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
int drawable = var_CreateGetInteger( p_vout, "drawable" ); |
|---|
| 105 |
if( drawable ) return (void *)(intptr_t)drawable; |
|---|
| 106 |
|
|---|
| 107 |
vout_window_t *wnd = vlc_custom_create (VLC_OBJECT(p_vout), sizeof (*wnd), |
|---|
| 108 |
VLC_OBJECT_GENERIC, "window"); |
|---|
| 109 |
if (wnd == NULL) |
|---|
| 110 |
return NULL; |
|---|
| 111 |
|
|---|
| 112 |
wnd->vout = p_vout; |
|---|
| 113 |
wnd->width = *pi_width_hint; |
|---|
| 114 |
wnd->height = *pi_height_hint; |
|---|
| 115 |
wnd->pos_x = *pi_x_hint; |
|---|
| 116 |
wnd->pos_y = *pi_y_hint; |
|---|
| 117 |
vlc_object_attach (wnd, p_vout); |
|---|
| 118 |
|
|---|
| 119 |
wnd->module = module_need (wnd, "vout window", 0, 0); |
|---|
| 120 |
if (wnd->module == NULL) |
|---|
| 121 |
{ |
|---|
| 122 |
msg_Dbg (wnd, "no window provider available"); |
|---|
| 123 |
vlc_object_release (wnd); |
|---|
| 124 |
return NULL; |
|---|
| 125 |
} |
|---|
| 126 |
p_vout->p_window = wnd; |
|---|
| 127 |
*pi_width_hint = wnd->width; |
|---|
| 128 |
*pi_height_hint = wnd->height; |
|---|
| 129 |
*pi_x_hint = wnd->pos_x; |
|---|
| 130 |
*pi_y_hint = wnd->pos_y; |
|---|
| 131 |
return wnd->handle; |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
void vout_ReleaseWindow( vout_thread_t *p_vout, void *dummy ) |
|---|
| 135 |
{ |
|---|
| 136 |
vout_window_t *wnd = p_vout->p_window; |
|---|
| 137 |
|
|---|
| 138 |
if (wnd == NULL) |
|---|
| 139 |
return; |
|---|
| 140 |
p_vout->p_window = NULL; |
|---|
| 141 |
|
|---|
| 142 |
assert (wnd->module); |
|---|
| 143 |
module_unneed (wnd, wnd->module); |
|---|
| 144 |
|
|---|
| 145 |
vlc_object_release (wnd); |
|---|
| 146 |
(void)dummy; |
|---|
| 147 |
} |
|---|
| 148 |
|
|---|
| 149 |
int vout_ControlWindow( vout_thread_t *p_vout, void *dummy, |
|---|
| 150 |
int i_query, va_list args ) |
|---|
| 151 |
{ |
|---|
| 152 |
(void)dummy; |
|---|
| 153 |
vout_window_t *wnd = p_vout->p_window; |
|---|
| 154 |
|
|---|
| 155 |
if (wnd == NULL) |
|---|
| 156 |
return VLC_EGENERIC; |
|---|
| 157 |
|
|---|
| 158 |
assert (wnd->control); |
|---|
| 159 |
return wnd->control (wnd, i_query, args); |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
static const struct |
|---|
| 166 |
{ |
|---|
| 167 |
double f_value; |
|---|
| 168 |
const char *psz_label; |
|---|
| 169 |
} p_zoom_values[] = { |
|---|
| 170 |
{ 0.25, N_("1:4 Quarter") }, |
|---|
| 171 |
{ 0.5, N_("1:2 Half") }, |
|---|
| 172 |
{ 1, N_("1:1 Original") }, |
|---|
| 173 |
{ 2, N_("2:1 Double") }, |
|---|
| 174 |
{ 0, NULL } }; |
|---|
| 175 |
|
|---|
| 176 |
static const struct |
|---|
| 177 |
{ |
|---|
| 178 |
const char *psz_value; |
|---|
| 179 |
const char *psz_label; |
|---|
| 180 |
} p_crop_values[] = { |
|---|
| 181 |
{ "", N_("Default") }, |
|---|
| 182 |
{ "16:10", "16:10" }, |
|---|
| 183 |
{ "16:9", "16:9" }, |
|---|
| 184 |
{ "185:100", "1.85:1" }, |
|---|
| 185 |
{ "221:100", "2.21:1" }, |
|---|
| 186 |
{ "235:100", "2.35:1" }, |
|---|
| 187 |
{ "239:100", "2.39:1" }, |
|---|
| 188 |
{ "5:3", "5:3" }, |
|---|
| 189 |
{ "4:3", "4:3" }, |
|---|
| 190 |
{ "5:4", "5:4" }, |
|---|
| 191 |
{ "1:1", "1:1" }, |
|---|
| 192 |
{ NULL, NULL } }; |
|---|
| 193 |
|
|---|
| 194 |
static const struct |
|---|
| 195 |
{ |
|---|
| 196 |
const char *psz_value; |
|---|
| 197 |
const char *psz_label; |
|---|
| 198 |
} p_aspect_ratio_values[] = { |
|---|
| 199 |
{ "", N_("Default") }, |
|---|
| 200 |
{ "1:1", "1:1" }, |
|---|
| 201 |
{ "4:3", "4:3" }, |
|---|
| 202 |
{ "16:9", "16:9" }, |
|---|
| 203 |
{ "16:10", "16:10" }, |
|---|
| 204 |
{ "221:100", "2.21:1" }, |
|---|
| 205 |
{ "5:4", "5:4" }, |
|---|
| 206 |
{ NULL, NULL } }; |
|---|
| 207 |
|
|---|
| 208 |
static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var, |
|---|
| 209 |
char *psz_list ) |
|---|
| 210 |
{ |
|---|
| 211 |
if( psz_list && *psz_list ) |
|---|
| 212 |
{ |
|---|
| 213 |
char *psz_cur = psz_list; |
|---|
| 214 |
char *psz_next; |
|---|
| 215 |
while( psz_cur && *psz_cur ) |
|---|
| 216 |
{ |
|---|
| 217 |
vlc_value_t val, text; |
|---|
| 218 |
psz_next = strchr( psz_cur, ',' ); |
|---|
| 219 |
if( psz_next ) |
|---|
| 220 |
{ |
|---|
| 221 |
*psz_next = '\0'; |
|---|
| 222 |
psz_next++; |
|---|
| 223 |
} |
|---|
| 224 |
val.psz_string = psz_cur; |
|---|
| 225 |
text.psz_string = psz_cur; |
|---|
| 226 |
var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text); |
|---|
| 227 |
psz_cur = psz_next; |
|---|
| 228 |
} |
|---|
| 229 |
} |
|---|
| 230 |
} |
|---|
| 231 |
|
|---|
| 232 |
void vout_IntfInit( vout_thread_t *p_vout ) |
|---|
| 233 |
{ |
|---|
| 234 |
vlc_value_t val, text, old_val; |
|---|
| 235 |
bool b_force_par = false; |
|---|
| 236 |
char *psz_buf; |
|---|
| 237 |
int i; |
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 241 |
var_Create( p_vout, "snapshot-prefix", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 242 |
var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 243 |
var_Create( p_vout, "snapshot-preview", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); |
|---|
| 244 |
var_Create( p_vout, "snapshot-sequential", |
|---|
| 245 |
VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); |
|---|
| 246 |
var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER ); |
|---|
| 247 |
var_SetInteger( p_vout, "snapshot-num", 1 ); |
|---|
| 248 |
var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 249 |
var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 250 |
|
|---|
| 251 |
var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 252 |
var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 253 |
p_vout->i_alignment = var_CreateGetInteger( p_vout, "align" ); |
|---|
| 254 |
|
|---|
| 255 |
var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 256 |
var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 257 |
|
|---|
| 258 |
var_Create( p_vout, "mouse-hide-timeout", |
|---|
| 259 |
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| 260 |
|
|---|
| 261 |
p_vout->p->b_title_show = var_CreateGetBool( p_vout, "video-title-show" ); |
|---|
| 262 |
p_vout->p->i_title_timeout = |
|---|
| 263 |
(mtime_t)var_CreateGetInteger( p_vout, "video-title-timeout" ); |
|---|
| 264 |
p_vout->p->i_title_position = |
|---|
| 265 |
var_CreateGetInteger( p_vout, "video-title-position" ); |
|---|
| 266 |
|
|---|
| 267 |
var_AddCallback( p_vout, "video-title-show", TitleShowCallback, NULL ); |
|---|
| 268 |
var_AddCallback( p_vout, "video-title-timeout", TitleTimeoutCallback, NULL ); |
|---|
| 269 |
var_AddCallback( p_vout, "video-title-position", TitlePositionCallback, NULL ); |
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 |
var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND | |
|---|
| 273 |
VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); |
|---|
| 274 |
|
|---|
| 275 |
text.psz_string = _("Zoom"); |
|---|
| 276 |
var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 277 |
|
|---|
| 278 |
var_Get( p_vout, "zoom", &old_val ); |
|---|
| 279 |
|
|---|
| 280 |
for( i = 0; p_zoom_values[i].f_value; i++ ) |
|---|
| 281 |
{ |
|---|
| 282 |
if( old_val.f_float == p_zoom_values[i].f_value ) |
|---|
| 283 |
var_Change( p_vout, "zoom", VLC_VAR_DELCHOICE, &old_val, NULL ); |
|---|
| 284 |
val.f_float = p_zoom_values[i].f_value; |
|---|
| 285 |
text.psz_string = _( p_zoom_values[i].psz_label ); |
|---|
| 286 |
var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 287 |
} |
|---|
| 288 |
|
|---|
| 289 |
var_Set( p_vout, "zoom", old_val ); |
|---|
| 290 |
|
|---|
| 291 |
var_AddCallback( p_vout, "zoom", ZoomCallback, NULL ); |
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); |
|---|
| 295 |
var_Create( p_vout, "crop-top", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); |
|---|
| 296 |
var_Create( p_vout, "crop-right", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); |
|---|
| 297 |
var_Create( p_vout, "crop-bottom", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); |
|---|
| 298 |
|
|---|
| 299 |
var_AddCallback( p_vout, "crop-left", CropCallback, NULL ); |
|---|
| 300 |
var_AddCallback( p_vout, "crop-top", CropCallback, NULL ); |
|---|
| 301 |
var_AddCallback( p_vout, "crop-right", CropCallback, NULL ); |
|---|
| 302 |
var_AddCallback( p_vout, "crop-bottom", CropCallback, NULL ); |
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 |
var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND | |
|---|
| 306 |
VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); |
|---|
| 307 |
|
|---|
| 308 |
text.psz_string = _("Crop"); |
|---|
| 309 |
var_Change( p_vout, "crop", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 310 |
|
|---|
| 311 |
val.psz_string = (char*)""; |
|---|
| 312 |
var_Change( p_vout, "crop", VLC_VAR_DELCHOICE, &val, 0 ); |
|---|
| 313 |
|
|---|
| 314 |
for( i = 0; p_crop_values[i].psz_value; i++ ) |
|---|
| 315 |
{ |
|---|
| 316 |
val.psz_string = (char*)p_crop_values[i].psz_value; |
|---|
| 317 |
text.psz_string = _( p_crop_values[i].psz_label ); |
|---|
| 318 |
var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 319 |
} |
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
var_Create( p_vout, "crop-update", VLC_VAR_VOID ); |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" ); |
|---|
| 326 |
AddCustomRatios( p_vout, "crop", psz_buf ); |
|---|
| 327 |
free( psz_buf ); |
|---|
| 328 |
|
|---|
| 329 |
var_AddCallback( p_vout, "crop", CropCallback, NULL ); |
|---|
| 330 |
var_Get( p_vout, "crop", &old_val ); |
|---|
| 331 |
if( old_val.psz_string && *old_val.psz_string ) |
|---|
| 332 |
var_Change( p_vout, "crop", VLC_VAR_TRIGGER_CALLBACKS, 0, 0 ); |
|---|
| 333 |
free( old_val.psz_string ); |
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 337 |
var_Get( p_vout, "monitor-par", &val ); |
|---|
| 338 |
if( val.psz_string && *val.psz_string ) |
|---|
| 339 |
{ |
|---|
| 340 |
char *psz_parser = strchr( val.psz_string, ':' ); |
|---|
| 341 |
unsigned int i_aspect_num = 0, i_aspect_den = 0; |
|---|
| 342 |
float i_aspect = 0; |
|---|
| 343 |
if( psz_parser ) |
|---|
| 344 |
{ |
|---|
| 345 |
i_aspect_num = strtol( val.psz_string, 0, 10 ); |
|---|
| 346 |
i_aspect_den = strtol( ++psz_parser, 0, 10 ); |
|---|
| 347 |
} |
|---|
| 348 |
else |
|---|
| 349 |
{ |
|---|
| 350 |
i_aspect = atof( val.psz_string ); |
|---|
| 351 |
vlc_ureduce( &i_aspect_num, &i_aspect_den, |
|---|
| 352 |
i_aspect *VOUT_ASPECT_FACTOR, VOUT_ASPECT_FACTOR, 0 ); |
|---|
| 353 |
} |
|---|
| 354 |
if( !i_aspect_num || !i_aspect_den ) i_aspect_num = i_aspect_den = 1; |
|---|
| 355 |
|
|---|
| 356 |
p_vout->p->i_par_num = i_aspect_num; |
|---|
| 357 |
p_vout->p->i_par_den = i_aspect_den; |
|---|
| 358 |
|
|---|
| 359 |
vlc_ureduce( &p_vout->p->i_par_num, &p_vout->p->i_par_den, |
|---|
| 360 |
p_vout->p->i_par_num, p_vout->p->i_par_den, 0 ); |
|---|
| 361 |
|
|---|
| 362 |
msg_Dbg( p_vout, "overriding monitor pixel aspect-ratio: %i:%i", |
|---|
| 363 |
p_vout->p->i_par_num, p_vout->p->i_par_den ); |
|---|
| 364 |
b_force_par = true; |
|---|
| 365 |
} |
|---|
| 366 |
free( val.psz_string ); |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND | |
|---|
| 370 |
VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); |
|---|
| 371 |
|
|---|
| 372 |
text.psz_string = _("Aspect-ratio"); |
|---|
| 373 |
var_Change( p_vout, "aspect-ratio", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 374 |
|
|---|
| 375 |
val.psz_string = (char*)""; |
|---|
| 376 |
var_Change( p_vout, "aspect-ratio", VLC_VAR_DELCHOICE, &val, 0 ); |
|---|
| 377 |
|
|---|
| 378 |
for( i = 0; p_aspect_ratio_values[i].psz_value; i++ ) |
|---|
| 379 |
{ |
|---|
| 380 |
val.psz_string = (char*)p_aspect_ratio_values[i].psz_value; |
|---|
| 381 |
text.psz_string = _( p_aspect_ratio_values[i].psz_label ); |
|---|
| 382 |
var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 383 |
} |
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" ); |
|---|
| 387 |
AddCustomRatios( p_vout, "aspect-ratio", psz_buf ); |
|---|
| 388 |
free( psz_buf ); |
|---|
| 389 |
|
|---|
| 390 |
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL ); |
|---|
| 391 |
var_Get( p_vout, "aspect-ratio", &old_val ); |
|---|
| 392 |
if( (old_val.psz_string && *old_val.psz_string) || b_force_par ) |
|---|
| 393 |
var_Change( p_vout, "aspect-ratio", VLC_VAR_TRIGGER_CALLBACKS, 0, 0 ); |
|---|
| 394 |
free( old_val.psz_string ); |
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
InitWindowSize( p_vout, &p_vout->i_window_width, |
|---|
| 398 |
&p_vout->i_window_height ); |
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT |
|---|
| 402 |
| VLC_VAR_ISCOMMAND ); |
|---|
| 403 |
text.psz_string = _("Always on top"); |
|---|
| 404 |
var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 405 |
var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL ); |
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); |
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
if( var_CreateGetBoolCommand( p_vout, "fullscreen" ) ) |
|---|
| 412 |
{ |
|---|
| 413 |
|
|---|
| 414 |
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; |
|---|
| 415 |
} |
|---|
| 416 |
text.psz_string = _("Fullscreen"); |
|---|
| 417 |
var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 418 |
var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL ); |
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); |
|---|
| 422 |
text.psz_string = _("Snapshot"); |
|---|
| 423 |
var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 424 |
var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL ); |
|---|
| 425 |
|
|---|
| 426 |
|
|---|
| 427 |
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); |
|---|
| 428 |
var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER ); |
|---|
| 429 |
var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); |
|---|
| 430 |
var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL ); |
|---|
| 431 |
var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER ); |
|---|
| 432 |
|
|---|
| 433 |
var_Create( p_vout, "intf-change", VLC_VAR_BOOL ); |
|---|
| 434 |
var_SetBool( p_vout, "intf-change", true ); |
|---|
| 435 |
} |
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
static int VoutSnapshotPip( vout_thread_t *p_vout, image_handler_t *p_image, picture_t *p_pic, const video_format_t *p_fmt_in ) |
|---|
| 445 |
{ |
|---|
| 446 |
video_format_t fmt_in = *p_fmt_in; |
|---|
| 447 |
video_format_t fmt_out; |
|---|
| 448 |
picture_t *p_pip; |
|---|
| 449 |
subpicture_t *p_subpic; |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
memset( &fmt_out, 0, sizeof(fmt_out) ); |
|---|
| 453 |
fmt_out = fmt_in; |
|---|
| 454 |
fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); |
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
p_pip = image_Convert( p_image, p_pic, &fmt_in, &fmt_out ); |
|---|
| 458 |
if( !p_pip ) |
|---|
| 459 |
return VLC_EGENERIC; |
|---|
| 460 |
|
|---|
| 461 |
p_subpic = subpicture_New(); |
|---|
| 462 |
if( p_subpic == NULL ) |
|---|
| 463 |
{ |
|---|
| 464 |
picture_Release( p_pip ); |
|---|
| 465 |
return VLC_EGENERIC; |
|---|
| 466 |
} |
|---|
| 467 |
|
|---|
| 468 |
p_subpic->i_channel = 0; |
|---|
| 469 |
p_subpic->i_start = mdate(); |
|---|
| 470 |
p_subpic->i_stop = mdate() + 4000000; |
|---|
| 471 |
p_subpic->b_ephemer = true; |
|---|
| 472 |
p_subpic->b_fade = true; |
|---|
| 473 |
p_subpic->i_original_picture_width = fmt_out.i_width * 4; |
|---|
| 474 |
p_subpic->i_original_picture_height = fmt_out.i_height * 4; |
|---|
| 475 |
fmt_out.i_aspect = 0; |
|---|
| 476 |
fmt_out.i_sar_num = |
|---|
| 477 |
fmt_out.i_sar_den = 0; |
|---|
| 478 |
|
|---|
| 479 |
p_subpic->p_region = subpicture_region_New( &fmt_out ); |
|---|
| 480 |
if( p_subpic->p_region ) |
|---|
| 481 |
{ |
|---|
| 482 |
picture_Release( p_subpic->p_region->p_picture ); |
|---|
| 483 |
p_subpic->p_region->p_picture = p_pip; |
|---|
| 484 |
} |
|---|
| 485 |
else |
|---|
| 486 |
{ |
|---|
| 487 |
picture_Release( p_pip ); |
|---|
| 488 |
} |
|---|
| 489 |
|
|---|
| 490 |
spu_DisplaySubpicture( p_vout->p_spu, p_subpic ); |
|---|
| 491 |
return VLC_SUCCESS; |
|---|
| 492 |
} |
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 |
static char *VoutSnapshotGetDefaultDirectory( void ) |
|---|
| 497 |
{ |
|---|
| 498 |
char *psz_path; |
|---|
| 499 |
#if defined(__APPLE__) || defined(SYS_BEOS) |
|---|
| 500 |
|
|---|
| 501 |
if( asprintf( &psz_path, "%s/Desktop", |
|---|
| 502 |
config_GetHomeDir() ) == -1 ) |
|---|
| 503 |
psz_path = NULL; |
|---|
| 504 |
|
|---|
| 505 |
#elif defined(WIN32) && !defined(UNDER_CE) |
|---|
| 506 |
|
|---|
| 507 |
|
|---|
| 508 |
char *p_mypicturesdir = NULL; |
|---|
| 509 |
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, |
|---|
| 510 |
LPWSTR ); |
|---|
| 511 |
#ifndef CSIDL_FLAG_CREATE |
|---|
| 512 |
# define CSIDL_FLAG_CREATE 0x8000 |
|---|
| 513 |
#endif |
|---|
| 514 |
#ifndef CSIDL_MYPICTURES |
|---|
| 515 |
# define CSIDL_MYPICTURES 0x27 |
|---|
| 516 |
#endif |
|---|
| 517 |
#ifndef SHGFP_TYPE_CURRENT |
|---|
| 518 |
# define SHGFP_TYPE_CURRENT 0 |
|---|
| 519 |
#endif |
|---|
| 520 |
|
|---|
| 521 |
HINSTANCE shfolder_dll; |
|---|
| 522 |
SHGETFOLDERPATH SHGetFolderPath ; |
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) |
|---|
| 526 |
{ |
|---|
| 527 |
wchar_t wdir[PATH_MAX]; |
|---|
| 528 |
SHGetFolderPath = (void *)GetProcAddress( shfolder_dll, |
|---|
| 529 |
_T("SHGetFolderPathW") ); |
|---|
| 530 |
if ((SHGetFolderPath != NULL ) |
|---|
| 531 |
&& SUCCEEDED (SHGetFolderPath (NULL, |
|---|
| 532 |
CSIDL_MYPICTURES | CSIDL_FLAG_CREATE, |
|---|
| 533 |
NULL, SHGFP_TYPE_CURRENT, |
|---|
| 534 |
wdir))) |
|---|
| 535 |
p_mypicturesdir = FromWide (wdir); |
|---|
| 536 |
|
|---|
| 537 |
FreeLibrary( shfolder_dll ); |
|---|
| 538 |
} |
|---|
| 539 |
|
|---|
| 540 |
if( p_mypicturesdir == NULL ) |
|---|
| 541 |
psz_path = strdup( config_GetHomeDir() ); |
|---|
| 542 |
else |
|---|
| 543 |
psz_path = p_mypicturesdir; |
|---|
| 544 |
|
|---|
| 545 |
#else |
|---|
| 546 |
|
|---|
| 547 |
|
|---|
| 548 |
|
|---|
| 549 |
char *psz_datadir = config_GetUserDataDir(); |
|---|
| 550 |
if( psz_datadir ) |
|---|
| 551 |
{ |
|---|
| 552 |
if( asprintf( &psz_path, "%s", psz_datadir ) == -1 ) |
|---|
| 553 |
psz_path = NULL; |
|---|
| 554 |
free( psz_datadir ); |
|---|
| 555 |
} |
|---|
| 556 |
|
|---|
| 557 |
#endif |
|---|
| 558 |
|
|---|
| 559 |
return psz_path; |
|---|
| 560 |
} |
|---|
| 561 |
|
|---|
| 562 |
int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) |
|---|
| 563 |
{ |
|---|
| 564 |
image_handler_t *p_image = image_HandlerCreate( p_vout ); |
|---|
| 565 |
video_format_t fmt_in, fmt_out; |
|---|
| 566 |
char *psz_filename = NULL; |
|---|
| 567 |
vlc_value_t val, format; |
|---|
| 568 |
DIR *path; |
|---|
| 569 |
int i_ret; |
|---|
| 570 |
bool b_embedded_snapshot; |
|---|
| 571 |
uintmax_t i_id = (uintptr_t)NULL; |
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
val.psz_string = var_GetNonEmptyString( p_vout, "snapshot-path" ); |
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
if( val.psz_string && sscanf( val.psz_string, "object:%ju", &i_id ) > 0 ) |
|---|
| 578 |
b_embedded_snapshot = true; |
|---|
| 579 |
else |
|---|
| 580 |
b_embedded_snapshot = false; |
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 |
memset( &fmt_in, 0, sizeof(video_format_t) ); |
|---|
| 584 |
fmt_in = p_vout->fmt_out; |
|---|
| 585 |
if( fmt_in.i_sar_num <= 0 || fmt_in.i_sar_den <= 0 ) |
|---|
| 586 |
{ |
|---|
| 587 |
fmt_in.i_sar_num = |
|---|
| 588 |
fmt_in.i_sar_den = 1; |
|---|
| 589 |
} |
|---|
| 590 |
|
|---|
| 591 |
|
|---|
| 592 |
memset( &fmt_out, 0, sizeof(video_format_t) ); |
|---|
| 593 |
fmt_out.i_sar_num = |
|---|
| 594 |
fmt_out.i_sar_den = 1; |
|---|
| 595 |
fmt_out.i_chroma = b_embedded_snapshot ? VLC_FOURCC('p','n','g',' ') : 0; |
|---|
| 596 |
fmt_out.i_width = var_GetInteger( p_vout, "snapshot-width" ); |
|---|
| 597 |
fmt_out.i_height = var_GetInteger( p_vout, "snapshot-height" ); |
|---|
| 598 |
|
|---|
| 599 |
if( b_embedded_snapshot && |
|---|
| 600 |
fmt_out.i_width == 0 && fmt_out.i_height == 0 ) |
|---|
| 601 |
{ |
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
fmt_out.i_width = 320; |
|---|
| 605 |
} |
|---|
| 606 |
|
|---|
| 607 |
if( fmt_out.i_height == 0 && fmt_out.i_width > 0 ) |
|---|
| 608 |
{ |
|---|
| 609 |
fmt_out.i_height = fmt_in.i_height * fmt_out.i_width / fmt_in.i_width; |
|---|
| 610 |
const int i_height = fmt_out.i_height * fmt_in.i_sar_den / fmt_in.i_sar_num; |
|---|
| 611 |
if( i_height > 0 ) |
|---|
| 612 |
fmt_out.i_height = i_height; |
|---|
| 613 |
} |
|---|
| 614 |
else |
|---|
| 615 |
{ |
|---|
| 616 |
if( fmt_out.i_width == 0 && fmt_out.i_height > 0 ) |
|---|
| 617 |
{ |
|---|
| 618 |
fmt_out.i_width = fmt_in.i_width * fmt_out.i_height / fmt_in.i_height; |
|---|
| 619 |
} |
|---|
| 620 |
else |
|---|
| 621 |
{ |
|---|
| 622 |
fmt_out.i_width = fmt_in.i_width; |
|---|
| 623 |
fmt_out.i_height = fmt_in.i_height; |
|---|
| 624 |
} |
|---|
| 625 |
const int i_width = fmt_out.i_width * fmt_in.i_sar_num / fmt_in.i_sar_den; |
|---|
| 626 |
if( i_width > 0 ) |
|---|
| 627 |
fmt_out.i_width = i_width; |
|---|
| 628 |
} |
|---|
| 629 |
|
|---|
| 630 |
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 |
if( b_embedded_snapshot ) |
|---|
| 636 |
{ |
|---|
| 637 |
vlc_object_t* p_dest = (vlc_object_t *)(uintptr_t)i_id; |
|---|
| 638 |
block_t *p_block; |
|---|
| 639 |
snapshot_t *p_snapshot; |
|---|
| 640 |
size_t i_size; |
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
|
|---|
| 644 |
p_dest->p_private = NULL; |
|---|
| 645 |
|
|---|
| 646 |
|
|---|
| 647 |
p_block = image_Write( p_image, p_pic, &fmt_in, &fmt_out ); |
|---|
| 648 |
if( !p_block ) |
|---|
| 649 |
{ |
|---|
| 650 |
msg_Err( p_vout, "Could not get snapshot" ); |
|---|
| 651 |
image_HandlerDelete( p_image ); |
|---|
| 652 |
vlc_object_signal_unlocked( p_dest ); |
|---|
| 653 |
vlc_object_release( p_dest ); |
|---|
| 654 |
return VLC_EGENERIC; |
|---|
| 655 |
} |
|---|
| 656 |
|
|---|
| 657 |
|
|---|
| 658 |
|
|---|
| 659 |
p_snapshot = malloc( sizeof( snapshot_t ) ); |
|---|
| 660 |
if( !p_snapshot ) |
|---|
| 661 |
{ |
|---|
| 662 |
block_Release( p_block ); |
|---|
| 663 |
image_HandlerDelete( p_image ); |
|---|
| 664 |
vlc_object_signal_unlocked( p_dest ); |
|---|
| 665 |
vlc_object_release( p_dest ); |
|---|
| 666 |
return VLC_ENOMEM; |
|---|
| 667 |
} |
|---|
| 668 |
|
|---|
| 669 |
i_size = p_block->i_buffer; |
|---|
| 670 |
|
|---|
| 671 |
p_snapshot->i_width = fmt_out.i_width; |
|---|
| 672 |
p_snapshot->i_height = fmt_out.i_height; |
|---|
| 673 |
p_snapshot->i_datasize = i_size; |
|---|
| 674 |
p_snapshot->date = p_block->i_pts; |
|---|
| 675 |
p_snapshot->p_data = malloc( i_size ); |
|---|
| 676 |
if( !p_snapshot->p_data ) |
|---|
| 677 |
{ |
|---|
| 678 |
block_Release( p_block ); |
|---|
| 679 |
free( p_snapshot ); |
|---|
| 680 |
image_HandlerDelete( p_image ); |
|---|
| 681 |
vlc_object_signal_unlocked( p_dest ); |
|---|
| 682 |
vlc_object_release( p_dest ); |
|---|
| 683 |
return VLC_ENOMEM; |
|---|
| 684 |
} |
|---|
| 685 |
memcpy( p_snapshot->p_data, p_block->p_buffer, p_block->i_buffer ); |
|---|
| 686 |
|
|---|
| 687 |
p_dest->p_private = p_snapshot; |
|---|
| 688 |
|
|---|
| 689 |
block_Release( p_block ); |
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
vlc_object_signal_unlocked( p_dest ); |
|---|
| 693 |
vlc_object_release( p_dest ); |
|---|
| 694 |
|
|---|
| 695 |
image_HandlerDelete( p_image ); |
|---|
| 696 |
return VLC_SUCCESS; |
|---|
| 697 |
} |
|---|
| 698 |
|
|---|
| 699 |
|
|---|
| 700 |
if( !val.psz_string ) |
|---|
| 701 |
val.psz_string = VoutSnapshotGetDefaultDirectory( ); |
|---|
| 702 |
if( !val.psz_string ) |
|---|
| 703 |
{ |
|---|
| 704 |
msg_Err( p_vout, "no path specified for snapshots" ); |
|---|
| 705 |
image_HandlerDelete( p_image ); |
|---|
| 706 |
return VLC_EGENERIC; |
|---|
| 707 |
} |
|---|
| 708 |
|
|---|
| 709 |
|
|---|
| 710 |
format.psz_string = var_GetNonEmptyString( p_vout, "snapshot-format" ); |
|---|
| 711 |
if( !format.psz_string ) |
|---|
| 712 |
format.psz_string = strdup( "png" ); |
|---|
| 713 |
if( !format.psz_string ) |
|---|
| 714 |
{ |
|---|
| 715 |
free( val.psz_string ); |
|---|
| 716 |
image_HandlerDelete( p_image ); |
|---|
| 717 |
return VLC_ENOMEM; |
|---|
| 718 |
} |
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 |
|
|---|
| 722 |
|
|---|
| 723 |
path = utf8_opendir ( (const char *)val.psz_string ); |
|---|
| 724 |
if( path != NULL ) |
|---|
| 725 |
{ |
|---|
| 726 |
char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" ); |
|---|
| 727 |
if( psz_prefix == NULL ) |
|---|
| 728 |
psz_prefix = strdup( "vlcsnap-" ); |
|---|
| 729 |
else |
|---|
| 730 |
{ |
|---|
| 731 |
char *psz_tmp = str_format( p_vout, psz_prefix ); |
|---|
| 732 |
filename_sanitize( psz_tmp ); |
|---|
| 733 |
free( psz_prefix ); |
|---|
| 734 |
psz_prefix = psz_tmp; |
|---|
| 735 |
} |
|---|
| 736 |
|
|---|
| 737 |
closedir( path ); |
|---|
| 738 |
if( var_GetBool( p_vout, "snapshot-sequential" ) == true ) |
|---|
| 739 |
{ |
|---|
| 740 |
int i_num = var_GetInteger( p_vout, "snapshot-num" ); |
|---|
| 741 |
struct stat st; |
|---|
| 742 |
|
|---|
| 743 |
do |
|---|
| 744 |
{ |
|---|
| 745 |
free( psz_filename ); |
|---|
| 746 |
if( asprintf( &psz_filename, "%s" DIR_SEP "%s%05d.%s", |
|---|
| 747 |
val.psz_string, psz_prefix, i_num++, |
|---|
| 748 |
format.psz_string ) == -1 ) |
|---|
| 749 |
{ |
|---|
| 750 |
msg_Err( p_vout, "could not create snapshot" ); |
|---|
| 751 |
image_HandlerDelete( p_image ); |
|---|
| 752 |
return VLC_EGENERIC; |
|---|
| 753 |
} |
|---|
| 754 |
} |
|---|
| 755 |
while( utf8_stat( psz_filename, &st ) == 0 ); |
|---|
| 756 |
|
|---|
| 757 |
var_SetInteger( p_vout, "snapshot-num", i_num ); |
|---|
| 758 |
} |
|---|
| 759 |
else |
|---|
| 760 |
{ |
|---|
| 761 |
if( asprintf( &psz_filename, "%s" DIR_SEP "%s%u.%s", |
|---|
| 762 |
val.psz_string, psz_prefix, |
|---|
| 763 |
(unsigned int)(p_pic->date / 100000) & 0xFFFFFF, |
|---|
| 764 |
format.psz_string ) == -1 ) |
|---|
| 765 |
{ |
|---|
| 766 |
msg_Err( p_vout, "could not create snapshot" ); |
|---|
| 767 |
image_HandlerDelete( p_image ); |
|---|
| 768 |
return VLC_EGENERIC; |
|---|
| 769 |
} |
|---|
| 770 |
} |
|---|
| 771 |
|
|---|
| 772 |
free( psz_prefix ); |
|---|
| 773 |
} |
|---|
| 774 |
else |
|---|
| 775 |
{ |
|---|
| 776 |
psz_filename = str_format( p_vout, val.psz_string ); |
|---|
| 777 |
path_sanitize( psz_filename ); |
|---|
| 778 |
} |
|---|
| 779 |
|
|---|
| 780 |
free( val.psz_string ); |
|---|
| 781 |
free( format.psz_string ); |
|---|
| 782 |
|
|---|
| 783 |
|
|---|
| 784 |
i_ret = image_WriteUrl( p_image, p_pic, &fmt_in, &fmt_out, psz_filename ); |
|---|
| 785 |
if( i_ret != VLC_SUCCESS ) |
|---|
| 786 |
{ |
|---|
| 787 |
msg_Err( p_vout, "could not create snapshot %s", psz_filename ); |
|---|
| 788 |
free( psz_filename ); |
|---|
| 789 |
image_HandlerDelete( p_image ); |
|---|
| 790 |
return VLC_EGENERIC; |
|---|
| 791 |
} |
|---|
| 792 |
|
|---|
| 793 |
|
|---|
| 794 |
msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename ); |
|---|
| 795 |
vout_OSDMessage( VLC_OBJECT( p_vout ), DEFAULT_CHAN, |
|---|
| 796 |
"%s", psz_filename ); |
|---|
| 797 |
free( psz_filename ); |
|---|
| 798 |
|
|---|
| 799 |
|
|---|
| 800 |
if( var_GetBool( p_vout, "snapshot-preview" ) ) |
|---|
| 801 |
{ |
|---|
| 802 |
if( VoutSnapshotPip( p_vout, p_image, p_pic, &fmt_in ) ) |
|---|
| 803 |
msg_Warn( p_vout, "Failed to display snapshot" ); |
|---|
| 804 |
} |
|---|
| 805 |
image_HandlerDelete( p_image ); |
|---|
| 806 |
|
|---|
| 807 |
return VLC_SUCCESS; |
|---|
| 808 |
} |
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 |
|
|---|
| 814 |
void vout_EnableFilter( vout_thread_t *p_vout, char *psz_name, |
|---|
| 815 |
bool b_add, bool b_setconfig ) |
|---|
| 816 |
{ |
|---|
| 817 |
char *psz_parser; |
|---|
| 818 |
char *psz_string = config_GetPsz( p_vout, "vout-filter" ); |
|---|
| 819 |
|
|---|
| 820 |
|
|---|
| 821 |
if( !psz_string ) psz_string = strdup(""); |
|---|
| 822 |
|
|---|
| 823 |
psz_parser = strstr( psz_string, psz_name ); |
|---|
| 824 |
if( b_add ) |
|---|
| 825 |
{ |
|---|
| 826 |
if( !psz_parser ) |
|---|
| 827 |
{ |
|---|
| 828 |
psz_parser = psz_string; |
|---|
| 829 |
if( asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s", |
|---|
| 830 |
psz_string, psz_name ) == -1 ) |
|---|
| 831 |
{ |
|---|
| 832 |
free( psz_parser ); |
|---|
| 833 |
return; |
|---|
| 834 |
} |
|---|
| 835 |
free( psz_parser ); |
|---|
| 836 |
} |
|---|
| 837 |
else |
|---|
| 838 |
return; |
|---|
| 839 |
} |
|---|
| 840 |
else |
|---|
| 841 |
{ |
|---|
| 842 |
if( psz_parser ) |
|---|
| 843 |
{ |
|---|
| 844 |
memmove( psz_parser, psz_parser + strlen(psz_name) + |
|---|
| 845 |
(*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ), |
|---|
| 846 |
strlen(psz_parser + strlen(psz_name)) + 1 ); |
|---|
| 847 |
|
|---|
| 848 |
|
|---|
| 849 |
if( *(psz_string+strlen(psz_string ) -1 ) == ':' ) |
|---|
| 850 |
{ |
|---|
| 851 |
*(psz_string+strlen(psz_string ) -1 ) = '\0'; |
|---|
| 852 |
} |
|---|
| 853 |
} |
|---|
| 854 |
else |
|---|
| 855 |
{ |
|---|
| 856 |
free( psz_string ); |
|---|
| 857 |
return; |
|---|
| 858 |
} |
|---|
| 859 |
} |
|---|
| 860 |
if( b_setconfig ) |
|---|
| 861 |
config_PutPsz( p_vout, "vout-filter", psz_string ); |
|---|
| 862 |
|
|---|
| 863 |
var_SetString( p_vout, "vout-filter", psz_string ); |
|---|
| 864 |
free( psz_string ); |
|---|
| 865 |
} |
|---|
| 866 |
|
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 |
|
|---|
| 870 |
int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args ) |
|---|
| 871 |
{ |
|---|
| 872 |
(void)args; |
|---|
| 873 |
switch( i_query ) |
|---|
| 874 |
{ |
|---|
| 875 |
case VOUT_REPARENT: |
|---|
| 876 |
case VOUT_CLOSE: |
|---|
| 877 |
vout_ReleaseWindow( p_vout, NULL ); |
|---|
| 878 |
return VLC_SUCCESS; |
|---|
| 879 |
|
|---|
| 880 |
case VOUT_SNAPSHOT: |
|---|
| 881 |
p_vout->p->b_snapshot = true; |
|---|
| 882 |
return VLC_SUCCESS; |
|---|
| 883 |
|
|---|
| 884 |
default: |
|---|
| 885 |
msg_Dbg( p_vout, "control query not supported" ); |
|---|
| 886 |
} |
|---|
| 887 |
return VLC_EGENERIC; |
|---|
| 888 |
} |
|---|
| 889 |
|
|---|
| 890 |
|
|---|
| 891 |
|
|---|
| 892 |
|
|---|
| 893 |
< |
|---|