Quellcode durchsuchen

deps/libff: Fix warnings with FFmpeg 3.0.0+

Fixes warnings with deprecated packet functions (av_free_packet and
av_dup packet, which were replaced by av_packet_unref and av_packet_ref
respectively)
jp9000 vor 9 Jahren
Ursprung
Commit
2fd30407e6

+ 2 - 0
deps/libff/libff/ff-audio-decoder.c

@@ -28,6 +28,8 @@
 
 #include <assert.h>
 
+#include "ff-compat.h"
+
 static inline void shrink_packet(struct ff_packet *packet, int packet_length)
 {
 	if (packet_length <= packet->base.size) {

+ 29 - 0
deps/libff/libff/ff-compat.h

@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Hugh Bailey <[email protected]>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#pragma once
+
+#if LIBAVCODEC_VERSION_MAJOR >= 57
+#define av_free_packet av_packet_unref
+static inline int av_dup_packet_2(AVPacket *pkt)
+{
+	AVPacket tmp = *pkt;
+	int ret = av_packet_ref(pkt, &tmp);
+	av_packet_unref(&tmp);
+	return ret;
+}
+#define av_dup_packet av_dup_packet_2
+#endif

+ 2 - 0
deps/libff/libff/ff-demuxer.c

@@ -23,6 +23,8 @@
 
 #include <assert.h>
 
+#include "ff-compat.h"
+
 #define DEFAULT_AV_SYNC_TYPE AV_SYNC_VIDEO_MASTER
 
 #define AUDIO_FRAME_QUEUE_SIZE 1

+ 1 - 0
deps/libff/libff/ff-packet-queue.c

@@ -15,6 +15,7 @@
  */
 
 #include "ff-packet-queue.h"
+#include "ff-compat.h"
 
 bool packet_queue_init(struct ff_packet_queue *q)
 {

+ 2 - 0
deps/libff/libff/ff-video-decoder.c

@@ -27,6 +27,8 @@
 
 #include <assert.h>
 
+#include "ff-compat.h"
+
 static bool queue_frame(struct ff_decoder *decoder, AVFrame *frame,
 		double best_effort_pts)
 {