godot_videodecoder.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*************************************************************************/
  2. /* godot_videodecoder.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GODOT_NATIVEVIDEODECODER_H
  31. #define GODOT_NATIVEVIDEODECODER_H
  32. #include <gdnative/gdnative.h>
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #define GODOTAV_API_MAJOR 0
  37. #define GODOTAV_API_MINOR 1
  38. typedef struct
  39. {
  40. godot_gdnative_api_version version;
  41. void *next;
  42. void *(*constructor)(godot_object *);
  43. void (*destructor)(void *);
  44. const char *(*get_plugin_name)(void);
  45. const char **(*get_supported_extensions)(int *count);
  46. godot_bool (*open_file)(void *, void *); // data struct, and a FileAccess pointer
  47. godot_real (*get_length)(const void *);
  48. godot_real (*get_playback_position)(const void *);
  49. void (*seek)(void *, godot_real);
  50. void (*set_audio_track)(void *, godot_int);
  51. void (*update)(void *, godot_real);
  52. godot_pool_byte_array *(*get_videoframe)(void *);
  53. godot_int (*get_audioframe)(void *, float *, int);
  54. godot_int (*get_channels)(const void *);
  55. godot_int (*get_mix_rate)(const void *);
  56. godot_vector2 (*get_texture_size)(const void *);
  57. } godot_videodecoder_interface_gdnative;
  58. typedef int (*GDNativeAudioMixCallback)(void *, const float *, int);
  59. // FileAccess wrappers for custom FFmpeg IO
  60. godot_int GDAPI godot_videodecoder_file_read(void *file_ptr, uint8_t *buf, int buf_size);
  61. int64_t GDAPI godot_videodecoder_file_seek(void *file_ptr, int64_t pos, int whence);
  62. void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interface_gdnative *p_interface);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* GODOT_NATIVEVIDEODECODER_H */