ffmpeg: updated for 5.0
This commit is contained in:
@@ -268,7 +268,7 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, const QAtomicIn
|
||||
AVStream* avstream = fmt_ctx->streams[i];
|
||||
|
||||
// Find decoder for this stream, if it exists we can proceed
|
||||
AVCodec* decoder = avcodec_find_decoder(avstream->codecpar->codec_id);
|
||||
const AVCodec* decoder = avcodec_find_decoder(avstream->codecpar->codec_id);
|
||||
|
||||
if (decoder
|
||||
&& (avstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO
|
||||
@@ -1010,7 +1010,7 @@ bool FFmpegDecoder::Instance::Open(const char *filename, int stream_index)
|
||||
avstream_ = fmt_ctx_->streams[stream_index];
|
||||
|
||||
// Find decoder
|
||||
AVCodec* codec = avcodec_find_decoder(avstream_->codecpar->codec_id);
|
||||
const AVCodec* codec = avcodec_find_decoder(avstream_->codecpar->codec_id);
|
||||
|
||||
// Handle failure to find decoder
|
||||
if (codec == nullptr) {
|
||||
|
||||
@@ -50,7 +50,7 @@ QStringList FFmpegEncoder::GetPixelFormatsForCodec(ExportCodec::Codec c) const
|
||||
{
|
||||
QStringList pix_fmts;
|
||||
|
||||
AVCodec* codec_info = GetEncoder(c);
|
||||
const AVCodec* codec_info = GetEncoder(c);
|
||||
|
||||
if (codec_info) {
|
||||
for (int i=0; codec_info->pix_fmts[i]!=-1; i++) {
|
||||
@@ -570,7 +570,7 @@ bool FFmpegEncoder::InitializeStream(AVMediaType type, AVStream** stream_ptr, AV
|
||||
}
|
||||
|
||||
// Find encoder
|
||||
AVCodec* encoder = GetEncoder(codec);
|
||||
const AVCodec* encoder = GetEncoder(codec);
|
||||
if (!encoder) {
|
||||
SetError(tr("Failed to find codec for 0x%1").arg(codec, 16));
|
||||
return false;
|
||||
@@ -669,7 +669,7 @@ bool FFmpegEncoder::InitializeStream(AVMediaType type, AVStream** stream_ptr, AV
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FFmpegEncoder::InitializeCodecContext(AVStream **stream, AVCodecContext **codec_ctx, AVCodec* codec)
|
||||
bool FFmpegEncoder::InitializeCodecContext(AVStream **stream, AVCodecContext **codec_ctx, const AVCodec* codec)
|
||||
{
|
||||
*stream = avformat_new_stream(fmt_ctx_, nullptr);
|
||||
if (!(*stream)) {
|
||||
@@ -687,7 +687,7 @@ bool FFmpegEncoder::InitializeCodecContext(AVStream **stream, AVCodecContext **c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FFmpegEncoder::SetupCodecContext(AVStream* stream, AVCodecContext* codec_ctx, AVCodec* codec)
|
||||
bool FFmpegEncoder::SetupCodecContext(AVStream* stream, AVCodecContext* codec_ctx, const AVCodec* codec)
|
||||
{
|
||||
int error_code;
|
||||
|
||||
@@ -833,7 +833,7 @@ bool FFmpegEncoder::InitializeResampleContext(SampleBufferPtr audio)
|
||||
return true;
|
||||
}
|
||||
|
||||
AVCodec *FFmpegEncoder::GetEncoder(ExportCodec::Codec c)
|
||||
const AVCodec *FFmpegEncoder::GetEncoder(ExportCodec::Codec c)
|
||||
{
|
||||
switch (c) {
|
||||
case ExportCodec::kCodecH264:
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define FFMPEGENCODER_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libswresample/swresample.h>
|
||||
@@ -69,15 +70,15 @@ private:
|
||||
bool WriteAVFrame(AVFrame* frame, AVCodecContext *codec_ctx, AVStream *stream);
|
||||
|
||||
bool InitializeStream(enum AVMediaType type, AVStream** stream, AVCodecContext** codec_ctx, const ExportCodec::Codec &codec);
|
||||
bool InitializeCodecContext(AVStream** stream, AVCodecContext** codec_ctx, AVCodec* codec);
|
||||
bool SetupCodecContext(AVStream *stream, AVCodecContext *codec_ctx, AVCodec *codec);
|
||||
bool InitializeCodecContext(AVStream** stream, AVCodecContext** codec_ctx, const AVCodec* codec);
|
||||
bool SetupCodecContext(AVStream *stream, AVCodecContext *codec_ctx, const AVCodec *codec);
|
||||
|
||||
void FlushEncoders();
|
||||
void FlushCodecCtx(AVCodecContext* codec_ctx, AVStream *stream);
|
||||
|
||||
bool InitializeResampleContext(SampleBufferPtr audio);
|
||||
|
||||
static AVCodec *GetEncoder(ExportCodec::Codec c);
|
||||
static const AVCodec *GetEncoder(ExportCodec::Codec c);
|
||||
|
||||
AVFormatContext* fmt_ctx_;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define FFMPEGABSTRACTION_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#ifndef AUDIOPARAMS_H
|
||||
#define AUDIOPARAMS_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/channel_layout.h>
|
||||
}
|
||||
|
||||
#include <QtMath>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
Reference in New Issue
Block a user