Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/applications/plugins/SofaPython/CMakeLists.txt b/applications/plugins/SofaPython/CMakeLists.txt
- index 4e09cb8..6e9fc5c 100644
- --- a/applications/plugins/SofaPython/CMakeLists.txt
- +++ b/applications/plugins/SofaPython/CMakeLists.txt
- @@ -111,6 +111,7 @@ if(${CMAKE_COMPILER_IS_GNUCC})
- endif()
- AddCompilerDefinitions("SOFA_BUILD_SOFAPYTHON")
- +AddCompilerDefinitions("__STDC_CONSTANT_MACROS")
- AddLinkerDependencies(SofaCore SofaSimulationCommon SofaGuiCommon ${PYTHON_LIBRARIES})
- include(${SOFA_CMAKE_DIR}/postProject.cmake)
- diff --git a/applications/plugins/image/ImageTypes.h b/applications/plugins/image/ImageTypes.h
- index 38ef84d..4e2c620 100644
- --- a/applications/plugins/image/ImageTypes.h
- +++ b/applications/plugins/image/ImageTypes.h
- @@ -27,7 +27,7 @@
- #define IMAGE_IMAGETYPES_H
- #if defined (SOFA_HAVE_FFMPEG) || defined (SOFA_EXTLIBS_FFMPEG)
- -#define cimg_use_ffmpeg
- +//#define cimg_use_ffmpeg
- #endif
- #ifdef SOFA_IMAGE_HAVE_OPENCV // should be "SOFA_HAVE_OPENCV" -> use "SOFA_IMAGE_HAVE_OPENCV" until the opencv plugin is fixed..
- #define cimg_use_opencv
- diff --git a/applications/sofa/gui/SofaGuiCommon/CMakeLists.txt b/applications/sofa/gui/SofaGuiCommon/CMakeLists.txt
- index 5b86e3a..4120589 100644
- --- a/applications/sofa/gui/SofaGuiCommon/CMakeLists.txt
- +++ b/applications/sofa/gui/SofaGuiCommon/CMakeLists.txt
- @@ -34,6 +34,7 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
- AddCompilerDefinitions("SOFA_BUILD_SOFAGUI")
- +AddCompilerDefinitions("__STDC_CONSTANT_MACROS")
- AddLinkerDependencies(SofaComponentMain SofaGraphComponent SofaBaseCollision SofaUserInteraction SofaBaseVisual)
- include(${SOFA_CMAKE_DIR}/postProject.cmake)
- diff --git a/applications/sofa/gui/SofaGuiMain/CMakeLists.txt b/applications/sofa/gui/SofaGuiMain/CMakeLists.txt
- index e8a6624..7afdab7 100644
- --- a/applications/sofa/gui/SofaGuiMain/CMakeLists.txt
- +++ b/applications/sofa/gui/SofaGuiMain/CMakeLists.txt
- @@ -25,6 +25,7 @@ if(SOFA-LIB_GUI_QGLVIEWER)
- endif()
- AddCompilerDefinitions("SOFA_BUILD_GUIMAIN")
- +AddCompilerDefinitions("__STDC_CONSTANT_MACROS")
- AddLinkerDependencies(SofaGuiCommon)
- if(SOFA-LIB_GUI_QT)
- diff --git a/applications/sofa/gui/qt/CMakeLists.txt b/applications/sofa/gui/qt/CMakeLists.txt
- index 7a2b763..8d1e54a 100644
- --- a/applications/sofa/gui/qt/CMakeLists.txt
- +++ b/applications/sofa/gui/qt/CMakeLists.txt
- @@ -153,6 +153,7 @@ set(FORM_FILES_GROUP "Generated")
- add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${MOC_FILES} ${FORM_FILES} ${SOURCE_FILES})
- AddCompilerDefinitions("SOFA_BUILD_SOFAGUIQT")
- +AddCompilerDefinitions("__STDC_CONSTANT_MACROS")
- AddLinkerDependencies(SofaGuiCommon Qwt SofaBaseVisual SofaExporter SofaLoader SofaOpenglVisual SofaMiscForceField)
- diff --git a/framework/sofa/helper/CMakeLists.txt b/framework/sofa/helper/CMakeLists.txt
- index 1ec171b..c9bbd71 100644
- --- a/framework/sofa/helper/CMakeLists.txt
- +++ b/framework/sofa/helper/CMakeLists.txt
- @@ -186,10 +186,46 @@ if(NOT SOFA-MISC_NO_OPENGL)
- )
- endif()
- -if(SOFA-EXTERNAL_FFMPEG)
- +#if((SOFA-EXTERNAL_FFMPEG) AND (NOT WIN32))
- +if(SOFA-EXTERNAL_FFMPEG)
- list(APPEND HEADER_FILES "gl/VideoRecorder.h")
- list(APPEND SOURCE_FILES "gl/VideoRecorder.cpp")
- + include_directories(${SOFA-EXTERNAL_FFMPEG_PATH}/include)
- + if (WIN32)
- + AddLinkerDependencies("${SOFA-EXTERNAL_FFMPEG_PATH}/lib/avformat.lib")
- + AddLinkerDependencies("${SOFA-EXTERNAL_FFMPEG_PATH}/lib/avcodec.lib")
- + AddLinkerDependencies("${SOFA-EXTERNAL_FFMPEG_PATH}/lib/avutil.lib")
- + AddLinkerDependencies("${SOFA-EXTERNAL_FFMPEG_PATH}/lib/swscale.lib")
- + elseif (APPLE)
- + set( FFMPEG_LIBS
- + "libavcodec.a"
- + "libavformat.a"
- + "libavutil.a"
- + "libswscale.a"
- + "libbz2.a"
- + "libmp3lame.a"
- + "libx264.a"
- + "libfaac.a"
- + "libxvidcore.a"
- + "libswresample.a"
- + "/usr/lib/libiconv.dylib"
- + )
- + find_library(FOUNDATION CoreFoundation)
- + find_library(VIDEO CoreVideo)
- + find_library(VIDEO_DECOD_ACC VideoDecodeAcceleration)
- + find_library(ICONV iconv)
- + target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBS} ${FOUNDATION} ${VIDEO} ${VIDEO_DECOD_ACC})
- + elseif (UNIX)
- + AddLinkerDependencies(avcodec)
- + AddLinkerDependencies(avformat)
- + AddLinkerDependencies(avutil)
- + AddLinkerDependencies(swscale)
- + AddLinkerDependencies(avdevice)
- + AddLinkerDependencies(avfilter)
- + AddLinkerDependencies(swresample)
- + endif()
- +
- endif()
- if(PS3)
- diff --git a/framework/sofa/helper/gl/VideoRecorder.cpp b/framework/sofa/helper/gl/VideoRecorder.cpp
- index cbf5532..5e87e74 100644
- --- a/framework/sofa/helper/gl/VideoRecorder.cpp
- +++ b/framework/sofa/helper/gl/VideoRecorder.cpp
- @@ -88,7 +88,7 @@ AVFrame *VideoRecorder::alloc_picture(PixelFormat pix_fmt, int width, int height
- return picture;
- }
- -AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id, const std::string& codec)
- +AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, AVCodecID codec_id, const std::string& codec)
- {
- AVCodecContext *c;
- AVStream *st;
- @@ -99,7 +99,7 @@ AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id,
- c = st->codec;
- c->codec_id = codec_id;
- - c->codec_type = CODEC_TYPE_VIDEO;
- + c->codec_type = AVMEDIA_TYPE_VIDEO;
- /* put sample parameters */
- c->bit_rate = p_bitrate;
- @@ -145,8 +145,8 @@ AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id,
- c->qcompress = 0.6;
- c->max_b_frames= 3;
- c->me_cmp |= FF_CMP_CHROMA;
- - c->partitions |= X264_PART_I8X8 | X264_PART_I4X4 |
- - X264_PART_P8X8 | X264_PART_B8X8;
- +// c->partitions |= X264_PART_I8X8 | X264_PART_I4X4 |
- +// X264_PART_P8X8 | X264_PART_B8X8;
- c->me_method = ME_HEX;
- //c->gop_size = 250;
- @@ -155,11 +155,11 @@ AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id,
- c->scenechange_threshold = 40;
- c->i_quant_factor = 0.71;
- c->b_frame_strategy = 1;
- - c->directpred = 1;
- +// c->directpred = 1;
- c->trellis = 1;
- - c->flags2 = CODEC_FLAG2_BPYRAMID | CODEC_FLAG2_MIXED_REFS |
- - CODEC_FLAG2_WPRED | CODEC_FLAG2_8X8DCT | CODEC_FLAG2_FASTPSKIP;
- - c->weighted_p_pred = 2;
- + c->flags2 = CODEC_FLAG2_FAST | CODEC_FLAG2_NO_OUTPUT |
- + CODEC_FLAG2_LOCAL_HEADER | CODEC_FLAG2_IGNORE_CROP | CODEC_FLAG2_CHUNKS;
- + // c->weighted_p_pred = 2;
- }
- else if (codec == std::string("mpeg4"))
- {
- @@ -180,8 +180,8 @@ AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id,
- c->qcompress = 0.6;
- c->max_b_frames= 3;
- c->me_cmp |= FF_CMP_CHROMA;
- - c->partitions |= X264_PART_I8X8 | X264_PART_I4X4 |
- - X264_PART_P8X8 | X264_PART_B8X8;
- +// c->partitions |= X264_PART_I8X8 | X264_PART_I4X4 |
- + // X264_PART_P8X8 | X264_PART_B8X8;
- c->me_method = ME_HEX;
- //c->gop_size = 250;
- @@ -190,13 +190,13 @@ AVStream *VideoRecorder::add_video_stream(AVFormatContext *oc, CodecID codec_id,
- c->scenechange_threshold = 40;
- c->i_quant_factor = 0.71;
- c->b_frame_strategy = 1;
- - c->directpred = 1;
- + // c->directpred = 1;
- c->trellis = 1;
- - c->flags2 = CODEC_FLAG2_BPYRAMID | CODEC_FLAG2_MIXED_REFS |
- - CODEC_FLAG2_WPRED | CODEC_FLAG2_8X8DCT | CODEC_FLAG2_FASTPSKIP;
- - c->weighted_p_pred = 2;
- + c->flags2 = CODEC_FLAG2_FAST | CODEC_FLAG2_NO_OUTPUT |
- + CODEC_FLAG2_LOCAL_HEADER | CODEC_FLAG2_IGNORE_CROP | CODEC_FLAG2_CHUNKS;
- + // c->weighted_p_pred = 2;
- - c->cqp = 0;
- +// c->cqp = 0;
- /*
- c->me_range = 16;
- @@ -242,7 +242,7 @@ bool VideoRecorder::open_video(AVFormatContext *oc, AVStream *st)
- }
- /* open the codec */
- - if (avcodec_open(c, codec) < 0)
- + if (avcodec_open2(c, codec,NULL) < 0)
- {
- std::cerr <<"could not open codec"<<std::endl;
- return false;
- @@ -324,7 +324,7 @@ bool VideoRecorder::write_delayed_video_frame(AVFormatContext *oc, AVStream *st)
- pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
- if(c->coded_frame->key_frame)
- - pkt.flags |= PKT_FLAG_KEY;
- + pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= videoOutbuf;
- pkt.size= out_size;
- @@ -388,7 +388,7 @@ bool VideoRecorder::write_video_frame(AVFormatContext *oc, AVStream *st)
- AVPacket pkt;
- av_init_packet(&pkt);
- - pkt.flags |= PKT_FLAG_KEY;
- + pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= (uint8_t *)pPicture;
- pkt.size= sizeof(AVPicture);
- @@ -408,7 +408,7 @@ bool VideoRecorder::write_video_frame(AVFormatContext *oc, AVStream *st)
- std::cout << "Encoded Video Frame: " << c->coded_frame->pts << std::endl;
- pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
- if(c->coded_frame->key_frame)
- - pkt.flags |= PKT_FLAG_KEY;
- + pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= videoOutbuf;
- pkt.size= out_size;
- @@ -519,11 +519,11 @@ bool VideoRecorder::init(const std::string& filename, unsigned int framerate, un
- }
- // set the output parameters (must be done even if no parameters)
- - if (av_set_parameters(pFormatContext, NULL) < 0)
- +/* if (av_set_parameters(pFormatContext, NULL) < 0)
- {
- std::cerr <<"Invalid output format parameters" << std::endl;
- return false;
- - }
- + }*/
- // now that all the parameters are set, we can open the audio and
- // video codecs and allocate the necessary encode buffers */
- @@ -533,7 +533,7 @@ bool VideoRecorder::init(const std::string& filename, unsigned int framerate, un
- // open the output file, if needed
- if (!(pFormat->flags & AVFMT_NOFILE))
- {
- - if (url_fopen(&pFormatContext->pb, filename.c_str(), URL_WRONLY) < 0)
- + if (avio_open(&pFormatContext->pb, filename.c_str(), AVIO_FLAG_WRITE) < 0)
- {
- std::cerr <<"Could not open '%s'" << std::endl;
- return false;
- @@ -541,7 +541,7 @@ bool VideoRecorder::init(const std::string& filename, unsigned int framerate, un
- }
- // write the stream header, if any
- - av_write_header(pFormatContext);
- + avformat_write_header(pFormatContext,NULL);
- std::cout << "Start Recording in " << filename << std::endl;
- //everything is ok
- @@ -563,7 +563,7 @@ void VideoRecorder::finishVideo()
- av_write_trailer(pFormatContext);
- //Dump to stdout
- - dump_format(pFormatContext, 0, p_filename.c_str(), 1);
- + av_dump_format(pFormatContext, 0, p_filename.c_str(), 1);
- // close each codec
- if (pVideoStream)
- @@ -579,7 +579,7 @@ void VideoRecorder::finishVideo()
- if (!(pFormat->flags & AVFMT_NOFILE))
- {
- // close the output file
- - url_fclose(pFormatContext->pb);
- + avio_close(pFormatContext->pb);
- }
- // free the stream
- diff --git a/framework/sofa/helper/gl/VideoRecorder.h b/framework/sofa/helper/gl/VideoRecorder.h
- index 4c638c4..56278b8 100644
- --- a/framework/sofa/helper/gl/VideoRecorder.h
- +++ b/framework/sofa/helper/gl/VideoRecorder.h
- @@ -95,7 +95,7 @@ public:
- std::string findFilename(const std::string &v);
- protected:
- - AVStream *add_video_stream(AVFormatContext *oc, CodecID codec_id, const std::string& codec="");
- + AVStream *add_video_stream(AVFormatContext *oc, AVCodecID codec_id, const std::string& codec="");
- bool open_video(AVFormatContext *oc, AVStream *st);
- AVFrame *alloc_picture(PixelFormat pix_fmt, int width, int height);
- bool write_video_frame(AVFormatContext *oc, AVStream *st);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement