Open Broadcaster Software
Free, open source software for live streaming and recording
image-file.h
Go to the documentation of this file.
1 /******************************************************************************
2  Copyright (C) 2016 by Hugh Bailey <obs.jim@gmail.com>
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
17 
18 #pragma once
19 
20 #include "graphics.h"
21 #include "libnsgif/libnsgif.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct gs_image_file {
30  uint32_t cx;
31  uint32_t cy;
34  bool loaded;
35 
37  uint8_t *gif_data;
40  uint64_t cur_time;
41  int cur_frame;
42  int cur_loop;
44 
45  uint8_t *texture_data;
47 };
48 
50  struct gs_image_file image;
51  uint64_t mem_usage;
52 };
53 
54 typedef struct gs_image_file gs_image_file_t;
55 typedef struct gs_image_file2 gs_image_file2_t;
56 
59 
62  uint64_t elapsed_time_ns);
64 
65 EXPORT void gs_image_file2_init(gs_image_file2_t *if2, const char *file);
66 
67 static void gs_image_file2_free(gs_image_file2_t *if2)
68 {
70  if2->mem_usage = 0;
71 }
72 
73 static inline void gs_image_file2_init_texture(gs_image_file2_t *if2)
74 {
76 }
77 
78 static inline bool gs_image_file2_tick(gs_image_file2_t *if2,
79  uint64_t elapsed_time_ns)
80 {
81  return gs_image_file_tick(&if2->image, elapsed_time_ns);
82 }
83 
84 static inline void gs_image_file2_update_texture(gs_image_file2_t *if2)
85 {
87 }
88 
89 #ifdef __cplusplus
90 }
91 #endif
gs_image_file_init_texture
EXPORT void gs_image_file_init_texture(gs_image_file_t *image)
graphics.h
gs_image_file_update_texture
EXPORT void gs_image_file_update_texture(gs_image_file_t *image)
gs_image_file::last_decoded_frame
int last_decoded_frame
Definition: image-file.h:43
gs_color_format
gs_color_format
Definition: graphics.h:56
gs_image_file::is_animated_gif
bool is_animated_gif
Definition: image-file.h:32
gs_image_file
Definition: image-file.h:27
gs_image_file::cy
uint32_t cy
Definition: image-file.h:31
gif_bitmap_callback_vt
Definition: libnsgif.h:73
EXPORT
#define EXPORT
Definition: c99defs.h:37
gs_image_file::format
enum gs_color_format format
Definition: image-file.h:29
gs_image_file_init
EXPORT void gs_image_file_init(gs_image_file_t *image, const char *file)
gs_image_file::frame_updated
bool frame_updated
Definition: image-file.h:33
gs_image_file::texture_data
uint8_t * texture_data
Definition: image-file.h:45
gs_texture_t
struct gs_texture gs_texture_t
Definition: graphics.h:266
gs_image_file::texture
gs_texture_t * texture
Definition: image-file.h:28
gs_image_file_free
EXPORT void gs_image_file_free(gs_image_file_t *image)
gs_image_file2
Definition: image-file.h:49
gs_image_file::bitmap_callbacks
gif_bitmap_callback_vt bitmap_callbacks
Definition: image-file.h:46
gs_image_file::animation_frame_cache
uint8_t ** animation_frame_cache
Definition: image-file.h:38
gif_animation
Definition: libnsgif.h:86
libnsgif.h
gs_image_file::loaded
bool loaded
Definition: image-file.h:34
gs_image_file::gif_data
uint8_t * gif_data
Definition: image-file.h:37
gs_image_file::gif
gif_animation gif
Definition: image-file.h:36
gs_image_file::cx
uint32_t cx
Definition: image-file.h:30
gs_image_file2::image
struct gs_image_file image
Definition: image-file.h:50
gs_image_file::cur_frame
int cur_frame
Definition: image-file.h:41
gs_image_file::cur_time
uint64_t cur_time
Definition: image-file.h:40
gs_image_file2_init
EXPORT void gs_image_file2_init(gs_image_file2_t *if2, const char *file)
gs_image_file::cur_loop
int cur_loop
Definition: image-file.h:42
gs_image_file_tick
EXPORT bool gs_image_file_tick(gs_image_file_t *image, uint64_t elapsed_time_ns)
gs_image_file2::mem_usage
uint64_t mem_usage
Definition: image-file.h:51
gs_image_file::animation_frame_data
uint8_t * animation_frame_data
Definition: image-file.h:39