| 408 | #endif |
| 409 | |
| 410 | inline static void* aligned_malloc(size_t size, size_t alignment = 32) |
| 411 | { |
| 412 | #if defined(_WIN32) |
| 413 | return _aligned_malloc(size, alignment); |
| 414 | #elif defined(__APPLE__) || defined(__linux__) |
| 415 | void* ptr = nullptr; |
| 416 | if (posix_memalign(&ptr, alignment, size) != 0) |
| 417 | return nullptr; |
| 418 | return ptr; |
| 419 | #else |
| 420 | #error "aligned_malloc not implemented on this platform" |
| 421 | #endif |
| 422 | } |
| 423 | |
| 424 | #endif // OPENSHOT_FFMPEG_UTILITIES_H |