[GRASS-SVN] r56737 - grass/branches/releasebranch_6_4/lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 16 15:17:54 PDT 2013
Author: hamish
Date: 2013-06-16 15:17:54 -0700 (Sun, 16 Jun 2013)
New Revision: 56737
Modified:
grass/branches/releasebranch_6_4/lib/ogsf/GS2.c
grass/branches/releasebranch_6_4/lib/ogsf/gsd_img_mpeg.c
Log:
tweaks to get it working on Ubuntu/10.04 (#1423, merge from devbr6)
Modified: grass/branches/releasebranch_6_4/lib/ogsf/GS2.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/ogsf/GS2.c 2013-06-16 21:36:51 UTC (rev 56736)
+++ grass/branches/releasebranch_6_4/lib/ogsf/GS2.c 2013-06-16 22:17:54 UTC (rev 56737)
@@ -3344,7 +3344,6 @@
*/
void GS_init_view(void)
{
- int i;
static int first = 1;
G_debug(3, "GS_init_view");
Modified: grass/branches/releasebranch_6_4/lib/ogsf/gsd_img_mpeg.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/ogsf/gsd_img_mpeg.c 2013-06-16 21:36:51 UTC (rev 56736)
+++ grass/branches/releasebranch_6_4/lib/ogsf/gsd_img_mpeg.c 2013-06-16 22:17:54 UTC (rev 56737)
@@ -27,6 +27,12 @@
#ifdef HAVE_FFMPEG
#include <avformat.h>
#include <avio.h>
+#if LIBAVUTIL_VERSION_MAJOR < 51
+#include <avutil.h>
+#else
+/* libavutil 51.22.1's avutil.h doesn't include libavutil/mathematics.h */
+#include <mathematics.h>
+#endif
/* 5 seconds stream duration */
#define STREAM_DURATION 5.0
@@ -58,7 +64,7 @@
AVCodecContext *c;
AVStream *st;
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 100, 0)
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 112, 0)
st = av_new_stream(oc, 0);
#else
st = avformat_new_stream(oc, NULL);
@@ -70,7 +76,11 @@
c = st->codec;
c->codec_id = codec_id;
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 123, 0)
+ c->codec_type = CODEC_TYPE_VIDEO;
+#else
c->codec_type = AVMEDIA_TYPE_VIDEO;
+#endif
/* put sample parameters */
c->bit_rate = 400000;
@@ -228,8 +238,11 @@
AVPacket pkt;
av_init_packet(&pkt);
-
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 32, 0)
+ pkt.flags |= PKT_FLAG_KEY;
+#else
pkt.flags |= AV_PKT_FLAG_KEY;
+#endif
pkt.stream_index = st->index;
pkt.data = (uint8_t *) picture;
pkt.size = sizeof(AVPicture);
@@ -250,7 +263,11 @@
av_rescale_q(c->coded_frame->pts, c->time_base,
st->time_base);
if (c->coded_frame->key_frame)
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 32, 0)
+ pkt.flags |= PKT_FLAG_KEY;
+#else
pkt.flags |= AV_PKT_FLAG_KEY;
+#endif
pkt.stream_index = st->index;
pkt.data = video_outbuf;
pkt.size = out_size;
@@ -315,10 +332,18 @@
av_register_all();
/* auto detect the output format from the name. default is mpeg. */
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 32, 0)
+ fmt = guess_format(NULL, filename, NULL);
+#else
fmt = av_guess_format(NULL, filename, NULL);
+#endif
if (!fmt) {
G_warning(_("Unable to deduce output format from file extension: using MPEG"));
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 32, 0)
+ fmt = guess_format("mpeg", NULL, NULL);
+#else
fmt = av_guess_format("mpeg", NULL, NULL);
+#endif
}
if (!fmt) {
G_warning(_("Unable to find suitable output format"));
@@ -369,7 +394,7 @@
/* open the output file, if needed */
if (!(fmt->flags & AVFMT_NOFILE)) {
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 100, 0)
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 112, 0)
if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
#else
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
More information about the grass-commit
mailing list