
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (67)
-
Qualité du média après traitement
21 juin 2013, parLe bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Changer son thème graphique
22 février 2011, parLe thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
Modifier le thème graphique utilisé
Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
Il suffit ensuite de se rendre dans l’espace de configuration du (...)
Sur d’autres sites (5807)
-
Compile Shotdetect on CentOS 7
14 septembre 2015, par BitLegacy01I’m migrating a service from a Debian server to a CentOS 7 one.
The service needs the Shotdetect command (github , official site).
I could not make it work on CentOS though I followed all steps :
-
Compile ffmpeg compilation guide
# ffmpeg
ffmpeg version git-2015-08-21-7a806c6 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --disable-libmp3lame --disable-libopus --disable-libvorbis --disable-libvpx --enable-libx264 --disable-libx265 --disable-lzma
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 58.100 / 56. 58.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 36.100 / 5. 36.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...-
Install needed packages
# yum install gd-devel libxml2-devel libxslt-devel clang libvpx libvorbis
-
Add pthread in the CMakeList file, in TARGET_LINK_LIBRARIES, because it throws an lpthread missing in linker error
-
Compile Shotdetect
# FFMPEG_DIR="/root/ffmpeg_build" ./compile.sh cmd
-
5.Lost in contemplation
-- avformat library found: /root/ffmpeg_build/lib/libavformat.a
-- avcodec library found: /root/ffmpeg_build/lib/libavcodec.a
-- avutil library found: /root/ffmpeg_build/lib/libavutil.a
-- swscale library found: /root/ffmpeg_build/lib/libswscale.a
Found all FFmpeg libraries in /root/ffmpeg_build/lib/libavformat.a;/root/ffmpeg_build/lib/libavdevice.a;/root/ffmpeg_build/lib/libavcodec.a;/root/ffmpeg_build/lib/libavutil.a;/root/ffmpeg_build/lib/libswscale.a.
-- Found GD: /usr/lib64/libgd.so
Found libgd: /usr/lib64/libgd.so;/usr/lib64/libpng.so;/usr/lib64/libz.so;/usr/lib64/libjpeg.so in /usr/include
Found libxml2: /usr/lib64/libxml2.so in /usr/include/libxml2
Found libxslt: /usr/lib64/libxslt.so in /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /root/Shotdetect-master/build
[ 71%] Built target shotdetect
Linking CXX executable shotdetect-cmd
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:323: undefined reference to « aacDecoder_Fill »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:329: undefined reference to « aacDecoder_DecodeFrame »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « get_stream_info »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:88: undefined reference to « aacDecoder_GetStreamInfo »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_close »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:201: undefined reference to « aacDecoder_Close »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:214: undefined reference to « aacDecoder_Open »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:221: undefined reference to « aacDecoder_ConfigRaw »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:228: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:252: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:270: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:277: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:284: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:291: encore plus de références indéfinies suivent vers « aacDecoder_SetParam »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:261: undefined reference to « aacDecoder_AncDataInit »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_flush »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:367: undefined reference to « aacDecoder_SetParam »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_close »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:97: undefined reference to « aacEncClose »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:357: undefined reference to « aacEncEncode »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:114: undefined reference to « aacEncOpen »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:123: undefined reference to « aacEncoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:130: undefined reference to « aacEncoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:138: undefined reference to « aacEncoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:172: undefined reference to « aacEncoder_SetParam »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:179: undefined reference to « aacEncoder_SetParam »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:197: encore plus de références indéfinies suivent vers « aacEncoder_SetParam »
/root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:276: undefined reference to « aacEncEncode »
/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:282: undefined reference to « aacEncInfo »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:260: undefined reference to « x264_picture_init »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:262: undefined reference to « x264_bit_depth »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:246: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:289: undefined reference to « x264_encoder_delayed_frames »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:173: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:178: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:185: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:205: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:211: undefined reference to « x264_encoder_reconfig »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:191: encore plus de références indéfinies suivent vers « x264_encoder_reconfig »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init_static »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:806: undefined reference to « x264_bit_depth »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_close »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:339: undefined reference to « x264_encoder_close »
/root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:413: undefined reference to « x264_param_default »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:418: undefined reference to « x264_param_default_preset »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:440: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:470: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:514: undefined reference to « x264_levels »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:516: undefined reference to « x264_levels »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:540: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:541: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:542: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:543: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:601: undefined reference to « x264_param_apply_fastfirstpass »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:651: undefined reference to « x264_param_apply_profile »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:703: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:705: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:717: undefined reference to « x264_param_parse »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:735: undefined reference to « x264_encoder_open_148 »
/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:744: undefined reference to « x264_encoder_headers »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:379: undefined reference to « swr_is_initialized »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:220: undefined reference to « swr_is_initialized »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_init_resample »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:161: undefined reference to « swr_init »
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:167: undefined reference to « swr_convert »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:234: undefined reference to « swr_convert »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_flush_resample »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:115: undefined reference to « swr_convert »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:411: undefined reference to « swr_close »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_flush »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:614: undefined reference to « swr_close »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_close »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:638: undefined reference to « swr_free »
/root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_init »:
/root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:705: undefined reference to « swr_alloc »
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [shotdetect-cmd] Error 1
make[1]: *** [CMakeFiles/shotdetect-cmd.dir/all] Error 2
make: *** [all] Error 2I’ve done a lot of research about the above errors but I didn’t find any clue.
How to compile successfully Shotdetect on CentOS7 ?
Thanks to tryp here is a working CMakelist file :
# CMake integration by Christian Frisson
cmake_minimum_required(VERSION 2.8)
PROJECT(shotdetect)
SET(CMAKE_C_COMPILER "/usr/bin/clang")
SET(CMAKE_CXX_COMPILER "/usr/bin/clang++")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Get git version information for automatic embedding in version string:
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
# Take the first 12 characters of the SHA1 as short identifier:
STRING(SUBSTRING ${GIT_SHA1} 0 11 GIT_SHA1_SHORT)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.cc.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cc" @ONLY)
list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/version.cc" src/version.h)
# Miscellaneous compilation options:
OPTION(USE_WXWIDGETS "Compile GUI app with wxWidgets, otherwise commandline app" ON)
OPTION(USE_POSTGRESQL "Compile with PostgreSQL support" OFF)
# Dependency: pkg-config (required if cross-compiling with MXE)
IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
FIND_PACKAGE (PkgConfig)
IF(NOT PKG_CONFIG_FOUND)
MESSAGE(FATAL_ERROR "pkgconfig required for cross-compiling with MXE for windows")
ENDIF()
SET(PKG_CONFIG_EXECUTABLE ${PKG_CONFIG_EXECUTABLE} CACHE STRING "pkg-config")
ENDIF()
# Dependency: FFmpeg (required)
FIND_PACKAGE( FFmpeg )
IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
PKG_CHECK_MODULES (FFMPEG_PKG REQUIRED libavcodec libavfilter libavutil libavdevice libavformat libavformat libswscale)
IF (FFMPEG_PKG_FOUND)
MESSAGE( "FFmpeg cflags found through pkg-config: ${FFMPEG_PKG_CFLAGS}" )
MESSAGE( "FFmpeg ldflags found through pkg-config: ${FFMPEG_PKG_LDFLAGS}" )
STRING(REGEX REPLACE ";" " " FFMPEG_PKG_CFLAGS "${FFMPEG_PKG_CFLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FFMPEG_PKG_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FFMPEG_PKG_CFLAGS}")
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARY} ${FFMPEG_PKG_LDFLAGS})
MESSAGE("FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES}")
ELSE (FFMPEG_PKG_FOUND)
MESSAGE( FATAL_ERROR "FFmpeg cflags/ldflags not found through pkg-config." )
ENDIF (FFMPEG_PKG_FOUND)
ENDIF()
IF(FFMPEG_LIBAVFORMAT_FOUND)
MESSAGE(STATUS "avformat library found: ${FFMPEG_LIBAVFORMAT_LIBRARIES}")
ELSE()
MESSAGE(STATUS "avformat library not found.")
ENDIF()
IF(FFMPEG_LIBAVCODEC_FOUND)
MESSAGE(STATUS "avcodec library found: ${FFMPEG_LIBAVCODEC_LIBRARIES}")
ELSE()
MESSAGE(STATUS "avcodec library not found.")
ENDIF()
IF(FFMPEG_LIBAVUTIL_FOUND)
MESSAGE(STATUS "avutil library found: ${FFMPEG_LIBAVUTIL_LIBRARIES}")
ELSE()
MESSAGE(STATUS "avutil library not found.")
ENDIF()
IF(FFMPEG_LIBSWSCALE_FOUND)
MESSAGE(STATUS "swscale library found: ${FFMPEG_LIBSWSCALE_LIBRARIES}")
ELSE()
MESSAGE(STATUS "swscale library not found.")
ENDIF()
IF(FFMPEG_FOUND)
INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
SET(FFMPEG_LIBRARIES "${FFMPEG_LIBRARIES};/root/ffmpeg_build/lib/libswresample.a;/root/ffmpeg_build/lib/libx264.a;/lib64/libdl.so.2;/root/ffmpeg_build/lib/libfdk-aac.a;/root/ffmpeg_build/lib/libswresample.a")
MESSAGE("Found all FFmpeg libraries in ${FFMPEG_LIBRARIES}.")
ELSE()
MESSAGE(FATAL_ERROR "Some FFmpeg libraries are missing.")
ENDIF()
# Dependency: GD (required)
FIND_PACKAGE(GD REQUIRED)
IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
EXEC_PROGRAM(${CMAKE_FIND_ROOT_PATH}/bin/gdlib-config ARGS "--cflags" OUTPUT_VARIABLE GD_PKG_CFLAGS)
EXEC_PROGRAM(${CMAKE_FIND_ROOT_PATH}/bin/gdlib-config ARGS "--libs" OUTPUT_VARIABLE GD_PKG_LDFLAGS)
MESSAGE( "gd cflags found through gdlib-config: ${GD_PKG_CFLAGS}" )
MESSAGE( "gd ldflags found through gdlib-config: ${GD_PKG_LDFLAGS}" )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GD_PKG_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GD_PKG_CFLAGS}")
SET(GD_LIBRARIES ${GD_LIBRARY} ${GD_PKG_LDFLAGS})
MESSAGE("GD_LIBRARIES ${GD_LIBRARIES}")
ENDIF()
IF(GD_FOUND)
INCLUDE_DIRECTORIES(${GD_INCLUDE_DIR})
MESSAGE("Found libgd: ${GD_LIBRARIES} in ${GD_INCLUDE_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Couldn't find libgd")
ENDIF()
# Dependency: libxml2 (required)
FIND_PACKAGE(LibXml2 2.7 REQUIRED)
IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
PKG_CHECK_MODULES (LIBXML2_PKG REQUIRED libxml-2.0)
IF (LIBXML2_PKG_FOUND)
MESSAGE( "LibXml2 cflags found through pkg-config: ${LIBXML2_PKG_CFLAGS}" )
MESSAGE( "LibXml2 ldflags found through pkg-config: ${LIBXML2_PKG_LDFLAGS}" )
STRING(REGEX REPLACE ";" " " LIBXML2_PKG_CFLAGS "${LIBXML2_PKG_CFLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBXML2_PKG_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBXML2_PKG_CFLAGS}")
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} ${LIBXML2_PKG_LDFLAGS})
MESSAGE("LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES}")
ELSE (LIBXML2_PKG_FOUND)
MESSAGE( FATAL_ERROR "LibXml2 cflags/ldflags not found through pkg-config." )
ENDIF (LIBXML2_PKG_FOUND)
ENDIF()
IF(LIBXML2_FOUND)
MESSAGE("Found libxml2: ${LIBXML2_LIBRARIES} in ${LIBXML2_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "Couldn't find libxml2")
ENDIF()
# Dependency: libxslt (required)
FIND_PACKAGE(LibXslt REQUIRED)
IF(LIBXSLT_FOUND)
MESSAGE("Found libxslt: ${LIBXSLT_LIBRARIES} in ${LIBXSLT_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${LIBXSLT_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "Couldn't find libxslt")
ENDIF()
# Dependency: wxWidgets (optional)
IF(USE_WXWIDGETS)
FIND_PACKAGE(wxWidgets)# COMPONENTS core base)
IF(wxWidgets_FOUND)
MESSAGE("Found wxWidgets: ${wxWidgets_LIBRARIES} in ${wxWidgets_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
ADD_DEFINITIONS(-DWXWIDGETS)
INCLUDE("${wxWidgets_USE_FILE}")
ELSE()
MESSAGE(FATAL_ERROR "Couldn't find wxWidgets. Set USE_WXWIDGETS to OFF or install wxWidgets.")
ENDIF()
ENDIF()
# Dependency: PostgreSQL (optional)
IF(USE_POSTGRESQL)
FIND_PACKAGE(PostgreSQL)
IF(PostgreSQL_FOUND)
MESSAGE("Found PostgreSQL: ${PostgreSQL_LIBRARIES} in ${PostgreSQL_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${PostgreSQL_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "Couldn't find PostgreSQL. Set USE_POSTGRESQL to OFF or install PostgreSQL.")
ENDIF()
ENDIF()
# shotdetect
SET(TARGET_NAME "shotdetect")
INCLUDE_DIRECTORIES(.)
# shotdetect library
SET(${TARGET_NAME}_LIBRARY_SRCS src/film.cc src/graph.cc src/image.cc src/shot.cc src/xml.cc)
SET(${TARGET_NAME}_LIBRARY_HDRS src/film.h src/graph.h src/image.h src/shot.h src/xml.h)
IF(USE_POSTGRESQL)
SET(${TARGET_NAME}_LIBRARY_SRCS ${${TARGET_NAME}_LIBRARY_SRCS} src/bdd.cc)
SET(${TARGET_NAME}_LIBRARY_HDRS ${${TARGET_NAME}_LIBRARY_HDRS} src/bdd.h)
ENDIF()
ADD_LIBRARY(${TARGET_NAME} ${${TARGET_NAME}_LIBRARY_SRCS} ${${TARGET_NAME}_LIBRARY_HDRS})
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${FFMPEG_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${GD_LIBRARIES} "pthread" "m" "z")
IF(USE_WXWIDGETS AND wxWidgets_FOUND)
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${wxWidgets_LIBRARIES})
ENDIF()
IF(USE_POSTGRESQL AND PostgreSQL_FOUND)
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${PostgreSQL_LIBRARY})
ENDIF()
# shotdetect application: gui or commandline
IF(APPLE)
SET(APP_TYPE "MACOSX_BUNDLE")
ELSEIF(WIN32)
SET(APP_TYPE "WIN32")
ENDIF()
IF(USE_WXWIDGETS AND wxWidgets_FOUND)
LIST(APPEND ${TARGET_NAME}_GUI_SRCS src/main.cc src/ui/dialog_help.cc src/ui/dialog_shotdetect.cc src/ui/process_video_thread.cc)
LIST(APPEND ${TARGET_NAME}_GUI_HDRS src/ui/dialog_help.h src/ui/dialog_shotdetect.h src/ui/process_video_thread.h)
ADD_EXECUTABLE(${TARGET_NAME}-gui ${APP_TYPE} ${SOURCES} ${${TARGET_NAME}_GUI_SRCS} ${${TARGET_NAME}_GUI_HDRS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}-gui ${TARGET_NAME})
# Make this target optional to install:
SET(TARGETS_TO_INSTALL ${TARGET_NAME}-gui)
ELSE()
LIST(APPEND ${TARGET_NAME}_COMMANDLINE_SRCS src/commandline.cc)
ADD_EXECUTABLE(${TARGET_NAME}-cmd ${SOURCES} ${${TARGET_NAME}_COMMANDLINE_SRCS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}-cmd ${TARGET_NAME})
# Make this target optional to install:
SET(TARGETS_TO_INSTALL ${TARGET_NAME}-cmd)
ENDIF()
# Routines for installing shotdetect.
# Taken from official documentation (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:install)
install(
TARGETS ${TARGETS_TO_INSTALL}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)the built binary will be in the built directory, you can move there and execute
make install
to make the binary system wide.
-
-
Unwrapping Matomo 5.2.0 – Bringing you enhanced security and performance
25 décembre 2024, par Daniel Crough — Latest Releases -
How to write UI tests for your plugin – Introducing the Piwik Platform
18 février 2015, par Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to write unit tests for your plugin). This time you’ll learn how to write UI tests in Piwik. For this tutorial you will need to have basic knowledge of JavaScript and the Piwik platform.
What is a UI test ?
Some might know a UI test under the term ‘CSS test’ or ‘screenshot test’. When we speak of UI tests we mean automated tests that capture a screenshot of a URL and then compare the result with an expected image. If the images are not exactly the same the test will fail. For more information read our blog post about UI Testing.
What is a UI test good for ?
We use them to test our PHP Controllers, Twig templates, CSS, and indirectly test our JavaScript. We do usually not write Unit or Integration tests for our controllers. For example we use UI tests to ensure that the installation, the login and the update process works as expected. We also have tests for most pages, reports, settings, etc. This increases the quality of our product and saves us a lot of time as it is easy to write and maintain such tests. All UI tests are executed on Travis after each commit and compared with our expected screenshots.
Getting started
In this post, we assume that you have already installed Piwik 2.11.0 or later via git, set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.
Next you need to install the needed packages to execute UI tests.
Let’s create a UI test
We start by using the Piwik Console to create a new UI test :
./console generate:test --testtype ui
The command will ask you to enter the name of the plugin the created test should belong to. I will use the plugin name “Widgetize”. Next it will ask you for the name of the test. Here you usually enter the name of the page or report you want to test. I will use the name “WidgetizePage” in this example. There should now be a file
plugins/Widgetize/tests/UI/WidgetizePage_spec.js
which contains already an example to get you started easily :describe("WidgetizePage", function () {
var generalParams = 'idSite=1&period=day&date=2010-01-03';
it('should load a simple page by its module and action', function (done) {
var screenshotName = 'simplePage';
// will save image in "processed-ui-screenshots/WidgetizePageTest_simplePage.png"
expect.screenshot(screenshotName).to.be.capture(function (page) {
var urlToTest = "?" + generalParams + "&module=Widgetize&action=index";
page.load(urlToTest);
}, done);
});
});What is happening here ?
This example declares a new set of specs by calling the method
describe(name, callback)
and within that a new spec by calling the methodit(description, func)
. Within the spec we load a URL and once loaded capture a screenshot of the whole page. The captured screenshot will be saved under the definedscreenshotName
. You might have noticed we write our UI tests in BDD style.Capturing only a part of the page
It is good practice to not always capture the full page. For example many pages contain a menu and if you change that menu, all your screenshot tests would fail. To avoid this you would instead have a separate test for your menu. To capture only a part of the page simply specify a jQuery selector and call the method
captureSelector
instead ofcapture
:var contentSelector = '#selector1, .selector2 .selector3';
// Only the content of both selectors will be in visible in the captured screenshot
expect.screenshot('page_partial').to.be.captureSelector(contentSelector, function (page) {
page.load(urlToTest);
}, done);Hiding content
There is a known issue with sparklines that can fail tests randomly. Also version numbers or a date that changes from time to time can fail tests without actually having an error. To avoid this you can prevent elements from being visible in the captured screenshot via CSS as we add a CSS class called
uiTest
to theHTML
element while tests are running..uiTest .version { visibility:hidden }
Running a test
To run the previously generated tests we will use the command
tests:run-ui
:./console tests:run-ui WidgetizePage
After running the tests for the first time you will notice a new folder
plugins/PLUGINNAME/tests/UI/processed-ui-screenshots
in your plugin. If everything worked, there will be an image for every captured screenshot. If you’re happy with the result it is time to copy the file over to theexpected-ui-screenshots
folder, otherwise you have to adjust your test until you get the result you want. From now on, the newly captured screenshots will be compared with the expected images whenever you execute the tests.Fixing a test
At some point your UI test will fail, for example due to expected CSS changes. To fix a test all you have to do is to copy the captured screenshot from the folder
processed-ui-screenshots
to the folderexpected-ui-screenshots
.Executing the UI tests on Travis
In case you have not generated a
.travis.yml
file for your plugin yet you can do this by executing the following command :./console generate:travis-yml --plugin PLUGINNAME
Next you have to activate Travis for your repository.
Advanced features
Isn’t it easy to create a UI test ? We never even created a file ! Of course you can accomplish even more if you want. For example you can specify a fixture to be inserted before running the tests which is useful when your plugin requires custom data. You can also control the browser as it was a human by clicking, moving the mouse, typing text, etc. If you want to discover more features have a look at our existing test cases.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.