Commit 001e307c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: inherit variables from configuration (fixes #7378)

The VLC UIs use the VLC configuration instead of variables. That way,
updated values are propagated immediately, rather than when a video
output is created.

Since the snapshot-related variables have no callbacks, they only need
to be created if and when they are overriden/set. This only occurs with
the LibVLC media player snapshot function (which remains quite broken).
parent f0a7d9a4
...@@ -147,11 +147,17 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num, ...@@ -147,11 +147,17 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
if (p_vout == NULL) if (p_vout == NULL)
return -1; return -1;
/* FIXME: This is not atomic. Someone else could change the values, /* FIXME: This is not atomic. All parameters should be passed at once
* at least in theory. */ * (obviously _not_ with var_*()). Also, the libvlc object should not be
* used for the callbacks: that breaks badly if there are concurrent
* media players in the instance. */
var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER );
var_SetInteger( p_vout, "snapshot-width", i_width); var_SetInteger( p_vout, "snapshot-width", i_width);
var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER );
var_SetInteger( p_vout, "snapshot-height", i_height ); var_SetInteger( p_vout, "snapshot-height", i_height );
var_Create( p_vout, "snapshot-path", VLC_VAR_STRING );
var_SetString( p_vout, "snapshot-path", psz_filepath ); var_SetString( p_vout, "snapshot-path", psz_filepath );
var_Create( p_vout, "snapshot-format", VLC_VAR_STRING );
var_SetString( p_vout, "snapshot-format", "png" ); var_SetString( p_vout, "snapshot-format", "png" );
var_TriggerCallback( p_vout, "video-snapshot" ); var_TriggerCallback( p_vout, "video-snapshot" );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
......
...@@ -470,8 +470,8 @@ int vout_GetSnapshot(vout_thread_t *vout, ...@@ -470,8 +470,8 @@ int vout_GetSnapshot(vout_thread_t *vout,
if (type && image_Type2Fourcc(type)) if (type && image_Type2Fourcc(type))
codec = image_Type2Fourcc(type); codec = image_Type2Fourcc(type);
const int override_width = var_GetInteger(vout, "snapshot-width"); const int override_width = var_InheritInteger(vout, "snapshot-width");
const int override_height = var_GetInteger(vout, "snapshot-height"); const int override_height = var_InheritInteger(vout, "snapshot-height");
if (picture_Export(VLC_OBJECT(vout), image_dst, fmt, if (picture_Export(VLC_OBJECT(vout), image_dst, fmt,
picture, codec, override_width, override_height)) { picture, codec, override_width, override_height)) {
......
...@@ -149,16 +149,8 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -149,16 +149,8 @@ void vout_IntfInit( vout_thread_t *p_vout )
char *psz_buf; char *psz_buf;
/* Create a few object variables we'll need later on */ /* Create a few object variables we'll need later on */
var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-prefix", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-preview", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-sequential",
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER ); var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER );
var_SetInteger( p_vout, "snapshot-num", 1 ); var_SetInteger( p_vout, "snapshot-num", 1 );
var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
...@@ -378,7 +370,7 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char ...@@ -378,7 +370,7 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char
msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename ); msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
if( var_GetBool( p_vout, "snapshot-preview" ) ) if( var_InheritBool( p_vout, "snapshot-preview" ) )
{ {
if( VoutSnapshotPip( p_vout, p_pic ) ) if( VoutSnapshotPip( p_vout, p_pic ) )
msg_Warn( p_vout, "Failed to display snapshot" ); msg_Warn( p_vout, "Failed to display snapshot" );
...@@ -390,9 +382,9 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char ...@@ -390,9 +382,9 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char
*/ */
static void VoutSaveSnapshot( vout_thread_t *p_vout ) static void VoutSaveSnapshot( vout_thread_t *p_vout )
{ {
char *psz_path = var_GetNonEmptyString( p_vout, "snapshot-path" ); char *psz_path = var_InheritString( p_vout, "snapshot-path" );
char *psz_format = var_GetNonEmptyString( p_vout, "snapshot-format" ); char *psz_format = var_InheritString( p_vout, "snapshot-format" );
char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" ); char *psz_prefix = var_InheritString( p_vout, "snapshot-prefix" );
/* */ /* */
picture_t *p_picture; picture_t *p_picture;
...@@ -420,7 +412,7 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout ) ...@@ -420,7 +412,7 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
vout_snapshot_save_cfg_t cfg; vout_snapshot_save_cfg_t cfg;
memset( &cfg, 0, sizeof(cfg) ); memset( &cfg, 0, sizeof(cfg) );
cfg.is_sequential = var_GetBool( p_vout, "snapshot-sequential" ); cfg.is_sequential = var_InheritBool( p_vout, "snapshot-sequential" );
cfg.sequence = var_GetInteger( p_vout, "snapshot-num" ); cfg.sequence = var_GetInteger( p_vout, "snapshot-num" );
cfg.path = psz_path; cfg.path = psz_path;
cfg.format = psz_format; cfg.format = psz_format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment