Skip to content

Commit

Permalink
Merge pull request #2 from alibaba/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
317394245 authored Jan 1, 2022
2 parents 9875643 + aee6899 commit 40bdb91
Show file tree
Hide file tree
Showing 355 changed files with 23,729 additions and 6,787 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
- name: Build debug APK
run: |
export ANDROID_NDK=/home/runner/android-env/android-ndk-r14b
export ANDROID_NDK_ROOT=/home/runner/android-env/android-ndk-r14b
export ANDROID_NDK_ROOT=${ANDROID_NDK}
export ANDROID_NDK_HOME=${ANDROID_NDK}
echo "y" | sudo apt-get install ninja-build
cd $GITHUB_WORKSPACE/platform/Android/source
export ANDROID_FULL_PACKAGE='true'
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: build external
- name: build SDK
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
. setup.env
. build_player.sh
build_iOS
- name: build SDK
run: |
cd platform/Apple/demo/iOS
./genxcodeproj.sh
cd SDK
xcodebuild -scheme ALL_BUILD ONLY_ACTIVE_ARCH=NO -configuration MinSizeRel -sdk iphoneos VALID_ARCHS="armv7 arm64"
2 changes: 1 addition & 1 deletion .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
./Genxcodeproj.sh
cd CicadaDemo
xcodebuild -workspace CicadaDemo.xcworkspace -scheme install ONLY_ACTIVE_ARCH=NO -configuration Release
xcodebuild -workspace CicadaDemo.xcworkspace -scheme CicadaDemo ONLY_ACTIVE_ARCH=NO -configuration Release
xcodebuild -workspace CicadaDemo.xcworkspace -scheme CicadaDemo ONLY_ACTIVE_ARCH=NO -configuration Release VALID_ARCHS="x86_64"
- name: build tests
Expand Down
211 changes: 211 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export CURL_GIT=https://gitee.com/mirrors/curl.git
- [2. compile Android](doc/compile_Android.md)
- [3. compile_Linux](doc/compile_Linux.md)
- [4. compile_Windows (cross compile)](doc/compile_Windows.md)
- [5. compile_MacOS](doc/compile_mac.md)
- 6.webAssembly coming soon
- [5.compile_Windows(msvc)](doc/compile_Windows_msvc.md)
- [6. compile_MacOS](doc/compile_mac.md)
- 7.webAssembly coming soon


