Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:16.0:Staging:C
gegl
66de8124.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 66de8124.patch of Package gegl
From 66de8124f496617eee8e6b5c68138a00343882db Mon Sep 17 00:00:00 2001 From: Joe Locash <@jlocash2> Date: Sat, 4 May 2024 17:08:04 +0200 Subject: [PATCH] ff-load, ff-save: fix build with FFmpeg 7 Fixing issue #371 --- operations/external/ff-load.c | 8 ++++++++ operations/external/ff-save.c | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c index 6b96fdfdd..dc24a6d59 100644 --- a/operations/external/ff-load.c +++ b/operations/external/ff-load.c @@ -250,7 +250,11 @@ decode_audio (GeglOperation *operation, while (samples_left) { int sample_count = samples_left; +#if LIBAVCODEC_VERSION_MAJOR < 61 int channels = MIN(p->audio_stream->codecpar->channels, GEGL_MAX_AUDIO_CHANNELS); +#else + int channels = MIN(p->audio_stream->codecpar->ch_layout.nb_channels, GEGL_MAX_AUDIO_CHANNELS); +#endif GeglAudioFragment *af = gegl_audio_fragment_new (o->audio_sample_rate, channels, AV_CH_LAYOUT_STEREO, samples_left); //); @@ -553,7 +557,11 @@ prepare (GeglOperation *operation) else { o->audio_sample_rate = p->audio_stream->codecpar->sample_rate; +#if LIBAVCODEC_VERSION_MAJOR < 61 o->audio_channels = MIN(p->audio_stream->codecpar->channels, GEGL_MAX_AUDIO_CHANNELS); +#else + o->audio_channels = MIN(p->audio_stream->codecpar->ch_layout.nb_channels, GEGL_MAX_AUDIO_CHANNELS); +#endif } } diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c index 9196b34aa..ffa5d8bee 100644 --- a/operations/external/ff-save.c +++ b/operations/external/ff-save.c @@ -315,8 +315,13 @@ add_audio_stream (GeglProperties *o, AVFormatContext * oc, int codec_id) } cp->sample_rate = o->audio_sample_rate; +#if LIBAVCODEC_VERSION_MAJOR < 61 cp->channel_layout = AV_CH_LAYOUT_STEREO; cp->channels = 2; +#else + cp->ch_layout.u.mask = AV_CH_LAYOUT_STEREO; + cp->ch_layout.nb_channels = 2; +#endif return st; } @@ -392,8 +397,13 @@ static AVFrame *alloc_audio_frame(AVCodecContext *c, int nb_samples) frame->format = c->sample_fmt; +#if LIBAVCODEC_VERSION_MAJOR < 61 frame->channel_layout = c->channel_layout; frame->channels = c->channels; +#else + frame->ch_layout = c->ch_layout; + frame->ch_layout.nb_channels = c->ch_layout.nb_channels; +#endif frame->sample_rate = c->sample_rate; frame->nb_samples = nb_samples; @@ -423,8 +433,13 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, { float left = 0, right = 0; get_sample_data (p, i + p->audio_read_pos, &left, &right); +#if LIBAVCODEC_VERSION_MAJOR < 61 ((float*)frame->data[0])[c->channels*i+0] = left; ((float*)frame->data[0])[c->channels*i+1] = right; +#else + ((float*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left; + ((float*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right; +#endif } break; case AV_SAMPLE_FMT_FLTP: @@ -441,8 +456,13 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, { float left = 0, right = 0; get_sample_data (p, i + p->audio_read_pos, &left, &right); +#if LIBAVCODEC_VERSION_MAJOR < 61 ((int16_t*)frame->data[0])[c->channels*i+0] = left * (1<<15); ((int16_t*)frame->data[0])[c->channels*i+1] = right * (1<<15); +#else + ((int16_t*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left * (1<<15); + ((int16_t*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right * (1<<15); +#endif } break; case AV_SAMPLE_FMT_S32: @@ -450,8 +470,8 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, { float left = 0, right = 0; get_sample_data (p, i + p->audio_read_pos, &left, &right); - ((int32_t*)frame->data[0])[c->channels*i+0] = left * (1<<31); - ((int32_t*)frame->data[0])[c->channels*i+1] = right * (1<<31); + ((int32_t*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left * (1<<31); + ((int32_t*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right * (1<<31); } break; case AV_SAMPLE_FMT_S32P: -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor