void-packages/srcpkgs/libopenshot/patches/ffmpeg4.patch

94 lines
4.9 KiB
Diff

source: https://pkgs.rpmfusion.org/cgit/free/libopenshot.git/plain/ffmpeg35_buildfix.patch
--- src/FFmpegWriter.cpp
+++ src/FFmpegWriter.cpp
@@ -543,7 +543,7 @@
{
if (info.has_audio && audio_codec && audio_st->codec->codec_type == AVMEDIA_TYPE_AUDIO && audio_codec->frame_size <= 1)
return;
- if (info.has_video && video_st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (oc->oformat->flags & AVFMT_RAWPICTURE) && video_codec->codec->id == AV_CODEC_ID_RAWVIDEO)
+ if (info.has_video && video_st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (oc->oformat->flags & AVFMT_NOFILE) && video_codec->codec->id == AV_CODEC_ID_RAWVIDEO)
return;
int error_code = 0;
@@ -858,7 +858,7 @@
// some formats want stream headers to be separate
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::add_audio_stream", "c->codec_id", c->codec_id, "c->bit_rate", c->bit_rate, "c->channels", c->channels, "c->sample_fmt", c->sample_fmt, "c->channel_layout", c->channel_layout, "c->sample_rate", c->sample_rate);
@@ -931,7 +931,7 @@
c->mb_decision = 2;
// some formats want stream headers to be separate
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
// Find all supported pixel formats for this codec
const PixelFormat* supported_pixel_formats = codec->pix_fmts;
@@ -951,14 +951,14 @@
if (strcmp(fmt->name, "gif") != 0)
// If not GIF format, skip the encoding process
// Set raw picture flag (so we don't encode this video)
- oc->oformat->flags |= AVFMT_RAWPICTURE;
+ oc->oformat->flags |= AVFMT_NOFILE;
} else {
// Set the default codec
c->pix_fmt = PIX_FMT_YUV420P;
}
}
- ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::add_video_stream (" + (string)fmt->name + " : " + (string)av_get_pix_fmt_name(c->pix_fmt) + ")", "c->codec_id", c->codec_id, "c->bit_rate", c->bit_rate, "c->pix_fmt", c->pix_fmt, "oc->oformat->flags", oc->oformat->flags, "AVFMT_RAWPICTURE", AVFMT_RAWPICTURE, "", -1);
+ ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::add_video_stream (" + (string)fmt->name + " : " + (string)av_get_pix_fmt_name(c->pix_fmt) + ")", "c->codec_id", c->codec_id, "c->bit_rate", c->bit_rate, "c->pix_fmt", c->pix_fmt, "oc->oformat->flags", oc->oformat->flags, "AVFMT_NOFILE", AVFMT_NOFILE, "", -1);
return st;
}
@@ -1018,7 +1018,7 @@
audio_encoder_buffer_size = AUDIO_PACKET_ENCODING_SIZE;
audio_encoder_buffer = new uint8_t[audio_encoder_buffer_size];
- ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::open_audio", "audio_codec->thread_count", audio_codec->thread_count, "audio_input_frame_size", audio_input_frame_size, "buffer_size", AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE, "", -1, "", -1, "", -1);
+ ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::open_audio", "audio_codec->thread_count", audio_codec->thread_count, "audio_input_frame_size", audio_input_frame_size, "buffer_size", AVCODEC_MAX_AUDIO_FRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE, "", -1, "", -1, "", -1);
}
@@ -1473,9 +1473,9 @@
// write video frame
bool FFmpegWriter::write_video_packet(std::shared_ptr<Frame> frame, AVFrame* frame_final)
{
- ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_video_packet", "frame->number", frame->number, "oc->oformat->flags & AVFMT_RAWPICTURE", oc->oformat->flags & AVFMT_RAWPICTURE, "", -1, "", -1, "", -1, "", -1);
-
- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
+ ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_video_packet", "frame->number", frame->number, "oc->oformat->flags & AVFMT_NOFILE", oc->oformat->flags & AVFMT_NOFILE, "", -1, "", -1, "", -1, "", -1);
+
+ if (oc->oformat->flags & AVFMT_NOFILE) {
// Raw video case.
AVPacket pkt;
av_init_packet(&pkt);
--- src/FFmpegReader.cpp
+++ src/FFmpegReader.cpp
@@ -903,7 +903,7 @@
int data_size = 0;
// re-initialize buffer size (it gets changed in the avcodec_decode_audio2 method call)
- int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE;
+ int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
int used = avcodec_decode_audio4(aCodecCtx, audio_frame, &frame_finished, packet);
if (frame_finished) {
@@ -976,7 +976,7 @@
// Allocate audio buffer
- int16_t *audio_buf = new int16_t[AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
+ int16_t *audio_buf = new int16_t[AVCODEC_MAX_AUDIO_FRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (ReSample)", "packet_samples", packet_samples, "info.channels", info.channels, "info.sample_rate", info.sample_rate, "aCodecCtx->sample_fmt", aCodecCtx->sample_fmt, "AV_SAMPLE_FMT_S16", AV_SAMPLE_FMT_S16, "", -1);