Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
17818d7b
Commit
17818d7b
authored
Jan 16, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use str_format_meta for snapshots
Fixes: #9938
parent
3514f7b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
src/video_output/snapshot.c
src/video_output/snapshot.c
+10
-6
src/video_output/snapshot.h
src/video_output/snapshot.h
+1
-1
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+1
-1
No files found.
src/video_output/snapshot.c
View file @
17818d7b
...
...
@@ -26,6 +26,7 @@
# include "config.h"
#endif
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
...
...
@@ -36,8 +37,10 @@
#include <vlc_fs.h>
#include <vlc_strings.h>
#include <vlc_block.h>
#include <vlc_vout.h>
#include "snapshot.h"
#include "vout_internal.h"
/* */
void
vout_snapshot_Init
(
vout_snapshot_t
*
snap
)
...
...
@@ -137,12 +140,13 @@ char *vout_snapshot_GetDirectory(void)
/* */
int
vout_snapshot_SaveImage
(
char
**
name
,
int
*
sequential
,
const
block_t
*
image
,
v
lc_object_t
*
objec
t
,
v
out_thread_t
*
p_vou
t
,
const
vout_snapshot_save_cfg_t
*
cfg
)
{
/* */
char
*
filename
;
DIR
*
pathdir
=
vlc_opendir
(
cfg
->
path
);
input_thread_t
*
input
=
(
input_thread_t
*
)
p_vout
->
p
->
input
;
if
(
pathdir
!=
NULL
)
{
/* The use specified a directory path */
closedir
(
pathdir
);
...
...
@@ -150,7 +154,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
/* */
char
*
prefix
=
NULL
;
if
(
cfg
->
prefix_fmt
)
prefix
=
str_format
_time
(
cfg
->
prefix_fmt
);
prefix
=
str_format
(
input
,
cfg
->
prefix_fmt
);
if
(
prefix
)
filename_sanitize
(
prefix
);
else
{
...
...
@@ -194,7 +198,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
free
(
prefix
);
}
else
{
/* The user specified a full path name (including file name) */
filename
=
str_format
_time
(
cfg
->
path
);
filename
=
str_format
(
input
,
cfg
->
path
);
path_sanitize
(
filename
);
}
...
...
@@ -204,12 +208,12 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
/* Save the snapshot */
FILE
*
file
=
vlc_fopen
(
filename
,
"wb"
);
if
(
!
file
)
{
msg_Err
(
objec
t
,
"Failed to open '%s'"
,
filename
);
msg_Err
(
p_vou
t
,
"Failed to open '%s'"
,
filename
);
free
(
filename
);
goto
error
;
}
if
(
fwrite
(
image
->
p_buffer
,
image
->
i_buffer
,
1
,
file
)
!=
1
)
{
msg_Err
(
objec
t
,
"Failed to write to '%s'"
,
filename
);
msg_Err
(
p_vou
t
,
"Failed to write to '%s'"
,
filename
);
fclose
(
file
);
free
(
filename
);
goto
error
;
...
...
@@ -225,7 +229,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
return
VLC_SUCCESS
;
error:
msg_Err
(
objec
t
,
"could not save snapshot"
);
msg_Err
(
p_vou
t
,
"could not save snapshot"
);
return
VLC_EGENERIC
;
}
src/video_output/snapshot.h
View file @
17818d7b
...
...
@@ -77,7 +77,7 @@ typedef struct {
*/
int
vout_snapshot_SaveImage
(
char
**
name
,
int
*
sequential
,
const
block_t
*
image
,
v
lc_object_t
*
objec
t
,
v
out_thread_t
*
p_vou
t
,
const
vout_snapshot_save_cfg_t
*
cfg
);
#endif
src/video_output/vout_intf.c
View file @
17818d7b
...
...
@@ -431,7 +431,7 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
char
*
psz_filename
;
int
i_sequence
;
if
(
vout_snapshot_SaveImage
(
&
psz_filename
,
&
i_sequence
,
p_image
,
VLC_OBJECT
(
p_vout
)
,
&
cfg
)
)
p_image
,
p_vout
,
&
cfg
)
)
goto
exit
;
if
(
cfg
.
is_sequential
)
var_SetInteger
(
p_vout
,
"snapshot-num"
,
i_sequence
+
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment