summaryrefslogtreecommitdiff
path: root/academic/grass/grass-6.4.2-ffmpeg-1.patch
blob: ec26ae251529c9aefbe5b154de8ce6d9b79a5e33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
     }