]> git.sesse.net Git - vlc/blob - src/video_output/snapshot.h
macosx: fix wrong ref counting in media info
[vlc] / src / video_output / snapshot.h
1 /*****************************************************************************
2  * snapshot.h : vout internal snapshot
3  *****************************************************************************
4  * Copyright (C) 2009 Laurent Aimar
5  * $Id$
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 {
30     vlc_mutex_t lock;
31     vlc_cond_t  wait;
32
33         bool        is_available;
34         int         request_count;
35         picture_t   *picture;
36
37 } vout_snapshot_t;
38
39 /* */
40 void vout_snapshot_Init(vout_snapshot_t *);
41 void vout_snapshot_Clean(vout_snapshot_t *);
42
43 void vout_snapshot_End(vout_snapshot_t *);
44
45 /* */
46 picture_t *vout_snapshot_Get(vout_snapshot_t *, mtime_t timeout);
47
48 /**
49  * It tells if they are pending snapshot request
50  */
51 bool vout_snapshot_IsRequested(vout_snapshot_t *);
52
53 /**
54  * It set the picture used to create the snapshots.
55  *
56  * The given picture is only copied and not released.
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  */
60 void vout_snapshot_Set(vout_snapshot_t *, const video_format_t *, const picture_t *);
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;
73 } vout_snapshot_save_cfg_t;
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