cloudofoz / raylib-media

Clean and user-friendly extension for raylib that adds seamless audio and video streaming support via the FFmpeg libav* libraries. It enables easy integration of multimedia content into raylib applications, providing direct access to video textures and audio streams, with support for seeking and looping.
zlib License
47 stars 1 forks source link

Compile error #1

Closed GuvaCode closed 1 week ago

GuvaCode commented 1 week ago

Hi. I get errors when compiling

gcc -c rmedia.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -fPIC -O1 -Werror=implicit-function-declaration -D_GLFW_X11  -I.  -Iexternal/glfw/include
rmedia.c: In function ‘UnloadMediaContext’:
rmedia.c:811:26: warning: passing argument 1 of ‘IsQueueReady’ from incompatible pointer type [-Wincompatible-pointer-types]
  811 |         if (IsQueueReady(ctx))
      |                          ^~~
      |                          |
      |                          MediaContext * {aka struct MediaContext *}
rmedia.c:236:38: note: expected ‘const PacketQueue *’ but argument is of type ‘MediaContext *’ {aka ‘struct MediaContext *’}
  236 | bool IsQueueReady(const PacketQueue* queue);                    // Check if the queue is properly loaded.
      |                   ~~~~~~~~~~~~~~~~~~~^~~~~
rmedia.c: In function ‘LoadMediaEx’:
rmedia.c:874:34: error: incompatible type for argument 1 of ‘IsQueueReady’
  874 |                 if (IsQueueReady(ret))
      |                                  ^~~
      |                                  |
      |                                  MediaStream
rmedia.c:236:38: note: expected ‘const PacketQueue *’ but argument is of type ‘MediaStream’
  236 | bool IsQueueReady(const PacketQueue* queue);                    // Check if the queue is properly loaded.
      |                   ~~~~~~~~~~~~~~~~~~~^~~~~
rmedia.c:897:22: error: implicit declaration of function ‘IsAudioStreamReady’; did you mean ‘IsAudioStreamValid’? [-Werror=implicit-function-declaration]
  897 |                 if (!IsAudioStreamReady(ret.audioStream))
      |                      ^~~~~~~~~~~~~~~~~~
      |                      IsAudioStreamValid
rmedia.c: In function ‘UnloadMedia’:
rmedia.c:939:12: error: implicit declaration of function ‘IsTextureReady’; did you mean ‘IsQueueReady’? [-Werror=implicit-function-declaration]
  939 |         if(IsTextureReady(media->videoTexture))
      |            ^~~~~~~~~~~~~~
      |            IsQueueReady
cc1: some warnings being treated as errors
make: *** [Makefile:764: rmedia.o] Ошибка 1

Kernel: 6.8.0-48-generic arch: x86_64 bits: 64 compiler: gcc v: 13.2.0 Distro: Linux Mint 22 Wilma base: Ubuntu 24.04 noble

raysan5 commented 1 week ago

IsTextureReady() was renamed to IsTextureValid() in latest raylib.

GuvaCode commented 1 week ago

@raysan5 oh tnx

cloudofoz commented 1 week ago

@raysan5, thank you for your help and for pointing out this change!

@GuvaCode, thank you for testing it out. When raylib updates its version macros (RAYLIB_VERSION_MAJOR and RAYLIB_VERSION_MINOR), I will provide a proper compatibility fix that works for all versions.

In the meantime (if you haven’t already done so), you can add the following #define statements at the beginning of your raymedia.h file. This will alias the new function names to their legacy equivalents, maintaining compatibility:


#define IsImageReady IsImageValid
#define IsTextureReady IsTextureValid
#define IsAudioStreamReady IsAudioStreamValid
#define IsModelReady IsModelValid
#define IsRenderTextureReady IsRenderTextureValid