Changeset 7831cef in git


Ignore:
Timestamp:
20/09/11 05:31:05 (8 years ago)
Author:
Olly Betts <olly@…>
Branches:
add-show-splays, line_contents, master, stereo, svn/github/master, svn/origin/master, svn/tags/1.2.1, svn/tags/1.2.2, svn/tags/1.2.3, svn/tags/1.2.4, svn/tags/1.2.5, svn/trunk, travis-osx
Children:
aecd032
Parents:
63621a7
Message:

configure.in,src/moviemaker.cc: Fix to build with FFmpeg library
versions in Debian unstable, as well as those in Debian stable.

git-svn-id: file:///home/survex-svn/survex/trunk@3669 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r63621a7 r7831cef  
     1Tue Sep 20 04:30:14 GMT 2011  Olly Betts <olly@survex.com>
     2
     3        * configure.in,src/moviemaker.cc: Fix to build with FFmpeg library
     4          versions in Debian unstable, as well as those in Debian stable.
     5
    16Tue Sep 20 03:51:40 GMT 2011  Olly Betts <olly@survex.com>
    27
  • configure.in

    r63621a7 r7831cef  
    189189  [AC_CHECK_LIB(avformat, av_register_all,
    190190    [AC_CHECK_LIB(swscale, sws_scale,
    191       [AC_CHECK_HEADERS([libavformat/avformat.h],
    192         [MOVIE_LIBS="-lswscale -lavformat -lavcodec"])],
     191      [AC_CHECK_LIB(avutil, av_malloc,
     192        [AC_CHECK_HEADERS([libavformat/avformat.h],
     193          [MOVIE_LIBS="-lswscale -lavformat -lavcodec -lavutil"
     194          save_LIBS=$LIBS
     195          LIBS="$LIBS $MOVIE_LIBS"
     196          AC_CHECK_FUNCS([av_guess_format avio_open avio_close avformat_write_header])
     197          AC_CHECK_DECLS([AVMEDIA_TYPE_VIDEO], [], [], [#include <libavcodec/avcodec.h>])
     198          LIBS=$save_LIBS])],
     199        [], [-lavformat -lavcodec -lswscale $WX_LIBS])],
    193200      [], [-lavformat -lavcodec $WX_LIBS])],
    194201    [], [-lavcodec $WX_LIBS])
  • src/moviemaker.cc

    r63621a7 r7831cef  
    6161#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
    6262extern "C" {
    63 #include "libavformat/avformat.h"
    64 #include "libswscale/swscale.h"
    65 }
    66 #ifndef AV_PKT_FLAG_KEY
    67 # define AV_PKT_FLAG_KEY PKT_FLAG_KEY
    68 #endif
     63# include "libavformat/avformat.h"
     64# include "libswscale/swscale.h"
     65}
     66# ifndef AV_PKT_FLAG_KEY
     67#  define AV_PKT_FLAG_KEY PKT_FLAG_KEY
     68# endif
     69# ifndef HAVE_AV_GUESS_FORMAT
     70#  define av_guess_format guess_format
     71# endif
     72# ifndef HAVE_AVIO_OPEN
     73#  define avio_open url_fopen
     74# endif
     75# ifndef HAVE_AVIO_CLOSE
     76#  define avio_close url_fclose
     77# endif
     78# if !HAVE_DECL_AVMEDIA_TYPE_VIDEO
     79#  define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
     80# endif
    6981#endif
    7082
     
    95107{
    96108#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
    97     AVOutputFormat * fmt = guess_format(NULL, fnm, NULL);
     109    AVOutputFormat * fmt = av_guess_format(NULL, fnm, NULL);
    98110    if (!fmt) {
    99111        // We couldn't deduce the output format from file extension so default
    100112        // to MPEG.
    101         fmt = guess_format("mpeg", NULL, NULL);
     113        fmt = av_guess_format("mpeg", NULL, NULL);
    102114        if (!fmt) {
    103115            averrno = MOVIE_NO_SUITABLE_FORMAT;
     
    133145    AVCodecContext *c = st->codec;
    134146    c->codec_id = fmt->video_codec;
    135     c->codec_type = CODEC_TYPE_VIDEO;
     147    c->codec_type = AVMEDIA_TYPE_VIDEO;
    136148
    137149    // Set sample parameters.
     
    150162        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
    151163
     164    int retval;
     165#ifndef HAVE_AVFORMAT_WRITE_HEADER
    152166    // Set the output parameters (must be done even if no parameters).
    153     int retval = av_set_parameters(oc, NULL);
     167    retval = av_set_parameters(oc, NULL);
    154168    if (retval < 0) {
    155169        averrno = retval;
    156170        return false;
    157171    }
     172#endif
    158173
    159174    // Show the format we've ended up with (for debug purposes).
     
    209224    }
    210225
    211     retval = url_fopen(&oc->pb, fnm, URL_WRONLY);
     226    retval = avio_open(&oc->pb, fnm, URL_WRONLY);
    212227    if (retval < 0) {
    213228        averrno = retval;
     
    216231
    217232    // Write the stream header, if any.
     233#ifdef HAVE_AVFORMAT_WRITE_HEADER
     234    retval = avformat_write_header(oc, NULL);
     235#else
    218236    retval = av_write_header(oc);
     237#endif
    219238    if (retval < 0) {
    220239        averrno = retval;
     
    376395        if (!(oc->oformat->flags & AVFMT_NOFILE)) {
    377396            // Close the output file.
    378             url_fclose(oc->pb);
     397            avio_close(oc->pb);
    379398        }
    380399
Note: See TracChangeset for help on using the changeset viewer.