From owner-svn-ports-all@FreeBSD.ORG Mon Oct 28 15:26:54 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5F6F963E; Mon, 28 Oct 2013 15:26:54 +0000 (UTC) (envelope-from wg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4BF452706; Mon, 28 Oct 2013 15:26:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SFQs8G009615; Mon, 28 Oct 2013 15:26:54 GMT (envelope-from wg@svn.freebsd.org) Received: (from wg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SFQrd7009612; Mon, 28 Oct 2013 15:26:53 GMT (envelope-from wg@svn.freebsd.org) Message-Id: <201310281526.r9SFQrd7009612@svn.freebsd.org> From: William Grzybowski Date: Mon, 28 Oct 2013 15:26:53 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r331864 - head/graphics/osg/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 15:26:54 -0000 Author: wg Date: Mon Oct 28 15:26:53 2013 New Revision: 331864 URL: http://svnweb.freebsd.org/changeset/ports/331864 Log: graphics/osg: fix build with newer ffmpeg - Add patches to chase the API change of ffmpeg 2.0 Reported by: marino Approved by: portmgr (bapt, implicit) Added: head/graphics/osg/files/patch-libav07 (contents, props changed) head/graphics/osg/files/patch-libav9 (contents, props changed) head/graphics/osg/files/patch-src-osgPlugins-ffmpeg-FFmpegDecoderAudio.cpp (contents, props changed) Added: head/graphics/osg/files/patch-libav07 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/graphics/osg/files/patch-libav07 Mon Oct 28 15:26:53 2013 (r331864) @@ -0,0 +1,22 @@ +diff -ruN src/osgPlugins/ffmpeg/FFmpegHeaders.hpp src/osgPlugins/ffmpeg/FFmpegHeaders.hpp +--- src/osgPlugins/ffmpeg/FFmpegHeaders.hpp 2011-06-17 10:41:56.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegHeaders.hpp 2011-11-17 19:44:33.194607494 +0100 +@@ -9,12 +9,13 @@ + #define FF_API_OLD_SAMPLE_FMT 0 + #include // for error codes defined in avformat.h + #include +-#include +-#include +-#include ++#include ++#include ++#include ++#include + +-#ifdef USE_SWSCALE +- #include ++#ifdef USE_SWSCALE ++ #include + #endif + + } Added: head/graphics/osg/files/patch-libav9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/graphics/osg/files/patch-libav9 Mon Oct 28 15:26:53 2013 (r331864) @@ -0,0 +1,284 @@ +Patch by lu_zero +https://bugs.gentoo.org/show_bug.cgi?id=439606 +upstream svn rev. 13335 contains similar changes. +no need to upstream this patch. + +diff -burN CMakeModules/FindFFmpeg.cmake CMakeModules/FindFFmpeg.cmake +--- CMakeModules/FindFFmpeg.cmake 2011-04-19 13:40:22.000000000 +0200 ++++ CMakeModules/FindFFmpeg.cmake 2012-11-22 13:59:28.303401170 +0100 +@@ -131,20 +131,16 @@ + SET(FFMPEG_FOUND "YES") + + SET(FFMPEG_INCLUDE_DIRS +- ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat +- ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice +- ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec +- ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil ++ ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ++ ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ++ ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ++ ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} + ) + + IF (FFMPEG_STDINT_INCLUDE_DIR) + SET(FFMPEG_INCLUDE_DIRS + ${FFMPEG_INCLUDE_DIRS} + ${FFMPEG_STDINT_INCLUDE_DIR} +- ${FFMPEG_STDINT_INCLUDE_DIR}/libavformat +- ${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice +- ${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec +- ${FFMPEG_STDINT_INCLUDE_DIR}/libavutil + ) + ENDIF() + +diff -burN src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp +--- src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp 2011-04-19 13:40:22.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp 2012-11-22 15:03:53.668601596 +0100 +@@ -89,7 +89,7 @@ + // m_context->flags |= CODEC_FLAG_TRUNCATED; + + // Open codec +- if (avcodec_open(m_context, p_codec) < 0) ++ if (avcodec_open2(m_context, p_codec, NULL) < 0) + throw std::runtime_error("avcodec_open() failed"); + } + +Binary files src/osgPlugins/ffmpeg/.FFmpegDecoderAudio.cpp.swp and src/osgPlugins/ffmpeg/.FFmpegDecoderAudio.cpp.swp differ +diff -burN src/osgPlugins/ffmpeg/FFmpegDecoder.cpp src/osgPlugins/ffmpeg/FFmpegDecoder.cpp +--- src/osgPlugins/ffmpeg/FFmpegDecoder.cpp 2011-07-15 12:25:12.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegDecoder.cpp 2012-11-22 15:59:39.569775078 +0100 +@@ -64,21 +64,12 @@ + + OSG_NOTICE<<"Attempting to stream "<getFormat() : 0); +- AVFormatParameters* av_params = (parameters ? parameters->getFormatParameter() : 0); +- if (av_open_input_file(&p_format_context, filename.c_str(), av_format, 0, av_params) !=0 ) ++ AVDictionary* av_options = (parameters ? parameters->getOptions() : NULL); ++ if (avformat_open_input(&p_format_context, filename.c_str(), av_format, &av_options) !=0 ) + throw std::runtime_error("av_open_input_file() failed"); + } + + m_format_context.reset(p_format_context); + + // Retrieve stream info +- if (av_find_stream_info(p_format_context) < 0) ++ if (avformat_find_stream_info(p_format_context, NULL) < 0) + throw std::runtime_error("av_find_stream_info() failed"); + + m_duration = double(m_format_context->duration) / AV_TIME_BASE; +@@ -134,7 +125,7 @@ + m_clocks.reset(m_start); + + // Dump info to stderr +- dump_format(p_format_context, 0, filename.c_str(), false); ++ av_dump_format(p_format_context, 0, filename.c_str(), false); + + // Find and open the first video and audio streams (note that audio stream is optional and only opened if possible) + +@@ -292,7 +283,7 @@ + // Read the next frame packet + if (av_read_frame(m_format_context.get(), &packet) < 0) + { +- if (url_ferror(m_format_context->pb) == 0) ++ if (m_format_context->pb->eof_reached == 0) + end_of_stream = true; + else + throw std::runtime_error("av_read_frame() failed"); +Binary files src/osgPlugins/ffmpeg/.FFmpegDecoder.cpp.swp and src/osgPlugins/ffmpeg/.FFmpegDecoder.cpp.swp differ +diff -burN src/osgPlugins/ffmpeg/FFmpegDecoder.hpp src/osgPlugins/ffmpeg/FFmpegDecoder.hpp +--- src/osgPlugins/ffmpeg/FFmpegDecoder.hpp 2011-04-19 13:40:22.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegDecoder.hpp 2012-11-22 15:59:18.895774005 +0100 +@@ -46,8 +46,8 @@ + { + if (_ptr) + { +- OSG_NOTICE<<"Calling av_close_input_file("<<_ptr<<")"<timestamp; +- else return HUGE_VAL; ++ return HUGE_VAL; + } + + inline double FFmpegDecoder::duration() const +diff -burN src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp +--- src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp 2011-04-19 13:40:22.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp 2012-11-22 16:01:30.906780849 +0100 +@@ -83,7 +83,7 @@ + m_context = stream->codec; + + // Trust the video size given at this point +- // (avcodec_open seems to sometimes return a 0x0 size) ++ // (avcodec_open2 seems to sometimes return a 0x0 size) + m_width = m_context->width; + m_height = m_context->height; + findAspectRatio(); +@@ -105,8 +105,8 @@ + // m_context->flags |= CODEC_FLAG_TRUNCATED; + + // Open codec +- if (avcodec_open(m_context, m_codec) < 0) +- throw std::runtime_error("avcodec_open() failed"); ++ if (avcodec_open2(m_context, m_codec, NULL) < 0) ++ throw std::runtime_error("avcodec_open2() failed"); + + // Allocate video frame + m_frame.reset(avcodec_alloc_frame()); +Binary files src/osgPlugins/ffmpeg/.FFmpegDecoderVideo.cpp.swp and src/osgPlugins/ffmpeg/.FFmpegDecoderVideo.cpp.swp differ +diff -burN src/osgPlugins/ffmpeg/FFmpegParameters.cpp src/osgPlugins/ffmpeg/FFmpegParameters.cpp +--- src/osgPlugins/ffmpeg/FFmpegParameters.cpp 2011-07-15 12:25:12.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegParameters.cpp 2012-11-22 17:20:09.019025477 +0100 +@@ -8,7 +8,7 @@ + #if LIBAVCODEC_VERSION_MAJOR >= 53 + extern "C" + { +- #include ++ #include + } + #define av_parse_video_frame_size av_parse_video_size + #define av_parse_video_frame_rate av_parse_video_rate +@@ -19,7 +19,7 @@ + + extern "C" + { +- #include ++ #include + } + + inline PixelFormat osg_av_get_pix_fmt(const char *name) { return av_get_pix_fmt(name); } +@@ -34,14 +34,15 @@ + + + FFmpegParameters::FFmpegParameters() : +- m_format(0) +-{ +- memset(&m_parameters, 0, sizeof(m_parameters)); +-} ++ m_format(0), ++ m_options(NULL) ++{} + + + FFmpegParameters::~FFmpegParameters() +-{} ++{ ++ av_dict_free(&m_options); ++} + + + void FFmpegParameters::parse(const std::string& name, const std::string& value) +@@ -59,40 +60,19 @@ + } + else if (name == "pixel_format") + { +- m_parameters.pix_fmt = osg_av_get_pix_fmt(value.c_str()); ++ av_dict_set(&m_options, "pixel_format", value.c_str(), 0); + } + else if (name == "frame_size") + { +- int frame_width = 0, frame_height = 0; +- if (av_parse_video_frame_size(&frame_width, &frame_height, value.c_str()) < 0) +- { +- OSG_NOTICE<<"Failed to apply frame size: "<> audio_sample_rate; +- m_parameters.sample_rate = audio_sample_rate; ++ av_dict_set(&m_options, "sample_rate", value.c_str(), 0); + } + } + +diff -burN src/osgPlugins/ffmpeg/FFmpegParameters.hpp src/osgPlugins/ffmpeg/FFmpegParameters.hpp +--- src/osgPlugins/ffmpeg/FFmpegParameters.hpp 2011-04-19 13:40:22.000000000 +0200 ++++ src/osgPlugins/ffmpeg/FFmpegParameters.hpp 2012-11-22 15:23:27.490662455 +0100 +@@ -21,14 +21,14 @@ + bool isFormatAvailable() const { return m_format!=NULL; } + + AVInputFormat* getFormat() { return m_format; } +- AVFormatParameters* getFormatParameter() { return &m_parameters; } ++ AVDictionary* getOptions() { return m_options; } + + void parse(const std::string& name, const std::string& value); + + protected: + + AVInputFormat* m_format; +- AVFormatParameters m_parameters; ++ AVDictionary* m_options; + }; + + Added: head/graphics/osg/files/patch-src-osgPlugins-ffmpeg-FFmpegDecoderAudio.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/graphics/osg/files/patch-src-osgPlugins-ffmpeg-FFmpegDecoderAudio.cpp Mon Oct 28 15:26:53 2013 (r331864) @@ -0,0 +1,11 @@ +--- src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp.orig 2013-10-28 13:22:11.997950234 -0200 ++++ src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp 2013-10-28 13:22:39.838945189 -0200 +@@ -9,6 +9,8 @@ + //#include + + ++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio ++ + + namespace osgFFmpeg { +