## How to use
Expand Down
20 changes: 6 additions & 14 deletions build_player.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function build_Android(){
mkdir -p output/armeabi-v7a/
mkdir -p output/arm64-v8a/

cp platform/Android/source/premierlibrary/build/intermediates/cmake/corePlayer/release/obj/armeabi-v7a/*.so output/armeabi-v7a/
cp platform/Android/source/premierlibrary/build/intermediates/cmake/corePlayer/release/obj/arm64-v8a/*.so output/arm64-v8a/
cp platform/Android/source/premierlibrary/build/intermediates/cmake/corePlayerRelease/obj/armeabi-v7a/*.so output/armeabi-v7a/
cp platform/Android/source/premierlibrary/build/intermediates/cmake/corePlayerRelease/obj/arm64-v8a/*.so output/arm64-v8a/

cp external/install/ffmpeg/Android/armeabi-v7a/libalivcffmpeg.so output/armeabi-v7a/
cp external/install/ffmpeg/Android/arm64-v8a/libalivcffmpeg.so output/arm64-v8a/
Expand Down Expand Up @@ -171,16 +171,10 @@ function build_iOS_new(){
DEMO_SOURCE_DIR_IOS=${TOP_DIR}/platform/Apple/demo/iOS
cd ${DEMO_SOURCE_DIR_IOS}
./genxcodeproj.sh
if [[ -n "$MTL" ]];then
packet_iOS
fi
packet_iOS
}

function build_iOS(){

if [[ -n "$MTL" ]];then
export HOMEBREW_NO_AUTO_UPDATE=true
fi
check_brew

if [[ -n "$MTL" ]];then
Expand All @@ -204,11 +198,9 @@ function build_iOS(){
fi

build_iOS_new
if [[ -n "$MTL" ]];then
if [[ ! -f "${TOP_DIR}/output/CicadaPlayerSDK/SDK/ARM_SIMULATOR/CicadaPlayerSDK.framework/CicadaPlayerSDK" ]]; then
echo "CicadaPlayerSDK.framework build failed"
return 1
fi
if [[ ! -f "${TOP_DIR}/output/CicadaPlayerSDK/SDK/ARM_SIMULATOR/CicadaPlayerSDK.framework/CicadaPlayerSDK" ]]; then
echo "CicadaPlayerSDK.framework build failed"
return 1
fi
}

Expand Down
3 changes: 2 additions & 1 deletion build_tools/build_curl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ function build_curl(){
--without-libidn2 \
--without-librtmp \
--without-brotli \
--without-libidn"
--without-libidn \
--without-nghttp2"
local build_dir="${CWD}/build/curl/$1/$2"
local install_dir="${CWD}/install/curl/$1/$2"

Expand Down
59 changes: 31 additions & 28 deletions build_tools/build_iOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,32 @@ function build_fat_libs(){
}

function create_cmake_config(){
echo "cmake_minimum_required(VERSION 3.6)" >> $CONFIG_FILE
echo "set(LIB_NAME ${LIB_NAME})" >> $CONFIG_FILE
echo "find_library(SECURITY Security)" >> $CONFIG_FILE
echo "cmake_minimum_required(VERSION 3.14)" >> "$CONFIG_FILE"
echo "set(LIB_NAME ${LIB_NAME})" >> "$CONFIG_FILE"
# echo "find_library(SECURITY Security)" >> "$CONFIG_FILE"
# echo "find_library(LIBXML2 Xml2)" >> $CONFIG_FILE
echo "find_library(AUDIO_TOOL_BOX AudioToolbox)" >> $CONFIG_FILE
# echo "find_library(AUDIO_TOOL_BOX AudioToolbox)" >> "$CONFIG_FILE"
# echo "find_library(VIDEO_TOOL_BOX VideoToolbox)" >> $CONFIG_FILE
# echo "find_library(COREMEDIA CoreMedia)" >> $CONFIG_FILE
# echo "find_library(COREVIDEO CoreVideo)" >> $CONFIG_FILE
# echo "find_library(COREFOUNDATION CoreFoundation)" >> $CONFIG_FILE
echo -n "set(SRC_LIBRARIES ${SRC_LIBRARIES}" >> $CONFIG_FILE
if [[ "${SSL_USE_NATIVE}" == "TRUE" ]];then
echo -n ' ${SECURITY}' >> $CONFIG_FILE
fi
echo -n "set(SRC_LIBRARIES ${SRC_LIBRARIES}" >> "$CONFIG_FILE"
# if [[ "${SSL_USE_NATIVE}" == "TRUE" ]];then
# echo -n ' ${SECURITY}' >> "$CONFIG_FILE"
# fi
if [[ "${XML_USE_NATIVE}" == "TRUE" ]];then
echo -n ' xml2' >> $CONFIG_FILE
echo -n ' xml2' >> "$CONFIG_FILE"
fi
echo -n ' ${AUDIO_TOOL_BOX}' >> $CONFIG_FILE
# echo -n ' ${AUDIO_TOOL_BOX}' >> "$CONFIG_FILE"
# echo -n ' ${VIDEO_TOOL_BOX}' >> $CONFIG_FILE
# echo -n ' ${COREMEDIA}' >> $CONFIG_FILE
# echo -n ' ${COREVIDEO}' >> $CONFIG_FILE
# echo -n ' ${COREFOUNDATION}' >> $CONFIG_FILE
echo ")" >> $CONFIG_FILE
echo "set(SRC_LIBRARIES_DIR ${SRC_LIBRARIES_DIR})" >>$CONFIG_FILE
echo ")" >> "$CONFIG_FILE"
echo "set(SRC_LIBRARIES_DIR ${SRC_LIBRARIES_DIR})" >>"$CONFIG_FILE"
echo -n "set(LINK_FRAMEWORKS " >> "$CONFIG_FILE"
echo -n '"-framework Security -framework AudioToolbox"' >> "$CONFIG_FILE"
echo ")" >> "$CONFIG_FILE"
}
#build to ffmpeg
function build_shared_framework(){
Expand Down Expand Up @@ -115,22 +118,22 @@ function build_shared_framework(){

cp ${BUILD_TOOLS_DIR}/src/build_version.cpp ./
sh ${BUILD_TOOLS_DIR}/gen_build_version.sh > version.h
rm -rf Xcode/
mkdir -p Xcode/OS
cd Xcode/OS
cmake -DCMAKE_TOOLCHAIN_FILE=${BUILD_TOOLS_DIR}/iOS/iOS.cmake \
-DIOS_PLATFORM=OS ../../ \
-G Xcode
xcodebuild -destination generic/platform=iOS -configuration MinSizeRel -target ALL_BUILD

cd -
mkdir -p Xcode/SIMULATOR64
cd Xcode/SIMULATOR64
cmake -DCMAKE_TOOLCHAIN_FILE=${BUILD_TOOLS_DIR}/iOS/iOS.cmake \
-DIOS_PLATFORM=SIMULATOR64 ../../ \
-G Xcode

xcodebuild -destination "platform=iOS Simulator" -configuration MinSizeRel -target ALL_BUILD
# rm -rf Xcode/
# mkdir -p Xcode/OS
# cd Xcode/OS
# cmake -DCMAKE_TOOLCHAIN_FILE=${BUILD_TOOLS_DIR}/iOS/iOS.cmake \
# -DIOS_PLATFORM=OS ../../ \
# -G Xcode
# xcodebuild -destination generic/platform=iOS -configuration MinSizeRel -target ALL_BUILD
#
# cd -
# mkdir -p Xcode/SIMULATOR64
# cd Xcode/SIMULATOR64
# cmake -DCMAKE_TOOLCHAIN_FILE=${BUILD_TOOLS_DIR}/iOS/iOS.cmake \
# -DIOS_PLATFORM=SIMULATOR64 ../../ \
# -G Xcode
#
# xcodebuild -destination "platform=iOS Simulator" -configuration MinSizeRel -target ALL_BUILD

return;
}
Expand Down
2 changes: 2 additions & 0 deletions build_tools/iOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set_target_properties(${LIB_NAME} PROPERTIES
# MACOSX_FRAMEWORK_INFO_PLIST Info.plist
# PUBLIC_HEADER dynamicFramework.h
# XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] arm64
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS YES
XCODE_ATTRIBUTE_ENABLE_BITCODE "YES"
XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode
Expand Down Expand Up @@ -69,3 +70,4 @@ endif ()
# set_xcode_property(${LIB_NAME} BITCODE_GENERATION_MODE bitcode)
#endif ()
target_link_libraries(${LIB_NAME} PRIVATE ${LIBRARYS})
target_link_libraries(${LIB_NAME} PUBLIC "${LINK_FRAMEWORKS}")
6 changes: 6 additions & 0 deletions cmdline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ endif ()
target_link_libraries(cicadaPlayer PRIVATE
framework_filter
framework_utils
framework_drm
avfilter
avformat
avcodec
swresample
swscale
avutil
${FRAMEWORK_LIBS})
if (NOT MSVC)
Expand Down Expand Up @@ -101,11 +103,15 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif ()

if (APPLE)
find_library(AVFOUNDATION AVFoundation)
find_library(QUARTZCORE QuartzCore)
target_link_libraries(
cicadaPlayer PUBLIC
iconv
bz2
${FRAMEWORK_LIBS}
${AVFOUNDATION}
${QUARTZCORE}
)
elseif (MSVC)
else ()
Expand Down
11 changes: 9 additions & 2 deletions cmdline/cicadaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
using namespace Cicada;
using namespace std;

#include "NetWorkEventReceiver.h"
#include "SDLEventReceiver.h"
#include "cicadaEventListener.h"
#include "NetWorkEventReceiver.h"
#include <utils/frame_work_log.h>

#include <media_player_error_def.h>

Expand Down Expand Up @@ -50,6 +51,11 @@ static void onPrepared(void *userData)
cont->player->Start();
}

static void currentDownLoadSpeed(int64_t speed, void *userData)
{
AF_LOGD("current speed is %f kbps\n", (float) speed / 1024);
}

static void onEvent(int64_t errorCode, const void *errorMsg, void *userData)
{
auto *cont = static_cast<cicadaCont *>(userData);
Expand All @@ -72,7 +78,7 @@ static void onEvent(int64_t errorCode, const void *errorMsg, void *userData)
msg.deleteItem("content");
msg.addValue("content", "hi");
msg.addValue("cmd", 0);
cont->player->InvokeComponent(msg.printJSON());
cont->player->InvokeComponent(msg.printJSON().c_str());
}
break;
}
Expand Down Expand Up @@ -130,6 +136,7 @@ int main(int argc, char *argv[])
pListener.EventCallback = onEvent;
pListener.ErrorCallback = onError;
pListener.Prepared = onPrepared;
pListener.CurrentDownLoadSpeed = currentDownLoadSpeed;
cicadaEventListener eListener(player.get());
#ifdef ENABLE_SDL
SDLEventReceiver receiver(eListener);
Expand Down
1 change: 1 addition & 0 deletions cmdline/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ endif ()
target_link_libraries(syncPlayer PRIVATE
framework_filter
framework_utils
framework_drm
avfilter
avformat
avcodec
Expand Down
1 change: 1 addition & 0 deletions cmdline/example/syncPlayer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <MediaPlayer.h>
#include <memory>
#include <utils/frame_work_log.h>
#include <utils/timer.h>

using namespace Cicada;
Expand Down
5 changes: 5 additions & 0 deletions external/build_external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ if [[ -f "${CICADA_FFMPEG_CONFIG_FILE}" ]]; then
cp "${CICADA_FFMPEG_CONFIG_FILE}" ./
fi

if [[ -f "${CICADA_GIT_SOURCE_LIST_FILE}" ]]; then
rm player_git_source_list.sh
cp "${CICADA_GIT_SOURCE_LIST_FILE}" ./
fi

mkdir external
cd external
load_source
Expand Down
6 changes: 3 additions & 3 deletions external/player_ffmpeg_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ function dav1d_decoder_prebuilt() {
}

ffmpeg_config_add_decoders aac aac_latm h264 hevc mpeg4 mp3 mp3adu mp3float mp3on4float mp3adufloat mp3on4 pcm_s16le ac3_at eac3_at
ffmpeg_config_add_demuxers flv aac live_flv webvtt mov mp3 mpegts matroska h264
ffmpeg_config_add_demuxers flv aac live_flv webvtt srt mov mp3 mpegts matroska h264 ac3 eac3
ffmpeg_config_add_muxers mp4 adts mpegts
ffmpeg_config_add_parsers aac h264 hevc aac_latm ac3
ffmpeg_config_add_bsfs aac_adtstoasc h264_mp4toannexb hevc_mp4toannexb extract_extradata
ffmpeg_config_add_protocols file crypto rtmp
ffmpeg_config_add_filters atempo aresample aformat volume


ffmpeg_config_add_user "--enable-libxml2"
ffmpeg_config_add_demuxers dash
#ffmpeg_config_add_user "--enable-libxml2"
#ffmpeg_config_add_demuxers dash

#for ffmpeg concat demuxer
ffmpeg_config_add_demuxers concat
Expand Down
8 changes: 4 additions & 4 deletions external/player_git_source_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ fi
CURL_BRANCH="curl-7_63_0"
clone_git $CURL_GIT "$CURL_BRANCH"

if [[ -z "${LIBXML2_GIT}" ]];then
LIBXML2_GIT="https://github.com/GNOME/libxml2.git"
fi
LIBXML2_BRANCH="v2.9.9"
#if [[ -z "${LIBXML2_GIT}" ]];then
# LIBXML2_GIT="https://github.com/GNOME/libxml2.git"
#fi
#LIBXML2_BRANCH="v2.9.9"
clone_git ${LIBXML2_GIT} "$LIBXML2_BRANCH"

if [[ -z "${DAV1D_EXTERNAL_DIR}" ]];then
Expand Down
6 changes: 6 additions & 0 deletions framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ if ($ENV{VERSION})
endif ()

include(module_config.cmake)
message("CICADA_FRAMEWORK_MODULE_CONFIG_FILE is $ENV{CICADA_FRAMEWORK_MODULE_CONFIG_FILE}")
if(DEFINED ENV{CICADA_FRAMEWORK_MODULE_CONFIG_FILE})
include("$ENV{CICADA_FRAMEWORK_MODULE_CONFIG_FILE}" OPTIONAL)
endif()

add_subdirectory(demuxer)
add_subdirectory(codec)
add_subdirectory(utils)
add_subdirectory(filter)
add_subdirectory(render)
add_subdirectory(drm)
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
else ()
add_subdirectory(communication)
Expand Down
2 changes: 1 addition & 1 deletion framework/Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(COMMON_INC_DIR ${COMMON_INC_DIR}
${PROJECT_SOURCE_DIR})


set(FFMPEG_SOURCE_DIR ${TOPDIR}/external/external/ffmpeg/)
set(FFMPEG_SOURCE_DIR ${INSTALL_DIR}/../external/ffmpeg/)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=return-type")
Expand Down
Loading

0 comments on commit 40bdb91

Please sign in to comment.