mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 09:40:18 +00:00
Libavcodec 58 compat
This commit is contained in:
@@ -304,7 +304,7 @@ static bool reinitialize_coder(struct libavcodec_codec_state *s, struct audio_de
|
||||
}
|
||||
pthread_mutex_unlock(s->libav_global_lock);
|
||||
|
||||
if(s->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) {
|
||||
if(s->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) {
|
||||
s->codec_ctx->frame_size = 1;
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ static audio_channel *libavcodec_compress(void *state, audio_channel * channel)
|
||||
}
|
||||
#endif
|
||||
offset += chunk_size;
|
||||
if(!(s->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
|
||||
if(!(s->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ static audio_channel *libavcodec_decompress(void *state, audio_channel * channel
|
||||
|
||||
int offset = 0;
|
||||
// FFMPEG buffer needs to be FF_INPUT_BUFFER_PADDING_SIZE longer than data
|
||||
unique_ptr<unsigned char []> tmp_buffer(new unsigned char[channel->data_len + FF_INPUT_BUFFER_PADDING_SIZE]);
|
||||
unique_ptr<unsigned char []> tmp_buffer(new unsigned char[channel->data_len + AV_INPUT_BUFFER_PADDING_SIZE]);
|
||||
memcpy(tmp_buffer.get(), channel->data, channel->data_len);
|
||||
|
||||
AVPacket pkt;
|
||||
|
||||
@@ -27,6 +27,22 @@ extern "C" {
|
||||
///
|
||||
/// compat
|
||||
///
|
||||
#ifndef AV_CODEC_CAP_FRAME_THREADS
|
||||
#define AV_CODEC_CAP_FRAME_THREADS CODEC_CAP_FRAME_THREADS
|
||||
#endif
|
||||
#ifndef AV_CODEC_CAP_SLICE_THREADS
|
||||
#define AV_CODEC_CAP_SLICE_THREADS CODEC_CAP_SLICE_THREADS
|
||||
#endif
|
||||
#ifndef AV_CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||
#endif
|
||||
#ifndef AV_CODEC_FLAG2_FAST
|
||||
#define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST
|
||||
#endif
|
||||
#ifndef AV_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 8, 0)
|
||||
#define av_packet_unref av_free_packet
|
||||
#endif
|
||||
|
||||
@@ -1299,14 +1299,14 @@ static void setparam_default(AVCodecContext *codec_ctx, struct setparam_param *p
|
||||
if (!param->thread_mode.empty() && param->thread_mode != "no") {
|
||||
if (param->thread_mode == "slice") {
|
||||
// zero should mean count equal to the number of virtual cores
|
||||
if (codec_ctx->codec->capabilities & CODEC_CAP_SLICE_THREADS) {
|
||||
if (codec_ctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
|
||||
codec_ctx->thread_count = 0;
|
||||
codec_ctx->thread_type = FF_THREAD_SLICE;
|
||||
} else {
|
||||
log_msg(LOG_LEVEL_WARNING, "[lavc] Warning: Codec doesn't support slice-based multithreading.\n");
|
||||
}
|
||||
} else if (param->thread_mode == "frame") {
|
||||
if (codec_ctx->codec->capabilities & CODEC_CAP_FRAME_THREADS) {
|
||||
if (codec_ctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) {
|
||||
codec_ctx->thread_count = 0;
|
||||
codec_ctx->thread_type = FF_THREAD_FRAME;
|
||||
} else {
|
||||
|
||||
@@ -127,7 +127,7 @@ static void deconfigure(struct state_libavcodec_decompress *s)
|
||||
static void set_codec_context_params(struct state_libavcodec_decompress *s)
|
||||
{
|
||||
// zero should mean count equal to the number of virtual cores
|
||||
if (s->codec_ctx->codec->capabilities & CODEC_CAP_SLICE_THREADS) {
|
||||
if (s->codec_ctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
|
||||
if(!broken_h264_mt_decoding) {
|
||||
s->codec_ctx->thread_count = 0; // == X264_THREADS_AUTO, perhaps same for other codecs
|
||||
s->codec_ctx->thread_type = FF_THREAD_SLICE;
|
||||
@@ -147,7 +147,7 @@ static void set_codec_context_params(struct state_libavcodec_decompress *s)
|
||||
#endif
|
||||
}
|
||||
|
||||
s->codec_ctx->flags2 |= CODEC_FLAG2_FAST;
|
||||
s->codec_ctx->flags2 |= AV_CODEC_FLAG2_FAST;
|
||||
|
||||
// set by decoder
|
||||
s->codec_ctx->pix_fmt = AV_PIX_FMT_NONE;
|
||||
|
||||
Reference in New Issue
Block a user