Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
audaspace
034645c883a51dfc8897dccce15aa8ee4a9d5c8c.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 034645c883a51dfc8897dccce15aa8ee4a9d5c8c.patch of Package audaspace
From 034645c883a51dfc8897dccce15aa8ee4a9d5c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com> Date: Fri, 22 Apr 2022 21:45:14 +0200 Subject: [PATCH] Update for ffmpeg 5. --- plugins/ffmpeg/FFMPEGReader.cpp | 2 +- plugins/ffmpeg/FFMPEGWriter.cpp | 43 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/plugins/ffmpeg/FFMPEGReader.cpp b/plugins/ffmpeg/FFMPEGReader.cpp index de3ca09..69bb451 100644 --- a/plugins/ffmpeg/FFMPEGReader.cpp +++ b/plugins/ffmpeg/FFMPEGReader.cpp @@ -177,7 +177,7 @@ void FFMPEGReader::init(int stream) // get a decoder and open it #ifndef FFMPEG_OLD_CODE - AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id); + const AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id); if(!aCodec) AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg."); diff --git a/plugins/ffmpeg/FFMPEGWriter.cpp b/plugins/ffmpeg/FFMPEGWriter.cpp index 10517d1..ae6558c 100644 --- a/plugins/ffmpeg/FFMPEGWriter.cpp +++ b/plugins/ffmpeg/FFMPEGWriter.cpp @@ -23,6 +23,9 @@ extern "C" { #include <libavcodec/avcodec.h> #include <libavformat/avio.h> +#if LIBAVCODEC_VERSION_MAJOR >= 59 +#include <libavutil/channel_layout.h> +#endif } AUD_NAMESPACE_BEGIN @@ -171,66 +174,66 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0) AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg."); - AVOutputFormat* outputFmt = m_formatCtx->oformat; + const AVOutputFormat* outputFmt = m_formatCtx->oformat; if(!outputFmt) { avformat_free_context(m_formatCtx); AUD_THROW(FileException, "File couldn't be written, output format couldn't be found with ffmpeg."); } - outputFmt->audio_codec = AV_CODEC_ID_NONE; + AVCodecID audio_codec = AV_CODEC_ID_NONE; switch(codec) { case CODEC_AAC: - outputFmt->audio_codec = AV_CODEC_ID_AAC; + audio_codec = AV_CODEC_ID_AAC; break; case CODEC_AC3: - outputFmt->audio_codec = AV_CODEC_ID_AC3; + audio_codec = AV_CODEC_ID_AC3; break; case CODEC_FLAC: - outputFmt->audio_codec = AV_CODEC_ID_FLAC; + audio_codec = AV_CODEC_ID_FLAC; break; case CODEC_MP2: - outputFmt->audio_codec = AV_CODEC_ID_MP2; + audio_codec = AV_CODEC_ID_MP2; break; case CODEC_MP3: - outputFmt->audio_codec = AV_CODEC_ID_MP3; + audio_codec = AV_CODEC_ID_MP3; break; case CODEC_OPUS: - outputFmt->audio_codec = AV_CODEC_ID_OPUS; + audio_codec = AV_CODEC_ID_OPUS; break; case CODEC_PCM: switch(specs.format) { case FORMAT_U8: - outputFmt->audio_codec = AV_CODEC_ID_PCM_U8; + audio_codec = AV_CODEC_ID_PCM_U8; break; case FORMAT_S16: - outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE; + audio_codec = AV_CODEC_ID_PCM_S16LE; break; case FORMAT_S24: - outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE; + audio_codec = AV_CODEC_ID_PCM_S24LE; break; case FORMAT_S32: - outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE; + audio_codec = AV_CODEC_ID_PCM_S32LE; break; case FORMAT_FLOAT32: - outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE; + audio_codec = AV_CODEC_ID_PCM_F32LE; break; case FORMAT_FLOAT64: - outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE; + audio_codec = AV_CODEC_ID_PCM_F64LE; break; default: - outputFmt->audio_codec = AV_CODEC_ID_NONE; + audio_codec = AV_CODEC_ID_NONE; break; } break; case CODEC_VORBIS: - outputFmt->audio_codec = AV_CODEC_ID_VORBIS; + audio_codec = AV_CODEC_ID_VORBIS; break; default: - outputFmt->audio_codec = AV_CODEC_ID_NONE; + audio_codec = AV_CODEC_ID_NONE; break; } @@ -268,10 +271,10 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo try { - if(outputFmt->audio_codec == AV_CODEC_ID_NONE) + if(audio_codec == AV_CODEC_ID_NONE) AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg."); - AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec); + const AVCodec* codec = avcodec_find_encoder(audio_codec); if(!codec) AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg."); @@ -397,7 +400,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo m_specs.rate = m_codecCtx->sample_rate; #ifdef FFMPEG_OLD_CODE - m_codecCtx->codec_id = outputFmt->audio_codec; + m_codecCtx->codec_id = audio_codec; #endif m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
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