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 
51  uint64_t mem_usage;
52 };
53 
56 
57 EXPORT void gs_image_file_init(gs_image_file_t *image, const char *file);
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
uint8_t ** animation_frame_cache
Definition: image-file.h:38
gs_texture_t * texture
Definition: image-file.h:28
gif_bitmap_callback_vt bitmap_callbacks
Definition: image-file.h:46
Definition: image-file.h:49
bool loaded
Definition: image-file.h:34
EXPORT void gs_image_file2_init(gs_image_file2_t *if2, const char *file)
gs_color_format
Definition: graphics.h:56
uint8_t * gif_data
Definition: image-file.h:37
int cur_frame
Definition: image-file.h:41
uint64_t cur_time
Definition: image-file.h:40
gif_animation gif
Definition: image-file.h:36
uint32_t cx
Definition: image-file.h:30
EXPORT void gs_image_file_update_texture(gs_image_file_t *image)
#define EXPORT
Definition: c99defs.h:37
uint8_t * animation_frame_data
Definition: image-file.h:39
Definition: image-file.h:27
int cur_loop
Definition: image-file.h:42
EXPORT bool gs_image_file_tick(gs_image_file_t *image, uint64_t elapsed_time_ns)
int last_decoded_frame
Definition: image-file.h:43
EXPORT void gs_image_file_free(gs_image_file_t *image)
struct gs_texture gs_texture_t
Definition: graphics.h:266
EXPORT void gs_image_file_init(gs_image_file_t *image, const char *file)
uint32_t cy
Definition: image-file.h:31
bool is_animated_gif
Definition: image-file.h:32
Definition: libnsgif.h:86
Definition: libnsgif.h:73
bool frame_updated
Definition: image-file.h:33
EXPORT void gs_image_file_init_texture(gs_image_file_t *image)
enum gs_color_format format
Definition: image-file.h:29
uint64_t mem_usage
Definition: image-file.h:51
struct gs_image_file image
Definition: image-file.h:50
uint8_t * texture_data
Definition: image-file.h:45