Merge remote-tracking branch 'origin/master'

# Conflicts:
#	examples/ffPlayer.cpp
This commit is contained in:
selim mustafaev 2017-11-06 17:08:08 +03:00
commit 4392ebea1c
7 changed files with 80 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.idea/ .idea/
.vs/
lib/ lib/
bin/ bin/
CMakeLists.txt.user CMakeLists.txt.user

View File

@ -6,8 +6,12 @@ set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -pthread")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/lib)
include_directories(include) include_directories(include)
link_directories(lib) link_directories(lib)

View File

@ -253,6 +253,41 @@ mark_as_advanced(
_FFMPEG_z_LIBRARY_ _FFMPEG_z_LIBRARY_
) )
if(WIN32)
set(FFMPEG_WIN "ffmpeg-3.3.3-win64-dev")
set(FFMPEG_WIN_BINARIES "ffmpeg-3.3.3-win64-shared")
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}.zip")
file(DOWNLOAD "http://ffmpeg.zeranoe.com/builds/win64/dev/${FFMPEG_WIN}.zip" "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}.zip")
file(DOWNLOAD "https://ffmpeg.zeranoe.com/builds/win64/shared/${FFMPEG_WIN_BINARIES}.zip" "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}.zip")
endif()
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}.zip" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}.zip" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
set(FFMPEG_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}/include")
set(FFMPEG_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN}/lib")
set(FFMPEG_DLLS_DIR "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin")
set(FFMPEG_LIBRARIES "${FFMPEG_LIBRARY_DIRS}/avcodec.lib"
"${FFMPEG_LIBRARY_DIRS}/avformat.lib"
"${FFMPEG_LIBRARY_DIRS}/avdevice.lib"
"${FFMPEG_LIBRARY_DIRS}/avfilter.lib"
"${FFMPEG_LIBRARY_DIRS}/avutil.lib"
"${FFMPEG_LIBRARY_DIRS}/postproc.lib"
"${FFMPEG_LIBRARY_DIRS}/swresample.lib"
"${FFMPEG_LIBRARY_DIRS}/swscale.lib")
set(FFMPEG_AVCODEC_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/avcodec-57.dll")
set(FFMPEG_AVFORMAT_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/avformat-57.dll")
set(FFMPEG_AVDEVICE_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/avdevice-57.dll")
set(FFMPEG_AVFILTER_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/avfilter-6.dll")
set(FFMPEG_AVUTIL_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/avutil-55.dll")
set(FFMPEG_POSTPROC_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/postproc-54.dll")
set(FFMPEG_SWRESAMPLE_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/swresample-2.dll")
set(FFMPEG_SWSCALE_DLL "${CMAKE_CURRENT_BINARY_DIR}/${FFMPEG_WIN_BINARIES}/bin/swscale-4.dll")
set(FFMPEG_FOUND "YES")
endif()
# Set package properties if FeatureSummary was included # Set package properties if FeatureSummary was included
if(COMMAND set_package_properties) if(COMMAND set_package_properties)
set_package_properties(FFMPEG PROPERTIES DESCRIPTION "A complete, cross-platform solution to record, convert and stream audio and video") set_package_properties(FFMPEG PROPERTIES DESCRIPTION "A complete, cross-platform solution to record, convert and stream audio and video")

View File

@ -158,6 +158,21 @@ IF(SDL2_LIBRARY_TEMP)
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP) ENDIF(SDL2_LIBRARY_TEMP)
if(WIN32)
set(SDL2_WIN "SDL2-2.0.5")
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}.zip")
file(DOWNLOAD "http://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip" "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}.zip")
endif()
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}.zip" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
set(SDL2_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}/include")
set(SDL2_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}/lib/x64/SDL2.lib"
"${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}/lib/x64/SDL2main.lib")
set(SDL2_DLL "${CMAKE_CURRENT_BINARY_DIR}/${SDL2_WIN}/lib/x64/SDL2.dll")
set(SDL2_FOUND YES)
endif()
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

View File

@ -19,11 +19,28 @@ add_dependencies(ffPreview ffcpp)
target_link_libraries(ffPreview ffcpp) target_link_libraries(ffPreview ffcpp)
project(ffPlayer) project(ffPlayer)
find_package(FFMPEG REQUIRED)
if(NOT FFMPEG_FOUND)
message(FATAL_ERROR "FFMpeg not found")
endif()
include_directories(${FFMPEG_INCLUDE_DIR})
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
if(NOT SDL2_FOUND) if(NOT SDL2_FOUND)
message(FATAL_ERROR "SDL2 not found") message(FATAL_ERROR "SDL2 not found")
endif() endif()
include_directories(${SDL2_INCLUDE_DIR}) include_directories(${SDL2_INCLUDE_DIR})
add_executable(ffPlayer ffPlayer.cpp) add_executable(ffPlayer ffPlayer.cpp)
add_dependencies(ffPlayer ffcpp) add_dependencies(ffPlayer ffcpp)
target_link_libraries(ffPlayer ffcpp ${SDL2_LIBRARY}) target_link_libraries(ffPlayer ffcpp ${SDL2_LIBRARY})
if(WIN32)
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVFORMAT_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVCODEC_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVUTIL_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_SWSCALE_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_SWRESAMPLE_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SDL2_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()

View File

@ -11,7 +11,10 @@ extern "C" {
#include <string> #include <string>
#include <vector> #include <vector>
#include <bits/shared_ptr.h>
#ifndef _MSC_VER
#include <bits/shared_ptr.h>
#endif
namespace ffcpp { namespace ffcpp {

View File

@ -3,7 +3,7 @@ project(ffcpp)
find_package(FFMPEG REQUIRED) find_package(FFMPEG REQUIRED)
# FIXME: FFMPEG_INCLUDE_DIR is incorrect and causes errors # FIXME: FFMPEG_INCLUDE_DIR is incorrect and causes errors
# http://stackoverflow.com/questions/35982639/ctime-std-namespace-conflict # http://stackoverflow.com/questions/35982639/ctime-std-namespace-conflict
#include_directories(${FFMPEG_INCLUDE_DIR}) include_directories(${FFMPEG_INCLUDE_DIR})
link_directories(${FFMPEG_LIBRARY_DIRS}) link_directories(${FFMPEG_LIBRARY_DIRS})
if(NOT FFMPEG_FOUND) if(NOT FFMPEG_FOUND)