Skip to content

metaRTC Mac iOS Programming Guide

yangrtc edited this page Jan 5, 2026 · 1 revision

Library Compilation

iOS Compilation

sh cmake_lib_ios.sh

#cmake_lib_ios.sh
yang_main_os=7
yang_main_bit=64
yang_main_pic=0

cd libyangutil8
./cmake_build.sh ${yang_main_os} ${yang_main_bit} ${yang_main_pic}
cd ../libmetartccore8
./cmake_build.sh ${yang_main_os} ${yang_main_bit} ${yang_main_pic}
cd ../libyangwhip8
./cmake_build.sh ${yang_main_os} ${yang_main_bit} ${yang_main_pic}
cd ../libmetartc8
./cmake_build.sh ${yang_main_os} ${yang_main_bit} ${yang_main_pic}

Mac Compilation

#cmake arch

SET(CMAKE_C_COMPILER /usr/bin/clang)
SET(CMAKE_CXX_COMPILER /usr/bin/clang++)

#Compiler settings

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#macOS/Xcode specific settings
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    target_compile_options(mylib PRIVATE
       -Wdocumentation
        -Wdeprecated
    )
 
endif()

Demo Compilation

demo/metapushstream8 and demo/metaplayer8
Streaming demo metapushstream8

Open the file CMakeLists.txt in Qt. On macOS, you need to use CMake to compile.

MAC/iOS Video Encoding and Decoding

Video Encoding

    if(videoInfo->videoEncHwType==0){//software encoding
 
	    if (vcodec == Yang_VED_H264){
#if Yang_Enable_Openh264
	        return new YangOpenH264Encoder();
#else
	        return  new YangH264EncoderSoft();
#endif
        }else if (vcodec == Yang_VED_H265){
	        return new YangH265EncoderSoft();
       }
    }else{//hardware encoding
        //videoToolBox
        return new YangVideoEncoderMac();
 
    }

Video Decoding

   if(videoInfo->videoDecHwType==0){//software decoding
#if	Yang_Enable_H264Decoder
        return new YangH264DecoderSoft();
#else
        return new YangVideoDecoderFfmpeg(videoInfo,vcodec);
#endif
   }else{//hardware decoding
        return new YangVideoDecoderMac();
   }

Clone this wiki locally