./PaxHeaders/video-2.1.30000644000000000000000000000013214777432024011773 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.669459462 30 ctime=1744712724.669459462 video-2.1.3/0000755000175000017500000000000014777432024012605 5ustar00andyandy00000000000000video-2.1.3/PaxHeaders/NEWS0000644000000000000000000000013214777432024012412 xustar0030 mtime=1744712724.661459494 30 atime=1744712724.661459494 30 ctime=1744712724.669459462 video-2.1.3/NEWS0000644000175000017500000000406114777432024013305 0ustar00andyandy00000000000000Summary of important user-visible changes for video 2.1.2: ------------------------------------------------------------------- ** fix build on GNU Octave 10 (include cassert) Summary of important user-visible changes for video 2.1.1: ------------------------------------------------------------------- ** Add support for FFMPEG 5.x. (See #61978) ** Drop support for old ffmpeg versions. Lavu56.22.100, SwS5.3.100, Lavc58.35.100, Lavf58.20.100 is the lowest tested combination. ** Removed tests for outdated GNU/Linux distributions like Debian stretch, CentOS 7 and so on. See tests/docker_results.log for a list of tested distributions. Summary of important user-visible changes for video 2.0.2: ------------------------------------------------------------------- ** Fix build on GNU Octave 8.x (bug #61551) Summary of important user-visible changes for video 2.0.1: ------------------------------------------------------------------- ** Fix build on MacOS Monterrey (bug #57938) Summary 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.1.3/PaxHeaders/INDEX0000644000000000000000000000013214777432024012505 xustar0030 mtime=1744712724.661459494 30 atime=1744712724.661459494 30 ctime=1744712724.669459462 video-2.1.3/INDEX0000644000175000017500000000010614777432024013374 0ustar00andyandy00000000000000video >> Video functions Video processing VideoReader VideoWriter video-2.1.3/PaxHeaders/src0000644000000000000000000000013214777432024012425 xustar0030 mtime=1744712724.669459462 30 atime=1744712724.669459462 30 ctime=1744712724.669459462 video-2.1.3/src/0000755000175000017500000000000014777432024013374 5ustar00andyandy00000000000000video-2.1.3/src/PaxHeaders/bootstrap0000644000000000000000000000013214777432024014442 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/bootstrap0000755000175000017500000000030014777432024015330 0ustar00andyandy00000000000000#!/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.1.3/src/PaxHeaders/__cap_ffmpeg_wrapper__.cc0000644000000000000000000000013214777432024017434 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/__cap_ffmpeg_wrapper__.cc0000644000175000017500000004214314777432024020332 0ustar00andyandy00000000000000/* Copyright (C) 2019-2023 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" static bool writer_type_loaded = false; static bool capture_type_loaded = false; // PKG_ADD: autoload ("__octave_video_set_verbosity_level__", "__cap_ffmpeg_wrapper__.oct"); // PKG_DEL: autoload ("__octave_video_set_verbosity_level__", "__cap_ffmpeg_wrapper__.oct", "remove"); DEFUN_DLD(__octave_video_set_verbosity_level__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{def} =} __octave_video_set_verbosity_level__ ()\n\ undocumented internal function\n\ @end deftypefn") { // default = 1 => show errors and warnings octave_value_list retval; int l = args(0).int_value (); set_verbosity_level (l); return retval; } // 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; } /****************** 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 || !args(0).is_string ()) { print_usage(); return retval; } std::string filename = args(0).string_value (); 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; } opt.contents ("is_okay") = h->is_ok(); 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 int depth; // 0 = CV_8U, 1 glaube ich signed, 2 = CV_16U bool ret = p->retrieveFrame (0, &data, &step, &width, &height, &cn, &depth); //printf ("ret = %i, width = %i, height = %i, step = %i, cn = %i, depth = %i\n", ret, width, height, step, cn, depth); 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; } std::string filename = args(0).string_value (); // codec tag, in OpenCV "fourcc" is used interchangeably // empty fourcc selects default codec_id for guessed container 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) { tag = -1; } 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); //~ } #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) */ 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(); 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.1.3/src/PaxHeaders/configure0000644000000000000000000000013214777432024014406 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/configure0000755000175000017500000034777314777432024015330 0ustar00andyandy00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for Octave-Forge video package 2.1.1. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 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 as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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 printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # 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'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 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="as_nop=: if test \${ZSH_VERSION+y} && (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 \$as_nop 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 \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || 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_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi 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'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$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_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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=`printf "%s\n" "$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 || printf "%s\n" 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_nop 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_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$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 || printf "%s\n" 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" || { printf "%s\n" "$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 } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. 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 # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' 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.1.1' PACKAGE_STRING='Octave-Forge video package 2.1.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS FFMPEG_LIBS FFMPEG_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG 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 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=`printf "%s\n" "$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=`printf "%s\n" "$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=`printf "%s\n" "$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=`printf "%s\n" "$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. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$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" ;; *) printf "%s\n" "$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 || printf "%s\n" 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.1.1 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.1.1:";; 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=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$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 configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. 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 printf "%s\n" "$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.1.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 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 conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_nop printf "%s\n" "$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 ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac 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.1.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "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=`printf "%s\n" "$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=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## 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_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$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 printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$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 printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " # 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,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$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=`printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-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 clang++ 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else $as_nop 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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" printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "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 clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else $as_nop 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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" printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "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:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$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. printf "%s\n" "$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\"" printf "%s\n" "$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 printf "%s\n" "$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 (void) { ; 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. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 printf %s "checking whether the C++ compiler works... " >&6; } ac_link_default=`printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$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+y} && 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 $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 printf %s "checking for C++ compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$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 (void) { 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. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$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 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; 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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$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_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop 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 (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; 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.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; 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_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MKOCTFILE+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MKOCTFILE"; then ac_cv_prog_MKOCTFILE="$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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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_MKOCTFILE="yes" printf "%s\n" "$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_MKOCTFILE" && ac_cv_prog_MKOCTFILE="no" fi fi MKOCTFILE=$ac_cv_prog_MKOCTFILE if test -n "$MKOCTFILE"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKOCTFILE" >&5 printf "%s\n" "$MKOCTFILE" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test $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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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" printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 printf "%s\n" "$PKG_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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" printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libswscale, libavformat, libavcodec, libavutil" >&5 printf %s "checking for libswscale, libavformat, libavcodec, libavutil... " >&6; } if test -n "$FFMPEG_CFLAGS"; then pkg_cv_FFMPEG_CFLAGS="$FFMPEG_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$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=$? printf "%s\n" "$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" && \ { { printf "%s\n" "$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=$? printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "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_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$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+y} || &/ 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$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=`printf "%s\n" "$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" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$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 as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # 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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac 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 printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$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_nop 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_nop 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 || printf "%s\n" 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 # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. 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 # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' 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=`printf "%s\n" "$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 || printf "%s\n" 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.1.1, which was generated by GNU Autoconf 2.71. 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 ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ Octave-Forge video package config.status 2.1.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 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 ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$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 ) printf "%s\n" "$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 \printf "%s\n" "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 printf "%s\n" "$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+y} || 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=`printf "%s\n" "$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 '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$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 || printf "%s\n" 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=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$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@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$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"; } && { printf "%s\n" "$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 printf "%s\n" "$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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $PACKAGE_NAME is now configured with FFMPEG LIBS: $FFMPEG_LIBS FFMPEG CFLAGS: $FFMPEG_CFLAGS DEFS: $DEFS " >&5 printf "%s\n" "$as_me: $PACKAGE_NAME is now configured with FFMPEG LIBS: $FFMPEG_LIBS FFMPEG CFLAGS: $FFMPEG_CFLAGS DEFS: $DEFS " >&6;} video-2.1.3/src/PaxHeaders/cap_ffmpeg_impl_ov.hpp0000644000000000000000000000013214777432024017027 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/cap_ffmpeg_impl_ov.hpp0000644000175000017500000022456514777432024017737 0ustar00andyandy00000000000000/*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/4.x/modules/videoio/src/cap_ffmpeg_impl.hpp * commit 61d48dd0f8d1cc1a115d26998705a61478f64a3c * * and applying the patches in cap_ffmpeg_impl_ov.patch */ /* tested against following combinations: $ sudo ./run.sh | grep -iP "version|name" PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" OCTAVE_VERSION = 4.4.1 FFmpeg_versions = Lavu56.22.100, SwS5.3.100, Lavc58.35.100, Lavf58.20.100 <-- lowest PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" OCTAVE_VERSION = 6.2.0 FFmpeg_versions = Lavu56.51.100, SwS5.7.100, Lavc58.91.100, Lavf58.45.100 PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" OCTAVE_VERSION = 7.3.0 FFmpeg_versions = Lavu57.28.100, SwS6.7.100, Lavc59.37.100, Lavf59.27.100 NAME=Fedora VERSION="31 (Container Image)" OCTAVE_VERSION = 5.1.0 FFmpeg_versions = Lavu56.31.100, SwS5.5.100, Lavc58.54.100, Lavf58.29.100 NAME=Fedora VERSION="33 (Container Image)" OCTAVE_VERSION = 5.2.0 FFmpeg_versions = Lavu56.51.100, SwS5.7.100, Lavc58.91.100, Lavf58.45.100 NAME="Fedora Linux" VERSION="38 (Container Image)" OCTAVE_VERSION = 7.3.0 FFmpeg_versions = Lavu58.2.100, SwS7.1.100, Lavc60.3.100, Lavf60.3.100 NAME="Ubuntu" VERSION="20.04.6 LTS (Focal Fossa)" OCTAVE_VERSION = 5.2.0 FFmpeg_versions = Lavu56.31.100, SwS5.5.100, Lavc58.54.100, Lavf58.29.100 PRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" OCTAVE_VERSION = 6.4.0 FFmpeg_versions = Lavu56.70.100, SwS5.9.100, Lavc58.134.100, Lavf58.76.100 PRETTY_NAME="Ubuntu 23.04" NAME="Ubuntu" OCTAVE_VERSION = 7.3.0 FFmpeg_versions = Lavu57.28.100, SwS6.7.100, Lavc59.37.100, Lavf59.27.100 */ #include #include #include #include #include #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 #ifdef _MSC_VER #pragma warning(disable: 4996) // was declared deprecated #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 #include #include #include #include #include #include #include #include #ifdef HAVE_FFMPEG_LIBAVDEVICE #include #endif // https://github.com/FFmpeg/FFmpeg/blob/b6af56c034759b81985f8ea094e41cbd5f7fecfb/doc/APIchanges#L390-L392 #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(58, 87, 100) #include #endif #include // https://github.com/FFmpeg/FFmpeg/blob/b6af56c034759b81985f8ea094e41cbd5f7fecfb/doc/APIchanges#L208-L210 #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(59, 0, 100) # define CV_FFMPEG_FMT_CONST const #else // for example Debian bullseye has Lavu56.51.100, SwS5.7.100, Lavc58.91.100, Lavf58.45.100 # define CV_FFMPEG_FMT_CONST #endif #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(59, 16, 100) # define CV_FFMPEG_PTS_FIELD pts #else // for example Debian bullseye has Lavu56.51.100, SwS5.7.100, Lavc58.91.100, Lavf58.45.100 # define CV_FFMPEG_PTS_FIELD pkt_pts #endif #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 // octave-video wrappers verbosity level // 0 = only errors // 1 = + warnings // 2 = + wrapper info+debug messages // 3 = + verbose messages // 4 = + libav debug messages static int verbosity_level = -1; const char lvl_prefix[][8] = {"ERROR", "WARN", "INFO", "VERBOSE", "DEBUG"}; #define MSG(l, fmt, ...) if (verbosity_level >= l)\ { fprintf (stderr, "%s: ", lvl_prefix[l]);\ fprintf (stderr, fmt, __VA_ARGS__);\ fprintf (stderr, " (%s:%d)\n", __FILE__, __LINE__);} #define MSG_ERR(fmt, ...) MSG(0, fmt, __VA_ARGS__) #define MSG_WARN(fmt, ...) MSG(1, fmt, __VA_ARGS__) #define MSG_INFO(fmt, ...) MSG(2, fmt, __VA_ARGS__) #define MSG_VERBOSE(fmt, ...) MSG(3, fmt, __VA_ARGS__) #define MSG_DEBUG(fmt, ...) MSG(4, fmt, __VA_ARGS__) #define CV_Assert(x) assert(x); #define CV_8U 0 #define CV_16U 2 void set_verbosity_level (int l) { if (l < 0) l = 0; else if (l > 4) l = 4; verbosity_level = l; // see https://ffmpeg.org/doxygen/4.4/group__lavu__log__constants.html switch (l) { case 0: case 1: av_log_set_level (AV_LOG_WARNING); //Something somehow does not look correct. This may or may not lead to problems break; case 2: av_log_set_level (AV_LOG_INFO); //Standard information. break; case 3: av_log_set_level (AV_LOG_VERBOSE); //Detailed information. break; case 4: av_log_set_level (AV_LOG_DEBUG); //Stuff which is only useful for libav* developers break; } MSG_DEBUG ("set new verbosity_level = %i", av_log_get_level ()); } static int global_err; std::string get_last_err_msg () { char err_buf[AV_ERROR_MAX_STRING_SIZE + 1]; if (global_err) { av_strerror (global_err, err_buf, AV_ERROR_MAX_STRING_SIZE); return err_buf; } else return "No error"; } #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 #include #include #include #endif #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 #ifndef PKT_FLAG_KEY #define PKT_FLAG_KEY AV_PKT_FLAG_KEY #endif #define LIBAVFORMAT_INTERRUPT_OPEN_DEFAULT_TIMEOUT_MS 30000 #define LIBAVFORMAT_INTERRUPT_READ_DEFAULT_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 = (LONGLONG)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; } struct Image_FFMPEG { unsigned char* data; int step; int width; int height; }; struct AVInterruptCallbackMetadata { timespec value; unsigned int timeout_after_ms; int timeout; }; static inline int _opencv_ffmpeg_interrupt_callback(void *ptr) { AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr; CV_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; } static inline void _opencv_ffmpeg_av_packet_unref(AVPacket *pkt) { av_packet_unref(pkt); }; static inline void _opencv_ffmpeg_av_image_fill_arrays(void *frame, uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height) { av_image_fill_arrays(((AVFrame*)frame)->data, ((AVFrame*)frame)->linesize, ptr, pix_fmt, width, height, 1); }; static inline int _opencv_ffmpeg_av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height) { return av_image_get_buffer_size(pix_fmt, width, height, 1); }; static AVRational _opencv_ffmpeg_get_sample_aspect_ratio(AVStream *stream) { return av_guess_sample_aspect_ratio(NULL, stream, NULL); } 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 flag, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth); 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; int64_t get_bitrate() const; AVRational get_sample_aspect_ratio () const { if (ok) return _opencv_ffmpeg_get_sample_aspect_ratio(ic->streams[video_stream]); else { AVRational tmp; tmp.num = 0; tmp.den = 1; return tmp; } } const char* get_video_codec_name () const { return (ok)? avcodec_get_name(video_st->codecpar->codec_id) : NULL; } double r2d(AVRational r) const; int64_t dts_to_frame_number(int64_t dts); double dts_to_sec(int64_t dts) const; void get_rotation_angle(); AVFormatContext * ic; AVCodec * avcodec; AVCodecContext * context; 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; bool rotation_auto; int rotation_angle; // valid 0, 90, 180, 270 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; AVDictionary *dict; int open_timeout; int read_timeout; AVInterruptCallbackMetadata interrupt_metadata; bool setRaw(); bool processRawPacket(); bool rawMode; bool rawModeInitialized; bool convertRGB; AVPacket packet_filtered; AVBSFContext* bsfc; int use_opencl; int extraDataIdx; bool ok; bool is_ok () { return ok; } 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) { (void) pr_as_read_syntax; 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() { if (verbosity_level < 0) set_verbosity_level (1); #ifdef HAVE_FFMPEG_LIBAVDEVICE //libavdevice is available, so let's register all input and output devices (e.g v4l2) avdevice_register_all(); #endif 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; context = 0; frame_number = 0; eps_zero = 0.000025; rotation_angle = 0; rotation_auto = true; dict = NULL; open_timeout = LIBAVFORMAT_INTERRUPT_OPEN_DEFAULT_TIMEOUT_MS; read_timeout = LIBAVFORMAT_INTERRUPT_READ_DEFAULT_TIMEOUT_MS; rawMode = false; rawModeInitialized = false; convertRGB = true; memset(&packet_filtered, 0, sizeof(packet_filtered)); av_init_packet(&packet_filtered); bsfc = NULL; use_opencl = 0; extraDataIdx = 1; ok = false; } void CvCapture_FFMPEG::close() { if( img_convert_ctx ) { sws_freeContext(img_convert_ctx); img_convert_ctx = 0; } if( picture ) { av_frame_free(&picture); } if( video_st ) { avcodec_close( context ); video_st = NULL; } if (context) { avcodec_free_context(&context); } if( ic ) { avformat_close_input(&ic); ic = NULL; } av_frame_unref(&rgb_picture); // free last packet if exist if (packet.data) { _opencv_ffmpeg_av_packet_unref (&packet); packet.data = NULL; } if (dict != NULL) av_dict_free(&dict); if (packet_filtered.data) { _opencv_ffmpeg_av_packet_unref(&packet_filtered); packet_filtered.data = NULL; } if (bsfc) { av_bsf_free(&bsfc); } 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; }; #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: explicit 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; class InternalFFMpegRegister { public: static void init() { AutoLock lock(_mutex); static InternalFFMpegRegister instance; } InternalFFMpegRegister() { avformat_network_init(); } ~InternalFFMpegRegister() { av_log_set_callback(NULL); } }; static int get_number_of_cpus(void) { #if 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 } inline void fill_codec_context(AVCodecContext * enc, AVDictionary * dict) { if (!enc->thread_count) { int nCpus = get_number_of_cpus(); int requestedThreads = std::min(nCpus, 16); // [OPENCV:FFMPEG:24] Application has requested XX threads. Using a thread count greater than 16 is not recommended. enc->thread_count = requestedThreads; } AVDictionaryEntry* avdiscard_entry = av_dict_get(dict, "avdiscard", NULL, 0); if (avdiscard_entry) { if(strcmp(avdiscard_entry->value, "all") == 0) enc->skip_frame = AVDISCARD_ALL; else if (strcmp(avdiscard_entry->value, "bidir") == 0) enc->skip_frame = AVDISCARD_BIDIR; else if (strcmp(avdiscard_entry->value, "default") == 0) enc->skip_frame = AVDISCARD_DEFAULT; else if (strcmp(avdiscard_entry->value, "none") == 0) enc->skip_frame = AVDISCARD_NONE; else if (strcmp(avdiscard_entry->value, "nonintra") == 0) enc->skip_frame = AVDISCARD_NONINTRA; else if (strcmp(avdiscard_entry->value, "nonkey") == 0) enc->skip_frame = AVDISCARD_NONKEY; else if (strcmp(avdiscard_entry->value, "nonref") == 0) enc->skip_frame = AVDISCARD_NONREF; } } bool CvCapture_FFMPEG::open(const char* _filename) { InternalFFMpegRegister::init(); AutoLock lock(_mutex); unsigned i; int nThreads = 0; close(); convertRGB = true; interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_OPEN_DEFAULT_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; av_dict_set(&dict, "rtsp_transport", "tcp", 0); CV_FFMPEG_FMT_CONST 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); if (global_err < 0) { CV_WARN("Error opening file"); CV_WARN(_filename); goto exit_func; } global_err = avformat_find_stream_info(ic, NULL); if (global_err < 0) { MSG_WARN("Unable to read codec parameters from stream (%s)", get_last_err_msg().c_str()); goto exit_func; } for(i = 0; i < ic->nb_streams; i++) { AVCodecParameters* par = ic->streams[i]->codecpar; AVCodecID codec_id = par->codec_id; AVMediaType codec_type = par->codec_type; if( AVMEDIA_TYPE_VIDEO == codec_type && video_stream < 0) { // backup encoder' width/height int enc_width = par->width; int enc_height = par->height; MSG_INFO("FFMPEG: stream[%i] is video stream with codecID=%i, width=%i, height=%i", i, (int)codec_id, enc_width, enc_height); // find and open decoder, try HW acceleration types specified in 'hw_acceleration' list (in order) const AVCodec *codec = NULL; global_err = -1; do { { AVDictionaryEntry* video_codec_param = av_dict_get(dict, "video_codec", NULL, 0); if (video_codec_param == NULL) { codec = avcodec_find_decoder(codec_id); if (!codec) { MSG_ERR("Could not find decoder for codec '%s'(id = %i)", avcodec_get_name (codec_id), (int)codec_id); } } else { MSG_INFO("FFMPEG: Using video_codec='%s'", video_codec_param->value); codec = avcodec_find_decoder_by_name(video_codec_param->value); if (!codec) { MSG_ERR("Could not find decoder '%s'", video_codec_param->value); } } if (codec) { context = avcodec_alloc_context3(codec); CV_Assert(context); } } if (!codec) { avcodec_free_context(&context); continue; } context->thread_count = nThreads; fill_codec_context(context, dict); avcodec_parameters_to_context(context, par); global_err = avcodec_open2(context, codec, NULL); if (global_err >= 0) { break; } else { MSG_ERR("Could not open codec '%s', error: '%s'", codec->name, get_last_err_msg ().c_str()); } } while (0); if (global_err < 0) { MSG_ERR("VIDEOIO/FFMPEG: Failed to initialize VideoCapture, error: '%s'", get_last_err_msg().c_str()); goto exit_func; } // checking width/height (since decoder can sometimes alter it, eg. vp6f) if (enc_width && (context->width != enc_width)) context->width = enc_width; if (enc_height && (context->height != enc_height)) context->height = enc_height; video_stream = i; video_st = ic->streams[i]; picture = av_frame_alloc(); frame.width = context->width; frame.height = context->height; frame.step = 0; frame.data = NULL; get_rotation_angle(); break; } } if (video_stream >= 0) ok = true; exit_func: // deactivate interrupt callback interrupt_metadata.timeout_after_ms = 0; if( !ok ) close(); return ok; } bool CvCapture_FFMPEG::setRaw() { if (!rawMode) { if (frame_number != 0) { CV_WARN("Incorrect usage: do not grab frames before .set(CAP_PROP_FORMAT, -1)"); } // binary stream filter creation is moved into processRawPacket() rawMode = true; } return true; } static inline bool h26xContainer(const char* formatLongName) { return !strcmp(formatLongName, "QuickTime / MOV") || !strcmp(formatLongName, "FLV (Flash Video)") || !strcmp(formatLongName, "Matroska / WebM"); } bool CvCapture_FFMPEG::processRawPacket() { if (packet.data == NULL) // EOF return false; if (!rawModeInitialized) { rawModeInitialized = true; AVCodecID eVideoCodec = ic->streams[video_stream]->codecpar->codec_id; const char* filterName = NULL; if ( eVideoCodec == AV_CODEC_ID_H264 || eVideoCodec == AV_CODEC_ID_H265) { if(h26xContainer(ic->iformat->long_name)) filterName = eVideoCodec == AV_CODEC_ID_H264 ? "h264_mp4toannexb" : "hevc_mp4toannexb"; } if (filterName) { const AVBitStreamFilter * bsf = av_bsf_get_by_name(filterName); if (!bsf) { //fixme CV_WARN("Bitstream filter is not available: %s", filterName); return false; } int err = av_bsf_alloc(bsf, &bsfc); if (err < 0) { CV_WARN("Error allocating context for bitstream buffer"); return false; } avcodec_parameters_copy(bsfc->par_in, ic->streams[video_stream]->codecpar); err = av_bsf_init(bsfc); if (err < 0) { CV_WARN("Error initializing bitstream buffer"); return false; } } } if (bsfc) { if (packet_filtered.data) { _opencv_ffmpeg_av_packet_unref(&packet_filtered); } int err = av_bsf_send_packet(bsfc, &packet); if (err < 0) { CV_WARN("Packet submission for filtering failed"); return false; } err = av_bsf_receive_packet(bsfc, &packet_filtered); if (err < 0) { CV_WARN("Filtered packet retrieve failed"); return false; } return packet_filtered.data != NULL; } return packet.data != NULL; } bool CvCapture_FFMPEG::grabFrame() { bool valid = false; static const size_t max_read_attempts = 4096; // cv::utils::getConfigurationParameterSizeT("OPENCV_FFMPEG_READ_ATTEMPTS", 4096); static const size_t max_decode_attempts = 64; //cv::utils::getConfigurationParameterSizeT("OPENCV_FFMPEG_DECODE_ATTEMPTS", 64); size_t cur_read_attempts = 0; size_t cur_decode_attempts = 0; if( !ic || !video_st || !context ) 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_; // activate interrupt callback interrupt_metadata.timeout = 0; get_monotonic_time(&interrupt_metadata.value); interrupt_metadata.timeout_after_ms = read_timeout; // check if we can receive frame from previously decoded packet valid = avcodec_receive_frame(context, picture) >= 0; // get the next frame while (!valid) { _opencv_ffmpeg_av_packet_unref (&packet); if (interrupt_metadata.timeout) { valid = false; break; } int ret = av_read_frame(ic, &packet); if (ret == AVERROR(EAGAIN)) continue; if (ret == AVERROR_EOF) { if (rawMode) break; // flush cached frames from video decoder packet.data = NULL; packet.size = 0; packet.stream_index = video_stream; } if( packet.stream_index != video_stream ) { _opencv_ffmpeg_av_packet_unref (&packet); if (++cur_read_attempts > max_read_attempts) { MSG_WARN("packet read max attempts (%li) exceeded", max_read_attempts); break; } continue; } if (rawMode) { valid = processRawPacket(); break; } // Decode video frame if (avcodec_send_packet(context, &packet) < 0) { break; } ret = avcodec_receive_frame(context, picture); if (ret >= 0) { valid = true; } else if (ret == AVERROR(EAGAIN)) { continue; } else { if (++cur_decode_attempts > max_decode_attempts) { fprintf(stderr, "frame decode max attempts exceeded, try to increase attempt " "limit by setting environment variable OPENCV_FFMPEG_DECODE_ATTEMPTS " "(current value is %zu)\n", max_decode_attempts); break; } } } if (valid) { if( picture_pts == AV_NOPTS_VALUE_ ) picture_pts = picture->CV_FFMPEG_PTS_FIELD != AV_NOPTS_VALUE_ && picture->CV_FFMPEG_PTS_FIELD != 0 ? picture->CV_FFMPEG_PTS_FIELD : picture->pkt_dts; frame_number++; } if (!rawMode && valid && first_frame_number < 0) first_frame_number = dts_to_frame_number(picture_pts); // deactivate interrupt callback interrupt_metadata.timeout_after_ms = 0; // return if we have a new frame or not return valid; } bool CvCapture_FFMPEG::retrieveFrame(int flag, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth) { if (!video_st || !context) return false; if (rawMode || flag == extraDataIdx) { bool ret = true; if (flag == 0) { AVPacket& p = bsfc ? packet_filtered : packet; *data = p.data; *step = p.size; ret = p.data != NULL; } else if (flag == extraDataIdx) { *data = ic->streams[video_stream]->codecpar->extradata; *step = ic->streams[video_stream]->codecpar->extradata_size; } *width = *step; *height = 1; *cn = 1; *depth = CV_8U; return ret; } AVFrame* sw_picture = picture; if (!sw_picture || !sw_picture->data[0]) return false; MSG_VERBOSE("Input picture format: '%s'", av_get_pix_fmt_name((AVPixelFormat)sw_picture->format)); const AVPixelFormat result_format = convertRGB ? AV_PIX_FMT_BGR24 : (AVPixelFormat)sw_picture->format; switch (result_format) { case AV_PIX_FMT_BGR24: *depth = CV_8U; *cn = 3; break; case AV_PIX_FMT_GRAY8: *depth = CV_8U; *cn = 1; break; case AV_PIX_FMT_GRAY16LE: *depth = CV_16U; *cn = 1; break; default: MSG_WARN("Unknown/unsupported picture format: %s, will be treated as 8UC1.", av_get_pix_fmt_name(result_format)); *depth = CV_8U; *cn = 1; break; // TODO: return false? } if( img_convert_ctx == NULL || frame.width != video_st->codecpar->width || frame.height != video_st->codecpar->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 = context->coded_width, buffer_height = context->coded_height; img_convert_ctx = sws_getCachedContext( img_convert_ctx, buffer_width, buffer_height, (AVPixelFormat)sw_picture->format, buffer_width, buffer_height, result_format, SWS_BICUBIC, NULL, NULL, NULL ); if (img_convert_ctx == NULL) return false;//CV_Error(0, "Cannot initialize the conversion context!"); av_frame_unref(&rgb_picture); rgb_picture.format = result_format; rgb_picture.width = buffer_width; rgb_picture.height = buffer_height; if (0 != av_frame_get_buffer(&rgb_picture, 32)) { CV_WARN("OutOfMemory"); return false; } frame.width = video_st->codecpar->width; frame.height = video_st->codecpar->height; frame.data = rgb_picture.data[0]; frame.step = rgb_picture.linesize[0]; } sws_scale( img_convert_ctx, sw_picture->data, sw_picture->linesize, 0, sw_picture->height, rgb_picture.data, rgb_picture.linesize ); *data = frame.data; *step = frame.step; *width = frame.width; *height = frame.height; return true; } /* static inline double getCodecTag(const AVCodecID codec_id) { const struct AVCodecTag* fallback_tags[] = { avformat_get_riff_video_tags(), avformat_get_mov_video_tags(), codec_bmp_tags, // fallback for avformat < 54.1 NULL }; return av_codec_get_tag(fallback_tags, codec_id); } */ /* static inline double getCodecIdFourcc(const AVCodecID codec_id) { if (codec_id == AV_CODEC_ID_NONE) return -1; const char* codec_fourcc = _opencv_avcodec_get_name(codec_id); if (!codec_fourcc || strcmp(codec_fourcc, "unknown_codec") == 0 || strlen(codec_fourcc) != 4) return getCodecTag(codec_id); return (double)CV_FOURCC(codec_fourcc[0], codec_fourcc[1], codec_fourcc[2], codec_fourcc[3]); } */ #if 0 double CvCapture_FFMPEG::getProperty( int property_id ) const { if( !video_st || !context ) return 0; 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)((rotation_auto && ((rotation_angle%180) != 0)) ? frame.height : frame.width); case CAP_PROP_FRAME_HEIGHT: return (double)((rotation_auto && ((rotation_angle%180) != 0)) ? frame.width : frame.height); case CAP_PROP_FRAME_TYPE: return (double)av_get_picture_type_char(picture->pict_type); case CAP_PROP_FPS: return get_fps(); case CAP_PROP_FOURCC: { const double fourcc = getCodecIdFourcc(video_st->codecpar->codec_id); if (fourcc != -1) return fourcc; const double codec_tag = (double)video_st->codecpar->codec_tag; if (codec_tag) return codec_tag; else return -1; } 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; case CAP_PROP_CODEC_PIXEL_FORMAT: { AVPixelFormat pix_fmt = (AVPixelFormat)video_st->codecpar->format; unsigned int fourcc_tag = avcodec_pix_fmt_to_codec_tag(pix_fmt); return (fourcc_tag == 0) ? (double)-1 : (double)fourcc_tag; } case CAP_PROP_FORMAT: if (rawMode) return -1; break; case CAP_PROP_CONVERT_RGB: return convertRGB; case CAP_PROP_LRF_HAS_KEY_FRAME: { const AVPacket& p = bsfc ? packet_filtered : packet; return ((p.flags & AV_PKT_FLAG_KEY) != 0) ? 1 : 0; } case CAP_PROP_CODEC_EXTRADATA_INDEX: return extraDataIdx; case CAP_PROP_BITRATE: return static_cast(get_bitrate()); case CAP_PROP_ORIENTATION_META: return static_cast(rotation_angle); case CAP_PROP_ORIENTATION_AUTO: return static_cast(rotation_auto); case CAP_PROP_STREAM_OPEN_TIME_USEC: //ic->start_time_realtime is in microseconds return ((double)ic->start_time_realtime); case CAP_PROP_N_THREADS: return static_cast(context->thread_count); 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 { if (! ok) return -1; 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; } int64_t CvCapture_FFMPEG::get_bitrate() const { if (! ok) return -1; return ic->bit_rate / 1000; } double CvCapture_FFMPEG::get_fps() const { if (! ok) return -1; double fps = r2d(av_guess_frame_rate(ic, ic->streams[video_stream], NULL)); return fps; } int64_t CvCapture_FFMPEG::get_total_frames() const { if (! ok) return -1; 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::get_rotation_angle() { rotation_angle = 0; const uint8_t *data = 0; data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); if (data) { rotation_angle = -round(av_display_rotation_get((const int32_t*)data)); if (rotation_angle < 0) rotation_angle += 360; } } void CvCapture_FFMPEG::seek(int64_t _frame_number) { CV_Assert(context); _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(context); 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; case CAP_PROP_FORMAT: if (value == -1) return setRaw(); return false; case CAP_PROP_CONVERT_RGB: convertRGB = (value != 0); return true; case CAP_PROP_ORIENTATION_AUTO: rotation_auto = value != 0 ? true : false; return true; default: return false; } #endif return true; } */ ///////////////// FFMPEG CvVideoWriter implementation ////////////////////////// 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 ); double getProperty(int propId) const; void init(); CV_FFMPEG_FMT_CONST AVOutputFormat * fmt; AVFormatContext * oc; uint8_t * outbuf; uint32_t outbuf_size; FILE * outfile; AVFrame * picture; AVFrame * input_picture; uint8_t * picbuf; AVStream * video_st; AVCodecContext * context; AVPixelFormat input_pix_fmt; unsigned char * aligned_input; size_t aligned_input_size; int frame_width, frame_height; int frame_idx; struct SwsContext *img_convert_ctx; int hw_device; int use_opencl; bool ok; bool is_ok () { return ok; } const char* get_video_codec_name () const { return avcodec_get_name(video_st->codecpar->codec_id); } bool is_constant (void) const { return true; } bool is_defined (void) const { return true; } DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA // called from Octave, see example in demo_low_level_write_frame.m void print (std::ostream & os, bool pr_as_read_syntax = false) { (void) pr_as_read_syntax; 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; os << " get_video_codec_name () = " << get_video_codec_name () << std::endl; } }; 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) { 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; } return "Unspecified error"; } /* function internal to FFMPEG (libavformat/riff.c) to lookup codec id by fourcc tag*/ /* extern "C" { enum AVCodecID codec_get_bmp_id(unsigned int tag); } */ void CvVideoWriter_FFMPEG::init() { if (verbosity_level < 0) set_verbosity_level (1); fmt = 0; oc = 0; outbuf = 0; outbuf_size = 0; outfile = 0; picture = 0; input_picture = 0; picbuf = 0; video_st = 0; context = 0; input_pix_fmt = AV_PIX_FMT_NONE; aligned_input = NULL; aligned_input_size = 0; img_convert_ctx = 0; frame_width = frame_height = 0; frame_idx = 0; hw_device = -1; use_opencl = 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 = av_frame_alloc(); if (!picture) return NULL; picture->format = pix_fmt; picture->width = width; picture->height = height; int size = _opencv_ffmpeg_av_image_get_buffer_size( (AVPixelFormat) pix_fmt, width, height); if(alloc) { uint8_t *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; } /* configure video stream */ static AVCodecContext * icv_configure_video_stream_FFMPEG(AVFormatContext *oc, AVStream *st, const AVCodec* codec, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format, int fourcc) { AVCodecContext *c = avcodec_alloc_context3(codec); CV_Assert(c); int frame_rate, frame_rate_base; CV_Assert (codec); c->codec_id = codec->id; c->codec_type = AVMEDIA_TYPE_VIDEO; c->codec_tag = fourcc; /* 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); } c->time_base.den = frame_rate; c->time_base.num = frame_rate_base; /* adjust time base for supported framerates */ if(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) { avcodec_free_context(&c); return NULL; } c->time_base.den= best->num; c->time_base.num= best->den; } c->gop_size = 12; /* emit one intra frame every twelve frames at most */ c->pix_fmt = pixel_format; if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) { c->max_b_frames = 2; } if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO || c->codec_id == AV_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; } /* 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); } // some formats want stream headers to be separate if(oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; st->avg_frame_rate = av_make_q(frame_rate, frame_rate_base); st->time_base = c->time_base; return c; } static const int OPENCV_NO_FRAMES_WRITTEN_CODE = 1000; static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, AVCodecContext * c, uint8_t *, uint32_t, AVFrame * picture, int frame_idx) { int ret; /* encode the image */ if (picture == NULL && frame_idx == 0) { ret = OPENCV_NO_FRAMES_WRITTEN_CODE; MSG_ERR ("picture == NULL && frame_idx == %i", frame_idx); return ret; } else { ret = avcodec_send_frame(c, picture); if (ret < 0) { global_err = ret; MSG_ERR ("Error '%s' sending frame to encoder (avcodec_send_frame)", get_last_err_msg().c_str()); } } while (ret >= 0) { AVPacket* pkt = av_packet_alloc(); pkt->stream_index = video_st->index; ret = avcodec_receive_packet(c, pkt); //fprintf (stderr, "USE_AV_SEND_FRAME_API avcodec_receive_packet returned %i\n", ret); if (!ret) { av_packet_rescale_ts(pkt, c->time_base, video_st->time_base); ret = av_write_frame(oc, pkt); av_packet_free(&pkt); continue; } // FIXME von Andy: mir scheint bei der USE_AV_SEND_FRAME_API // ist das okay, wenn ein EAGAIN zurück kommt if (ret == AVERROR(EAGAIN)) { //fprintf (stderr, "von Andy, Rückgabe von avcodec_receive_packet umbiegen...\n"); ret = 0; } av_packet_free(&pkt); break; } 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) { MSG_ERR("Only cn == 3 is allowed for AV_PIX_FMT_BGR24 (but is %i)", cn); return false; } } else if (input_pix_fmt == AV_PIX_FMT_GRAY8 || input_pix_fmt == AV_PIX_FMT_GRAY16LE) { if (cn != 1) { MSG_ERR("Only cn == 1 is allowed for AV_PIX_FMT_GRAY8 or AV_PIX_FMT_GRAY16LE (but is %i)", cn); return false; } } else { MSG_ERR("Input data does not match selected pixel format: %s, number of channels: %i", av_get_pix_fmt_name(input_pix_fmt), cn); CV_Assert(false); } // hint: in ::open, width and height was truncated to even number if( (width & -2) != frame_width || (height & -2) != frame_height || !data ) { MSG_ERR("width (%i) or height (%i) doesn't match truncated values (frame_width = %i, frame_height = %i) previously given to ::open", width, height, frame_width, frame_height); return false; } width = frame_width; height = frame_height; // 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 = ~(size_t)(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; } AVPixelFormat sw_pix_fmt = context->pix_fmt; if ( sw_pix_fmt != input_pix_fmt ) { CV_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, context->width, context->height, sw_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; } bool ret; { picture->pts = frame_idx; int ret_write = icv_av_write_frame_FFMPEG(oc, video_st, context, outbuf, outbuf_size, picture, frame_idx); ret = ret_write >= 0 ? true : false; } frame_idx++; return ret; } /// close video output stream and free associated memory void CvVideoWriter_FFMPEG::close() { /* 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 (picture && ok && oc) { for(;;) { int ret = icv_av_write_frame_FFMPEG( oc, video_st, context, outbuf, outbuf_size, NULL, frame_idx); 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 (picture && context && context->pix_fmt != input_pix_fmt) { if(picture->data[0]) free(picture->data[0]); picture->data[0] = 0; } av_free(picture); if (input_picture) av_free(input_picture); avcodec_free_context(&context); av_free(outbuf); if (oc) { if (!(fmt->flags & AVFMT_NOFILE)) { /* close the output file */ avio_close(oc->pb); } /* 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) /// 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(); AutoLock lock(_mutex); AVCodecID codec_id = AV_CODEC_ID_NONE; AVPixelFormat codec_pix_fmt; double bitrate_scale = 1; close(); /* original code with depth in VideoParameter: const int depth = params.get(VIDEOWRITER_PROP_DEPTH, CV_8U); const bool is_supported = depth == CV_8U || (depth == CV_16U && !is_color); if (!is_supported) { MSG_ERR(Unsupported depth/isColor combination is selected, only CV_8UC1/CV_8UC3/CV_16UC1 are supported."); return false; } */ const int depth = CV_8U; //FIXME: interesting for octave-video wrapper? // 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; fmt = av_guess_format(NULL, filename, NULL); if (fmt) { MSG_INFO ("Guessed format '%s' from filename '%s'", fmt->long_name, filename); } else { MSG_ERR ("Can't guess output format from filename '%s'", filename); return false; } /* determine optimal pixel format */ if (is_color) { switch (depth) { case CV_8U: input_pix_fmt = AV_PIX_FMT_BGR24; break; default: MSG_ERR("Unsupported input depth %i for color image", depth); return false; } } else { switch (depth) { case CV_8U: input_pix_fmt = AV_PIX_FMT_GRAY8; break; case CV_16U: input_pix_fmt = AV_PIX_FMT_GRAY16LE; break; default: MSG_ERR("Unsupported input depth %i for grayscale image", depth); return false; } } MSG_INFO("Selected pixel format: '%s'", av_get_pix_fmt_name(input_pix_fmt)); /* Lookup codec_id for given fourcc */ if (fourcc < 0) { // use default from output format codec_id = fmt->video_codec; fourcc = av_codec_get_tag (fmt->codec_tag, codec_id); } else { codec_id = av_codec_get_id (fmt->codec_tag, fourcc); if (codec_id == AV_CODEC_ID_NONE) { MSG_INFO ("av_codec_get_id for tag '%c%c%c%c' failed, now try RIFF and MOV tags...", CV_TAG_TO_PRINTABLE_CHAR4(fourcc)); const struct AVCodecTag * fallback_tags[] = { avformat_get_riff_video_tags(), avformat_get_mov_video_tags(), //codec_bmp_tags, // fallback for avformat < 54.1 NULL }; codec_id = av_codec_get_id(fallback_tags, fourcc); if (codec_id == AV_CODEC_ID_NONE) { MSG_INFO ("av_codec_get_id in RIFF+MOV tags for '%c%c%c%c' failed, now try to search descriptor name...", CV_TAG_TO_PRINTABLE_CHAR4(fourcc)); char *p = (char *) &fourcc; char name[] = {(char)tolower(p[0]), (char)tolower(p[1]), (char)tolower(p[2]), (char)tolower(p[3]), 0}; const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(name); if (desc) codec_id = desc->id; if (codec_id == AV_CODEC_ID_NONE) { MSG_ERR ("Giving up to find codec for tag 0x%08x/'%c%c%c%c' for output format '%s / %s -> ABORT", fourcc, CV_TAG_TO_PRINTABLE_CHAR4(fourcc), fmt->name, fmt->long_name); return false; } } } } MSG_INFO ("Using codec '%s' for encoding, FOURCC = '%c%c%c%c'", avcodec_get_name (codec_id), CV_TAG_TO_PRINTABLE_CHAR4(fourcc)); // alloc memory for context oc = avformat_alloc_context(); CV_Assert(oc); /* set file name */ oc->oformat = fmt; size_t name_len = strlen(filename); oc->url = (char*)av_malloc(name_len + 1); CV_Assert(oc->url); memcpy((void*)oc->url, filename, name_len + 1); oc->url[name_len] = '\0'; /* 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) { case AV_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; case AV_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 AV_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 AV_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 AV_CODEC_ID_MJPEG: case AV_CODEC_ID_LJPEG: codec_pix_fmt = AV_PIX_FMT_YUVJ420P; bitrate_scale = 3; break; case AV_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 = std::min(bitrate_scale*fps*width*height, (double)INT_MAX/2); if (codec_id == AV_CODEC_ID_NONE) { codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_VIDEO); } // Add video stream to output file video_st = avformat_new_stream(oc, 0); if (!video_st) { CV_WARN("Could not allocate stream"); return false; } AVDictionary *dict = NULL; // find and open encoder, try HW acceleration types specified in 'hw_acceleration' list (in order) int err = -1; const AVCodec* codec = NULL; do { codec = avcodec_find_encoder(codec_id); if (!codec) { MSG_ERR("Could not find encoder for codec '%s'(id = %i)", avcodec_get_name (codec_id), (int)codec_id); continue; } AVPixelFormat format = codec_pix_fmt; avcodec_free_context(&context); context = icv_configure_video_stream_FFMPEG(oc, video_st, codec, width, height, (int) (bitrate + 0.5), fps, format, fourcc); if (!context) { continue; } //av_dump_format(oc, 0, filename, 1); int64_t lbit_rate = (int64_t) context->bit_rate; lbit_rate += (int64_t)(bitrate / 2); lbit_rate = std::min(lbit_rate, (int64_t) INT_MAX); context->bit_rate_tolerance = (int) lbit_rate; context->bit_rate = (int) lbit_rate; /* open the codec */ err = avcodec_open2(context, codec, NULL); if (err >= 0) { break; } else { MSG_ERR("Could not open codec '%s', error: %s (%i)", codec->name, icvFFMPEGErrStr(err), err); } } while (0); if (dict != NULL) av_dict_free(&dict); if (err < 0) { MSG_ERR("VIDEOIO/FFMPEG: Failed to initialize VideoWriter, err = %i", err); return false; } // Copy all to codecpar... // !!! https://stackoverflow.com/questions/15897849/c-ffmpeg-not-writing-avcc-box-information avcodec_parameters_from_context(video_st->codecpar, context); /* 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; AVPixelFormat sw_pix_fmt = context->pix_fmt; need_color_convert = (sw_pix_fmt != input_pix_fmt); /* allocate the encoded raw picture */ picture = icv_alloc_picture_FFMPEG(sw_pix_fmt, context->width, context->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, context->width, context->height, false); if (!input_picture) { return false; } } /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { return false; } } /* write the stream header, if any */ global_err = avformat_write_header(oc, NULL); //printf ("global_err = %i = %s\n", global_err, get_last_err_msg ().c_str()); //printf ("DEBUG codec_id = %i, fourcc = %i = '%c%c%c%c'\n", codec_id, fourcc, CV_TAG_TO_PRINTABLE_CHAR4(fourcc)); if(global_err < 0) { MSG_ERR ("avformat_write_header failed with '%s'", get_last_err_msg ().c_str()); close(); remove(filename); return false; } frame_width = width; frame_height = height; frame_idx = 0; ok = true; return true; } /* static CvCapture_FFMPEG* cvCreateFileCaptureWithParams_FFMPEG(const char* filename, const VideoCaptureParameters& params) { // FIXIT: remove unsafe malloc() approach CvCapture_FFMPEG* capture = (CvCapture_FFMPEG*)malloc(sizeof(*capture)); if (!capture) return 0; capture->init(); if (capture->open(filename, params)) 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(); } */ /* Original, was hat man sich da gedacht? int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn) { int depth = CV_8U; return cvRetrieveFrame2_FFMPEG(capture, data, step, width, height, cn, &depth); } int cvRetrieveFrame2_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth) { return capture->retrieveFrame(0, data, step, width, height, cn, depth); } */ /* int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth) { return capture->retrieveFrame(0, data, step, width, height, cn, depth); } */ /* 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.1.3/src/PaxHeaders/Makefile.in0000644000000000000000000000013214777432024014547 xustar0030 mtime=1744712724.669459462 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/Makefile.in0000644000175000017500000000070414777432024015442 0ustar00andyandy00000000000000MKOCTFILE ?= 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@ @CXXFLAGS@ clean: rm -f *.o *.oct octave-workspace ### below is removed in distributed Makefile.in video-2.1.3/src/PaxHeaders/configure.ac0000644000000000000000000000013214777432024014770 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/src/configure.ac0000644000175000017500000000210214777432024015655 0ustar00andyandy00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) AC_INIT([Octave-Forge video package], [2.1.1]) #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([MKOCTFILE], [mkoctfile], [yes], [no]) if [test $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 ]) video-2.1.3/PaxHeaders/inst0000644000000000000000000000013214777432024012613 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.669459462 30 ctime=1744712724.669459462 video-2.1.3/inst/0000755000175000017500000000000014777432024013562 5ustar00andyandy00000000000000video-2.1.3/inst/PaxHeaders/VideoReader.m0000644000000000000000000000013214777432024015237 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/inst/VideoReader.m0000644000175000017500000001411614777432024016134 0ustar00andyandy00000000000000######################################################################## ## ## Copyright (C) 2019-2023 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 ## . ## ######################################################################## classdef VideoReader < handle ## -*- texinfo -*- ## @deftypefn {} {@var{p} =} VideoReader () ## Create object @var{p} of the VideoReader class. ## @end deftypefn ## ## @deftypefn {} {} VideoReader.disp ## Outputs a list of all available properties. ## ## @end deftypefn ## ## @deftypefn {} {} VideoReader.readFrame ## Get next RGB24 frame. This also increases 'FrameNumber'. ## ## @end deftypefn ## ## @deftypefn {} {} __octave_video_set_verbosity_level__ (LEVEL) ## Internal function to increase chattiness of the underlying code ## for debugging purposes. ## ## @itemize ## @item 0: only errors ## @item 1: + warnings (default) ## @item 2: + info messages ## @item 3: + verbose info messages ## @item 4: + ffmpeg debug messages ## @end itemize ## ## @end deftypefn 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__ (filename); v.FFmpeg_versions = __ffmpeg_defines__ ().LIBAV_IDENT; update_properties (v); endfunction function disp (v) printf (" class VideoReader:\n\n"); printf (" read-only access:\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 (" VideoFormat = '%s'\n", v.VideoFormat); ## GNU Octave extensions printf (" FrameNumber = %i\n", v.FrameNumber); printf (" VideoCodec = '%s'\n", v.VideoCodec); printf (" AspectRatio = '%s'\n", mat2str (v.AspectRatio)); printf (" FFmpeg_versions = '%s'\n", v.FFmpeg_versions); printf ("\n"); printf (" read-write access:\n"); printf (" CurrentTime = %i\n", v.CurrentTime); printf (" Tag = '%s'\n", v.Tag); 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 function r = hasFrame (v) r = v.FrameNumber < v.NumberOfFrames; endfunction function close (v) __cap_close__ (v.h); update_properties (v); endfunction endmethods methods (Access = private) # internal function 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 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 currently is tested together with VideoWriter %!test %! assert (true); video-2.1.3/inst/PaxHeaders/VideoWriter.m0000644000000000000000000000013214777432024015311 xustar0030 mtime=1744712724.665459478 30 atime=1744712724.665459478 30 ctime=1744712724.669459462 video-2.1.3/inst/VideoWriter.m0000644000175000017500000003103214777432024016202 0ustar00andyandy00000000000000######################################################################## ## ## Copyright (C) 2019-2023 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 ## . ## ######################################################################## classdef VideoWriter < handle ## -*- texinfo -*- ## @deftypefn {} {@var{p} =} VideoWriter () ## Create object @var{p} of the VideoWriter class. ## @end deftypefn ## ## @deftypefn {} {} VideoWriter.open ## Just checks if the file can be created, no need to call this before ## 'writeVideo' in this implementation. ## ## @end deftypefn ## ## @deftypefn {} {} VideoWriter.writeVideo ## This ultimately creates the video file with previously set params. ## Width and height of the first frame given determines the width and ## height of the video. ## ## @end deftypefn ## ## @deftypefn {} {} __octave_video_set_verbosity_level__ (LEVEL) ## Internal function to increase chattiness of the underlying code ## for debugging purposes. ## ## @itemize ## @item 0: only errors ## @item 1: + warnings (default) ## @item 2: + info messages ## @item 3: + verbose info messages ## @item 4: + ffmpeg debug messages ## @end itemize ## ## @end deftypefn properties (SetAccess = public, GetAccess = public) FrameRate = 30; # fps in [Hz] endproperties properties (SetAccess = private, GetAccess = public) ColorChannels = 3; #Colormap = []; # not yet implemented #CompressionRatio = 10; # not yet implemented Duration = 0; # [s] FileFormat = "avi"; Filename = ""; FrameCount = 0; # Height/Width is set by the first frame written and can't be changed after that 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 && !isempty (varargin{1})) v.FourCC = varargin{1}; else v.FourCC = ""; endif v.FFmpeg_versions = __ffmpeg_defines__ ().LIBAV_IDENT; endfunction function disp (v) update_variable_properties (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) ## We can't create an instance of CvVideoWriter_FFMPEG right now ## because width,height, codec and so on aren't known yet. ## ## This implementation just opens the given filename to check if the ## file could be created. A new instance of CvVideoWriter_FFMPEG is ## created on the first call to 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) # TODO / IDEAS: # pantxo: 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. # input can be an image or a frame returned 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 v = set.FrameRate (v, fps) if (v.opened && ! isequal (fps, v.FrameRate)) error (["VideoWriter: cannot change the FrameRate propery of ", ... "an already open VideoWriter object"]); elseif (! isnumeric (fps) || ! isscalar (fps) || iscomplex (fps) || fps <= 0) error ("VideoWriter: FrameRate must be a positive scalar value"); else v.FrameRate = fps; endif endfunction function val = get.Duration (v) update_variable_properties (v); val = v.Duration; 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); %! w.FrameRate = 50; %! open (w); %! z = sombrero (); %! hs = surf (z); %! axis manual %! nframes = 200; %! 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 'open %s' to read the video with your default video player or try 'demo VideoReader'!\n", fn); # Create synthetic video (rainbow circshifting from left to right), # encode and decode it and compare decoded video with original data. # Throw error if relative deviation exceeds given threshold [%]. # # This check is error prone since codecs may produce more artifacts on # different architectures. See bugreports: # (https://savannah.gnu.org/bugs/?58451) # (https://savannah.gnu.org/bugs/?64452) # both for ppc64el # %!function encode_decode (fn, tag, thres, exp_size) %! %! width = 200; %! height = 150; %! nframes = 120; %! p = permute (rainbow (width), [3 1 2]); %! raw_video = zeros (height, width, 3, nframes); %! w = VideoWriter (fn, tag); %! for k=1:nframes %! ps = circshift (p, k * 6, 2); %! 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 thres exp_size %! r = VideoReader (fn); %! n = size (raw_video, 4); %! rel_err = zeros (n, 1); %! for k=1:n %! img = readFrame (r); %! #img(1,1,1) %! d = double (img) - raw_video(:,:,:,k); %! rel_err(k) = sum (abs(d(:)))/numel(d)/255; %! endfor %! close (r); %! median_rel_error = 1e2 * median(rel_err); # in % %! printf ("INFO: median(relative error) = %.2f%%\n", median_rel_error); %! if (median_rel_error > thres) %! error ("The median of the relative error exceeds the given threshold (%.2f%% > %.2f%%).\ %! Please inspect '%s' manually. You should see a horizontal rainbow running\ %! from left to right.", median_rel_error, thres, fn); %! endif %! s = stat (fn); %! printf ("INFO: size = %i kB\n", s.size / 1e3); %! rel_size_err = abs(exp_size - s.size) / exp_size; %! rel_size_err_thres = 0.3; # 30% %! if (rel_size_err > rel_size_err_thres) %! error ("The difference between the expected (%i kB) and observed (%i kB)\ %! filesize of the written video exceeds the given relative threshold (%.1f%%).\ %! Please inspect '%s' manually. You should see a horizontal rainbow running\ %! from left to right.", exp_size/1e3, s.size/1e3, rel_size_err_thres * 1e2, fn); %! endif %!endfunction %!test %! # raw/uncompressed video %! fn = [tempname() "_rainbow_raw.avi"]; %! # median(rel_err) = 0% on Debian GNU/Linux 12 on AMD Ryzen 7 5700X %! encode_decode (fn, "RGBA", 0.5, 14408600); # allow 0.5% median error %!test %! # mp4 + mp4v %! fn = [tempname() "_rainbow_mp4v.mp4"]; %! # median(rel_err) = 0.70% on Debian GNU/Linux 12 on AMD Ryzen 7 5700X %! encode_decode (fn, "mp4v", 15.0, 69554); # allow 15.0% median error %!test %! # mkv + VP9 %! fn = [tempname() "_rainbow_vp9.mkv"]; %! # median(rel_err) = 0.63% on Debian GNU/Linux 12 on AMD Ryzen 7 5700X %! encode_decode (fn, "VP90", 15.0, 15822); # allow 15.0% median error %!test %! # mp4 + default codec (= avc1) %! fn = [tempname() "_rainbow_h264.mp4"]; %! # median(rel_err) = 0.71% on Debian GNU/Linux 12 on AMD Ryzen 7 5700X %! # but 14.8%, reported here: https://savannah.gnu.org/bugs/?func=detailitem&item_id=64452 %! encode_decode (fn, "", 15.0, 12157); %!test %! # mkv + default codec (= H264 on Debian GNU/Linux 12) %! fn = [tempname() "_rainbow_default.mkv"]; %! # median(rel_err) = 0.71% on Debian GNU/Linux 12 on AMD Ryzen 7 5700X %! encode_decode (fn, [], 15.0, 12143); # allow 15.0% median error %!test <*64383> %! fn = fullfile (tempdir (), "comma_not_dot,mp4"); %! w = VideoWriter (fn); %! open (w); %! fail ("writeVideo (w, rand(100,100,3))", "failed"); video-2.1.3/PaxHeaders/COPYING0000644000000000000000000000013214777432024012746 xustar0030 mtime=1744712724.661459494 30 atime=1744712724.661459494 30 ctime=1744712724.669459462 video-2.1.3/COPYING0000644000175000017500000000004214777432024013634 0ustar00andyandy00000000000000See individual files for licenses video-2.1.3/PaxHeaders/DESCRIPTION0000644000000000000000000000013214777432024013421 xustar0030 mtime=1744712724.661459494 30 atime=1744712724.661459494 30 ctime=1744712724.669459462 video-2.1.3/DESCRIPTION0000644000175000017500000000101714777432024014312 0ustar00andyandy00000000000000Name: video Version: 2.1.3 Date: 2025-04-15 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.1) BuildRequires: ffmpeg or libav >= Lavu56.22.100, SwS5.3.100, Lavc58.35.100, Lavf58.20.100 License: GPLv3 and 3-clause BSD (https://www.opencv.org/license.html) Url: https://gnu-octave.github.io/packages/video/