fix compile warnings #284

This commit is contained in:
niels
2025-11-03 00:25:14 +01:00
parent 6f5b2d920a
commit faef530c1e
4 changed files with 23 additions and 14 deletions

View File

@@ -108,7 +108,7 @@ typedef struct
#endif #endif
AVFrame *frames[2]; AVFrame *frames[2];
int frameinfo[2]; int frameinfo[2];
AVCodec *codec; const AVCodec *codec;
AVCodecContext *codec_ctx; AVCodecContext *codec_ctx;
AVFormatContext *avformat_ctx; AVFormatContext *avformat_ctx;
#if LIBAVCODEC_VERSION_MAJOR >= 60 #if LIBAVCODEC_VERSION_MAJOR >= 60
@@ -150,11 +150,11 @@ static inline int hash_key_code( const char *str )
} }
static hash_val_t key_hash(const void *key) static hash_val_t key_hash(const void *key)
{ {
return (hash_val_t) key; return (hash_val_t) (uintptr_t)key;
} }
static int key_compare(const void *key1, const void *key2) static int key_compare(const void *key1, const void *key2)
{ {
return ((const int) key1 == (const int) key2 ? 0 : 1); return ((uintptr_t) key1 == (uintptr_t) key2 ? 0 : 1);
} }
int avhelper_set_num_decoders() { int avhelper_set_num_decoders() {
@@ -202,7 +202,7 @@ static int avhelper_build_table()
fourcc_node *node = (fourcc_node*) vj_malloc(sizeof(fourcc_node)); fourcc_node *node = (fourcc_node*) vj_malloc(sizeof(fourcc_node));
node->codec_id = _supported_codecs[i].id; node->codec_id = _supported_codecs[i].id;
hnode_t *hnode = hnode_create(node); hnode_t *hnode = hnode_create(node);
hash_insert( fourccTable, hnode, (const void*) hash_key_code(_supported_codecs[i].name ) ); hash_insert( fourccTable, hnode, (const void*) (uintptr_t) hash_key_code(_supported_codecs[i].name ) );
} }
return 0; return 0;
@@ -240,7 +240,7 @@ void *avhelper_get_codec_ctx( void *ptr )
} }
void *avhelper_get_codec( void *ptr ) const void *avhelper_get_codec( void *ptr )
{ {
el_decoder_t *e = (el_decoder_t*) ptr; el_decoder_t *e = (el_decoder_t*) ptr;
return e->codec; return e->codec;
@@ -801,7 +801,11 @@ further:
if(!got_picture) { if(!got_picture) {
veejay_msg(VEEJAY_MSG_ERROR, "FFmpeg: Unable to get whole picture from %s", filename ); veejay_msg(VEEJAY_MSG_ERROR, "FFmpeg: Unable to get whole picture from %s", filename );
#if LIBAVCODEC_VERSION_MAJOR >= 60
avcodec_free_context(&(x->codec_ctx));
#else
avcodec_close( x->codec_ctx ); avcodec_close( x->codec_ctx );
#endif
avhelper_close_input_file( x->avformat_ctx ); avhelper_close_input_file( x->avformat_ctx );
free(x->output); free(x->output);
free(x); free(x);
@@ -854,14 +858,17 @@ void avhelper_close_decoder( void *ptr )
yuv_free_swscaler( e->scaler ); yuv_free_swscaler( e->scaler );
} }
if(e->frames[0]->data[0]) if(e->frames[0]->data[0]) {
avhelper_frame_unref(e->frames[0]); avhelper_frame_unref(e->frames[0]);
if(e->frames[1]->data[0]) }
if(e->frames[1]->data[0]) {
avhelper_frame_unref(e->frames[1]); avhelper_frame_unref(e->frames[1]);
}
if(e->input) {
if(e->input)
free(e->input); free(e->input);
}
if(e->output) if(e->output)
free(e->output); free(e->output);
#if LIBAVCODEC_VERSION_MAJOR >= 60 #if LIBAVCODEC_VERSION_MAJOR >= 60

View File

@@ -403,8 +403,11 @@ void vj_avcodec_close_encoder( vj_encoder *av )
{ {
if(av->context) if(av->context)
{ {
#if LIBAVCODEC_VERSION_MAJOR > 59
avcodec_free_context( &(av->context) );
#else
avcodec_close( av->context ); avcodec_close( av->context );
avhelper_free_context( &(av->context) ); #endif
} }
if(av->data[0]) if(av->data[0])
free(av->data[0]); free(av->data[0]);

View File

@@ -41,7 +41,7 @@
typedef struct typedef struct
{ {
AVCodec *codec; const AVCodec *codec;
AVCodec *audiocodec; AVCodec *audiocodec;
AVFrame *frame; AVFrame *frame;
AVCodecContext *context; AVCodecContext *context;

View File

@@ -93,7 +93,7 @@ static long mmap_size = 0;
typedef struct typedef struct
{ {
AVCodec *codec; const AVCodec *codec;
AVCodecContext *codec_ctx; AVCodecContext *codec_ctx;
AVFormatContext *avformat_ctx; AVFormatContext *avformat_ctx;
AVPacket pkt; AVPacket pkt;
@@ -110,7 +110,7 @@ void vj_el_set_mmap_size( long size )
typedef struct typedef struct
{ {
AVCodec *codec; const AVCodec *codec;
AVFrame *frame; AVFrame *frame;
AVCodecContext *context; AVCodecContext *context;
uint8_t *tmp_buffer; uint8_t *tmp_buffer;
@@ -1974,7 +1974,6 @@ editlist *vj_el_soft_clone_range(editlist *el, long n1, long n2)
long len = n2 - n1; long len = n2 - n1;
uint64_t k = 0; uint64_t k = 0;
int idx = -1; int idx = -1;
int last_file_idx = -1;
clone->frame_list = (uint64_t *)vj_calloc(sizeof(uint64_t) * (len + 1)); clone->frame_list = (uint64_t *)vj_calloc(sizeof(uint64_t) * (len + 1));
if (!clone->frame_list) { if (!clone->frame_list) {