Fixed warnings and refactored FindFFmpeg.cmake and ffmpeg plugin CMakeLists.txt scripts to better handle different instation combinations
This commit is contained in:
parent
d1eb4fd5de
commit
d167142a59
@ -26,19 +26,20 @@
|
|||||||
MACRO(FFMPEG_FIND varname shortname headername)
|
MACRO(FFMPEG_FIND varname shortname headername)
|
||||||
# old version of ffmpeg put header in $prefix/include/[ffmpeg]
|
# old version of ffmpeg put header in $prefix/include/[ffmpeg]
|
||||||
# so try to find header in include directory
|
# so try to find header in include directory
|
||||||
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername}
|
|
||||||
|
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
|
||||||
PATHS
|
PATHS
|
||||||
${FFMPEG_ROOT}/include/lib${shortname}
|
${FFMPEG_ROOT}/include
|
||||||
$ENV{FFMPEG_DIR}/include/lib${shortname}
|
$ENV{FFMPEG_DIR}/include
|
||||||
~/Library/Frameworks/lib${shortname}
|
~/Library/Frameworks
|
||||||
/Library/Frameworks/lib${shortname}
|
/Library/Frameworks
|
||||||
/usr/local/include/lib${shortname}
|
/usr/local/include
|
||||||
/usr/include/lib${shortname}
|
/usr/include
|
||||||
/sw/include/lib${shortname} # Fink
|
/sw/include # Fink
|
||||||
/opt/local/include/lib${shortname} # DarwinPorts
|
/opt/local/include # DarwinPorts
|
||||||
/opt/csw/include/lib${shortname} # Blastwave
|
/opt/csw/include # Blastwave
|
||||||
/opt/include/lib${shortname}
|
/opt/include
|
||||||
/usr/freeware/include/lib${shortname}
|
/usr/freeware/include
|
||||||
PATH_SUFFIXES ffmpeg
|
PATH_SUFFIXES ffmpeg
|
||||||
DOC "Location of FFMPEG Headers"
|
DOC "Location of FFMPEG Headers"
|
||||||
)
|
)
|
||||||
@ -131,6 +132,24 @@ IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODE
|
|||||||
|
|
||||||
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
|
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
SET(FFMPEG_INCLUDE_DIRS
|
||||||
|
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
|
||||||
|
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
|
||||||
|
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
|
||||||
|
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (${FFMPEG_STDINT_INCLUDE_DIR})
|
||||||
|
SET(FFMPEG_INCLUDE_DIRS
|
||||||
|
$PFFMPEG_INCLUDE_DIRS}
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavformat
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavutil
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
|
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
|
||||||
|
|
||||||
# Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
|
# Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
|
||||||
|
@ -1,20 +1,8 @@
|
|||||||
# INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} )
|
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} )
|
||||||
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
|
|
||||||
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
|
|
||||||
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
|
|
||||||
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec
|
|
||||||
${FFMPEG_STDINT_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS})
|
LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS})
|
||||||
|
|
||||||
SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} )
|
SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IF(FFMPEG_LIBSWSCALE_FOUND)
|
IF(FFMPEG_LIBSWSCALE_FOUND)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS} ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/libswscale )
|
INCLUDE_DIRECTORIES( ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS} ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/libswscale )
|
||||||
|
@ -284,7 +284,7 @@ size_t FFmpegDecoderAudio::decodeFrame(void * const buffer, const size_t size)
|
|||||||
|
|
||||||
if (m_packet.type == FFmpegPacket::PACKET_DATA)
|
if (m_packet.type == FFmpegPacket::PACKET_DATA)
|
||||||
{
|
{
|
||||||
if (m_packet.packet.pts != AV_NOPTS_VALUE)
|
if (m_packet.packet.pts != int64_t(AV_NOPTS_VALUE))
|
||||||
{
|
{
|
||||||
const double pts = av_q2d(m_stream->time_base) * m_packet.packet.pts;
|
const double pts = av_q2d(m_stream->time_base) * m_packet.packet.pts;
|
||||||
m_clocks.audioSetBufferEndPts(pts);
|
m_clocks.audioSetBufferEndPts(pts);
|
||||||
|
@ -167,13 +167,13 @@ void FFmpegDecoderVideo::decodeLoop()
|
|||||||
|
|
||||||
// Find out the frame pts
|
// Find out the frame pts
|
||||||
|
|
||||||
if (packet.packet.dts == AV_NOPTS_VALUE &&
|
if (packet.packet.dts == int64_t(AV_NOPTS_VALUE) &&
|
||||||
m_frame->opaque != 0 &&
|
m_frame->opaque != 0 &&
|
||||||
*reinterpret_cast<const int64_t*>(m_frame->opaque) != AV_NOPTS_VALUE)
|
*reinterpret_cast<const int64_t*>(m_frame->opaque) != int64_t(AV_NOPTS_VALUE))
|
||||||
{
|
{
|
||||||
pts = *reinterpret_cast<const int64_t*>(m_frame->opaque);
|
pts = *reinterpret_cast<const int64_t*>(m_frame->opaque);
|
||||||
}
|
}
|
||||||
else if (packet.packet.dts != AV_NOPTS_VALUE)
|
else if (packet.packet.dts != int64_t(AV_NOPTS_VALUE))
|
||||||
{
|
{
|
||||||
pts = packet.packet.dts;
|
pts = packet.packet.dts;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user