summaryrefslogtreecommitdiffstats
path: root/academic/grass/grass-6.4.2-ffmpeg-1.patch
blob: ec26ae251529c9aefbe5b154de8ce6d9b79a5e33 (plain)
Fix build with ffmpeg-1.
Part of https://bugs.gentoo.org/show_bug.cgi?id=443264

Index: grass-6.4.2/lib/ogsf/gsd_img_mpeg.c
===================================================================
--- grass-6.4.2.orig/lib/ogsf/gsd_img_mpeg.c
+++ grass-6.4.2/lib/ogsf/gsd_img_mpeg.c
@@ -26,7 +26,8 @@
 
 /* FFMPEG stuff */
 #ifdef HAVE_FFMPEG
-#include <avformat.h>
+#include <libavformat/avformat.h>
+#include <libavformat/avio.h>
 
 /* 5 seconds stream duration */
 #define STREAM_DURATION   5.0
@@ -58,7 +59,7 @@ static AVStream *add_video_stream(AVForm
     AVCodecContext *c;
     AVStream *st;
 
-    st = av_new_stream(oc, 0);
+    st = avformat_new_stream(oc, 0);
     if (!st) {
 	G_warning(_("Unable to allocate stream"));
 	return NULL;
@@ -97,7 +98,7 @@ static AVStream *add_video_stream(AVForm
 	c->flags |= CODEC_FLAG_GLOBAL_HEADER;
 
     c->flags |= CODEC_FLAG_QSCALE;
-    c->global_quality = st->quality = FF_QP2LAMBDA * 10;
+    c->global_quality = FF_QP2LAMBDA * 10;
 
     return st;
 }
@@ -332,13 +333,7 @@ int gsd_init_mpeg(const char *filename)
 	    add_video_stream(oc, fmt->video_codec, (r - l + 1), (t - b + 1));
     }
 
-    /* set the output parameters (must be done even if no parameters). */
-    if (av_set_parameters(oc, NULL) < 0) {
-	G_warning(_("Invalid output format parameters"));
-	return (-1);
-    }
-
-    dump_format(oc, 0, filename, 1);
+    av_dump_format(oc, 0, filename, 1);
 
     /* now that all the parameters are set, we can open the audio and
        video codecs and allocate the necessary encode buffers */
@@ -347,14 +342,17 @@ int gsd_init_mpeg(const char *filename)
 
     /* open the output file, if needed */
     if (!(fmt->flags & AVFMT_NOFILE)) {
-	if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
+	if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
 	    G_warning(_("Unable to open <%s>"), filename);
 	    return (-1);
 	}
     }
 
     /* write the stream header, if any */
-    av_write_header(oc);
+    if (avformat_write_header(oc, NULL) < 0) {
+	G_warning(_("Failed to write header"));
+	return (-1);
+    }
 
 
 #else
@@ -439,7 +437,7 @@ int gsd_close_mpeg(void)
 #if (LIBAVFORMAT_VERSION_INT>>16) < 52
 	url_fclose(&oc->pb);
 #else
-	url_fclose(oc->pb);
+	avio_close(oc->pb);
 #endif
     }