kodi-shim.c 666 B

1234567891011121314151617181920212223242526272829
  1. // from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881536
  2. #define _GNU_SOURCE
  3. #include <dlfcn.h>
  4. #include <stdint.h>
  5. // Mini version of AVPacket
  6. typedef struct AVPacket {
  7. void *buf;
  8. int64_t pts;
  9. int64_t dts;
  10. uint8_t *data;
  11. int size;
  12. } AVPacket;
  13. int avcodec_decode_audio4(void* a, void* b, int* got_frame_ptr, const AVPacket* pkt)
  14. {
  15. // Ignore null packets
  16. if (pkt->size == 0)
  17. {
  18. *got_frame_ptr = 0;
  19. return 0;
  20. }
  21. // Forward to real function
  22. int (*orig_decode)(void*, void*, int*, const AVPacket*) =
  23. dlsym(RTLD_NEXT, "avcodec_decode_audio4");
  24. return orig_decode(a, b, got_frame_ptr, pkt);
  25. }