VLC  4.0.0-dev
libvlc_picture.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * libvlc_picture.h: libvlc external API
3  *****************************************************************************
4  * Copyright (C) 2018 VLC authors and VideoLAN
5  *
6  * Authors: Hugo BeauzĂ©e-Luyssen <hugo@beauzee.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22 
23 #ifndef VLC_LIBVLC_PICTURE_H
24 #define VLC_LIBVLC_PICTURE_H 1
25 
26 # ifdef __cplusplus
27 extern "C" {
28 # endif
29 
32 
34 {
39 
40 /**
41  * Increment the reference count of this picture.
42  *
43  * \see libvlc_picture_release()
44  * \param pic A picture object
45  */
46 LIBVLC_API void
48 
49 /**
50  * Decrement the reference count of this picture.
51  * When the reference count reaches 0, the picture will be released.
52  * The picture must not be accessed after calling this function.
53  *
54  * \see libvlc_picture_retain
55  * \param pic A picture object
56  */
57 LIBVLC_API void
59 
60 /**
61  * Saves this picture to a file. The image format is the same as the one
62  * returned by \link libvlc_picture_type \endlink
63  *
64  * \param pic A picture object
65  * \param path The path to the generated file
66  * \return 0 in case of success, -1 otherwise
67  */
68 LIBVLC_API int
69 libvlc_picture_save( const libvlc_picture_t* pic, const char* path );
70 
71 /**
72  * Returns the image internal buffer, including potential padding.
73  * The libvlc_picture_t owns the returned buffer, which must not be modified nor
74  * freed.
75  *
76  * \param pic A picture object
77  * \param size A pointer to a size_t that will hold the size of the buffer [required]
78  * \return A pointer to the internal buffer.
79  */
80 LIBVLC_API const unsigned char*
81 libvlc_picture_get_buffer( const libvlc_picture_t* pic, size_t *size );
82 
83 /**
84  * Returns the picture type
85  *
86  * \param pic A picture object
87  * \see libvlc_picture_type_t
88  */
91 
92 /**
93  * Returns the image stride, ie. the number of bytes per line.
94  * This can only be called on images of type libvlc_picture_Argb
95  *
96  * \param pic A picture object
97  */
98 LIBVLC_API unsigned int
100 
101 /**
102  * Returns the width of the image in pixels
103  *
104  * \param pic A picture object
105  */
106 LIBVLC_API unsigned int
108 
109 /**
110  * Returns the height of the image in pixels
111  *
112  * \param pic A picture object
113  */
114 LIBVLC_API unsigned int
116 
117 /**
118  * Returns the time at which this picture was generated, in milliseconds
119  * \param pic A picture object
120  */
123 
124 /**
125  * Returns the number of pictures in the list
126  */
128 
129 /**
130  * Returns the picture at the provided index.
131  *
132  * If the index is out of bound, the result is undefined.
133  */
135  size_t index );
136 
137 /**
138  * Destroys a picture list and releases the pictures it contains
139  * \param list The list to destroy
140  *
141  * Calling this function with a NULL list is safe and will return immediatly
142  */
144 
145 # ifdef __cplusplus
146 }
147 # endif
148 
149 #endif // VLC_LIBVLC_PICTURE_H
libvlc_picture_retain
LIBVLC_API void libvlc_picture_retain(libvlc_picture_t *pic)
Increment the reference count of this picture.
libvlc_picture_type_t
libvlc_picture_type_t
Definition: libvlc_picture.h:33
libvlc_picture_save
LIBVLC_API int libvlc_picture_save(const libvlc_picture_t *pic, const char *path)
Saves this picture to a file.
libvlc_picture_get_time
LIBVLC_API libvlc_time_t libvlc_picture_get_time(const libvlc_picture_t *pic)
Returns the time at which this picture was generated, in milliseconds.
libvlc_picture_list_t
struct libvlc_picture_list_t libvlc_picture_list_t
Definition: libvlc_picture.h:31
libvlc_picture_list_destroy
LIBVLC_API void libvlc_picture_list_destroy(libvlc_picture_list_t *list)
Destroys a picture list and releases the pictures it contains.
libvlc_picture_list_at
LIBVLC_API libvlc_picture_t * libvlc_picture_list_at(const libvlc_picture_list_t *list, size_t index)
Returns the picture at the provided index.
libvlc_picture_Jpg
@ libvlc_picture_Jpg
Definition: libvlc_picture.h:37
libvlc_picture_get_height
LIBVLC_API unsigned int libvlc_picture_get_height(const libvlc_picture_t *pic)
Returns the height of the image in pixels.
libvlc_picture_Argb
@ libvlc_picture_Argb
Definition: libvlc_picture.h:35
libvlc_picture_get_stride
LIBVLC_API unsigned int libvlc_picture_get_stride(const libvlc_picture_t *pic)
Returns the image stride, ie.
LIBVLC_API
#define LIBVLC_API
Definition: libvlc.h:42
libvlc_picture_get_width
LIBVLC_API unsigned int libvlc_picture_get_width(const libvlc_picture_t *pic)
Returns the width of the image in pixels.
libvlc_picture_list_count
LIBVLC_API size_t libvlc_picture_list_count(const libvlc_picture_list_t *list)
Returns the number of pictures in the list.
list
module_config_t ** list
Definition: core.c:400
libvlc_picture_release
LIBVLC_API void libvlc_picture_release(libvlc_picture_t *pic)
Decrement the reference count of this picture.
libvlc_time_t
int64_t libvlc_time_t
Definition: libvlc.h:78
libvlc_picture_get_buffer
const LIBVLC_API unsigned char * libvlc_picture_get_buffer(const libvlc_picture_t *pic, size_t *size)
Returns the image internal buffer, including potential padding.
libvlc_picture_t
struct libvlc_picture_t libvlc_picture_t
Definition: libvlc_picture.h:30
libvlc_picture_type
LIBVLC_API libvlc_picture_type_t libvlc_picture_type(const libvlc_picture_t *pic)
Returns the picture type.
libvlc_picture_Png
@ libvlc_picture_Png
Definition: libvlc_picture.h:36