Workaround ffmpeg stable api nonsence

This commit is contained in:
mittorn 2024-10-28 21:13:20 +03:00
parent 0d90b67015
commit 61b25038b1

View file

@ -25,6 +25,18 @@ extern "C" {
// It does not "HELP" drawing 2D triangle!!! It is not useful in engines using own matrix transform code!
#include <glm/gtc/matrix_transform.hpp>
#define MAX_SWAPCHAIN_IMAGES 32
// workaround for ffmpeg stable api nonsence with incompatible pointers between versions
struct PointerWrap
{
void *ptr;
template <typename T>
PointerWrap(T p):ptr((void*)p){}
template <typename T>
operator T() const
{
return (T)ptr;
}
};
struct Vertex
{
@ -147,7 +159,7 @@ static void *DecoderThread(void*)
int video;
avformat_open_input(&input_ctx, "out.265", NULL, NULL);
avformat_find_stream_info(input_ctx, NULL);
video = av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, 0);
video = av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, PointerWrap(&decoder), 0);
decoder_ctx = avcodec_alloc_context3(decoder);
avcodec_open2(decoder_ctx, decoder, NULL);
packet = av_packet_alloc();