./PaxHeaders.4213/video-2.0.00000644000000000000000000000013213627020723012347 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/0000755000175000017500000000000013627020723012545 5ustar00olafolaf00000000000000video-2.0.0/PaxHeaders.4213/inst0000644000000000000000000000013213627020723013167 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/inst/0000755000175000017500000000000013627020723013522 5ustar00olafolaf00000000000000video-2.0.0/inst/PaxHeaders.4213/VideoWriter.m0000644000000000000000000000013213627020723015665 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/inst/VideoWriter.m0000644000175000017500000002105113627020723016142 0ustar00olafolaf00000000000000## Copyright (C) 2019-2020 Andreas Weber ## ## This file is part of octave-video. ## ## This program is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; see the file COPYING. If not, see ## . ## -*- texinfo -*- ## @deftypefn {} {@var{p} =} VideoWriter () ## Create object @var{p} of the VideoWriter class. ## @end deftypefn ## ToDo: https://savannah.gnu.org/bugs/?func=detailitem&item_id=57020 ## pantxo ## - most properties should be read-only (SetAccess = "private"): ColorChannels (codec specific), Duration, FileFormat (codec specific), ## FileName/Path (fixed at object instantiation), FrameCount, Height/Width (fixed by the first provided frame), VideoBitsPerPixel/VideoCompressionMethod/VideoFormat (codec specific) ## - increment FrameCount and Duration after each successful call to writeVideo, ## - allow passing frames or frame arrays directly to writeVideo, without having to extract the "cdata" field manually, ## - allow passing arbitrary image data types even if we end up converting them internally to whatever is prefered for the chosen codec, e.g uint8 for RGB 24bits video formats. classdef VideoWriter < handle properties (SetAccess = private, GetAccess = public) ColorChannels = 3; #Colormap = []; # not yet implemented #CompressionRatio = 10; # not yet implemented Duration = 0; # [s] FileFormat = "avi"; Filename = ""; FrameCount = 0; FrameRate = 30; # fps in [Hz] Height = []; # height of the video frames which can be different than requested due to padding or cropping Width = []; # width of the video frames which can be different than requested due to padding or cropping #LosslessCompression = false; # FIXME: currently not used Path = "./"; #Quality = 75; # FIXME: currently not used VideoBitsPerPixel = 24; # 8 * ColorChannels VideoCompressionMethod = ""; # Used video codec, for exmaple "h264" or "mpeg4" VideoFormat = ""; # descriptive container format for example # "MP4 (MPEG-4 Part 14)" or "AVI (Audio Video Interleaved)" ## GNU Octave extensions FourCC = ""; FFmpeg_versions = ""; endproperties properties (Hidden, SetAccess = protected) h = []; opened = false; endproperties methods (Access = private) function update_variable_properties (v) ## update properties which may change with calls to writeVideo if (v.opened) opt = __writer_get_properties__ (v.h); v.FrameCount = opt.frame_idx; v.Duration = opt.frame_idx / v.FrameRate; else #warning ("VideoWriter isn't opened"); # I think just don't update is the best here ; endif endfunction endmethods methods ## call VideoWriter ("foo.mpg", "xxx") function v = VideoWriter (filename, varargin) [v.Path, Filename, ext] = fileparts (filename); v.Filename = [Filename ext]; ## Currently the container format is guessed using the filename extension ## and the default video codec is used or you can set FourCC ## to force a specific codec. ## List formats: "ffmpeg -formats" ## ffmpeg -h muxer=matroska ## ffmpeg -codecs ## https://superuser.com/questions/300897/what-is-a-codec-e-g-divx-and-how-does-it-differ-from-a-file-format-e-g-mp/300997#300997 if (numel (varargin) > 0) v.FourCC = varargin{1}; else v.FourCC = ""; endif v.FFmpeg_versions = __ffmpeg_defines__ ().LIBAV_IDENT; endfunction function disp (v) printf(" class VideoWriter:\n"); printf(" ColorChannels = %i\n", v.ColorChannels); #printf(" CompressionRatio = %i\n", v.CompressionRatio); printf(" Duration [s] = %.2f\n", v.Duration); printf(" FileFormat = %s\n", v.FileFormat); printf(" Filename = %s\n", v.Filename); printf(" FrameCount = %i\n", v.FrameCount); printf(" FrameRate [1/s] = %i\n", v.FrameRate); printf(" Height [px] = %i\n", v.Height); printf(" Width [px] = %i\n", v.Width); #printf(" LosslessCompression = %s\n", v.LosslessCompression); printf(" Path = %s\n", v.Path); #printf(" Quality = %i\n", v.Quality); printf(" VideoBitsPerPixel = %i\n", v.VideoBitsPerPixel); printf(" VideoCompressionMethod = %s\n", v.VideoCompressionMethod); printf(" VideoFormat = %s\n", v.VideoFormat); printf(" FourCC = %s\n", v.FourCC); printf(" FFmpeg_versions = %s\n", v.FFmpeg_versions); endfunction function open (v) ## This implementation just opens a dummy file to check if the file ## can be created. A new instance of CvVideoWriter_FFMPEG is ## created on the first call writeVideo. fn = fullfile (v.Path, v.Filename); [fid, msg] = fopen (fn, "w"); if (fid < 0) error ("VideoWriter open failed: '%s'", msg); endif s = fputs (fid, "dummy\n"); fclose (fid); endfunction function close (v) if (v.opened) __writer_close__ (v.h); v.opened = false; endif endfunction function writeVideo (v, in) # input can be an image or a frame geturned by getframe is_frame = isstruct (in) && isfield (in, "cdata"); is_img = isnumeric (in); if (! is_frame && ! is_img) error ("writeVideo: 'in' has to be a numeric matrix or a frame with cdata") endif if (is_frame) in = in.cdata; endif if (! v.opened) n_ch = size (in, 3); if (n_ch != 1 && n_ch != 3) error ("writeVideo: 'in' has to be a 'H x W x 1' (grayscale or indexed) or 'H x W x 3' matrix (RGB)"); endif v.ColorChannels = n_ch; v.VideoBitsPerPixel = 8 * v.ColorChannels; v.h = __writer_open__ (fullfile (v.Path, v.Filename), v.FourCC, v.FrameRate, columns (in), rows (in), v.ColorChannels == 3); ## update properties opt = __writer_get_properties__ (v.h); v.Width = opt.frame_width; v.Height = opt.frame_height; v.VideoFormat = opt.output_format_long_name; v.VideoCompressionMethod = opt.output_video_stream_codec; v.opened = true; endif # default ist BGR24, flip RGB -> BGR in = flip (in, 3); __writer_write_frame__ (v.h, in); endfunction function val = get.FrameCount (v) update_variable_properties (v); val = v.FrameCount; endfunction endmethods endclassdef %!demo %! fn = fullfile (tempdir(), "sombrero.mp4"); %! w = VideoWriter (fn); %! open (w); %! z = sombrero (); %! hs = surf (z); %! axis manual %! nframes = 100; %! for ii = 1:nframes %! set (hs, "zdata", z * sin (2*pi*ii/nframes + pi/5)); %! drawnow %! writeVideo (w, getframe (gcf)); %! endfor %! close (w) %! printf ("Now run '%s' in your favourite video player or try 'demo VideoReader'!\n", fn); %!test %! fn = fullfile (tempdir(), "rainbow.mp4"); %! width = 200; %! height = 150; %! nframes = 120; %! p = permute (rainbow (width), [3 1 2]); %! raw_video = zeros (height, width, 3, nframes); %! w = VideoWriter (fn); %! for k=1:nframes %! ps = circshift (p, k * 6); %! img = uint8 (255 * repmat (ps, height, 1)); %! raw_video (:, :, :, k) = img; %! writeVideo (w, img); %! endfor %! close (w) %! ## read video and compare %! clear -x raw_video fn %! r = VideoReader (fn); %! for k=1:size (raw_video, 4) %! img = readFrame (r); %! d = double (img) - raw_video(:,:,:,k); %! # this doesn't work well due to compression... %! # FIXME: a better idea to test write/read roundtrip %! rel_err = sum (abs(d(:)))/numel(d)/255; %! assert (rel_err < 0.015) %! endfor %! close (r); video-2.0.0/inst/PaxHeaders.4213/VideoReader.m0000644000000000000000000000013213627020723015613 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/inst/VideoReader.m0000644000175000017500000001210213627020723016065 0ustar00olafolaf00000000000000## Copyright (C) 2019-2020 Andreas Weber ## ## This file is part of octave-video. ## ## This program is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; see the file COPYING. If not, see ## . ## -*- texinfo -*- ## @deftypefn {} {@var{p} =} VideoReader () ## Create object @var{p} of the VideoReader class. ## @end deftypefn ## ToDo: https://savannah.gnu.org/bugs/?func=detailitem&item_id=57020 classdef VideoReader < handle properties (SetAccess = private, GetAccess = public) Duration = 0; # [s] BitsPerPixel = 24; # Bitrate = 0; FrameRate = 0; # [1/s] Height = 0; # [px] Width = 0; # [px] Name = ""; # filename Path = "./"; NumberOfFrames = 0; VideoFormat = "RGB24"; ## GNU Octave extensions FrameNumber = 0; # 0-based index of the frame to be decoded/captured next. VideoCodec = ""; # Name of used video codec as obtained by AVCodecDescriptor->name AspectRatio = [0, 1]; FFmpeg_versions = ""; endproperties properties (SetAccess = public, GetAccess = public) CurrentTime = 0; # [s] Tag = ""; endproperties properties (Hidden, SetAccess = protected) h = []; endproperties methods (Hidden) endmethods methods function v = VideoReader (filename, varargin) [v.Path, Filename, ext] = fileparts (filename); v.Name = [Filename ext]; # varargin could be name/value property pairs # FIXME: implement me [v.h] = __cap_open__ (fullfile (v.Path, v.Name)); v.FFmpeg_versions = __ffmpeg_defines__ ().LIBAV_IDENT; update_properties (v); endfunction function disp (v) printf (" class VideoReader:\n"); printf (" Duration [s] = %.2f\n", v.Duration); printf (" BitsPerPixel = %i\n", v.BitsPerPixel); printf (" Bitrate = %i\n", v.Bitrate); printf (" FrameRate [fps] = %.2f\n", v.FrameRate); printf (" Height [px] = %i\n", v.Height); printf (" Width [px] = %i\n", v.Width); printf (" Name = %s\n", v.Name); printf (" Path = %s\n", v.Path); printf (" NumberOfFrames = %i\n", v.NumberOfFrames); printf (" FrameNumber = %i\n", v.FrameNumber); printf (" VideoFormat = %s\n", v.VideoFormat); printf (" VideoCodec = %s\n", v.VideoCodec); printf (" AspectRatio = %s\n", mat2str (v.AspectRatio)); endfunction function frame = readFrame (v) r = __cap_grab_frame__ (v.h); if (r) frame = __cap_retrieve_frame__ (v.h); # default ist BGR24, flip frame = flip (frame, 3); else frame = []; endif endfunction function val = get.FrameNumber (v) val = __cap_get_properties__ (v.h).frame_number; endfunction # internal function # FIXME: perhaps this can be hidden or method Access = private but what would be the benefit? function update_properties (v) prop = __cap_get_properties__ (v.h); v.Duration = prop.duration_sec; v.FrameRate = prop.fps; v.NumberOfFrames = prop.total_frames; v.FrameNumber = prop.frame_number; v.Bitrate = prop.bitrate; v.Width = prop.width; v.Height = prop.height; v.VideoCodec = prop.video_codec_name; v.AspectRatio = [prop.aspect_ration_num prop.aspect_ration_den]; endfunction function r = hasFrame (v) r = v.FrameNumber < v.NumberOfFrames; endfunction function close (v) __cap_close__ (v.h); endfunction endmethods endclassdef %!demo %! fn = fullfile (tempdir(), "sombrero.mp4"); %! if (! exist (fn, "file")) %! warning ("'%s' doesn't exist, running demo VideoWriter first...", fn); %! demo ("VideoWriter"); %! endif %! x = VideoReader (fn); %! im = []; %! while (! isempty (img = readFrame (x))) %! if (isempty (im)) %! im = image (img); %! axis off; %! else %! set (im, "cdata", img); %! endif %! drawnow %! pause (1/30); %! endwhile %!demo %! r = VideoReader("https://raw.githubusercontent.com/opencv/opencv/master/samples/data/vtest.avi") %! im = []; %! while (r.hasFrame()) %! img = readFrame (r); %! if (isempty (im)) %! im = image (img); %! axis off; %! else %! set (im, "cdata", img); %! endif %! drawnow %! endwhile # VideoReader is currently tested with VideoWriter %!test %! assert (true); video-2.0.0/PaxHeaders.4213/DESCRIPTION0000644000000000000000000000013213627020723013775 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/DESCRIPTION0000644000175000017500000000072613627020723014260 0ustar00olafolaf00000000000000Name: video Version: 2.0.0 Date: 2020-02-24 Author: Andreas Weber and the OpenCV developers Maintainer: Andreas Weber Title: Video functions Description: A wrapper for OpenCV's CvCapture_FFMPEG and CvVideoWriter_FFMPEG Categories: Video processing Depends: octave (>= 4.4.0) BuildRequires: ffmpeg or libav License: GPLv3 and 3-clause BSD (https://www.opencv.org/license.html) Url: https://octave.sourceforge.io/video/index.html video-2.0.0/PaxHeaders.4213/COPYING0000644000000000000000000000013213627020723013322 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/COPYING0000644000175000017500000000004213627020723013574 0ustar00olafolaf00000000000000See individual files for licenses video-2.0.0/PaxHeaders.4213/NEWS0000644000000000000000000000013213627020723012766 xustar0030 mtime=1583096275.206828757 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/NEWS0000644000175000017500000000210613627020723013243 0ustar00olafolaf00000000000000Summary of important user-visible changes for video 2.0.0: ------------------------------------------------------------------- ** complete rewrite of the package, all sourcecode from previous versions was dropped and OpenCV's CvCapture_FFMPEG and CvVideoWriter_FFMPEG was used as base to implement the new VideoReader and VideoWriter classes. Summary of important user-visible changes for video 1.2.4: ------------------------------------------------------------------- ** Bugfix #51057 Summary of important user-visible changes for video 1.2.3: ------------------------------------------------------------------- ** none (bugfix release #48846) Summary of important user-visible changes for video 1.2.2: ------------------------------------------------------------------- ** none (bugfix release for Windows) Summary of important user-visible changes for video 1.2.1: ------------------------------------------------------------------- ** Builds with GNU Octave 4.0.0 ** Fix to read/write metadata title and comment ** Package is no longer automatically loaded. video-2.0.0/PaxHeaders.4213/src0000644000000000000000000000013213627020723013001 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/0000755000175000017500000000000013627020723013334 5ustar00olafolaf00000000000000video-2.0.0/src/PaxHeaders.4213/configure0000644000000000000000000000013213627020723014762 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.206828757 30 ctime=1583096275.210828904 video-2.0.0/src/configure0000755000175000017500000032541613627020723015256 0ustar00olafolaf00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for Octave-Forge video package 2.0.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Octave-Forge video package' PACKAGE_TARNAME='octave-forge-video-package' PACKAGE_VERSION='2.0.0' PACKAGE_STRING='Octave-Forge video package 2.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS FFMPEG_LIBS FFMPEG_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG HAVE_MKOCTFILE OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR FFMPEG_CFLAGS FFMPEG_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Octave-Forge video package 2.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/octave-forge-video-package] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Octave-Forge video package 2.0.0:";; esac cat <<\_ACEOF Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path FFMPEG_CFLAGS C compiler flags for FFMPEG, overriding pkg-config FFMPEG_LIBS linker flags for FFMPEG, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Octave-Forge video package configure 2.0.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Octave-Forge video package $as_me 2.0.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #AC_CONFIG_HEADERS([config.h]) # Checks for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Define macros needed for libav #AC_DEFINE(__STDC_CONSTANT_MACROS, [], [workaround for C++ programs to use C99 macros]) # Extract the first word of "mkoctfile", so it can be a program name with args. set dummy mkoctfile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_HAVE_MKOCTFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAVE_MKOCTFILE"; then ac_cv_prog_HAVE_MKOCTFILE="$HAVE_MKOCTFILE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_MKOCTFILE="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_HAVE_MKOCTFILE" && ac_cv_prog_HAVE_MKOCTFILE="no" fi fi HAVE_MKOCTFILE=$ac_cv_prog_HAVE_MKOCTFILE if test -n "$HAVE_MKOCTFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_MKOCTFILE" >&5 $as_echo "$HAVE_MKOCTFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test $HAVE_MKOCTFILE = "no"; then as_fn_error $? "mkoctfile required to install $PACKAGE_NAME" "$LINENO" 5 fi # Checks for libraries. if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFMPEG" >&5 $as_echo_n "checking for FFMPEG... " >&6; } if test -n "$FFMPEG_CFLAGS"; then pkg_cv_FFMPEG_CFLAGS="$FFMPEG_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libswscale, libavformat, libavcodec, libavutil\""; } >&5 ($PKG_CONFIG --exists --print-errors "libswscale, libavformat, libavcodec, libavutil") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FFMPEG_CFLAGS=`$PKG_CONFIG --cflags "libswscale, libavformat, libavcodec, libavutil" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$FFMPEG_LIBS"; then pkg_cv_FFMPEG_LIBS="$FFMPEG_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libswscale, libavformat, libavcodec, libavutil\""; } >&5 ($PKG_CONFIG --exists --print-errors "libswscale, libavformat, libavcodec, libavutil") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FFMPEG_LIBS=`$PKG_CONFIG --libs "libswscale, libavformat, libavcodec, libavutil" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then FFMPEG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libswscale, libavformat, libavcodec, libavutil" 2>&1` else FFMPEG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libswscale, libavformat, libavcodec, libavutil" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$FFMPEG_PKG_ERRORS" >&5 as_fn_error $? "FFmpeg libswscale, libavformat, libavcodec or libavutil not found" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "FFmpeg libswscale, libavformat, libavcodec or libavutil not found" "$LINENO" 5 else FFMPEG_CFLAGS=$pkg_cv_FFMPEG_CFLAGS FFMPEG_LIBS=$pkg_cv_FFMPEG_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # Checks for typedefs, structures, and compiler characteristics. #AC_CHECK_HEADER_STDBOOL #AC_TYPE_UINT64_T #AC_TYPE_UINT8_T ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Octave-Forge video package $as_me 2.0.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Octave-Forge video package config.status 2.0.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: $PACKAGE_NAME is now configured with FFMPEG LIBS: $FFMPEG_LIBS FFMPEG CFLAGS: $FFMPEG_CFLAGS DEFS: $DEFS " >&5 $as_echo "$as_me: $PACKAGE_NAME is now configured with FFMPEG LIBS: $FFMPEG_LIBS FFMPEG CFLAGS: $FFMPEG_CFLAGS DEFS: $DEFS " >&6;} video-2.0.0/src/PaxHeaders.4213/Makefile.in0000644000000000000000000000013213627020723015123 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/Makefile.in0000644000175000017500000000065513627020723015407 0ustar00olafolaf00000000000000MKOCTFILE ?= mkoctfile MKOCTFLAGS ?= -Wall -v .PHONY: all clean style check realclean distclean all: cap_ffmpeg_wrapper.oct debug : MKOCTFLAGS += -ggdb -O0 debug : all cap_ffmpeg_wrapper.oct: cap_ffmpeg_wrapper.cc cap_ffmpeg_impl_ov.hpp $(MKOCTFILE) $(MKOCTFLAGS) @FFMPEG_CFLAGS@ @DEFS@ $< $(filter %.o, $^) @FFMPEG_LIBS@ @CPPFLAGS@ clean: rm -f *.o *.oct octave-workspace ### below is removed in distributed Makefile.in video-2.0.0/src/PaxHeaders.4213/cap_ffmpeg_wrapper.cc0000644000000000000000000000013213627020723017214 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/cap_ffmpeg_wrapper.cc0000644000175000017500000005102013627020723017470 0ustar00olafolaf00000000000000/* Copyright (C) 2019-2020 Andreas Weber This file is part of octave-video; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . */ #include "cap_ffmpeg_impl_ov.hpp" // PKG_ADD: autoload ("__ffmpeg_defines__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__ffmpeg_defines__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__ffmpeg_defines__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{def} =} __ffmpeg_defines__ ()\n\ undocumented internal function\n\ @end deftypefn") { octave_value_list retval; octave_scalar_map opt; opt.contents ("LIBAVUTIL_BUILD") = LIBAVUTIL_BUILD; opt.contents ("LIBAVUTIL_IDENT") = LIBAVUTIL_IDENT; opt.contents ("LIBSWSCALE_BUILD") = LIBSWSCALE_BUILD; opt.contents ("LIBSWSCALE_IDENT") = LIBSWSCALE_IDENT; opt.contents ("LIBAVCODEC_BUILD") = LIBAVCODEC_BUILD; opt.contents ("LIBAVCODEC_IDENT") = LIBAVCODEC_IDENT; opt.contents ("LIBAVFORMAT_BUILD") = LIBAVFORMAT_BUILD; opt.contents ("LIBAVFORMAT_IDENT") = LIBAVFORMAT_IDENT; //join ident opt.contents ("LIBAV_IDENT") = LIBAVUTIL_IDENT ", " LIBSWSCALE_IDENT ", " LIBAVCODEC_IDENT ", " LIBAVFORMAT_IDENT; retval.append (opt); return retval; } // PKG_ADD: autoload ("__ffmpeg_output_formats__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__ffmpeg_output_formats__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__ffmpeg_output_formats__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{f} =} __ffmpeg_output_formats__ ()\n\ undocumented internal function\n\ @end deftypefn") { av_register_all(); octave_idx_type n = 0; // first loop to get numer of output formats AVOutputFormat * oformat = av_oformat_next(NULL); while (oformat != NULL) { n++; oformat = av_oformat_next (oformat); } Cell names (n, 1); Cell long_names (n, 1); Cell mime_types (n, 1); Cell extensions (n, 1); Cell codecs (n, 1); // second loop, now fill the cells oformat = av_oformat_next(NULL); int i = 0; while(oformat != NULL) { names (i) = oformat->name; long_names (i) = oformat->long_name; mime_types (i) = oformat->mime_type; extensions (i) = oformat->extensions; octave_map map_codecs; if (oformat->codec_tag) { // printf ("%s %s %s\n", oformat->name, oformat->long_name, oformat->mime_type); std::vector video_codecs; const AVCodecTag * ptags = oformat->codec_tag[0]; while (ptags->id != AV_CODEC_ID_NONE) { AVCodecID id = (AVCodecID) ptags->id; // get descriptor const AVCodecDescriptor* d = avcodec_descriptor_get (id); if (d) { // only add encoder video codecs if (d->type == AVMEDIA_TYPE_VIDEO) { // prüfen, ob es einen encoder gibt if (avcodec_find_encoder (d->id)) { unsigned int tag = ptags->tag; if (! strcmp (oformat->name, "mp4")) // use riff { const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; tag = av_codec_get_tag(table, id); } char buf[5]; snprintf (buf, 5, "%c%c%c%c", CV_TAG_TO_PRINTABLE_CHAR4(tag)); //printf("fourcc tag 0x%08x '%s' codec_id %04X\n", tag, buf, id); video_codecs.push_back (buf); } } } ptags++; } // unique but keep order { auto last = std::unique(video_codecs.begin(), video_codecs.end()); video_codecs.erase (last, video_codecs.end()); Cell codec_fourcc (video_codecs.size (), 1); for (unsigned int k = 0; k < video_codecs.size (); ++k) codec_fourcc(k) = video_codecs[k]; codecs (i) = codec_fourcc; } } oformat = av_oformat_next(oformat); i++; } octave_map m; m.assign ("name", names); m.assign ("long_name", long_names); m.assign ("mime_type", mime_types); m.assign ("extensions", extensions); m.assign ("codecs", codecs); return octave_value (m); } /****************** CvCapture_FFMPEG **************************/ CvCapture_FFMPEG* get_cap_from_ov (octave_value ov) { if (!capture_type_loaded) { CvCapture_FFMPEG::register_type(); capture_type_loaded = true; } if (ov.type_id() != CvCapture_FFMPEG::static_type_id()) { error("get_handler_from_ov: Not a valid CvCapture_FFMPEG"); return 0; } CvCapture_FFMPEG* p = 0; const octave_base_value& rep = ov.get_rep(); p = &((CvCapture_FFMPEG &)rep); return p; } // PKG_ADD: autoload ("__cap_open__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__cap_open__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__cap_open__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __cap_open__ (@var{filename})\n\ Creates an instance of CvCapture_FFMPEG.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage(); return retval; } //if (!type_loaded) // { // CvCapture_FFMPEG::register_type(); // type_loaded = true; // } std::string filename = args(0).string_value (); if (! error_state) { CvCapture_FFMPEG *h = new CvCapture_FFMPEG (); // returns "valid" (true if open was successful) bool valid = h->open (filename.c_str ()); if (valid) retval.append (octave_value (h)); else error ("Opening '%s' failed : '%s'", filename.c_str (), get_last_err_msg().c_str ()); } return retval; } // PKG_ADD: autoload ("__cap_get_properties__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__cap_get_properties__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__cap_get_properties__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{h}, @var{opt}] =} __cap_get_properties__ (@var{h})\n\ Gets CvCapture_FFMPEG properties like bitrate, fps, total_frames, duration_sec...\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) error("__cap_get_properties__ needs one parameter"); CvCapture_FFMPEG* h = get_cap_from_ov (args(0)); if (h) { octave_scalar_map opt; opt.contents ("total_frames") = h->get_total_frames (); opt.contents ("duration_sec") = h->get_duration_sec (); opt.contents ("fps") = h->get_fps (); opt.contents ("bitrate") = h->get_bitrate (); opt.contents ("width") = h->frame.width; opt.contents ("height") = h->frame.height; // Current position of the video file in milliseconds //opt.contents ("pos") = (h->picture_pts == AV_NOPTS_VALUE_) ? 0 : h->dts_to_sec(h->picture_pts) * 1000; // Relative position of the video file: 0=start of the film, 1=end of the film. //opt.contents ("rel_pos") = h->r2d(h->ic->streams[h->video_stream]->time_base); // 0-based index of the frame to be decoded/captured next. opt.contents ("frame_number") = h->frame_number; opt.contents ("video_codec_name") = h->get_video_codec_name (); // aspect ratio // 0, 1 is "undefined" { AVRational s = h->get_sample_aspect_ratio (); opt.contents ("aspect_ration_num") = s.num; opt.contents ("aspect_ration_den") = s.den; } retval.append (opt); } return retval; } // PKG_ADD: autoload ("__cap_grab_frame__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__cap_grab_frame__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__cap_grab_frame__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{f} =} __cap_grab_frame__ (@var{h})\n\ \n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) error("__cap_grab_frame__ needs one parameter"); CvCapture_FFMPEG* p = get_cap_from_ov (args(0)); if (p) return (octave_value (p->grabFrame ())); return retval; } // PKG_ADD: autoload ("__cap_retrieve_frame__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__cap_retrieve_frame__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__cap_retrieve_frame__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{f} =} __cap_retrieve_frame__ (@var{h})\n\ \n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) error("__cap_retrieve_frame__ needs one parameter"); CvCapture_FFMPEG* p = get_cap_from_ov (args(0)); if (p) { unsigned char* data; int width = 0; int height = 0; int step; // AVFrame::linesize, size in bytes of each picture line int cn; // number of colors and should always be 3 here bool ret = p->retrieveFrame (0, &data, &step, &width, &height, &cn); //printf ("ret = %i, width = %i, height = %i, step = %i, cn = %i\n", ret, width, height, step, cn); assert (cn == 3); // step may be bigger because of padding assert (step >= width * cn); if (ret) { #if 0 // Attention: step and cn not handled yet dim_vector dv (3, step/cn, height); uint8NDArray img (dv); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, data, img.numel ()); Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; // FIXME: howto handle padding? Extract submatrix with "extract"? retval(0) = octave_value(img.permute (perm)); #else dim_vector dv (height, width, cn); uint8NDArray img (dv); for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) for (int c = 0; c < cn; ++c) img (y, x, c) = data[x * cn + y * step + c]; retval(0) = octave_value(img); #endif } } return retval; } // PKG_ADD: autoload ("__cap_close__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__cap_close__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__cap_close__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __cap_close__ (@var{h})\n\ undocumented internal function\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage(); return retval; } CvCapture_FFMPEG* p = get_cap_from_ov (args(0)); if (p) p->close (); return retval; } /************* CvVideoWriter_FFMPEG ****************/ CvVideoWriter_FFMPEG* get_writer_from_ov (octave_value ov) { if (!writer_type_loaded) { CvVideoWriter_FFMPEG::register_type(); writer_type_loaded = true; } if (ov.type_id() != CvVideoWriter_FFMPEG::static_type_id()) { error("get_handler_from_ov: Not a valid CvVideoWriter_FFMPEG"); return 0; } CvVideoWriter_FFMPEG* p = 0; const octave_base_value& rep = ov.get_rep(); p = &((CvVideoWriter_FFMPEG &)rep); return (CvVideoWriter_FFMPEG *) p; } // PKG_ADD: autoload ("__writer_open__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__writer_open__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__writer_open__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __writer_open__ (@var{filename}, @var{fourcc}, @var{fps}, @var{width}, @var{height}, @var{isColor})\n\ undocumented internal function\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 6) { print_usage(); return retval; } if (! writer_type_loaded) { CvVideoWriter_FFMPEG::register_type(); writer_type_loaded = true; av_register_all(); } std::string filename = args(0).string_value (); // codec tag, in OpenCV "fourcc" is used interchangeably // empty fourcc selects default codec_id for guessed container unsigned int tag; std::string fourcc = args(1).string_value (); // FIXME no error handling yet double fps = args(2).double_value (); int width = args(3).int_value (); int height = args(4).int_value (); bool isColor = args(5).bool_value (); if (fourcc.size () == 0) { // get tag for default codec for guessed container from filename AVOutputFormat* foo = av_guess_format (NULL, filename.c_str (), NULL); // list supported codecs for guessed format #if 0 if (foo->codec_tag) { const AVCodecTag * ptags = foo->codec_tag[0]; while (ptags->id != AV_CODEC_ID_NONE) { unsigned int tag = ptags->tag; printf("fourcc tag 0x%08x/'%c%c%c%c' codec_id %04X\n", tag, CV_TAG_TO_PRINTABLE_CHAR4(tag), ptags->id); ptags++; } } #endif tag = av_codec_get_tag (foo->codec_tag, foo->video_codec); } else if (fourcc.size () == 4) { tag = MKTAG(fourcc[0], fourcc[1], fourcc[2], fourcc[3]); } else error ("fourcc has to be empty or 4 chars long"); // list codecs //~ AVCodec * codec = av_codec_next(NULL); //~ while(codec != NULL) //~ { //~ fprintf(stderr, "%s\n", codec->long_name); //~ codec = av_codec_next(codec); //~ } // list formats //~ AVOutputFormat * oformat = av_oformat_next(NULL); //~ while(oformat != NULL) //~ { //~ printf ("%s; %s; %s; %s\n", oformat->name, oformat->long_name, oformat->mime_type, oformat->extensions); //~ //cv_ff_codec_tag_dump (oformat->codec_tag); //~ oformat = av_oformat_next(oformat); //~ } //~ AVOutputFormat * oformat = av_oformat_next(NULL); //~ while(oformat != NULL) //~ { //~ fprintf(stderr, "%s\n", oformat->long_name); //~ if (oformat->codec_tag != NULL) //~ { //~ int i = 0; //~ CV_CODEC_ID cid = CV_CODEC(CODEC_ID_MPEG1VIDEO); //~ while (cid != CV_CODEC(CODEC_ID_NONE)) //~ { //~ cid = av_codec_get_id(oformat->codec_tag, i++); //~ fprintf(stderr, " %d\n", cid); //~ } //~ } //~ oformat = av_oformat_next(oformat); //~ } //printf ("tag = %i = %#x = %c%c%c%c\n", tag, tag, CV_TAG_TO_PRINTABLE_CHAR4(tag)); #if 0 // that would be a workaround: AVOutputFormat* foo = av_guess_format (NULL, "foo.mp4", NULL); printf ("default video_codec = %i = %#x\n", foo->video_codec, foo->video_codec); unsigned int tag = av_codec_get_tag (foo->codec_tag, AV_CODEC_ID_H264); printf ("tag = %i = %#x\n", tag, tag); // vom tag über riff zum codec_id: tag = MKTAG('H', '2', '6', '4'); const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; enum AVCodecID id = av_codec_get_id (table, tag); printf ("id = %i = %#x, AV_CODEC_ID_H264 = %#x\n", id, id, AV_CODEC_ID_H264); // und zum tag zurück, Achtung, das ergibt nicht mehr 0x21 tag = av_codec_get_tag (table, AV_CODEC_ID_H264); printf ("tag = %i = %#x = %c%c%c%c\n", tag, tag, CV_TAG_TO_PRINTABLE_CHAR4(tag)); #endif // welche API wäre denn von Octave aus gewünscht? // Ich denke direkt AVCodecID angeben wäre sinnvoller, als die fourcc /* * codecs anzeigen: * andy@Ryzen5Babe:~/Downloads/libav-12.3$ grep -r show_codecs * cmdutils_common_opts.h: { "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" }, * cmdutils.h:int show_codecs(void *optctx, const char *opt, const char *arg); * cmdutils.c:int show_codecs(void *optctx, const char *opt, const char *arg) */ if (! error_state) { CvVideoWriter_FFMPEG *h = new CvVideoWriter_FFMPEG (); // https://docs.opencv.org/3.4.1/dd/d9e/classcv_1_1VideoWriter.html#ac3478f6257454209fa99249cc03a5c59 // fourcc 4-character code of codec used to compress the frames. For example, // VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, // VideoWriter::fourcc('M','J','P','G') is a motion-jpeg codec etc. // List of codes can be obtained at Video Codecs by FOURCC page. // FFMPEG backend with MP4 container natively uses other values as fourcc code: see http://mp4ra.org/#/codecs, // so you may receive a warning message from OpenCV about fourcc code conversion. // fps Framerate of the created video stream. // isColor If it is not zero, the encoder will expect and encode color frames, // otherwise it will work with grayscale frames (the flag is currently supported on Windows only). //printf ("h->open (%s, %i, %f, %u, %u, %u);\n", filename.c_str (), tag, fps, width, height, isColor); bool valid = h->open (filename.c_str (), tag, fps, width, height, isColor); if (valid) { retval.append (octave_value (h)); } else { // FIXME: CvVideoWriter_FFMPEG::open just returns false without explanation why error ("Opening '%s' for writing failed", filename.c_str ()); } } return retval; } // PKG_ADD: autoload ("__writer_get_properties__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__writer_get_properties__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__writer_get_properties__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{h}, @var{opt}] =} __cap_get_properties__ (@var{h})\n\ Gets CvVideoWriter_FFMPEG properties...\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) error("__writer_get_properties__ needs one parameter"); CvVideoWriter_FFMPEG* h = get_writer_from_ov (args(0)); if (h) { octave_scalar_map opt; opt.contents ("ok") = h->ok; opt.contents ("frame_width") = h->frame_width; opt.contents ("output_format_long_name") = h->fmt->long_name; opt.contents ("output_video_stream_codec") = h->get_video_codec_name (); opt.contents ("frame_height") = h->frame_height; opt.contents ("frame_idx") = h->frame_idx; retval.append (opt); } return retval; } // PKG_ADD: autoload ("__writer_write_frame__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__writer_write_frame__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__writer_write_frame__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __writer_write_frame__ (@var{h}, @var{frame})\n\ undocumented internal function\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage(); return retval; } //NDArray f = args(1).array_value(); uint8NDArray f = args(1).uint8_array_value(); if (error_state) { error("__writer_write_frame__: frame should be a matrix"); return retval; } CvVideoWriter_FFMPEG* p = get_writer_from_ov (args(0)); if (p) { int width = f.columns (); int height = f.rows (); int cn = f.dim3 (); int step = width * cn; int origin = 0; //printf ("width=%i, height=%i, step=%i\n", width, height, step); // permute, see also __cap_retrieve_frame__ // for opposite Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; f = f.permute (perm); unsigned char *t = reinterpret_cast(f.fortran_vec()); bool ret = p->writeFrame (t, step, width, height, cn, origin); if (! ret) error ("CvVideoWriter_FFMPEG::writeFrame failed"); } return retval; } // PKG_ADD: autoload ("__writer_close__", "cap_ffmpeg_wrapper.oct"); // PKG_DEL: autoload ("__writer_close__", "cap_ffmpeg_wrapper.oct", "remove"); DEFUN_DLD(__writer_close__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __writer_close__ (@var{h})\n\ undocumented internal function\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage(); return retval; } CvVideoWriter_FFMPEG* p = get_writer_from_ov (args(0)); if (p) p->close (); return retval; } video-2.0.0/src/PaxHeaders.4213/bootstrap0000644000000000000000000000013213627020723015016 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/bootstrap0000755000175000017500000000030013627020723015270 0ustar00olafolaf00000000000000#!/bin/bash ## Octave-Forge: video package bootstrap script ## Run this to generate the configure script set -e # halt if unhandled error aclocal autoconf # generate configure script video-2.0.0/src/PaxHeaders.4213/cap_ffmpeg_impl_ov.hpp0000644000000000000000000000013213627020723017403 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/cap_ffmpeg_impl_ov.hpp0000644000175000017500000021472013627020723017667 0ustar00olafolaf00000000000000/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ /* ATTENTION: * * This file was generated from * * https://github.com/opencv/opencv/blob/master/modules/videoio/src/cap_ffmpeg_impl.hpp * commit 2ad0487cec35b08a1dbf49e98c27b05153aaa23a * * and applying the patches in cap_ffmpeg_impl_ov.patch */ #include #include #include #include #include #undef USE_AV_INTERRUPT_CALLBACK #ifndef __OPENCV_BUILD #define CV_FOURCC(c1, c2, c3, c4) (((c1) & 255) + (((c2) & 255) << 8) + (((c3) & 255) << 16) + (((c4) & 255) << 24)) #endif #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c ) #if defined _MSC_VER && _MSC_VER >= 1200 #pragma warning( disable: 4244 4510 4610 ) #endif #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #ifndef CV_UNUSED // Required for standalone compilation mode (OpenCV defines this in base.hpp) #define CV_UNUSED(name) (void)name #endif #ifdef __cplusplus extern "C" { #endif #include "ffmpeg_codecs.hpp" #include #if LIBAVUTIL_BUILD > CALC_FFMPEG_VERSION(51,11,0) #include #endif #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(51, 63, 100) : CALC_FFMPEG_VERSION(54, 6, 0)) #include #endif #include #include #ifdef __cplusplus } #endif #if defined _MSC_VER && _MSC_VER >= 1200 #pragma warning( default: 4244 4510 4610 ) #endif #ifdef NDEBUG #define CV_WARN(message) #else #define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__) #endif static int global_err; std::string get_last_err_msg () { char err_buf[80]; av_strerror (global_err, err_buf, 80); return err_buf; } #if defined _WIN32 #include #if defined _MSC_VER && _MSC_VER < 1900 struct timespec { time_t tv_sec; long tv_nsec; }; #endif #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ #include #include #include #include #if defined __APPLE__ #include #include #include #endif #endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #if defined(__APPLE__) #define AV_NOPTS_VALUE_ ((int64_t)0x8000000000000000LL) #else #define AV_NOPTS_VALUE_ ((int64_t)AV_NOPTS_VALUE) #endif #ifndef AVERROR_EOF #define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) #endif #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0) # define CV_CODEC_ID AVCodecID # define CV_CODEC(name) AV_##name #else # define CV_CODEC_ID CodecID # define CV_CODEC(name) name #endif #if LIBAVUTIL_BUILD < (LIBAVUTIL_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(51, 74, 100) : CALC_FFMPEG_VERSION(51, 42, 0)) #define AVPixelFormat PixelFormat #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 #define AV_PIX_FMT_GRAY8 PIX_FMT_GRAY8 #define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P #define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P #define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P #define AV_PIX_FMT_GRAY16LE PIX_FMT_GRAY16LE #define AV_PIX_FMT_GRAY16BE PIX_FMT_GRAY16BE #endif #ifndef PKT_FLAG_KEY #define PKT_FLAG_KEY AV_PKT_FLAG_KEY #endif #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(52, 38, 100) : CALC_FFMPEG_VERSION(52, 13, 0)) #define USE_AV_FRAME_GET_BUFFER 1 #else #define USE_AV_FRAME_GET_BUFFER 0 #ifndef AV_NUM_DATA_POINTERS // required for 0.7.x/0.8.x ffmpeg releases #define AV_NUM_DATA_POINTERS 4 #endif #endif #ifndef USE_AV_INTERRUPT_CALLBACK #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 21, 0) #define USE_AV_INTERRUPT_CALLBACK 1 #else #define USE_AV_INTERRUPT_CALLBACK 0 #endif #endif #if USE_AV_INTERRUPT_CALLBACK #define LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS 30000 #define LIBAVFORMAT_INTERRUPT_READ_TIMEOUT_MS 30000 #ifdef _WIN32 // http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows static inline LARGE_INTEGER get_filetime_offset() { SYSTEMTIME s; FILETIME f; LARGE_INTEGER t; s.wYear = 1970; s.wMonth = 1; s.wDay = 1; s.wHour = 0; s.wMinute = 0; s.wSecond = 0; s.wMilliseconds = 0; SystemTimeToFileTime(&s, &f); t.QuadPart = f.dwHighDateTime; t.QuadPart <<= 32; t.QuadPart |= f.dwLowDateTime; return t; } static inline void get_monotonic_time(timespec *tv) { LARGE_INTEGER t; FILETIME f; double microseconds; static LARGE_INTEGER offset; static double frequencyToMicroseconds; static int initialized = 0; static BOOL usePerformanceCounter = 0; if (!initialized) { LARGE_INTEGER performanceFrequency; initialized = 1; usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency); if (usePerformanceCounter) { QueryPerformanceCounter(&offset); frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.; } else { offset = get_filetime_offset(); frequencyToMicroseconds = 10.; } } if (usePerformanceCounter) { QueryPerformanceCounter(&t); } else { GetSystemTimeAsFileTime(&f); t.QuadPart = f.dwHighDateTime; t.QuadPart <<= 32; t.QuadPart |= f.dwLowDateTime; } t.QuadPart -= offset.QuadPart; microseconds = (double)t.QuadPart / frequencyToMicroseconds; t.QuadPart = microseconds; tv->tv_sec = t.QuadPart / 1000000; tv->tv_nsec = (t.QuadPart % 1000000) * 1000; } #else static inline void get_monotonic_time(timespec *time) { #if defined(__APPLE__) && defined(__MACH__) clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); time->tv_sec = mts.tv_sec; time->tv_nsec = mts.tv_nsec; #else clock_gettime(CLOCK_MONOTONIC, time); #endif } #endif static inline timespec get_monotonic_time_diff(timespec start, timespec end) { timespec temp; if (end.tv_nsec - start.tv_nsec < 0) { temp.tv_sec = end.tv_sec - start.tv_sec - 1; temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec; } else { temp.tv_sec = end.tv_sec - start.tv_sec; temp.tv_nsec = end.tv_nsec - start.tv_nsec; } return temp; } static inline double get_monotonic_time_diff_ms(timespec time1, timespec time2) { timespec delta = get_monotonic_time_diff(time1, time2); double milliseconds = delta.tv_sec * 1000 + (double)delta.tv_nsec / 1000000.0; return milliseconds; } #endif // USE_AV_INTERRUPT_CALLBACK static int get_number_of_cpus(void) { #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(52, 111, 0) return 1; #elif defined _WIN32 SYSTEM_INFO sysinfo; GetSystemInfo( &sysinfo ); return (int)sysinfo.dwNumberOfProcessors; #elif defined __linux__ || defined __HAIKU__ return (int)sysconf( _SC_NPROCESSORS_ONLN ); #elif defined __APPLE__ int numCPU=0; int mib[4]; size_t len = sizeof(numCPU); // set the mib for hw.ncpu mib[0] = CTL_HW; mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU; // get the number of CPUs from the system sysctl(mib, 2, &numCPU, &len, NULL, 0); if( numCPU < 1 ) { mib[1] = HW_NCPU; sysctl( mib, 2, &numCPU, &len, NULL, 0 ); if( numCPU < 1 ) numCPU = 1; } return (int)numCPU; #else return 1; #endif } struct Image_FFMPEG { unsigned char* data; int step; int width; int height; int cn; }; #if USE_AV_INTERRUPT_CALLBACK struct AVInterruptCallbackMetadata { timespec value; unsigned int timeout_after_ms; int timeout; }; // https://github.com/opencv/opencv/pull/12693#issuecomment-426236731 static inline const char* _opencv_avcodec_get_name(AVCodecID id) { #if LIBAVCODEC_VERSION_MICRO >= 100 \ && LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(53, 47, 100) return avcodec_get_name(id); #else const AVCodecDescriptor *cd; AVCodec *codec; if (id == AV_CODEC_ID_NONE) { return "none"; } cd = avcodec_descriptor_get(id); if (cd) { return cd->name; } codec = avcodec_find_decoder(id); if (codec) { return codec->name; } codec = avcodec_find_encoder(id); if (codec) { return codec->name; } return "unknown_codec"; #endif } static inline void _opencv_ffmpeg_free(void** ptr) { if(*ptr) free(*ptr); *ptr = 0; } static inline int _opencv_ffmpeg_interrupt_callback(void *ptr) { AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr; assert(metadata); if (metadata->timeout_after_ms == 0) { return 0; // timeout is disabled } timespec now; get_monotonic_time(&now); metadata->timeout = get_monotonic_time_diff_ms(metadata->value, now) > metadata->timeout_after_ms; return metadata->timeout ? -1 : 0; } #endif static inline void _opencv_ffmpeg_av_packet_unref(AVPacket *pkt) { #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(55, 25, 100) : CALC_FFMPEG_VERSION(55, 16, 0)) av_packet_unref(pkt); #else av_free_packet(pkt); #endif }; static inline void _opencv_ffmpeg_av_image_fill_arrays(void *frame, uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height) { #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(51, 63, 100) : CALC_FFMPEG_VERSION(54, 6, 0)) av_image_fill_arrays(((AVFrame*)frame)->data, ((AVFrame*)frame)->linesize, ptr, pix_fmt, width, height, 1); #else avpicture_fill((AVPicture*)frame, ptr, pix_fmt, width, height); #endif }; static inline int _opencv_ffmpeg_av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height) { #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(51, 63, 100) : CALC_FFMPEG_VERSION(54, 6, 0)) return av_image_get_buffer_size(pix_fmt, width, height, 1); #else return avpicture_get_size(pix_fmt, width, height); #endif }; static AVRational _opencv_ffmpeg_get_sample_aspect_ratio(AVStream *stream) { #if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_BUILD >= CALC_FFMPEG_VERSION(54, 5, 100) return av_guess_sample_aspect_ratio(NULL, stream, NULL); #else AVRational undef = {0, 1}; // stream AVRational ratio = stream ? stream->sample_aspect_ratio : undef; av_reduce(&ratio.num, &ratio.den, ratio.num, ratio.den, INT_MAX); if (ratio.num > 0 && ratio.den > 0) return ratio; // codec ratio = stream && stream->codec ? stream->codec->sample_aspect_ratio : undef; av_reduce(&ratio.num, &ratio.den, ratio.num, ratio.den, INT_MAX); if (ratio.num > 0 && ratio.den > 0) return ratio; return undef; #endif } static bool capture_type_loaded = false; class CvCapture_FFMPEG: public octave_base_value { public: CvCapture_FFMPEG (); bool open( const char* filename ); void close(); //double getProperty(int) const; bool setProperty(int, double); bool grabFrame(); bool retrieveFrame(int, unsigned char** data, int* step, int* width, int* height, int* cn); void init(); void seek(int64_t frame_number); void seek(double sec); bool slowSeek( int framenumber ); int64_t get_total_frames() const; double get_duration_sec() const; double get_fps() const; int get_bitrate() const; AVRational get_sample_aspect_ratio () const { return _opencv_ffmpeg_get_sample_aspect_ratio(ic->streams[video_stream]); } const char* get_video_codec_name () const { #if LIBAVFORMAT_BUILD > 4628 return _opencv_avcodec_get_name(video_st->codec->codec_id); #else return _opencv_avcodec_get_name(video_st->codec.codec_id); #endif } double r2d(AVRational r) const; int64_t dts_to_frame_number(int64_t dts); double dts_to_sec(int64_t dts) const; AVFormatContext * ic; AVCodec * avcodec; int video_stream; AVStream * video_st; AVFrame * picture; AVFrame rgb_picture; int64_t picture_pts; AVPacket packet; Image_FFMPEG frame; struct SwsContext *img_convert_ctx; int64_t frame_number, first_frame_number; double eps_zero; /* 'filename' contains the filename of the videosource, 'filename==NULL' indicates that ffmpeg's seek support works for the particular file. 'filename!=NULL' indicates that the slow fallback function is used for seeking, and so the filename is needed to reopen the file on backward seeking. */ char * filename; #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) AVDictionary *dict; #endif #if USE_AV_INTERRUPT_CALLBACK AVInterruptCallbackMetadata interrupt_metadata; #endif bool is_constant (void) const { return true; } bool is_defined (void) const { return true; } DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA void print (std::ostream & os, bool pr_as_read_syntax = false) { os << "CvCapture_FFMPEG:" << std::endl; if (filename) os << " filename = " << filename << std::endl; os << " get_total_frames() = " << get_total_frames() << std::endl; os << " get_duration_sec() = " << get_duration_sec() << std::endl; os << " get_fps() = " << get_fps() << std::endl; os << " get_bitrate() = " << get_bitrate() << std::endl; os << " width = " << frame.width << std::endl; os << " height = " << frame.height << std::endl; os << " frame_number = " << frame_number << std::endl; os << " video_codec_name = " << get_video_codec_name () << std::endl; AVRational s = get_sample_aspect_ratio (); os << " aspect_ration_num = " << s.num << std::endl; os << " aspect_ration_den = " << s.den << std::endl; } }; DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(CvCapture_FFMPEG, "CvCapture_FFMPEG", "CvCapture_FFMPEG"); CvCapture_FFMPEG::CvCapture_FFMPEG () : octave_base_value () { init (); }; void CvCapture_FFMPEG::init() { av_register_all(); ic = 0; video_stream = -1; video_st = 0; picture = 0; picture_pts = AV_NOPTS_VALUE_; first_frame_number = -1; memset( &rgb_picture, 0, sizeof(rgb_picture) ); memset( &frame, 0, sizeof(frame) ); filename = 0; memset(&packet, 0, sizeof(packet)); av_init_packet(&packet); img_convert_ctx = 0; avcodec = 0; frame_number = 0; eps_zero = 0.000025; #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) dict = NULL; #endif } void CvCapture_FFMPEG::close() { if( img_convert_ctx ) { sws_freeContext(img_convert_ctx); img_convert_ctx = 0; } if( picture ) { #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) av_frame_free(&picture); #elif LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0)) avcodec_free_frame(&picture); #else av_free(picture); #endif } if( video_st ) { #if LIBAVFORMAT_BUILD > 4628 avcodec_close( video_st->codec ); #else avcodec_close( &(video_st->codec) ); #endif video_st = NULL; } if( ic ) { #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 24, 2) av_close_input_file(ic); #else avformat_close_input(&ic); #endif ic = NULL; } #if USE_AV_FRAME_GET_BUFFER av_frame_unref(&rgb_picture); #else if( rgb_picture.data[0] ) { free( rgb_picture.data[0] ); rgb_picture.data[0] = 0; } #endif // free last packet if exist if (packet.data) { _opencv_ffmpeg_av_packet_unref (&packet); packet.data = NULL; } #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) if (dict != NULL) av_dict_free(&dict); #endif init(); } #ifndef AVSEEK_FLAG_FRAME #define AVSEEK_FLAG_FRAME 0 #endif #ifndef AVSEEK_FLAG_ANY #define AVSEEK_FLAG_ANY 1 #endif #if defined(__OPENCV_BUILD) || defined(BUILD_PLUGIN) typedef cv::Mutex ImplMutex; #else class ImplMutex { public: ImplMutex() { init(); } ~ImplMutex() { destroy(); } void init(); void destroy(); void lock(); bool trylock(); void unlock(); struct Impl; protected: Impl* impl; private: ImplMutex(const ImplMutex&); ImplMutex& operator = (const ImplMutex& m); }; #if defined _WIN32 || defined WINCE struct ImplMutex::Impl { void init() { #if (_WIN32_WINNT >= 0x0600) ::InitializeCriticalSectionEx(&cs, 1000, 0); #else ::InitializeCriticalSection(&cs); #endif refcount = 1; } void destroy() { DeleteCriticalSection(&cs); } void lock() { EnterCriticalSection(&cs); } bool trylock() { return TryEnterCriticalSection(&cs) != 0; } void unlock() { LeaveCriticalSection(&cs); } CRITICAL_SECTION cs; int refcount; }; #ifndef __GNUC__ static int _interlockedExchangeAdd(int* addr, int delta) { #if defined _MSC_VER && _MSC_VER >= 1500 return (int)_InterlockedExchangeAdd((long volatile*)addr, delta); #else return (int)InterlockedExchangeAdd((long volatile*)addr, delta); #endif } #endif // __GNUC__ #elif defined __APPLE__ #include struct ImplMutex::Impl { void init() { sl = OS_SPINLOCK_INIT; refcount = 1; } void destroy() { } void lock() { OSSpinLockLock(&sl); } bool trylock() { return OSSpinLockTry(&sl); } void unlock() { OSSpinLockUnlock(&sl); } OSSpinLock sl; int refcount; }; #elif defined __linux__ && !defined __ANDROID__ struct ImplMutex::Impl { void init() { pthread_spin_init(&sl, 0); refcount = 1; } void destroy() { pthread_spin_destroy(&sl); } void lock() { pthread_spin_lock(&sl); } bool trylock() { return pthread_spin_trylock(&sl) == 0; } void unlock() { pthread_spin_unlock(&sl); } pthread_spinlock_t sl; int refcount; }; #else struct ImplMutex::Impl { void init() { pthread_mutex_init(&sl, 0); refcount = 1; } void destroy() { pthread_mutex_destroy(&sl); } void lock() { pthread_mutex_lock(&sl); } bool trylock() { return pthread_mutex_trylock(&sl) == 0; } void unlock() { pthread_mutex_unlock(&sl); } pthread_mutex_t sl; int refcount; }; #endif void ImplMutex::init() { impl = new Impl(); impl->init(); } void ImplMutex::destroy() { impl->destroy(); delete(impl); impl = NULL; } void ImplMutex::lock() { impl->lock(); } void ImplMutex::unlock() { impl->unlock(); } bool ImplMutex::trylock() { return impl->trylock(); } class AutoLock { public: AutoLock(ImplMutex& m) : mutex(&m) { mutex->lock(); } ~AutoLock() { mutex->unlock(); } protected: ImplMutex* mutex; private: AutoLock(const AutoLock&); // disabled AutoLock& operator = (const AutoLock&); // disabled }; #endif static ImplMutex _mutex; static int LockCallBack(void **mutex, AVLockOp op) { ImplMutex* localMutex = reinterpret_cast(*mutex); switch (op) { case AV_LOCK_CREATE: localMutex = new ImplMutex(); if (!localMutex) return 1; *mutex = localMutex; if (!*mutex) return 1; break; case AV_LOCK_OBTAIN: localMutex->lock(); break; case AV_LOCK_RELEASE: localMutex->unlock(); break; case AV_LOCK_DESTROY: delete localMutex; localMutex = NULL; *mutex = NULL; break; } return 0; } static void ffmpeg_log_callback(void *ptr, int level, const char *fmt, va_list vargs) { static bool skip_header = false; static int prev_level = -1; CV_UNUSED(ptr); if (!skip_header || level != prev_level) printf("[OPENCV:FFMPEG:%02d] ", level); vprintf(fmt, vargs); size_t fmt_len = strlen(fmt); skip_header = fmt_len > 0 && fmt[fmt_len - 1] != '\n'; prev_level = level; } class InternalFFMpegRegister { public: static void init() { AutoLock lock(_mutex); static InternalFFMpegRegister instance; } InternalFFMpegRegister() { #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0) avformat_network_init(); #endif /* register all codecs, demux and protocols */ av_register_all(); /* register a callback function for synchronization */ av_lockmgr_register(&LockCallBack); #ifndef NO_GETENV char* debug_option = getenv("OPENCV_FFMPEG_DEBUG"); if (debug_option != NULL) { av_log_set_level(AV_LOG_VERBOSE); av_log_set_callback(ffmpeg_log_callback); } else #endif { av_log_set_level(AV_LOG_ERROR); } } ~InternalFFMpegRegister() { av_lockmgr_register(NULL); } }; bool CvCapture_FFMPEG::open( const char* _filename ) { InternalFFMpegRegister::init(); AutoLock lock(_mutex); unsigned i; bool valid = false; close(); #if USE_AV_INTERRUPT_CALLBACK /* interrupt callback */ interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS; get_monotonic_time(&interrupt_metadata.value); ic = avformat_alloc_context(); ic->interrupt_callback.callback = _opencv_ffmpeg_interrupt_callback; ic->interrupt_callback.opaque = &interrupt_metadata; #endif #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) #ifndef NO_GETENV char* options = getenv("OPENCV_FFMPEG_CAPTURE_OPTIONS"); if(options == NULL) { av_dict_set(&dict, "rtsp_transport", "tcp", 0); } else { #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 ? CALC_FFMPEG_VERSION(52, 17, 100) : CALC_FFMPEG_VERSION(52, 7, 0)) av_dict_parse_string(&dict, options, ";", "|", 0); #else av_dict_set(&dict, "rtsp_transport", "tcp", 0); #endif } #else av_dict_set(&dict, "rtsp_transport", "tcp", 0); #endif AVInputFormat* input_format = NULL; AVDictionaryEntry* entry = av_dict_get(dict, "input_format", NULL, 0); if (entry != 0) { input_format = av_find_input_format(entry->value); } global_err = avformat_open_input(&ic, _filename, input_format, &dict); #else global_err = av_open_input_file(&ic, _filename, NULL, 0, NULL); #endif if (global_err < 0) { CV_WARN("Error opening file"); CV_WARN(_filename); goto exit_func; } global_err = #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0) avformat_find_stream_info(ic, NULL); #else av_find_stream_info(ic); #endif if (global_err < 0) { CV_WARN("Could not find codec parameters"); goto exit_func; } for(i = 0; i < ic->nb_streams; i++) { #if LIBAVFORMAT_BUILD > 4628 AVCodecContext *enc = ic->streams[i]->codec; #else AVCodecContext *enc = &ic->streams[i]->codec; #endif //#ifdef FF_API_THREAD_INIT // avcodec_thread_init(enc, get_number_of_cpus()); //#else enc->thread_count = get_number_of_cpus(); //#endif #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0) #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO #endif if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) { // backup encoder' width/height int enc_width = enc->width; int enc_height = enc->height; AVCodec *codec; if(av_dict_get(dict, "video_codec", NULL, 0) == NULL) { codec = avcodec_find_decoder(enc->codec_id); } else { codec = avcodec_find_decoder_by_name(av_dict_get(dict, "video_codec", NULL, 0)->value); } if (!codec || #if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0) avcodec_open2(enc, codec, NULL) #else avcodec_open(enc, codec) #endif < 0) goto exit_func; // checking width/height (since decoder can sometimes alter it, eg. vp6f) if (enc_width && (enc->width != enc_width)) { enc->width = enc_width; } if (enc_height && (enc->height != enc_height)) { enc->height = enc_height; } video_stream = i; video_st = ic->streams[i]; #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) picture = av_frame_alloc(); #else picture = avcodec_alloc_frame(); #endif frame.width = enc->width; frame.height = enc->height; frame.cn = 3; frame.step = 0; frame.data = NULL; break; } } if(video_stream >= 0) valid = true; exit_func: #if USE_AV_INTERRUPT_CALLBACK // deactivate interrupt callback interrupt_metadata.timeout_after_ms = 0; #endif if( !valid ) close(); return valid; } bool CvCapture_FFMPEG::grabFrame() { bool valid = false; int got_picture; int count_errs = 0; const int max_number_of_attempts = 1 << 9; if( !ic || !video_st ) return false; if( ic->streams[video_stream]->nb_frames > 0 && frame_number > ic->streams[video_stream]->nb_frames ) return false; picture_pts = AV_NOPTS_VALUE_; #if USE_AV_INTERRUPT_CALLBACK // activate interrupt callback get_monotonic_time(&interrupt_metadata.value); interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_READ_TIMEOUT_MS; #endif // get the next frame while (!valid) { _opencv_ffmpeg_av_packet_unref (&packet); #if USE_AV_INTERRUPT_CALLBACK if (interrupt_metadata.timeout) { valid = false; break; } #endif int ret = av_read_frame(ic, &packet); if (ret == AVERROR(EAGAIN)) continue; /* else if (ret < 0) break; */ if( packet.stream_index != video_stream ) { _opencv_ffmpeg_av_packet_unref (&packet); count_errs++; if (count_errs > max_number_of_attempts) break; continue; } // Decode video frame #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0) avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet); #elif LIBAVFORMAT_BUILD > 4628 avcodec_decode_video(video_st->codec, picture, &got_picture, packet.data, packet.size); #else avcodec_decode_video(&video_st->codec, picture, &got_picture, packet.data, packet.size); #endif // Did we get a video frame? if(got_picture) { //picture_pts = picture->best_effort_timestamp; if( picture_pts == AV_NOPTS_VALUE_ ) picture_pts = picture->pkt_pts != AV_NOPTS_VALUE_ && picture->pkt_pts != 0 ? picture->pkt_pts : picture->pkt_dts; frame_number++; valid = true; } else { count_errs++; if (count_errs > max_number_of_attempts) break; } } if( valid && first_frame_number < 0 ) first_frame_number = dts_to_frame_number(picture_pts); #if USE_AV_INTERRUPT_CALLBACK // deactivate interrupt callback interrupt_metadata.timeout_after_ms = 0; #endif // return if we have a new picture or not return valid; } bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char** data, int* step, int* width, int* height, int* cn) { if( !video_st || !picture->data[0] ) return false; if( img_convert_ctx == NULL || frame.width != video_st->codec->width || frame.height != video_st->codec->height || frame.data == NULL ) { // Some sws_scale optimizations have some assumptions about alignment of data/step/width/height // Also we use coded_width/height to workaround problem with legacy ffmpeg versions (like n0.8) int buffer_width = video_st->codec->coded_width, buffer_height = video_st->codec->coded_height; img_convert_ctx = sws_getCachedContext( img_convert_ctx, buffer_width, buffer_height, video_st->codec->pix_fmt, buffer_width, buffer_height, AV_PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL ); if (img_convert_ctx == NULL) return false;//CV_Error(0, "Cannot initialize the conversion context!"); #if USE_AV_FRAME_GET_BUFFER av_frame_unref(&rgb_picture); rgb_picture.format = AV_PIX_FMT_BGR24; rgb_picture.width = buffer_width; rgb_picture.height = buffer_height; if (0 != av_frame_get_buffer(&rgb_picture, 32)) { CV_WARN("OutOfMemory"); return false; } #else int aligns[AV_NUM_DATA_POINTERS]; avcodec_align_dimensions2(video_st->codec, &buffer_width, &buffer_height, aligns); rgb_picture.data[0] = (uint8_t*)realloc(rgb_picture.data[0], _opencv_ffmpeg_av_image_get_buffer_size( AV_PIX_FMT_BGR24, buffer_width, buffer_height )); _opencv_ffmpeg_av_image_fill_arrays(&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_BGR24, buffer_width, buffer_height ); #endif frame.width = video_st->codec->width; frame.height = video_st->codec->height; frame.cn = 3; frame.data = rgb_picture.data[0]; frame.step = rgb_picture.linesize[0]; } sws_scale( img_convert_ctx, picture->data, picture->linesize, 0, video_st->codec->coded_height, rgb_picture.data, rgb_picture.linesize ); *data = frame.data; *step = frame.step; *width = frame.width; *height = frame.height; *cn = frame.cn; return true; } #if 0 double CvCapture_FFMPEG::getProperty( int property_id ) const { if( !video_st ) return 0; double codec_tag = 0; AVCodecID codec_id = AV_CODEC_ID_NONE; const char* codec_fourcc = NULL; switch( property_id ) { case CAP_PROP_POS_MSEC: if (picture_pts == AV_NOPTS_VALUE_) { return 0; } return (dts_to_sec(picture_pts) * 1000); case CAP_PROP_POS_FRAMES: return (double)frame_number; case CAP_PROP_POS_AVI_RATIO: return r2d(ic->streams[video_stream]->time_base); case CAP_PROP_FRAME_COUNT: return (double)get_total_frames(); case CAP_PROP_FRAME_WIDTH: return (double)frame.width; case CAP_PROP_FRAME_HEIGHT: return (double)frame.height; case CAP_PROP_FPS: return get_fps(); case CAP_PROP_FOURCC: #if LIBAVFORMAT_BUILD > 4628 codec_id = video_st->codec->codec_id; codec_tag = (double) video_st->codec->codec_tag; #else codec_id = video_st->codec.codec_id; codec_tag = (double)video_st->codec.codec_tag; #endif if(codec_tag || codec_id == AV_CODEC_ID_NONE) { return codec_tag; } codec_fourcc = _opencv_avcodec_get_name(codec_id); if(!codec_fourcc || strlen(codec_fourcc) < 4 || strcmp(codec_fourcc, "unknown_codec") == 0) { return codec_tag; } return (double) CV_FOURCC(codec_fourcc[0], codec_fourcc[1], codec_fourcc[2], codec_fourcc[3]); case CAP_PROP_SAR_NUM: return _opencv_ffmpeg_get_sample_aspect_ratio(ic->streams[video_stream]).num; case CAP_PROP_SAR_DEN: return _opencv_ffmpeg_get_sample_aspect_ratio(ic->streams[video_stream]).den; default: break; } return 0; } #endif double CvCapture_FFMPEG::r2d(AVRational r) const { return r.num == 0 || r.den == 0 ? 0. : (double)r.num / (double)r.den; } double CvCapture_FFMPEG::get_duration_sec() const { double sec = (double)ic->duration / (double)AV_TIME_BASE; if (sec < eps_zero) { sec = (double)ic->streams[video_stream]->duration * r2d(ic->streams[video_stream]->time_base); } return sec; } int CvCapture_FFMPEG::get_bitrate() const { return ic->bit_rate; } double CvCapture_FFMPEG::get_fps() const { #if 0 && LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 1, 100) && LIBAVFORMAT_VERSION_MICRO >= 100 double fps = r2d(av_guess_frame_rate(ic, ic->streams[video_stream], NULL)); #else #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0) double fps = r2d(ic->streams[video_stream]->avg_frame_rate); #else double fps = r2d(ic->streams[video_stream]->r_frame_rate); #endif #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) if (fps < eps_zero) { fps = r2d(ic->streams[video_stream]->avg_frame_rate); } #endif if (fps < eps_zero) { fps = 1.0 / r2d(ic->streams[video_stream]->codec->time_base); } #endif return fps; } int64_t CvCapture_FFMPEG::get_total_frames() const { int64_t nbf = ic->streams[video_stream]->nb_frames; if (nbf == 0) { nbf = (int64_t)floor(get_duration_sec() * get_fps() + 0.5); } return nbf; } int64_t CvCapture_FFMPEG::dts_to_frame_number(int64_t dts) { double sec = dts_to_sec(dts); return (int64_t)(get_fps() * sec + 0.5); } double CvCapture_FFMPEG::dts_to_sec(int64_t dts) const { return (double)(dts - ic->streams[video_stream]->start_time) * r2d(ic->streams[video_stream]->time_base); } void CvCapture_FFMPEG::seek(int64_t _frame_number) { _frame_number = std::min(_frame_number, get_total_frames()); int delta = 16; // if we have not grabbed a single frame before first seek, let's read the first frame // and get some valuable information during the process if( first_frame_number < 0 && get_total_frames() > 1 ) grabFrame(); for(;;) { int64_t _frame_number_temp = std::max(_frame_number-delta, (int64_t)0); double sec = (double)_frame_number_temp / get_fps(); int64_t time_stamp = ic->streams[video_stream]->start_time; double time_base = r2d(ic->streams[video_stream]->time_base); time_stamp += (int64_t)(sec / time_base + 0.5); if (get_total_frames() > 1) av_seek_frame(ic, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD); avcodec_flush_buffers(ic->streams[video_stream]->codec); if( _frame_number > 0 ) { grabFrame(); if( _frame_number > 1 ) { frame_number = dts_to_frame_number(picture_pts) - first_frame_number; //printf("_frame_number = %d, frame_number = %d, delta = %d\n", // (int)_frame_number, (int)frame_number, delta); if( frame_number < 0 || frame_number > _frame_number-1 ) { if( _frame_number_temp == 0 || delta >= INT_MAX/4 ) break; delta = delta < 16 ? delta*2 : delta*3/2; continue; } while( frame_number < _frame_number-1 ) { if(!grabFrame()) break; } frame_number++; break; } else { frame_number = 1; break; } } else { frame_number = 0; break; } } } void CvCapture_FFMPEG::seek(double sec) { seek((int64_t)(sec * get_fps() + 0.5)); } bool CvCapture_FFMPEG::setProperty( int property_id, double value ) { if( !video_st ) return false; #if 0 switch( property_id ) { case CAP_PROP_POS_MSEC: case CAP_PROP_POS_FRAMES: case CAP_PROP_POS_AVI_RATIO: { switch( property_id ) { case CAP_PROP_POS_FRAMES: seek((int64_t)value); break; case CAP_PROP_POS_MSEC: seek(value/1000.0); break; case CAP_PROP_POS_AVI_RATIO: seek((int64_t)(value*ic->duration)); break; } picture_pts=(int64_t)value; } break; default: return false; } #endif return true; } ///////////////// FFMPEG CvVideoWriter implementation ////////////////////////// static bool writer_type_loaded = false; class CvVideoWriter_FFMPEG: public octave_base_value { public: CvVideoWriter_FFMPEG (); bool open( const char* filename, int fourcc, double fps, int width, int height, bool isColor ); void close(); bool writeFrame( const unsigned char* data, int step, int width, int height, int cn, int origin ); void init(); AVOutputFormat * fmt; AVFormatContext * oc; uint8_t * outbuf; uint32_t outbuf_size; FILE * outfile; AVFrame * picture; AVFrame * input_picture; uint8_t * picbuf; AVStream * video_st; int input_pix_fmt; unsigned char * aligned_input; size_t aligned_input_size; int frame_width, frame_height; int frame_idx; bool ok; struct SwsContext *img_convert_ctx; const char* get_video_codec_name () const { #if LIBAVFORMAT_BUILD > 4628 return _opencv_avcodec_get_name(video_st->codec->codec_id); #else return _opencv_avcodec_get_name(video_st->codec.codec_id); #endif } bool is_constant (void) const { return true; } bool is_defined (void) const { return true; } DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA void print (std::ostream & os, bool pr_as_read_syntax = false) { os << "CvVideoWriter_FFMPEG:" << std::endl; os << " ok = " << ok << std::endl; os << " frame_width = " << frame_width << std::endl; os << " frame_height = " << frame_height << std::endl; os << " frame_idx = " << frame_idx << std::endl; // FIXME: add more properies } }; DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(CvVideoWriter_FFMPEG, "CvVideoWriter_FFMPEG", "CvVideoWriter_FFMPEG"); CvVideoWriter_FFMPEG::CvVideoWriter_FFMPEG () : octave_base_value () { init (); }; static const char * icvFFMPEGErrStr(int err) { #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0) switch(err) { case AVERROR_BSF_NOT_FOUND: return "Bitstream filter not found"; case AVERROR_DECODER_NOT_FOUND: return "Decoder not found"; case AVERROR_DEMUXER_NOT_FOUND: return "Demuxer not found"; case AVERROR_ENCODER_NOT_FOUND: return "Encoder not found"; case AVERROR_EOF: return "End of file"; case AVERROR_EXIT: return "Immediate exit was requested; the called function should not be restarted"; case AVERROR_FILTER_NOT_FOUND: return "Filter not found"; case AVERROR_INVALIDDATA: return "Invalid data found when processing input"; case AVERROR_MUXER_NOT_FOUND: return "Muxer not found"; case AVERROR_OPTION_NOT_FOUND: return "Option not found"; case AVERROR_PATCHWELCOME: return "Not yet implemented in FFmpeg, patches welcome"; case AVERROR_PROTOCOL_NOT_FOUND: return "Protocol not found"; case AVERROR_STREAM_NOT_FOUND: return "Stream not found"; default: break; } #else switch(err) { case AVERROR_NUMEXPECTED: return "Incorrect filename syntax"; case AVERROR_INVALIDDATA: return "Invalid data in header"; case AVERROR_NOFMT: return "Unknown format"; case AVERROR_IO: return "I/O error occurred"; case AVERROR_NOMEM: return "Memory allocation error"; default: break; } #endif return "Unspecified error"; } /* function internal to FFMPEG (libavformat/riff.c) to lookup codec id by fourcc tag*/ extern "C" { enum CV_CODEC_ID codec_get_bmp_id(unsigned int tag); } void CvVideoWriter_FFMPEG::init() { av_register_all(); fmt = 0; oc = 0; outbuf = 0; outbuf_size = 0; outfile = 0; picture = 0; input_picture = 0; picbuf = 0; video_st = 0; input_pix_fmt = 0; aligned_input = NULL; aligned_input_size = 0; img_convert_ctx = 0; frame_width = frame_height = 0; frame_idx = 0; ok = false; } /** * the following function is a modified version of code * found in ffmpeg-0.4.9-pre1/output_example.c */ static AVFrame * icv_alloc_picture_FFMPEG(int pix_fmt, int width, int height, bool alloc) { AVFrame * picture; uint8_t * picture_buf = 0; int size; #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) picture = av_frame_alloc(); #else picture = avcodec_alloc_frame(); #endif if (!picture) return NULL; picture->format = pix_fmt; picture->width = width; picture->height = height; size = _opencv_ffmpeg_av_image_get_buffer_size( (AVPixelFormat) pix_fmt, width, height); if(alloc){ picture_buf = (uint8_t *) malloc(size); if (!picture_buf) { av_free(picture); return NULL; } _opencv_ffmpeg_av_image_fill_arrays(picture, picture_buf, (AVPixelFormat) pix_fmt, width, height); } return picture; } /* add a video output stream to the container */ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, int pixel_format) { AVCodecContext *c; AVStream *st; int frame_rate, frame_rate_base; AVCodec *codec; #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0) st = avformat_new_stream(oc, 0); #else st = av_new_stream(oc, 0); #endif if (!st) { CV_WARN("Could not allocate stream"); return NULL; } #if LIBAVFORMAT_BUILD > 4628 c = st->codec; #else c = &(st->codec); #endif #if LIBAVFORMAT_BUILD > 4621 c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); #else c->codec_id = oc->oformat->video_codec; #endif if(codec_id != CV_CODEC(CODEC_ID_NONE)){ c->codec_id = codec_id; } //if(codec_tag) c->codec_tag=codec_tag; codec = avcodec_find_encoder(c->codec_id); c->codec_type = AVMEDIA_TYPE_VIDEO; #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0) // Set per-codec defaults AVCodecID c_id = c->codec_id; avcodec_get_context_defaults3(c, codec); // avcodec_get_context_defaults3 erases codec_id for some reason c->codec_id = c_id; #endif /* put sample parameters */ int64_t lbit_rate = (int64_t)bitrate; lbit_rate += (bitrate / 2); lbit_rate = std::min(lbit_rate, (int64_t)INT_MAX); c->bit_rate = lbit_rate; // took advice from // http://ffmpeg-users.933282.n4.nabble.com/warning-clipping-1-dct-coefficients-to-127-127-td934297.html c->qmin = 3; /* resolution must be a multiple of two */ c->width = w; c->height = h; /* time base: this is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. for fixed-fps content, timebase should be 1/framerate and timestamp increments should be identically 1. */ frame_rate=(int)(fps+0.5); frame_rate_base=1; while (fabs(((double)frame_rate/frame_rate_base) - fps) > 0.001){ frame_rate_base*=10; frame_rate=(int)(fps*frame_rate_base + 0.5); } #if LIBAVFORMAT_BUILD > 4752 c->time_base.den = frame_rate; c->time_base.num = frame_rate_base; /* adjust time base for supported framerates */ if(codec && codec->supported_framerates){ const AVRational *p= codec->supported_framerates; AVRational req = {frame_rate, frame_rate_base}; const AVRational *best=NULL; AVRational best_error= {INT_MAX, 1}; for(; p->den!=0; p++){ AVRational error= av_sub_q(req, *p); if(error.num <0) error.num *= -1; if(av_cmp_q(error, best_error) < 0){ best_error= error; best= p; } } if (best == NULL) return NULL; c->time_base.den= best->num; c->time_base.num= best->den; } #else c->frame_rate = frame_rate; c->frame_rate_base = frame_rate_base; #endif c->gop_size = 12; /* emit one intra frame every twelve frames at most */ c->pix_fmt = (AVPixelFormat) pixel_format; if (c->codec_id == CV_CODEC(CODEC_ID_MPEG2VIDEO)) { c->max_b_frames = 2; } if (c->codec_id == CV_CODEC(CODEC_ID_MPEG1VIDEO) || c->codec_id == CV_CODEC(CODEC_ID_MSMPEG4V3)){ /* needed to avoid using macroblocks in which some coeffs overflow this doesn't happen with normal video, it just happens here as the motion of the chroma plane doesn't match the luma plane */ /* avoid FFMPEG warning 'clipping 1 dct coefficients...' */ c->mb_decision=2; } #if LIBAVUTIL_BUILD > CALC_FFMPEG_VERSION(51,11,0) /* Some settings for libx264 encoding, restore dummy values for gop_size and qmin since they will be set to reasonable defaults by the libx264 preset system. Also, use a crf encode with the default quality rating, this seems easier than finding an appropriate default bitrate. */ if (c->codec_id == AV_CODEC_ID_H264) { c->gop_size = -1; c->qmin = -1; c->bit_rate = 0; if (c->priv_data) av_opt_set(c->priv_data,"crf","23", 0); } #endif #if LIBAVCODEC_VERSION_INT>0x000409 // some formats want stream headers to be separate if(oc->oformat->flags & AVFMT_GLOBALHEADER) { #if LIBAVCODEC_BUILD > CALC_FFMPEG_VERSION(56, 35, 0) c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; #else c->flags |= CODEC_FLAG_GLOBAL_HEADER; #endif } #endif #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(52, 42, 0) #if defined(_MSC_VER) AVRational avg_frame_rate = {frame_rate, frame_rate_base}; st->avg_frame_rate = avg_frame_rate; #else st->avg_frame_rate = (AVRational){frame_rate, frame_rate_base}; #endif #endif #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 20, 0) st->time_base = c->time_base; #endif return st; } static const int OPENCV_NO_FRAMES_WRITTEN_CODE = 1000; static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0) uint8_t *, uint32_t, #else uint8_t * outbuf, uint32_t outbuf_size, #endif AVFrame * picture ) { #if LIBAVFORMAT_BUILD > 4628 AVCodecContext * c = video_st->codec; #else AVCodecContext * c = &(video_st->codec); #endif int ret = OPENCV_NO_FRAMES_WRITTEN_CODE; #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0) if (oc->oformat->flags & AVFMT_RAWPICTURE) { /* raw video case. The API will change slightly in the near futur for that */ AVPacket pkt; av_init_packet(&pkt); pkt.flags |= PKT_FLAG_KEY; pkt.stream_index= video_st->index; pkt.data= (uint8_t *)picture; pkt.size= sizeof(AVPicture); ret = av_write_frame(oc, &pkt); } else #endif { /* encode the image */ AVPacket pkt; av_init_packet(&pkt); #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0) int got_output = 0; pkt.data = NULL; pkt.size = 0; ret = avcodec_encode_video2(c, &pkt, picture, &got_output); if (ret < 0) ; else if (got_output) { if (pkt.pts != (int64_t)AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, c->time_base, video_st->time_base); if (pkt.dts != (int64_t)AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, c->time_base, video_st->time_base); if (pkt.duration) pkt.duration = av_rescale_q(pkt.duration, c->time_base, video_st->time_base); pkt.stream_index= video_st->index; ret = av_write_frame(oc, &pkt); _opencv_ffmpeg_av_packet_unref(&pkt); } else ret = OPENCV_NO_FRAMES_WRITTEN_CODE; #else int out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); /* if zero size, it means the image was buffered */ if (out_size > 0) { #if LIBAVFORMAT_BUILD > 4752 if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE) pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base); #else pkt.pts = c->coded_frame->pts; #endif if(c->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY; pkt.stream_index= video_st->index; pkt.data= outbuf; pkt.size= out_size; /* write the compressed frame in the media file */ ret = av_write_frame(oc, &pkt); } #endif } return ret; } /// write a frame with FFMPEG bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int width, int height, int cn, int origin ) { // check parameters if (input_pix_fmt == AV_PIX_FMT_BGR24) { if (cn != 3) { return false; } } else if (input_pix_fmt == AV_PIX_FMT_GRAY8) { if (cn != 1) { return false; } } else { assert(false); } if( (width & -2) != frame_width || (height & -2) != frame_height || !data ) return false; width = frame_width; height = frame_height; // typecast from opaque data type to implemented struct #if LIBAVFORMAT_BUILD > 4628 AVCodecContext *c = video_st->codec; #else AVCodecContext *c = &(video_st->codec); #endif // FFmpeg contains SIMD optimizations which can sometimes read data past // the supplied input buffer. // Related info: https://trac.ffmpeg.org/ticket/6763 // 1. To ensure that doesn't happen, we pad the step to a multiple of 32 // (that's the minimal alignment for which Valgrind doesn't raise any warnings). // 2. (dataend - SIMD_SIZE) and (dataend + SIMD_SIZE) is from the same 4k page const int CV_STEP_ALIGNMENT = 32; const size_t CV_SIMD_SIZE = 32; const size_t CV_PAGE_MASK = ~(4096 - 1); const unsigned char* dataend = data + ((size_t)height * step); if (step % CV_STEP_ALIGNMENT != 0 || (((size_t)dataend - CV_SIMD_SIZE) & CV_PAGE_MASK) != (((size_t)dataend + CV_SIMD_SIZE) & CV_PAGE_MASK)) { int aligned_step = (step + CV_STEP_ALIGNMENT - 1) & ~(CV_STEP_ALIGNMENT - 1); size_t new_size = (aligned_step * height + CV_SIMD_SIZE); if (!aligned_input || aligned_input_size < new_size) { if (aligned_input) av_freep(&aligned_input); aligned_input_size = new_size; aligned_input = (unsigned char*)av_mallocz(aligned_input_size); } if (origin == 1) for( int y = 0; y < height; y++ ) memcpy(aligned_input + y*aligned_step, data + (height-1-y)*step, step); else for( int y = 0; y < height; y++ ) memcpy(aligned_input + y*aligned_step, data + y*step, step); data = aligned_input; step = aligned_step; } if ( c->pix_fmt != input_pix_fmt ) { assert( input_picture ); // let input_picture point to the raw data buffer of 'image' _opencv_ffmpeg_av_image_fill_arrays(input_picture, (uint8_t *) data, (AVPixelFormat)input_pix_fmt, width, height); input_picture->linesize[0] = step; if( !img_convert_ctx ) { img_convert_ctx = sws_getContext(width, height, (AVPixelFormat)input_pix_fmt, c->width, c->height, c->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL); if( !img_convert_ctx ) return false; } if ( sws_scale(img_convert_ctx, input_picture->data, input_picture->linesize, 0, height, picture->data, picture->linesize) < 0 ) return false; } else{ _opencv_ffmpeg_av_image_fill_arrays(picture, (uint8_t *) data, (AVPixelFormat)input_pix_fmt, width, height); picture->linesize[0] = step; } picture->pts = frame_idx; bool ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, picture) >= 0; frame_idx++; return ret; } /// close video output stream and free associated memory void CvVideoWriter_FFMPEG::close() { // nothing to do if already released if ( !picture ) return; /* no more frame to compress. The codec has a latency of a few frames if using B frames, so we get the last frames by passing the same picture again */ // TODO -- do we need to account for latency here? /* write the trailer, if any */ if(ok && oc) { #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0) if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) #endif { for(;;) { int ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, NULL); if( ret == OPENCV_NO_FRAMES_WRITTEN_CODE || ret < 0 ) break; } } av_write_trailer(oc); } if( img_convert_ctx ) { sws_freeContext(img_convert_ctx); img_convert_ctx = 0; } // free pictures #if LIBAVFORMAT_BUILD > 4628 if( video_st->codec->pix_fmt != input_pix_fmt) #else if( video_st->codec.pix_fmt != input_pix_fmt) #endif { if(picture->data[0]) free(picture->data[0]); picture->data[0] = 0; } av_free(picture); if (input_picture) av_free(input_picture); /* close codec */ #if LIBAVFORMAT_BUILD > 4628 avcodec_close(video_st->codec); #else avcodec_close(&(video_st->codec)); #endif av_free(outbuf); if (oc) { if (!(fmt->flags & AVFMT_NOFILE)) { /* close the output file */ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0) #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0) url_fclose(oc->pb); #else url_fclose(&oc->pb); #endif #else avio_close(oc->pb); #endif } /* free the stream */ avformat_free_context(oc); } av_freep(&aligned_input); init(); } #define CV_PRINTABLE_CHAR(ch) ((ch) < 32 ? '?' : (ch)) #define CV_TAG_TO_PRINTABLE_CHAR4(tag) CV_PRINTABLE_CHAR((tag) & 255), CV_PRINTABLE_CHAR(((tag) >> 8) & 255), CV_PRINTABLE_CHAR(((tag) >> 16) & 255), CV_PRINTABLE_CHAR(((tag) >> 24) & 255) static inline bool cv_ff_codec_tag_match(const AVCodecTag *tags, CV_CODEC_ID id, unsigned int tag) { while (tags->id != AV_CODEC_ID_NONE) { if (tags->id == id && tags->tag == tag) return true; tags++; } return false; } static inline bool cv_ff_codec_tag_list_match(const AVCodecTag *const *tags, CV_CODEC_ID id, unsigned int tag) { int i; for (i = 0; tags && tags[i]; i++) { bool res = cv_ff_codec_tag_match(tags[i], id, tag); if (res) return res; } return false; } static inline void cv_ff_codec_tag_dump(const AVCodecTag *const *tags) { int i; for (i = 0; tags && tags[i]; i++) { const AVCodecTag * ptags = tags[i]; while (ptags->id != AV_CODEC_ID_NONE) { unsigned int tag = ptags->tag; printf("fourcc tag 0x%08x/'%c%c%c%c' codec_id %04X\n", tag, CV_TAG_TO_PRINTABLE_CHAR4(tag), ptags->id); ptags++; } } } /// Create a video writer object that uses FFMPEG bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc, double fps, int width, int height, bool is_color ) { InternalFFMpegRegister::init(); CV_CODEC_ID codec_id = CV_CODEC(CODEC_ID_NONE); int codec_pix_fmt; double bitrate_scale = 1; close(); // check arguments if( !filename ) return false; if(fps <= 0) return false; // we allow frames of odd width or height, but in this case we truncate // the rightmost column/the bottom row. Probably, this should be handled more elegantly, // but some internal functions inside FFMPEG swscale require even width/height. width &= -2; height &= -2; if( width <= 0 || height <= 0 ) return false; /* auto detect the output format from the name and fourcc code. */ #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0) fmt = av_guess_format(NULL, filename, NULL); #else fmt = guess_format(NULL, filename, NULL); #endif if (!fmt) return false; /* determine optimal pixel format */ if (is_color) { input_pix_fmt = AV_PIX_FMT_BGR24; } else { input_pix_fmt = AV_PIX_FMT_GRAY8; } if (fourcc == -1) { fprintf(stderr,"OpenCV: FFMPEG: format %s / %s\n", fmt->name, fmt->long_name); cv_ff_codec_tag_dump(fmt->codec_tag); return false; } /* Lookup codec_id for given fourcc */ #if LIBAVCODEC_VERSION_INT<((51<<16)+(49<<8)+0) if( (codec_id = codec_get_bmp_id( fourcc )) == CV_CODEC(CODEC_ID_NONE) ) return false; #else if( (codec_id = av_codec_get_id(fmt->codec_tag, fourcc)) == CV_CODEC(CODEC_ID_NONE) ) { const struct AVCodecTag * fallback_tags[] = { #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0) // APIchanges: // 2012-01-31 - dd6d3b0 - lavf 54.01.0 // Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). avformat_get_riff_video_tags(), #endif #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 25, 100) && defined LIBAVFORMAT_VERSION_MICRO && LIBAVFORMAT_VERSION_MICRO >= 100 // APIchanges: ffmpeg only // 2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h // Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags(). avformat_get_mov_video_tags(), #endif codec_bmp_tags, // fallback for avformat < 54.1 NULL }; if( (codec_id = av_codec_get_id(fallback_tags, fourcc)) == CV_CODEC(CODEC_ID_NONE) ) { fflush(stdout); fprintf(stderr, "OpenCV: FFMPEG: tag 0x%08x/'%c%c%c%c' is not found (format '%s / %s')'\n", fourcc, CV_TAG_TO_PRINTABLE_CHAR4(fourcc), fmt->name, fmt->long_name); return false; } } // validate tag if (cv_ff_codec_tag_list_match(fmt->codec_tag, codec_id, fourcc) == false) { fflush(stdout); fprintf(stderr, "OpenCV: FFMPEG: tag 0x%08x/'%c%c%c%c' is not supported with codec id %d and format '%s / %s'\n", fourcc, CV_TAG_TO_PRINTABLE_CHAR4(fourcc), codec_id, fmt->name, fmt->long_name); int supported_tag; if( (supported_tag = av_codec_get_tag(fmt->codec_tag, codec_id)) != 0 ) { fprintf(stderr, "OpenCV: FFMPEG: fallback to use tag 0x%08x/'%c%c%c%c'\n", supported_tag, CV_TAG_TO_PRINTABLE_CHAR4(supported_tag)); fourcc = supported_tag; } } #endif // alloc memory for context #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0) oc = avformat_alloc_context(); #else oc = av_alloc_format_context(); #endif assert (oc); /* set file name */ oc->oformat = fmt; snprintf(oc->filename, sizeof(oc->filename), "%s", filename); /* set some options */ oc->max_delay = (int)(0.7*AV_TIME_BASE); /* This reduces buffer underrun warnings with MPEG */ // set a few optimal pixel formats for lossless codecs of interest.. switch (codec_id) { #if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0) case CV_CODEC(CODEC_ID_JPEGLS): // BGR24 or GRAY8 depending on is_color... // supported: bgr24 rgb24 gray gray16le // as of version 3.4.1 codec_pix_fmt = input_pix_fmt; break; #endif case CV_CODEC(CODEC_ID_HUFFYUV): // supported: yuv422p rgb24 bgra // as of version 3.4.1 switch(input_pix_fmt) { case AV_PIX_FMT_RGB24: case AV_PIX_FMT_BGRA: codec_pix_fmt = input_pix_fmt; break; case AV_PIX_FMT_BGR24: codec_pix_fmt = AV_PIX_FMT_RGB24; break; default: codec_pix_fmt = AV_PIX_FMT_YUV422P; break; } break; case CV_CODEC(CODEC_ID_PNG): // supported: rgb24 rgba rgb48be rgba64be pal8 gray ya8 gray16be ya16be monob // as of version 3.4.1 switch(input_pix_fmt) { case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_GRAY16BE: case AV_PIX_FMT_RGB24: case AV_PIX_FMT_BGRA: codec_pix_fmt = input_pix_fmt; break; case AV_PIX_FMT_GRAY16LE: codec_pix_fmt = AV_PIX_FMT_GRAY16BE; break; case AV_PIX_FMT_BGR24: codec_pix_fmt = AV_PIX_FMT_RGB24; break; default: codec_pix_fmt = AV_PIX_FMT_YUV422P; break; } break; case CV_CODEC(CODEC_ID_FFV1): // supported: MANY // as of version 3.4.1 switch(input_pix_fmt) { case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_GRAY16LE: #ifdef AV_PIX_FMT_BGR0 case AV_PIX_FMT_BGR0: #endif case AV_PIX_FMT_BGRA: codec_pix_fmt = input_pix_fmt; break; case AV_PIX_FMT_GRAY16BE: codec_pix_fmt = AV_PIX_FMT_GRAY16LE; break; case AV_PIX_FMT_BGR24: case AV_PIX_FMT_RGB24: #ifdef AV_PIX_FMT_BGR0 codec_pix_fmt = AV_PIX_FMT_BGR0; #else codec_pix_fmt = AV_PIX_FMT_BGRA; #endif break; default: codec_pix_fmt = AV_PIX_FMT_YUV422P; break; } break; case CV_CODEC(CODEC_ID_MJPEG): case CV_CODEC(CODEC_ID_LJPEG): codec_pix_fmt = AV_PIX_FMT_YUVJ420P; bitrate_scale = 3; break; case CV_CODEC(CODEC_ID_RAWVIDEO): // RGBA is the only RGB fourcc supported by AVI and MKV format if(fourcc == CV_FOURCC('R','G','B','A')) { codec_pix_fmt = AV_PIX_FMT_RGBA; } else { switch(input_pix_fmt) { case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_GRAY16LE: case AV_PIX_FMT_GRAY16BE: codec_pix_fmt = input_pix_fmt; break; default: codec_pix_fmt = AV_PIX_FMT_YUV420P; break; } } break; default: // good for lossy formats, MPEG, etc. codec_pix_fmt = AV_PIX_FMT_YUV420P; break; } double bitrate = MIN(bitrate_scale*fps*width*height, (double)INT_MAX/2); // TODO -- safe to ignore output audio stream? video_st = icv_add_video_stream_FFMPEG(oc, codec_id, width, height, (int)(bitrate + 0.5), fps, codec_pix_fmt); /* set the output parameters (must be done even if no parameters). */ #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0) if (av_set_parameters(oc, NULL) < 0) { return false; } #endif #if 0 #if FF_API_DUMP_FORMAT dump_format(oc, 0, filename, 1); #else av_dump_format(oc, 0, filename, 1); #endif #endif /* now that all the parameters are set, we can open the audio and video codecs and allocate the necessary encode buffers */ if (!video_st){ return false; } AVCodec *codec; AVCodecContext *c; #if LIBAVFORMAT_BUILD > 4628 c = (video_st->codec); #else c = &(video_st->codec); #endif c->codec_tag = fourcc; /* find the video encoder */ codec = avcodec_find_encoder(c->codec_id); if (!codec) { fprintf(stderr, "Could not find encoder for codec id %d: %s\n", c->codec_id, icvFFMPEGErrStr( #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0) AVERROR_ENCODER_NOT_FOUND #else -1 #endif )); return false; } int64_t lbit_rate = (int64_t)c->bit_rate; lbit_rate += (bitrate / 2); lbit_rate = std::min(lbit_rate, (int64_t)INT_MAX); c->bit_rate_tolerance = (int)lbit_rate; c->bit_rate = (int)lbit_rate; /* open the codec */ if ((global_err= #if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0) avcodec_open2(c, codec, NULL) #else avcodec_open(c, codec) #endif ) < 0) { fprintf(stderr, "Could not open codec '%s': %s\n", codec->name, icvFFMPEGErrStr(global_err)); return false; } outbuf = NULL; #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0) if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) #endif { /* allocate output buffer */ /* assume we will never get codec output with more than 4 bytes per pixel... */ outbuf_size = width*height*4; outbuf = (uint8_t *) av_malloc(outbuf_size); } bool need_color_convert; need_color_convert = (c->pix_fmt != input_pix_fmt); /* allocate the encoded raw picture */ picture = icv_alloc_picture_FFMPEG(c->pix_fmt, c->width, c->height, need_color_convert); if (!picture) { return false; } /* if the output format is not our input format, then a temporary picture of the input format is needed too. It is then converted to the required output format */ input_picture = NULL; if ( need_color_convert ) { input_picture = icv_alloc_picture_FFMPEG(input_pix_fmt, c->width, c->height, false); if (!input_picture) { return false; } } /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0) if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) #else if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) #endif { return false; } } #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) /* write the stream header, if any */ global_err=avformat_write_header(oc, NULL); #else global_err=av_write_header( oc ); #endif if(global_err < 0) { close(); remove(filename); return false; } frame_width = width; frame_height = height; frame_idx = 0; ok = true; return true; } CvCapture_FFMPEG* cvCreateFileCapture_FFMPEG( const char* filename ) { CvCapture_FFMPEG* capture = (CvCapture_FFMPEG*)malloc(sizeof(*capture)); if (!capture) return 0; capture->init(); if( capture->open( filename )) return capture; capture->close(); free(capture); return 0; } void cvReleaseCapture_FFMPEG(CvCapture_FFMPEG** capture) { if( capture && *capture ) { (*capture)->close(); free(*capture); *capture = 0; } } int cvSetCaptureProperty_FFMPEG(CvCapture_FFMPEG* capture, int prop_id, double value) { return capture->setProperty(prop_id, value); } //~ double cvGetCaptureProperty_FFMPEG(CvCapture_FFMPEG* capture, int prop_id) //~ { //~ return capture->getProperty(prop_id); //~ } int cvGrabFrame_FFMPEG(CvCapture_FFMPEG* capture) { return capture->grabFrame(); } int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn) { return capture->retrieveFrame(0, data, step, width, height, cn); } CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG( const char* filename, int fourcc, double fps, int width, int height, int isColor ) { CvVideoWriter_FFMPEG* writer = (CvVideoWriter_FFMPEG*)malloc(sizeof(*writer)); if (!writer) return 0; writer->init(); if( writer->open( filename, fourcc, fps, width, height, isColor != 0 )) return writer; writer->close(); free(writer); return 0; } void cvReleaseVideoWriter_FFMPEG( CvVideoWriter_FFMPEG** writer ) { if( writer && *writer ) { (*writer)->close(); free(*writer); *writer = 0; } } int cvWriteFrame_FFMPEG( CvVideoWriter_FFMPEG* writer, const unsigned char* data, int step, int width, int height, int cn, int origin) { return writer->writeFrame(data, step, width, height, cn, origin); } video-2.0.0/src/PaxHeaders.4213/ffmpeg_codecs.hpp0000644000000000000000000000013213627020723016353 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/ffmpeg_codecs.hpp0000644000175000017500000003164013627020723016635 0ustar00olafolaf00000000000000/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #ifdef __cplusplus extern "C" { #endif #if !defined(_WIN32) || defined(__MINGW32__) // some versions of FFMPEG assume a C99 compiler, and don't define INT64_C #include // some versions of FFMPEG assume a C99 compiler, and don't define INT64_C #ifndef INT64_C #define INT64_C(c) (c##LL) #endif #ifndef UINT64_C #define UINT64_C(c) (c##ULL) #endif #include #endif #include #ifdef __cplusplus } #endif #ifndef MKTAG #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) #endif // required to look up the correct codec ID depending on the FOURCC code, // this is just a snipped from the file riff.c from ffmpeg/libavformat typedef struct AVCodecTag { int id; unsigned int tag; } AVCodecTag; #if (LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(54, 51, 100)) #define AV_CODEC_ID_H264 CODEC_ID_H264 #define AV_CODEC_ID_H263 CODEC_ID_H263 #define AV_CODEC_ID_H263P CODEC_ID_H263P #define AV_CODEC_ID_H263I CODEC_ID_H263I #define AV_CODEC_ID_H261 CODEC_ID_H261 #define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4 #define AV_CODEC_ID_MSMPEG4V3 CODEC_ID_MSMPEG4V3 #define AV_CODEC_ID_MSMPEG4V2 CODEC_ID_MSMPEG4V2 #define AV_CODEC_ID_MSMPEG4V1 CODEC_ID_MSMPEG4V1 #define AV_CODEC_ID_WMV1 CODEC_ID_WMV1 #define AV_CODEC_ID_WMV2 CODEC_ID_WMV1 #define AV_CODEC_ID_DVVIDEO CODEC_ID_DVVIDEO #define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO #define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO #define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG #define AV_CODEC_ID_LJPEG CODEC_ID_LJPEG #define AV_CODEC_ID_HUFFYUV CODEC_ID_HUFFYUV #define AV_CODEC_ID_FFVHUFF CODEC_ID_FFVHUFF #define AV_CODEC_ID_CYUV CODEC_ID_CYUV #define AV_CODEC_ID_RAWVIDEO CODEC_ID_RAWVIDEO #define AV_CODEC_ID_INDEO3 CODEC_ID_INDEO3 #define AV_CODEC_ID_VP3 CODEC_ID_VP3 #define AV_CODEC_ID_ASV1 CODEC_ID_ASV1 #define AV_CODEC_ID_ASV2 CODEC_ID_ASV2 #define AV_CODEC_ID_VCR1 CODEC_ID_VCR1 #define AV_CODEC_ID_FFV1 CODEC_ID_FFV1 #define AV_CODEC_ID_XAN_WC4 CODEC_ID_XAN_WC4 #define AV_CODEC_ID_MSRLE CODEC_ID_MSRLE #define AV_CODEC_ID_MSVIDEO1 CODEC_ID_MSVIDEO1 #define AV_CODEC_ID_CINEPAK CODEC_ID_CINEPAK #define AV_CODEC_ID_TRUEMOTION1 CODEC_ID_TRUEMOTION1 #define AV_CODEC_ID_MSZH CODEC_ID_MSZH #define AV_CODEC_ID_ZLIB CODEC_ID_ZLIB #define AV_CODEC_ID_SNOW CODEC_ID_SNOW #define AV_CODEC_ID_4XM CODEC_ID_4XM #define AV_CODEC_ID_FLV1 CODEC_ID_FLV1 #define AV_CODEC_ID_SVQ1 CODEC_ID_SVQ1 #define AV_CODEC_ID_TSCC CODEC_ID_TSCC #define AV_CODEC_ID_ULTI CODEC_ID_ULTI #define AV_CODEC_ID_VIXL CODEC_ID_VIXL #define AV_CODEC_ID_QPEG CODEC_ID_QPEG #define AV_CODEC_ID_WMV3 CODEC_ID_WMV3 #define AV_CODEC_ID_LOCO CODEC_ID_LOCO #define AV_CODEC_ID_THEORA CODEC_ID_THEORA #define AV_CODEC_ID_WNV1 CODEC_ID_WNV1 #define AV_CODEC_ID_AASC CODEC_ID_AASC #define AV_CODEC_ID_INDEO2 CODEC_ID_INDEO2 #define AV_CODEC_ID_FRAPS CODEC_ID_FRAPS #define AV_CODEC_ID_TRUEMOTION2 CODEC_ID_TRUEMOTION2 #define AV_CODEC_ID_FLASHSV CODEC_ID_FLASHSV #define AV_CODEC_ID_JPEGLS CODEC_ID_JPEGLS #define AV_CODEC_ID_VC1 CODEC_ID_VC1 #define AV_CODEC_ID_CSCD CODEC_ID_CSCD #define AV_CODEC_ID_ZMBV CODEC_ID_ZMBV #define AV_CODEC_ID_KMVC CODEC_ID_KMVC #define AV_CODEC_ID_VP5 CODEC_ID_VP5 #define AV_CODEC_ID_VP6 CODEC_ID_VP6 #define AV_CODEC_ID_VP6F CODEC_ID_VP6F #define AV_CODEC_ID_JPEG2000 CODEC_ID_JPEG2000 #define AV_CODEC_ID_VMNC CODEC_ID_VMNC #define AV_CODEC_ID_TARGA CODEC_ID_TARGA #define AV_CODEC_ID_NONE CODEC_ID_NONE #endif const AVCodecTag codec_bmp_tags[] = { { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('h', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('X', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('x', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, { AV_CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') }, { AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') }, { AV_CODEC_ID_H263P, MKTAG('H', '2', '6', '3') }, { AV_CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */ { AV_CODEC_ID_H261, MKTAG('H', '2', '6', '1') }, /* added based on MPlayer */ { AV_CODEC_ID_H263P, MKTAG('U', '2', '6', '3') }, { AV_CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') }, { AV_CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') }, { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') }, { AV_CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') }, { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') }, { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') }, { AV_CODEC_ID_MPEG4, MKTAG(0x04, 0, 0, 0) }, /* some broken avi use this */ /* added based on MPlayer */ { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') }, { AV_CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') }, { AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') }, { AV_CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') }, { AV_CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') }, { AV_CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') }, { AV_CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */ { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') }, /* added based on MPlayer */ { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') }, { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') }, { AV_CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') }, /* added based on MPlayer */ { AV_CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') }, { AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') }, { AV_CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') }, /* added based on MPlayer */ { AV_CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') }, { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') }, { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') }, { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') }, { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') }, { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') }, { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') }, { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') }, { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') }, { AV_CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') }, { AV_CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') }, { AV_CODEC_ID_MPEG1VIDEO, 0x10000001 }, { AV_CODEC_ID_MPEG2VIDEO, 0x10000002 }, { AV_CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') }, { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') }, { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') }, { AV_CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') }, { AV_CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') }, { AV_CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */ { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */ { AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, { AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') }, { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') }, { AV_CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') }, { AV_CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') }, { AV_CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') }, { AV_CODEC_ID_RAWVIDEO, 0 }, { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') }, { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') }, { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') }, { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') }, { AV_CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') }, { AV_CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') }, { AV_CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') }, { AV_CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') }, { AV_CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') }, { AV_CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') }, { AV_CODEC_ID_MSRLE, MKTAG(0x1, 0x0, 0x0, 0x0) }, { AV_CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') }, { AV_CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') }, { AV_CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') }, { AV_CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') }, { AV_CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') }, { AV_CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') }, { AV_CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') }, { AV_CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') }, { AV_CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') }, { AV_CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') }, { AV_CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') }, { AV_CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') }, { AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') }, { AV_CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') }, { AV_CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') }, { AV_CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') }, { AV_CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') }, { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') }, { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') }, { AV_CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') }, { AV_CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') }, { AV_CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') }, #if LIBAVCODEC_VERSION_INT>0x000409 { AV_CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') }, { AV_CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') }, { AV_CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') }, { AV_CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') }, { AV_CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') }, #endif #if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0) { AV_CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') }, { AV_CODEC_ID_JPEGLS,MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */ { AV_CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') }, { AV_CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') }, { AV_CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') }, { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') }, { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') }, #endif #if LIBAVCODEC_VERSION_INT>((51<<16)+(11<<8)+0) { AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') }, { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') }, { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') }, { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') }, { AV_CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') }, { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') }, { AV_CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') }, #endif #if LIBAVCODEC_VERSION_INT>=((51<<16)+(49<<8)+0) // this tag seems not to exist in older versions of FFMPEG { AV_CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') }, #endif { AV_CODEC_ID_NONE, 0 }, }; video-2.0.0/src/PaxHeaders.4213/configure.ac0000644000000000000000000000013213627020723015344 xustar0030 mtime=1583096275.210828904 30 atime=1583096275.210828904 30 ctime=1583096275.210828904 video-2.0.0/src/configure.ac0000644000175000017500000000211413627020723015620 0ustar00olafolaf00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) AC_INIT([Octave-Forge video package], [2.0.0]) #AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CXX AC_LANG(C++) # Define macros needed for libav #AC_DEFINE(__STDC_CONSTANT_MACROS, [], [workaround for C++ programs to use C99 macros]) AC_CHECK_PROG([HAVE_MKOCTFILE], [mkoctfile], [yes], [no]) if [test $HAVE_MKOCTFILE = "no"]; then AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME]) fi # Checks for libraries. PKG_CHECK_MODULES([FFMPEG], [libswscale, libavformat, libavcodec, libavutil], [], [AC_MSG_ERROR([FFmpeg libswscale, libavformat, libavcodec or libavutil not found])]) # Checks for typedefs, structures, and compiler characteristics. #AC_CHECK_HEADER_STDBOOL #AC_TYPE_UINT64_T #AC_TYPE_UINT8_T AC_SUBST(CPPFLAGS) AC_CONFIG_FILES([Makefile]) AC_OUTPUT AC_MSG_NOTICE([ $PACKAGE_NAME is now configured with FFMPEG LIBS: $FFMPEG_LIBS FFMPEG CFLAGS: $FFMPEG_CFLAGS DEFS: $DEFS ])