From owner-svn-ports-all@FreeBSD.ORG Mon Oct 28 16:01:33 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8C7F9690; Mon, 28 Oct 2013 16:01:33 +0000 (UTC) (envelope-from wg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 78E83297E; Mon, 28 Oct 2013 16:01:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SG1XdZ022208; Mon, 28 Oct 2013 16:01:33 GMT (envelope-from wg@svn.freebsd.org) Received: (from wg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SG1XPt022205; Mon, 28 Oct 2013 16:01:33 GMT (envelope-from wg@svn.freebsd.org) Message-Id: <201310281601.r9SG1XPt022205@svn.freebsd.org> From: William Grzybowski Date: Mon, 28 Oct 2013 16:01:33 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r331866 - head/math/octave-forge-video/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 16:01:33 -0000 Author: wg Date: Mon Oct 28 16:01:32 2013 New Revision: 331866 URL: http://svnweb.freebsd.org/changeset/ports/331866 Log: math/octave-forge-video: fix buid with newer ffmpeg - Chase API changes with ffmpeg 2.0 Reported by: marino Approved by: portmgr (bapt, implicit) Added: head/math/octave-forge-video/files/patch-ffmpeg_0 (contents, props changed) head/math/octave-forge-video/files/patch-ffmpeg_1 (contents, props changed) head/math/octave-forge-video/files/patch-ffmpeg_2 (contents, props changed) Added: head/math/octave-forge-video/files/patch-ffmpeg_0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/math/octave-forge-video/files/patch-ffmpeg_0 Mon Oct 28 16:01:32 2013 (r331866) @@ -0,0 +1,132 @@ +changeset: 11:a17550ef53d5 +user: carandraug +date: Tue Jan 10 14:06:05 2012 +0000 +files: src/AVHandler.cc +description: +AVHandler.cc: up[dating code to be compatible with latest version, 0.9, of ffmpeg. Patch submitted by Cihan Baran + + +diff -r db975a9b9954 -r a17550ef53d5 src/AVHandler.cc +--- src/AVHandler.cc Tue Sep 27 12:34:58 2011 +0000 ++++ src/AVHandler.cc Tue Jan 10 14:06:05 2012 +0000 +@@ -42,6 +42,8 @@ + #endif + + std::ostream *AVHandler::out = &std::cout; ++/** head of registered output format linked list */ ++static AVOutputFormat *first_oformat = NULL; + + AVHandler::~AVHandler(void) { + if (frame) { +@@ -106,7 +108,7 @@ + return -1; + } + +- av_output = av_alloc_format_context(); ++ av_output = avformat_alloc_context(); + if (!av_output) { + (*out) << "AVHandler: Memory error allocating format context" << std::endl; + return -1; +@@ -127,9 +129,9 @@ + } + + snprintf(av_output->filename, sizeof(av_output->filename), "%s", filename.c_str()); +- snprintf(av_output->title, sizeof(av_output->title), "%s", title.c_str()); +- snprintf(av_output->author, sizeof(av_output->author), "%s", author.c_str()); +- snprintf(av_output->comment, sizeof(av_output->comment), "%s", comment.c_str()); ++// snprintf(av_output->title, sizeof(av_output->title), "%s", title.c_str()); ++// snprintf(av_output->author, sizeof(av_output->author), "%s", author.c_str()); ++// snprintf(av_output->comment, sizeof(av_output->comment), "%s", comment.c_str()); + + if (url_fopen(&av_output->pb, filename.c_str(), URL_WRONLY) < 0) { + (*out) << "AVHandler: Could not open \"" << filename << "\" for output" << std::endl; +@@ -162,7 +164,7 @@ + } + + for (int i=0; i < av_input->nb_streams; i++) { +- if (av_input->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) { ++ if (av_input->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + vstream = av_input->streams[i]; + break; + } +@@ -173,7 +175,7 @@ + } + + for (int i=0; i < av_input->nb_streams; i++) { +- if (av_input->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) { ++ if (av_input->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { + astream = av_input->streams[i]; + break; + } +@@ -204,9 +206,9 @@ + width = vstream->codec->width; + height = vstream->codec->height; + +- title = av_input->title; +- author = av_input->author; +- comment = av_input->comment; ++// title = av_input->title; ++// author = av_input->author; ++// comment = av_input->comment; + + rgbframe = create_frame(PIX_FMT_RGB24); + if (!rgbframe) return -1; +@@ -258,7 +260,7 @@ + if (c->coded_frame) + pkt.pts = c->coded_frame->pts; + if (c->coded_frame && c->coded_frame->key_frame) +- pkt.flags |= PKT_FLAG_KEY; ++ pkt.flags |= AV_PKT_FLAG_KEY; + /// XXX FIXME XXX does this ensure that the first frame is always a key frame? + + if (av_write_frame(av_output, &pkt) != 0) { +@@ -296,7 +298,7 @@ + (*out) << "AVHandler: Error seeking to " << target_timestamp << std::endl; + return -1; + } +- cc->hurry_up = 1; ++ cc->skip_frame; + + // Flush stream buffers after seek + avcodec_flush_buffers(cc); +@@ -331,7 +333,11 @@ + + // Decode the packet into a frame + int frameFinished; +- if (avcodec_decode_video(cc, frame, &frameFinished, packet.data, packet.size) < 0) { ++ ++ // HACK for CorePNG to decode as normal PNG by default ++ packet.flags = AV_PKT_FLAG_KEY; ++ ++ if (avcodec_decode_video2(cc, frame, &frameFinished, &packet) < 0) { + (*out) << "AVHandler: Error decoding video stream" << std::endl; + av_free_packet(&packet); + av_free(frame); frame = NULL; +@@ -342,7 +348,7 @@ + current_timestamp = (uint64_t)(vstream->cur_dts * AV_TIME_BASE * (long double)stream_time_base); + } + } +- cc->hurry_up = 0; ++// cc->hurry_up = 0; + + SwsContext *sc = sws_getContext(cc->width, cc->height, cc->pix_fmt, + cc->width, cc->height, PIX_FMT_BGR24, +@@ -375,7 +381,7 @@ + + AVCodec *codec; + for (codec = av_codec_next(0); codec != NULL; codec = av_codec_next(codec)) { +- if ((codec->type == CODEC_TYPE_VIDEO) && ++ if ((codec->type == AVMEDIA_TYPE_VIDEO) && + (codec->encode)) { + (*out) << codec->name << " "; + } +@@ -395,7 +401,7 @@ + + cc = vstream->codec; + +- cc->codec_type = CODEC_TYPE_VIDEO; ++ cc->codec_type = AVMEDIA_TYPE_VIDEO; + + cc->bit_rate = bitrate; + cc->width = width; + Added: head/math/octave-forge-video/files/patch-ffmpeg_1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/math/octave-forge-video/files/patch-ffmpeg_1 Mon Oct 28 16:01:32 2013 (r331866) @@ -0,0 +1,257 @@ +changeset: 12:7caa40bb8a47 +user: carandraug +date: Tue Oct 09 21:26:03 2012 +0000 +files: DESCRIPTION src/AVHandler.cc src/AVHandler.h src/aviinfo.cc src/oct-avifile.cc +description: +video: fixes for new versions of ffmpeg and do not reject videos with odd dimension sizes (patch by Donjan Rodic + + +diff -r a17550ef53d5 -r 7caa40bb8a47 DESCRIPTION +--- DESCRIPTION Tue Jan 10 14:06:05 2012 +0000 ++++ DESCRIPTION Tue Oct 09 21:26:03 2012 +0000 +@@ -7,6 +7,6 @@ + Description: Implements addframe, avifile, aviinfo, and aviread, using ffmpeg. (and approximately conforms to Matlab interface) + Depends: octave (>= 2.9.12) + Autoload: yes +-SystemRequirements: ffmpeg ++SystemRequirements: >=ffmpeg-0.7 + License: BSD + Url: http://octave.sf.net +diff -r a17550ef53d5 -r 7caa40bb8a47 src/AVHandler.cc +--- src/AVHandler.cc Tue Jan 10 14:06:05 2012 +0000 ++++ src/AVHandler.cc Tue Oct 09 21:26:03 2012 +0000 +@@ -42,8 +42,6 @@ + #endif + + std::ostream *AVHandler::out = &std::cout; +-/** head of registered output format linked list */ +-static AVOutputFormat *first_oformat = NULL; + + AVHandler::~AVHandler(void) { + if (frame) { +@@ -66,7 +64,7 @@ + if (av_output->pb->buf_ptr) { + while (write_frame() > 0) {} + av_write_trailer(av_output); +- if (url_fclose( av_output->pb ) < 0) ++ if (avio_close( av_output->pb ) < 0) + (*out) << "AVHandler: cannot close output file" << std::endl; + } + av_free(av_output); +@@ -80,7 +78,7 @@ + } + + if (av_input) { +- av_close_input_file(av_input); ++ avformat_close_input(&av_input); + } else { + // close output stream + if (vstream) av_freep(&vstream); +@@ -96,8 +94,8 @@ + AVHandler::setup_write() { + av_register_all(); + +- AVOutputFormat *avifmt; +- for (avifmt = first_oformat; avifmt != NULL; avifmt = avifmt->next) { ++ AVOutputFormat *avifmt = NULL; ++ while (NULL != (avifmt = av_oformat_next(avifmt))) { + if (std::string(avifmt->name) == "avi") { + break; + } +@@ -123,17 +121,18 @@ + } + + /* av_set_parameters is mandatory */ ++ // FIXME: deprecated, but there's no replacement yet + if (av_set_parameters(av_output, NULL) < 0) { + (*out) << "AVHandler: Error setting output format parameters" << std::endl; + return -1; + } + + snprintf(av_output->filename, sizeof(av_output->filename), "%s", filename.c_str()); +-// snprintf(av_output->title, sizeof(av_output->title), "%s", title.c_str()); +-// snprintf(av_output->author, sizeof(av_output->author), "%s", author.c_str()); +-// snprintf(av_output->comment, sizeof(av_output->comment), "%s", comment.c_str()); ++// FIXME: snprintf(av_output->title, sizeof(av_output->title), "%s", title.c_str()); ++// FIXME: snprintf(av_output->author, sizeof(av_output->author), "%s", author.c_str()); ++// FIXME: snprintf(av_output->comment, sizeof(av_output->comment), "%s", comment.c_str()); + +- if (url_fopen(&av_output->pb, filename.c_str(), URL_WRONLY) < 0) { ++ if (avio_open(&av_output->pb, filename.c_str(), URL_WRONLY) < 0) { + (*out) << "AVHandler: Could not open \"" << filename << "\" for output" << std::endl; + return -1; + } +@@ -143,8 +142,8 @@ + frame = create_frame(vstream->codec->pix_fmt); + rgbframe = create_frame(PIX_FMT_RGB24); + if (!frame || !rgbframe) return -1; +- +- av_write_header(av_output); ++ ++ avformat_write_header(av_output, NULL); + + return 0; + } +@@ -153,12 +152,12 @@ + AVHandler::setup_read() { + av_register_all(); + +- if (av_open_input_file(&av_input, filename.c_str(), NULL, 0, NULL) != 0) { ++ if (avformat_open_input(&av_input, filename.c_str(), NULL, NULL) != 0) { + (*out) << "AVHandler: Could not open \"" << filename << "\" for reading" << std::endl; + return -1; + } + +- if (av_find_stream_info(av_input) < 0) { ++ if (avformat_find_stream_info(av_input, NULL) < 0) { + (*out) << "AVHandler: No stream information available" << std::endl; + return -1; + } +@@ -194,7 +193,7 @@ + if (codec->capabilities & CODEC_CAP_TRUNCATED) + vstream->codec->flags |= CODEC_FLAG_TRUNCATED; + +- if (avcodec_open(vstream->codec, codec) < 0) { ++ if (avcodec_open2(vstream->codec, codec, NULL) < 0) { + (*out) << "AVHandler: Cannot open codec " << codec_name << std::endl; + vstream->codec->codec = NULL; + return -1; +@@ -206,9 +205,9 @@ + width = vstream->codec->width; + height = vstream->codec->height; + +-// title = av_input->title; +-// author = av_input->author; +-// comment = av_input->comment; ++// FIXME: title = av_input->title; ++// FIXME: author = av_input->author; ++// FIXME: comment = av_input->comment; + + rgbframe = create_frame(PIX_FMT_RGB24); + if (!rgbframe) return -1; +@@ -326,7 +325,7 @@ + return -1; + } + +- if (url_feof(av_input->pb)) { ++ if (av_input->pb->eof_reached) { + (*out) << "AVHandler: EOF reached" << std::endl; + } + } +@@ -348,6 +347,8 @@ + current_timestamp = (uint64_t)(vstream->cur_dts * AV_TIME_BASE * (long double)stream_time_base); + } + } ++// http://ffmpeg.org/pipermail/ffmpeg-cvslog/2011-April/035933.html ++// FIXME maybe use: cc->skip_frame; + // cc->hurry_up = 0; + + SwsContext *sc = sws_getContext(cc->width, cc->height, cc->pix_fmt, +@@ -367,9 +368,9 @@ + (*out) << "Supported file formats:" << std::endl; + av_register_all(); + +- AVOutputFormat *ofmt; +- for (ofmt = first_oformat; ofmt != NULL; ofmt = ofmt->next) { +- (*out) << ofmt->name << " "; ++ AVOutputFormat *ofmt = NULL; ++ while (NULL != (ofmt = av_oformat_next(ofmt))) { ++ (*out) << ofmt->name << " "; + } + (*out) << std::endl << std::endl; + } +@@ -392,8 +393,9 @@ + int + AVHandler::add_video_stream() { + AVCodecContext *cc; +- +- vstream = av_new_stream(av_output, 0); ++ ++ // FIXME: vstream = avformat_new_stream(av_output, av_find_default_stream_index(av_output)); ++ vstream = avformat_new_stream(av_output, NULL); + if (!vstream) { + (*out) << "AVHandler: error opening video output stream" << std::endl; + return -1; +@@ -402,7 +404,7 @@ + cc = vstream->codec; + + cc->codec_type = AVMEDIA_TYPE_VIDEO; +- ++ + cc->bit_rate = bitrate; + cc->width = width; + cc->height = height; +@@ -432,7 +434,7 @@ + return -1; + } + +- if (avcodec_open(cc, codec) < 0) { ++ if (avcodec_open2(cc, codec, NULL) < 0) { + (*out) << "AVHandler: cannot open codec" << std::endl; + cc->codec = NULL; + return -1; +diff -r a17550ef53d5 -r 7caa40bb8a47 src/AVHandler.h +--- src/AVHandler.h Tue Jan 10 14:06:05 2012 +0000 ++++ src/AVHandler.h Tue Oct 09 21:26:03 2012 +0000 +@@ -27,8 +27,11 @@ + + #define VIDEO_OUTBUF_SIZE 200000 + ++// FIXME: should define -D__STDC_CONSTANT_MACROS instead of the following + #define INT64_C ++#define UINT64_C + #define __STDC_CONSTANT_MACROS ++ + #include + extern "C" { + #if defined (HAVE_FFMPEG_AVFORMAT_H) +@@ -165,7 +168,7 @@ + + unsigned int get_total_frames() const { + if (vstream) { +- return (unsigned int)((double)framerate * vstream->duration / AV_TIME_BASE); ++ return (unsigned int) vstream->nb_frames; + } else { + return 0; + } +@@ -173,7 +176,7 @@ + + unsigned int get_filesize() const { + if (av_input) { +- return av_input->file_size; ++ return avio_size(av_input->pb); + } else { + return 0; + } +diff -r a17550ef53d5 -r 7caa40bb8a47 src/aviinfo.cc +--- src/aviinfo.cc Tue Jan 10 14:06:05 2012 +0000 ++++ src/aviinfo.cc Tue Oct 09 21:26:03 2012 +0000 +@@ -66,6 +66,7 @@ + av.set_log(&octave_stdout); + + if (av.setup_read() != 0) { ++ error("aviread: AVHandler setup failed"); + return retval; + } + +diff -r a17550ef53d5 -r 7caa40bb8a47 src/oct-avifile.cc +--- src/oct-avifile.cc Tue Jan 10 14:06:05 2012 +0000 ++++ src/oct-avifile.cc Tue Oct 09 21:26:03 2012 +0000 +@@ -56,10 +56,12 @@ + void + Avifile::addframe(const NDArray &f) { + if (frames == 0) { +- if ( (f.columns() % 2 != 0) || (f.rows() % 2 != 0) ) { +- error("avifile: matrix dimensions must be multiple of two"); +- return; +- } ++// FIXME: this suppresses warnings from ffmpeg, but completely prevents ++// working with many videos. ++// if ( (f.columns() % 2 != 0) || (f.rows() % 2 != 0) ) { ++// error("avifile: matrix dimensions must be multiple of two"); ++// return; ++// } + + if ( (f.columns() == 0) || (f.rows() == 0) ) { + error("avifile: matrix must have non-zero dimensions"); + Added: head/math/octave-forge-video/files/patch-ffmpeg_2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/math/octave-forge-video/files/patch-ffmpeg_2 Mon Oct 28 16:01:32 2013 (r331866) @@ -0,0 +1,34 @@ +--- src/AVHandler.cc.orig 2013-10-28 13:54:16.834945990 -0200 ++++ src/AVHandler.cc 2013-10-28 13:59:18.276945264 -0200 +@@ -123,17 +123,17 @@ + + /* av_set_parameters is mandatory */ + // FIXME: deprecated, but there's no replacement yet +- if (av_set_parameters(av_output, NULL) < 0) { +- (*out) << "AVHandler: Error setting output format parameters" << std::endl; +- return -1; +- } ++ //if (av_set_parameters(av_output, NULL) < 0) { ++ // (*out) << "AVHandler: Error setting output format parameters" << std::endl; ++ // return -1; ++ //} + + snprintf(av_output->filename, sizeof(av_output->filename), "%s", filename.c_str()); + // FIXME: snprintf(av_output->title, sizeof(av_output->title), "%s", title.c_str()); + // FIXME: snprintf(av_output->author, sizeof(av_output->author), "%s", author.c_str()); + // FIXME: snprintf(av_output->comment, sizeof(av_output->comment), "%s", comment.c_str()); + +- if (avio_open(&av_output->pb, filename.c_str(), URL_WRONLY) < 0) { ++ if (avio_open(&av_output->pb, filename.c_str(), AVIO_FLAG_WRITE) < 0) { + (*out) << "AVHandler: Could not open \"" << filename << "\" for output" << std::endl; + return -1; + } +@@ -384,7 +384,7 @@ + AVCodec *codec; + for (codec = av_codec_next(0); codec != NULL; codec = av_codec_next(codec)) { + if ((codec->type == AVMEDIA_TYPE_VIDEO) && +- (codec->encode)) { ++ av_codec_is_encoder(codec)) { + (*out) << codec->name << " "; + } + }