void-packages/srcpkgs/vba-m/patches/ffmpeg4.patch
2018-07-01 19:30:17 +02:00

55 lines
1.9 KiB
Diff

source: https://github.com/visualboyadvance-m/visualboyadvance-m/commit/f3f6ee7b1c9f95cc1e8df368652034b9da84c130
--- src/common/ffmpeg.cpp.orig 2016-12-14 22:52:45.000000000 +0100
+++ src/common/ffmpeg.cpp 2018-05-09 16:41:18.048068182 +0200
@@ -84,11 +84,22 @@
// I have no idea what size to make these buffers
// I don't see any ffmpeg functions to guess the size, either
-// use frame size, or FF_MIN_BUFFER_SIZE (that seems to be what it wants)
+#ifdef AV_INPUT_BUFFER_MIN_SIZE
+
+ // use frame size, or AV_INPUT_BUFFER_MIN_SIZE (that seems to be what it wants)
+#define AUDIO_BUF_LEN (frame_len > AV_INPUT_BUFFER_MIN_SIZE ? frame_len : AV_INPUT_BUFFER_MIN_SIZE)
+ // use maximum frame size * 32 bpp * 2 for good measure
+#define VIDEO_BUF_LEN (AV_INPUT_BUFFER_MIN_SIZE + 256 * 244 * 4 * 2)
+
+#else
+
+ // use frame size, or FF_MIN_BUFFER_SIZE (that seems to be what it wants)
#define AUDIO_BUF_LEN (frame_len > FF_MIN_BUFFER_SIZE ? frame_len : FF_MIN_BUFFER_SIZE)
-// use maximum frame size * 32 bpp * 2 for good measure
+ // use maximum frame size * 32 bpp * 2 for good measure
#define VIDEO_BUF_LEN (FF_MIN_BUFFER_SIZE + 256 * 244 * 4 * 2)
+#endif
+
bool MediaRecorder::did_init = false;
MediaRecorder::MediaRecorder() : oc(0), vid_st(0), aud_st(0), video_buf(0),
@@ -435,6 +446,7 @@
}
av_init_packet(&pkt);
pkt.stream_index = vid_st->index;
+#ifdef AVFMT_RAWPICTURE
if(oc->oformat->flags & AVFMT_RAWPICTURE) {
// this won't work due to border
// not sure what formats set this, anyway
@@ -442,6 +454,7 @@
pkt.data = f->data[0];
pkt.size = linesize * ctx->height;
} else {
+#endif
#if LIBAVCODEC_VERSION_MAJOR > 56
pkt.data = video_buf;
pkt.size = VIDEO_BUF_LEN;
@@ -468,7 +481,9 @@
if(ctx->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.data = video_buf;
+#ifdef AVFMT_RAWPICTURE
}
+#endif
if(av_interleaved_write_frame(oc, &pkt) < 0) {
avformat_free_context(oc);
oc = NULL;