1 /******************************************************************************
2     Copyright (C) 2019 by Dillon Pentz <dillon@vodbox.io>
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 "util/c99defs.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef void (*obs_missing_file_cb)(void *src, const char *new_path,
27 				    void *data);
28 
29 struct obs_missing_file;
30 struct obs_missing_files;
31 typedef struct obs_missing_file obs_missing_file_t;
32 typedef struct obs_missing_files obs_missing_files_t;
33 
34 enum obs_missing_file_src { OBS_MISSING_FILE_SOURCE, OBS_MISSING_FILE_SCRIPT };
35 
36 EXPORT obs_missing_files_t *obs_missing_files_create();
37 EXPORT obs_missing_file_t *obs_missing_file_create(const char *path,
38 						   obs_missing_file_cb callback,
39 						   int src_type, void *src,
40 						   void *data);
41 
42 EXPORT void obs_missing_files_add_file(obs_missing_files_t *files,
43 				       obs_missing_file_t *file);
44 EXPORT size_t obs_missing_files_count(obs_missing_files_t *files);
45 EXPORT obs_missing_file_t *
46 obs_missing_files_get_file(obs_missing_files_t *files, int idx);
47 EXPORT void obs_missing_files_destroy(obs_missing_files_t *files);
48 EXPORT void obs_missing_files_append(obs_missing_files_t *dst,
49 				     obs_missing_files_t *src);
50 
51 EXPORT void obs_missing_file_issue_callback(obs_missing_file_t *file,
52 					    const char *new_path);
53 EXPORT const char *obs_missing_file_get_path(obs_missing_file_t *file);
54 EXPORT const char *obs_missing_file_get_source_name(obs_missing_file_t *file);
55 EXPORT void obs_missing_file_release(obs_missing_file_t *file);
56 EXPORT void obs_missing_file_destroy(obs_missing_file_t *file);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61