VLC  3.0.15
snapshot.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * snapshot.h : vout internal snapshot
3  *****************************************************************************
4  * Copyright (C) 2009 Laurent Aimar
5  * $Id: 3085d5038b04e5a4a601b25676157976dbd2898b $
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef LIBVLC_VOUT_INTERNAL_SNAPSHOT_H
25 #define LIBVLC_VOUT_INTERNAL_SNAPSHOT_H
26 
27 #include <vlc_picture.h>
28 
29 typedef struct {
31  vlc_cond_t wait;
32 
33  bool is_available;
34  int request_count;
35  picture_t *picture;
36 
38 
39 /* */
42 
44 
45 /* */
47 
48 /**
49  * It tells if they are pending snapshot request
50  */
52 
53 /**
54  * It set the picture used to create the snapshots.
55  *
56  * The given picture is cloned.
57  * If p_fmt is non NULL it will override the format of the p_picture (mainly
58  * used because of aspect/crop problems).
59  */
61 
62 /**
63  * This function will return the directory used for snapshots
64  */
65 char *vout_snapshot_GetDirectory(void);
66 
67 typedef struct {
68  bool is_sequential;
69  int sequence;
70  char *path;
71  char *format;
72  char *prefix_fmt;
74 
75 /**
76  * This function will write an image to the disk an return the file name created.
77  */
78 int vout_snapshot_SaveImage(char **name, int *sequential,
79  const block_t *image,
80  vout_thread_t *p_vout,
81  const vout_snapshot_save_cfg_t *cfg);
82 
83 #endif
vlc_gl_surface::height
int height
Definition: opengl.c:105
vlc_fopen
FILE * vlc_fopen(const char *filename, const char *mode)
Opens a FILE pointer.
Definition: filesystem.c:46
vout_snapshot_GetDirectory
char * vout_snapshot_GetDirectory(void)
This function will return the directory used for snapshots.
Definition: snapshot.c:135
picture_t::format
video_frame_format_t format
The properties of the picture.
Definition: vlc_picture.h:73
vlc_mutex_trylock
int vlc_mutex_trylock(vlc_mutex_t *p_mutex)
Tries to acquire a mutex.
Definition: thread.c:129
vout_window_t
Graphical window.
Definition: vlc_vout_window.h:130
vout_snapshot_Clean
void vout_snapshot_Clean(vout_snapshot_t *)
Definition: snapshot.c:53
vlc_gl_surface_ResizeNotify
static void vlc_gl_surface_ResizeNotify(vout_window_t *surface, unsigned width, unsigned height)
Definition: opengl.c:109
vlc_common.h
vout_snapshot_SaveImage
int vout_snapshot_SaveImage(char **name, int *sequential, const block_t *image, vout_thread_t *p_vout, const vout_snapshot_save_cfg_t *cfg)
This function will write an image to the disk an return the file name created.
Definition: snapshot.c:140
DIR_SEP
#define DIR_SEP
Definition: vlc_common.h:1023
vlc_vout.h
block_t::i_buffer
size_t i_buffer
Payload length.
Definition: vlc_block.h:116
gmtime_r
struct tm * gmtime_r(const time_t *, struct tm *)
vout_window_t::owner
vout_window_owner_t owner
Definition: vlc_vout_window.h:199
vlc_gl_Create
vlc_gl_t * vlc_gl_Create(struct vout_window_t *wnd, unsigned flags, const char *name)
Creates an OpenGL context (and its underlying surface).
Definition: opengl.c:50
vlc_opengl.h
vout_snapshot_End
void vout_snapshot_End(vout_snapshot_t *)
Definition: snapshot.c:66
video_format_t
video format description
Definition: vlc_es.h:325
msg_Dbg
#define msg_Dbg(p_this,...)
Definition: vlc_messages.h:86
vout_snapshot_save_cfg_t::prefix_fmt
char * prefix_fmt
Definition: snapshot.h:71
vout_snapshot_save_cfg_t::is_sequential
bool is_sequential
Definition: snapshot.h:67
vout_snapshot_t::is_available
bool is_available
Definition: snapshot.h:52
vlc_cond_broadcast
void vlc_cond_broadcast(vlc_cond_t *p_condvar)
Wakes up all threads waiting on a condition variable.
Definition: thread.c:262
VLC_EGENERIC
#define VLC_EGENERIC
Unspecified error.
Definition: vlc_common.h:350
vlc_gl_Resize
static void vlc_gl_Resize(vlc_gl_t *gl, unsigned w, unsigned h)
Definition: vlc_opengl.h:99
vout_snapshot_Clean
void vout_snapshot_Clean(vout_snapshot_t *snap)
Definition: snapshot.c:53
vlc_stat
int vlc_stat(const char *filename, struct stat *buf)
Finds file/inode information - like stat().
Definition: filesystem.c:170
vlc_gl_surface::width
int width
Definition: opengl.c:104
picture_Release
void picture_Release(picture_t *p_picture)
This function will release a picture.
Definition: picture.c:300
vout_snapshot_Init
void vout_snapshot_Init(vout_snapshot_t *snap)
Definition: snapshot.c:44
vout_window_New
vout_window_t * vout_window_New(vlc_object_t *obj, const char *module, const vout_window_cfg_t *cfg, const vout_window_owner_t *owner)
Creates a new window.
Definition: window.c:52
vlc_gl_surface_CheckSize
bool vlc_gl_surface_CheckSize(vlc_gl_t *gl, unsigned *restrict width, unsigned *restrict height)
Checks if the dimensions of the surface used by the OpenGL context have changed (since the previous c...
Definition: opengl.c:169
vlc_cond_t
pthread_cond_t vlc_cond_t
Condition variable.
Definition: vlc_threads.h:279
picture_t
Video picture.
Definition: vlc_picture.h:68
asprintf
int asprintf(char **, const char *,...)
vout_snapshot_Set
void vout_snapshot_Set(vout_snapshot_t *, const video_format_t *, picture_t *)
It set the picture used to create the snapshots.
Definition: snapshot.c:112
VLC_OPENGL_ES2
Definition: vlc_opengl.h:82
vout_snapshot_save_cfg_t
Definition: snapshot.h:66
timespec::tv_nsec
long tv_nsec
Definition: vlc_fixups.h:445
video_format_CopyCrop
void video_format_CopyCrop(video_format_t *p_dst, const video_format_t *p_src)
It will copy the crop properties from a video_format_t to another.
Definition: es_format.c:225
picture_t::p_next
struct picture_t * p_next
Next picture in a FIFO a pictures.
Definition: vlc_picture.h:101
vlc_gl_surface_Create
vlc_gl_t * vlc_gl_surface_Create(vlc_object_t *obj, const vout_window_cfg_t *cfg, struct vout_window_t **restrict wp)
Definition: opengl.c:122
vout_snapshot_t::lock
vlc_mutex_t lock
Definition: snapshot.h:49
vout_thread_sys_t::input
vlc_object_t * input
Definition: vout_internal.h:52
lock
static vlc_mutex_t lock
Definition: interface.c:62
vout_snapshot_t::picture
picture_t * picture
Definition: snapshot.h:54
vlc_object_release
#define vlc_object_release(a)
Definition: vlc_objects.h:63
filename_sanitize
void filename_sanitize(char *str)
Sanitize a file name.
Definition: strings.c:875
vlc_gl_t::module
module_t * module
Definition: vlc_opengl.h:45
timespec::tv_sec
time_t tv_sec
Definition: vlc_fixups.h:444
vout_snapshot_IsRequested
bool vout_snapshot_IsRequested(vout_snapshot_t *)
It tells if they are pending snapshot request.
Definition: snapshot.c:103
TIME_UTC
#define TIME_UTC
Definition: vlc_fixups.h:254
vlc_atomic.h
vlc_gl_priv_t
Definition: opengl.c:34
vout_snapshot_save_cfg_t::format
char * format
Definition: snapshot.h:70
timespec_get
int timespec_get(struct timespec *, int)
vout_thread_t::p
vout_thread_sys_t * p
Definition: vlc_vout.h:74
vout_snapshot_Init
void vout_snapshot_Init(vout_snapshot_t *)
Definition: snapshot.c:44
vlc_strings.h
vout_snapshot_save_cfg_t::sequence
int sequence
Definition: snapshot.h:68
vout_snapshot_GetDirectory
char * vout_snapshot_GetDirectory(void)
This function will return the directory used for snapshots.
Definition: snapshot.c:135
vout_window_cfg_t::width
unsigned width
Definition: vlc_vout_window.h:105
vlc_gl_t
Definition: vlc_opengl.h:40
vlc_mutex_init
void vlc_mutex_init(vlc_mutex_t *p_mutex)
Initializes a fast mutex.
Definition: thread.c:85
vlc_gl_surface::lock
vlc_mutex_t lock
Definition: opengl.c:106
vout_snapshot_End
void vout_snapshot_End(vout_snapshot_t *snap)
Definition: snapshot.c:66
vlc_gl_priv_t::ref_count
atomic_uint ref_count
Definition: opengl.c:54
vlc_fs.h
vout_window_Delete
void vout_window_Delete(vout_window_t *window)
Deletes a window created by vout_window_New().
Definition: window.c:99
vlc_object_t
The main vlc_object_t structure.
Definition: vlc_objects.h:39
vout_snapshot_IsRequested
bool vout_snapshot_IsRequested(vout_snapshot_t *snap)
It tells if they are pending snapshot request.
Definition: snapshot.c:103
vout_snapshot_t
Definition: snapshot.h:28
vout_snapshot_Get
picture_t * vout_snapshot_Get(vout_snapshot_t *, mtime_t timeout)
Definition: snapshot.c:77
vlc_mutex_t
pthread_mutex_t vlc_mutex_t
Mutex.
Definition: vlc_threads.h:267
VLC_SUCCESS
#define VLC_SUCCESS
No error.
Definition: vlc_common.h:349
str_format
static char * str_format(input_thread_t *input, const char *fmt)
Definition: vlc_strings.h:143
strdup
char * strdup(const char *)
vlc_gl_surface
Definition: opengl.c:102
vlc_picture.h
vout_window_cfg_t
Definition: vlc_vout_window.h:90
VLC_PICTURES_DIR
Definition: vlc_configuration.h:132
vlc_custom_create
#define vlc_custom_create(o, s, n)
Definition: libvlc.h:108
vlc_block.h
name
const char name[16]
Definition: httpd.c:1249
VLC_OPENGL
Definition: vlc_opengl.h:81
vlc_cond_destroy
void vlc_cond_destroy(vlc_cond_t *p_condvar)
Deinitializes a condition variable.
Definition: thread.c:228
config_GetUserDir
char * config_GetUserDir(vlc_userdir_t type)
Definition: specific.c:272
vlc_cond_init
void vlc_cond_init(vlc_cond_t *p_condvar)
Initializes a condition variable.
Definition: thread.c:216
vlc_gl_Release
void vlc_gl_Release(vlc_gl_t *gl)
Definition: opengl.c:91
vout_snapshot_t::wait
vlc_cond_t wait
Definition: snapshot.h:50
vout_snapshot_Set
void vout_snapshot_Set(vout_snapshot_t *snap, const video_format_t *fmt, picture_t *picture)
It set the picture used to create the snapshots.
Definition: snapshot.c:112
snapshot.h
vlc_mutex_destroy
void vlc_mutex_destroy(vlc_mutex_t *p_mutex)
Deinitializes a mutex.
Definition: thread.c:110
vout_snapshot_t::request_count
int request_count
Definition: snapshot.h:53
vlc_gl_surface_Destroy
void vlc_gl_surface_Destroy(vlc_gl_t *gl)
Definition: opengl.c:191
vlc_mutex_unlock
void vlc_mutex_unlock(vlc_mutex_t *p_mutex)
Releases a mutex.
Definition: thread.c:138
unlikely
#define unlikely(p)
Definition: vlc_common.h:114
vout_snapshot_SaveImage
int vout_snapshot_SaveImage(char **name, int *sequential, const block_t *image, vout_thread_t *p_vout, const vout_snapshot_save_cfg_t *cfg)
This function will write an image to the disk an return the file name created.
Definition: snapshot.c:140
vout_window_owner
Definition: vlc_vout_window.h:110
vlc_vout_window.h
vlc_gl_Hold
void vlc_gl_Hold(vlc_gl_t *gl)
Definition: opengl.c:85
localtime_r
struct tm * localtime_r(const time_t *, struct tm *)
libvlc.h
mtime_t
int64_t mtime_t
High precision date or time interval.
Definition: vlc_common.h:150
vlc_cond_timedwait
int vlc_cond_timedwait(vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex, mtime_t deadline)
Waits on a condition variable up to a certain date.
Definition: thread.c:273
vout_snapshot_save_cfg_t::path
char * path
Definition: snapshot.h:69
timespec
Definition: vlc_fixups.h:443
block_t::p_buffer
uint8_t * p_buffer
Payload start.
Definition: vlc_block.h:115
vout_snapshot_Get
picture_t * vout_snapshot_Get(vout_snapshot_t *snap, mtime_t timeout)
Definition: snapshot.c:77
vout_thread_t
Video output thread descriptor.
Definition: vlc_vout.h:70
input_thread_t
Main structure representing an input thread.
Definition: vlc_input.h:221
mdate
mtime_t mdate(void)
Precision monotonic clock.
Definition: thread.c:406
vout_internal.h
module_unneed
#define module_unneed(a, b)
Definition: vlc_modules.h:49
vout_window_cfg_t::height
unsigned height
Definition: vlc_vout_window.h:106
vlc_mutex_lock
void vlc_mutex_lock(vlc_mutex_t *p_mutex)
Acquires a mutex.
Definition: thread.c:123
block_t
Definition: vlc_block.h:111
msg_Err
#define msg_Err(p_this,...)
Definition: vlc_messages.h:82
picture_Clone
picture_t * picture_Clone(picture_t *picture)
Perform a shallow picture copy.
Definition: picture.c:387
vout_window_owner::sys
void * sys
Definition: vlc_vout_window.h:111
vlc_gl_t::surface
struct vout_window_t * surface
Definition: vlc_opengl.h:44
module_need
#define module_need(a, b, c, d)
Definition: vlc_modules.h:47
vlc_gl_surface_t
struct vlc_gl_surface vlc_gl_surface_t
vlc_modules.h
vlc_gl_priv_t::gl
vlc_gl_t gl
Definition: opengl.c:53