diff options
author | jbeich <jbeich@FreeBSD.org> | 2016-11-04 16:48:49 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2016-11-04 16:48:49 +0800 |
commit | c77f0e7f115f8120ae2b1a76687c67cc54b20dd5 (patch) | |
tree | 0a462a655a47eee8d98045018c3c859b87bea9bb /x11-toolkits | |
parent | 97d9ba41bd72028a63523d2326618c6a479be30c (diff) | |
download | freebsd-ports-graphics-c77f0e7f115f8120ae2b1a76687c67cc54b20dd5.tar.gz freebsd-ports-graphics-c77f0e7f115f8120ae2b1a76687c67cc54b20dd5.tar.zst freebsd-ports-graphics-c77f0e7f115f8120ae2b1a76687c67cc54b20dd5.zip |
x11-toolkits/nucleo: unbreak build with ffmpeg 3.x
In file included from nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:14:
nucleo/plugins/ffmpeg/ffmpegImageSink.H:39:10: error: ISO C++ forbids forward references to
'enum' types
enum PixelFormat srcEncoding ;
^
nucleo/plugins/ffmpeg/ffmpegImageSink.H:39:22: error: field has incomplete type
'enum PixelFormat'
enum PixelFormat srcEncoding ;
^
nucleo/plugins/ffmpeg/ffmpegImageSink.H:39:10: note: forward declaration of
'nucleo::PixelFormat'
enum PixelFormat srcEncoding ;
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:131:44: error: use of undeclared identifier 'CODEC_ID_NONE'; did you mean
'AV_CODEC_ID_NONE'?
else if (output_format->video_codec == CODEC_ID_NONE) {
^~~~~~~~~~~~~
AV_CODEC_ID_NONE
/usr/local/include/libavcodec/avcodec.h:192:5: note: 'AV_CODEC_ID_NONE' declared here
AV_CODEC_ID_NONE,
^
nucleo/plugins/ffmpeg/ffmpegImageSource.cxx:132:8: error: use of undeclared identifier 'PIX_FMT_GRAY8'; did you mean
'AV_PIX_FMT_GRAY8'?
case PIX_FMT_GRAY8:
^~~~~~~~~~~~~
AV_PIX_FMT_GRAY8
/usr/local/include/libavutil/pixfmt.h:70:5: note: 'AV_PIX_FMT_GRAY8' declared here
AV_PIX_FMT_GRAY8, ///< Y , 8bpp
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:265:34: error: use of undeclared identifier 'PIX_FMT_GRAY8'; did you mean
'AV_PIX_FMT_GRAY8'?
case Image::L: srcEncoding = PIX_FMT_GRAY8 ; break ;
^~~~~~~~~~~~~
AV_PIX_FMT_GRAY8
/usr/local/include/libavutil/pixfmt.h:70:5: note: 'AV_PIX_FMT_GRAY8' declared here
AV_PIX_FMT_GRAY8, ///< Y , 8bpp
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:266:42: error: use of undeclared identifier 'PIX_FMT_YUV420P'; did you mean
'AV_PIX_FMT_YUV420P'?
case Image::YpCbCr420: srcEncoding = PIX_FMT_YUV420P ; break ;
^~~~~~~~~~~~~~~
AV_PIX_FMT_YUV420P
/usr/local/include/libavutil/pixfmt.h:62:5: note: 'AV_PIX_FMT_YUV420P' declared here
AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:267:28: error: use of undeclared identifier 'PIX_FMT_RGB24'; did you mean
'AV_PIX_FMT_RGB24'?
default: srcEncoding = PIX_FMT_RGB24 ; break ;
^~~~~~~~~~~~~
AV_PIX_FMT_RGB24
/usr/local/include/libavutil/pixfmt.h:64:5: note: 'AV_PIX_FMT_RGB24' declared here
AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:270:5: error: use of undeclared identifier 'avcodec_get_frame_defaults'
avcodec_get_frame_defaults(&srcPic) ;
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:274:3: error: use of undeclared identifier 'avcodec_get_frame_defaults'
avcodec_get_frame_defaults(&convPic) ;
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:303:22: error: use of undeclared identifier 'PIX_FMT_RGB24'; did you mean
'AV_PIX_FMT_RGB24'?
if (srcEncoding==PIX_FMT_RGB24) convertImage(img, Image::RGB) ;
^~~~~~~~~~~~~
AV_PIX_FMT_RGB24
/usr/local/include/libavutil/pixfmt.h:64:5: note: 'AV_PIX_FMT_RGB24' declared here
AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:329:20: error: use of undeclared identifier 'avcodec_encode_video'; did you mean
'avcodec_encode_video2'?
int out_size = avcodec_encode_video(cctx, video_outbuf, video_outbuf_size, picture) ;
^~~~~~~~~~~~~~~~~~~~
avcodec_encode_video2
/usr/local/include/libavcodec/avcodec.h:5322:5: note: 'avcodec_encode_video2' declared here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
^
nucleo/plugins/ffmpeg/ffmpegImageSink.cxx:329:47: error: cannot initialize a parameter of type 'AVPacket *' with an lvalue
of type 'uint8_t *' (aka 'unsigned char *')
int out_size = avcodec_encode_video(cctx, video_outbuf, video_outbuf_size, picture) ;
^~~~~~~~~~~~
/usr/local/include/libavcodec/avcodec.h:5322:60: note: passing argument to parameter 'avpkt' here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
^
PR: 207547
Diffstat (limited to 'x11-toolkits')
4 files changed, 134 insertions, 13 deletions
diff --git a/x11-toolkits/nucleo/Makefile b/x11-toolkits/nucleo/Makefile index a8308264945..ca6d9e866d6 100644 --- a/x11-toolkits/nucleo/Makefile +++ b/x11-toolkits/nucleo/Makefile @@ -3,7 +3,7 @@ PORTNAME= nucleo PORTVERSION= 0.7.6 -PORTREVISION= 14 +PORTREVISION= 15 CATEGORIES= x11-toolkits MASTER_SITES= http://insitu.lri.fr/metisse/download/nucleo/ diff --git a/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSink.cxx b/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSink.cxx index 00cf200875f..36e8cf30cda 100644 --- a/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSink.cxx +++ b/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSink.cxx @@ -1,6 +1,6 @@ ---- nucleo/plugins/ffmpeg/ffmpegImageSink.cxx.orig 2009-05-25 14:53:15.000000000 +0200 -+++ nucleo/plugins/ffmpeg/ffmpegImageSink.cxx 2015-07-03 23:24:23.255152399 +0200 -@@ -118,11 +118,11 @@ namespace nucleo { +--- nucleo/plugins/ffmpeg/ffmpegImageSink.cxx.orig 2009-05-25 12:53:15 UTC ++++ nucleo/plugins/ffmpeg/ffmpegImageSink.cxx +@@ -118,17 +118,17 @@ namespace nucleo { output_format = 0 ; if (uri.scheme=="mpegts-udp") { @@ -15,6 +15,13 @@ } std::string message ; + if (!output_format) + message = "Unable to find the requested format" ; +- else if (output_format->video_codec == CODEC_ID_NONE) { ++ else if (output_format->video_codec == AV_CODEC_ID_NONE) { + output_format = 0 ; + message = "Not a video format" ; + } else if (output_format->flags & AVFMT_NOFILE) { @@ -156,12 +156,13 @@ namespace nucleo { snprintf(format_context->filename, sizeof(format_context->filename), "%s", filename.c_str()) ; @@ -30,15 +37,17 @@ // ---------------- -@@ -190,7 +191,7 @@ namespace nucleo { +@@ -190,8 +191,8 @@ namespace nucleo { AVCodecContext *codec_context = vstream->codec ; codec_context->codec_id = output_format->video_codec ; - codec_context->codec_type = CODEC_TYPE_VIDEO ; +- codec_context->pix_fmt = PIX_FMT_YUV420P ; + codec_context->codec_type = AVMEDIA_TYPE_VIDEO ; - codec_context->pix_fmt = PIX_FMT_YUV420P ; ++ codec_context->pix_fmt = AV_PIX_FMT_YUV420P ; codec_context->width = img->getWidth() ; // must be a multiple of two codec_context->height = img->getHeight() ; // must be a multiple of two + codec_context->me_method = ME_EPZS ; // ME_ZERO @@ -210,12 +211,7 @@ namespace nucleo { || !strcmp(format_context->oformat->name, "3gp")) codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER ; @@ -71,7 +80,7 @@ std::cerr << "ffmpegImageSink: could not open " << filename << std::endl ; return false ; } -@@ -245,17 +241,17 @@ namespace nucleo { +@@ -245,37 +241,37 @@ namespace nucleo { int port = uri.port ; if (!port) port = 1234 ; sender = new UdpSender(uri.host.c_str(), port) ; @@ -92,8 +101,70 @@ video_outbuf_size = 256*1024 ; // FIXME ? video_outbuf = new uint8_t [video_outbuf_size] ; -@@ -346,7 +342,7 @@ namespace nucleo { - pkt.size = out_size ; + + switch (img->getEncoding()) { + case Image::ARGB: +- // PIX_FMT_RGBA32 is endian-sensitive... +- // srcEncoding = ByteOrder::isLittleEndian() ? PIX_FMT_RGB24 : PIX_FMT_RGBA32 ; +- srcEncoding = PIX_FMT_RGB24 ; ++ // AV_PIX_FMT_RGBA32 is endian-sensitive... ++ // srcEncoding = ByteOrder::isLittleEndian() ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_RGBA32 ; ++ srcEncoding = AV_PIX_FMT_RGB24 ; + break ; +- case Image::L: srcEncoding = PIX_FMT_GRAY8 ; break ; +- case Image::YpCbCr420: srcEncoding = PIX_FMT_YUV420P ; break ; +- default: srcEncoding = PIX_FMT_RGB24 ; break ; ++ case Image::L: srcEncoding = AV_PIX_FMT_GRAY8 ; break ; ++ case Image::YpCbCr420: srcEncoding = AV_PIX_FMT_YUV420P ; break ; ++ default: srcEncoding = AV_PIX_FMT_RGB24 ; break ; + } + +- avcodec_get_frame_defaults(&srcPic) ; ++ av_frame_unref(&srcPic) ; + if (codec_context->pix_fmt==srcEncoding) + picture = &srcPic ; + else { +- avcodec_get_frame_defaults(&convPic) ; ++ av_frame_unref(&convPic) ; + int size = avpicture_get_size(codec_context->pix_fmt, codec_context->width, codec_context->height) ; + avpicture_fill((AVPicture *)&convPic, + new uint8_t [size], +@@ -304,7 +300,7 @@ namespace nucleo { + // std::cerr << "base: " << vstream->time_base.num << " / " << vstream->time_base.den << std::endl ; + + AVCodecContext *cctx = vstream->codec ; +- if (srcEncoding==PIX_FMT_RGB24) convertImage(img, Image::RGB) ; ++ if (srcEncoding==AV_PIX_FMT_RGB24) convertImage(img, Image::RGB) ; + resizeImage(img, cctx->width, cctx->height) ; + avpicture_fill((AVPicture *)&srcPic, img->getData(), srcEncoding, + cctx->width, cctx->height) ; +@@ -330,23 +326,23 @@ namespace nucleo { + picture->pts = pts ; + // std::cerr << "pts: " << pts << std::endl ; + +- int out_size = avcodec_encode_video(cctx, video_outbuf, video_outbuf_size, picture) ; +- if (!out_size) { +- std::cerr << "ffmpegImageSink: avcodec_encode_video returned 0" << std::endl ; ++ AVPacket pkt ; ++ av_init_packet(&pkt) ; ++ pkt.data = video_outbuf ; ++ pkt.size = video_outbuf_size ; ++ ++ int got_packet = 0 ; ++ int ret = avcodec_encode_video2(cctx, &pkt, picture, &got_packet) ; ++ if (ret) { ++ std::cerr << "ffmpegImageSink: avcodec_encode_video2 failed" << std::endl ; + stop() ; + return false ; + } + +- // std::cerr << "out_size = " << out_size << std::endl ; +- +- AVPacket pkt ; +- av_init_packet(&pkt) ; + pkt.stream_index = vstream->index ; +- pkt.data = video_outbuf ; +- pkt.size = out_size ; if (cctx->coded_frame) { pkt.pts = pkt.dts = pts ; - if (cctx->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY ; diff --git a/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSource.cxx b/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSource.cxx index 08f3928e12a..0df594db0c4 100644 --- a/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSource.cxx +++ b/x11-toolkits/nucleo/files/patch-nucleo__plugins__ffmpeg__ffmpegImageSource.cxx @@ -1,6 +1,6 @@ ---- nucleo/plugins/ffmpeg/ffmpegImageSource.cxx.orig +--- nucleo/plugins/ffmpeg/ffmpegImageSource.cxx.orig 2009-05-25 12:53:15 UTC +++ nucleo/plugins/ffmpeg/ffmpegImageSource.cxx -@@ -47,23 +47,23 @@ +@@ -47,23 +47,23 @@ namespace nucleo { bool ffmpegImageSource::start(void) { @@ -28,7 +28,7 @@ video_stream = i ; found_video_stream = true ; } else -@@ -86,7 +86,7 @@ +@@ -86,7 +86,7 @@ namespace nucleo { return false ; } @@ -37,7 +37,7 @@ if (ret<0) { std::cerr << "ffmpegImageSource: unable to open codec" << std::endl ; return false ; -@@ -123,7 +123,7 @@ +@@ -123,39 +123,39 @@ namespace nucleo { #endif int got_picture = 0 ; @@ -46,3 +46,42 @@ av_free_packet(&packet) ; if (!got_picture) continue ; + lastImage.setTimeStamp() ; + switch (cctx->pix_fmt) { +- case PIX_FMT_GRAY8: ++ case AV_PIX_FMT_GRAY8: + lastImage.setDims(cctx->width, cctx->height) ; + lastImage.setEncoding(Image::L) ; + lastImage.setData(frame.data[0], cctx->width*cctx->height, Image::NONE) ; + break ; +- case PIX_FMT_RGB24: ++ case AV_PIX_FMT_RGB24: + lastImage.setDims(cctx->width, cctx->height) ; + lastImage.setEncoding(Image::RGB) ; + lastImage.setData(frame.data[0], (cctx->width*cctx->height)*3, Image::NONE) ; + break ; + default: // Convert everything else to RGB24 +- // PIX_FMT_YUV420P has three separate plans and ffmpeg converts ++ // AV_PIX_FMT_YUV420P has three separate plans and ffmpeg converts + // them to RGB faster than nucleo does... +- // PIX_FMT_RGBA32 and PIX_FMT_RGB565 are stored in cpu endianness ++ // AV_PIX_FMT_RGBA32 and AV_PIX_FMT_RGB565 are stored in cpu endianness + // On OS X (powerpc), they correspond to Image::ARGB and Image::RGB565 + lastImage.prepareFor(cctx->width, cctx->height, Image::RGB) ; + AVFrame tmpframe ; +- avpicture_fill((AVPicture*)&tmpframe, lastImage.getData(), PIX_FMT_RGB24, ++ avpicture_fill((AVPicture*)&tmpframe, lastImage.getData(), AV_PIX_FMT_RGB24, + cctx->width, cctx->height) ; + #if NO_SOFTWARE_SCALER +- img_convert((AVPicture*)&tmpframe, PIX_FMT_RGB24, ++ img_convert((AVPicture*)&tmpframe, AV_PIX_FMT_RGB24, + (AVPicture*)&frame, cctx->pix_fmt, cctx->width, cctx->height) ; + #else + SwsContext *swsc = 0 ; + swsc = sws_getCachedContext(swsc, + cctx->width, cctx->height, cctx->pix_fmt, +- cctx->width, cctx->height, PIX_FMT_RGB24, ++ cctx->width, cctx->height, AV_PIX_FMT_RGB24, + SWS_BICUBIC, NULL, NULL, NULL) ; + if (!swsc) { + std::cerr << "ffmpegImageSource: sws_getCachedContext failed" << std::endl ; diff --git a/x11-toolkits/nucleo/files/patch-nucleo_plugins_ffmpeg_ffmpegImageSink.H b/x11-toolkits/nucleo/files/patch-nucleo_plugins_ffmpeg_ffmpegImageSink.H new file mode 100644 index 00000000000..78571ca4865 --- /dev/null +++ b/x11-toolkits/nucleo/files/patch-nucleo_plugins_ffmpeg_ffmpegImageSink.H @@ -0,0 +1,11 @@ +--- nucleo/plugins/ffmpeg/ffmpegImageSink.H.orig 2009-05-25 12:53:15 UTC ++++ nucleo/plugins/ffmpeg/ffmpegImageSink.H +@@ -36,7 +36,7 @@ namespace nucleo { + AVFrame srcPic, convPic, *picture ; + int video_outbuf_size ; + uint8_t *video_outbuf ; +- enum PixelFormat srcEncoding ; ++ enum AVPixelFormat srcEncoding ; + + std::string filename ; // if used as a file sink + |