ENABLE_MEDIAFILE宏拆分为ENABLE_HLS和ENABLE_MP4V2

This commit is contained in:
xiongziliang 2017-05-02 17:07:02 +08:00
parent 810bb71e21
commit bf9b575569
21 changed files with 97 additions and 104 deletions

View File

@ -124,10 +124,11 @@
<listOptionValue builtIn="false" value="../../ZLToolKit/src"/> <listOptionValue builtIn="false" value="../../ZLToolKit/src"/>
</option> </option>
<option id="gnu.cpp.compiler.option.preprocessor.def.863813077" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols"> <option id="gnu.cpp.compiler.option.preprocessor.def.863813077" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="ENABLE_FAAC"/>
<listOptionValue builtIn="false" value="ENABLE_RTSP2RTMP"/> <listOptionValue builtIn="false" value="ENABLE_RTSP2RTMP"/>
<listOptionValue builtIn="false" value="ENABLE_RTMP2RTSP"/> <listOptionValue builtIn="false" value="ENABLE_RTMP2RTSP"/>
<listOptionValue builtIn="false" value="ENABLE_MEDIAFILE"/> <listOptionValue builtIn="false" value="ENABLE_HLS"/>
<listOptionValue builtIn="false" value="ENABLE_MP4V2"/>
<listOptionValue builtIn="false" value="ENABLE_FAAC"/>
<listOptionValue builtIn="false" value="ENABLE_X264"/> <listOptionValue builtIn="false" value="ENABLE_X264"/>
</option> </option>
<option id="gnu.cpp.compiler.option.other.pic.198751626" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="gnu.cpp.compiler.option.other.pic.198751626" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>

View File

@ -20,7 +20,7 @@ CPP_DEPS += \
src/Codec/%.o: ../src/Codec/%.cpp src/Codec/%.o: ../src/Codec/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -23,7 +23,7 @@ CPP_DEPS += \
src/Device/%.o: ../src/Device/%.cpp src/Device/%.o: ../src/Device/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -36,7 +36,7 @@ CPP_DEPS += \
src/H264/%.o: ../src/H264/%.cpp src/H264/%.o: ../src/H264/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -20,7 +20,7 @@ CPP_DEPS += \
src/Http/%.o: ../src/Http/%.cpp src/Http/%.o: ../src/Http/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -1,24 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/MedaiFile/CRC/crc32.cpp
OBJS += \
./src/MedaiFile/CRC/crc32.o
CPP_DEPS += \
./src/MedaiFile/CRC/crc32.d
# Each subdirectory must supply rules for building sources it contributes
src/MedaiFile/CRC/%.o: ../src/MedaiFile/CRC/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

View File

@ -1,36 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/MedaiFile/HLSMaker.cpp \
../src/MedaiFile/MediaReader.cpp \
../src/MedaiFile/MediaRecorder.cpp \
../src/MedaiFile/Mp4Maker.cpp \
../src/MedaiFile/TSMaker.cpp
OBJS += \
./src/MedaiFile/HLSMaker.o \
./src/MedaiFile/MediaReader.o \
./src/MedaiFile/MediaRecorder.o \
./src/MedaiFile/Mp4Maker.o \
./src/MedaiFile/TSMaker.o
CPP_DEPS += \
./src/MedaiFile/HLSMaker.d \
./src/MedaiFile/MediaReader.d \
./src/MedaiFile/MediaRecorder.d \
./src/MedaiFile/Mp4Maker.d \
./src/MedaiFile/TSMaker.d
# Each subdirectory must supply rules for building sources it contributes
src/MedaiFile/%.o: ../src/MedaiFile/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

View File

@ -0,0 +1,39 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/MediaFile/HLSMaker.cpp \
../src/MediaFile/MediaReader.cpp \
../src/MediaFile/MediaRecorder.cpp \
../src/MediaFile/Mp4Maker.cpp \
../src/MediaFile/TSMaker.cpp \
../src/MediaFile/crc32.cpp
OBJS += \
./src/MediaFile/HLSMaker.o \
./src/MediaFile/MediaReader.o \
./src/MediaFile/MediaRecorder.o \
./src/MediaFile/Mp4Maker.o \
./src/MediaFile/TSMaker.o \
./src/MediaFile/crc32.o
CPP_DEPS += \
./src/MediaFile/HLSMaker.d \
./src/MediaFile/MediaReader.d \
./src/MediaFile/MediaRecorder.d \
./src/MediaFile/Mp4Maker.d \
./src/MediaFile/TSMaker.d \
./src/MediaFile/crc32.d
# Each subdirectory must supply rules for building sources it contributes
src/MediaFile/%.o: ../src/MediaFile/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

View File

@ -23,7 +23,7 @@ CPP_DEPS += \
src/Player/%.o: ../src/Player/%.cpp src/Player/%.o: ../src/Player/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -20,7 +20,7 @@ CPP_DEPS += \
src/RTP/%.o: ../src/RTP/%.cpp src/RTP/%.o: ../src/RTP/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -44,7 +44,7 @@ CPP_DEPS += \
src/Rtmp/%.o: ../src/Rtmp/%.cpp src/Rtmp/%.o: ../src/Rtmp/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -41,7 +41,7 @@ CPP_DEPS += \
src/Rtsp/%.o: ../src/Rtsp/%.cpp src/Rtsp/%.o: ../src/Rtsp/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -20,7 +20,7 @@ CPP_DEPS += \
src/Shell/%.o: ../src/Shell/%.cpp src/Shell/%.o: ../src/Shell/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -17,7 +17,7 @@ CPP_DEPS += \
src/%.o: ../src/%.cpp src/%.o: ../src/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -20,7 +20,7 @@ CPP_DEPS += \
test/%.o: ../test/%.cpp test/%.o: ../test/%.cpp
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: Cross G++ Compiler' @echo 'Invoking: Cross G++ Compiler'
g++ -std=c++1y -DENABLE_FAAC -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_MEDIAFILE -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" g++ -std=c++1y -DENABLE_RTSP2RTMP -DENABLE_RTMP2RTSP -DENABLE_HLS -DENABLE_MP4V2 -DENABLE_FAAC -DENABLE_X264 -I"/home/xzl/git/ZLMediaKit/src" -I../../ZLToolKit/src -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<' @echo 'Finished building: $<'
@echo ' ' @echo ' '

View File

@ -16,7 +16,7 @@ using namespace ZL::Util;
namespace ZL { namespace ZL {
namespace MediaFile { namespace MediaFile {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
MediaReader::MediaReader(const string &strApp, const string &strId) { MediaReader::MediaReader(const string &strApp, const string &strId) {
static string recordPath = mINI::Instance()[Config::Record::kFilePath]; static string recordPath = mINI::Instance()[Config::Record::kFilePath];
auto strFileName = recordPath + "/" + strApp + "/" + strId; auto strFileName = recordPath + "/" + strApp + "/" + strId;
@ -301,10 +301,10 @@ void MediaReader::seek(int iSeekTime,bool bReStart){
} }
} }
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
RtspMediaSource::Ptr MediaReader::onMakeRtsp(const string &strApp, const string &strId) { RtspMediaSource::Ptr MediaReader::onMakeRtsp(const string &strApp, const string &strId) {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
static string appName = mINI::Instance()[Config::Record::kAppName]; static string appName = mINI::Instance()[Config::Record::kAppName];
if (strApp != appName) { if (strApp != appName) {
return nullptr; return nullptr;
@ -319,12 +319,12 @@ RtspMediaSource::Ptr MediaReader::onMakeRtsp(const string &strApp, const string
} }
#else #else
return nullptr; return nullptr;
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
} }
RtmpMediaSource::Ptr MediaReader::onMakeRtmp(const string &strApp, const string &strId) { RtmpMediaSource::Ptr MediaReader::onMakeRtmp(const string &strApp, const string &strId) {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
static string appName = mINI::Instance()[Config::Record::kAppName]; static string appName = mINI::Instance()[Config::Record::kAppName];
if (strApp != appName) { if (strApp != appName) {
return nullptr; return nullptr;
@ -339,7 +339,7 @@ RtmpMediaSource::Ptr MediaReader::onMakeRtmp(const string &strApp, const string
} }
#else #else
return nullptr; return nullptr;
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
} }

View File

@ -12,9 +12,9 @@
#include "Rtsp/RtspMediaSource.h" #include "Rtsp/RtspMediaSource.h"
#include "Rtmp/RtmpMediaSource.h" #include "Rtmp/RtmpMediaSource.h"
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
#include <mp4v2/mp4v2.h> #include <mp4v2/mp4v2.h>
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
using namespace ZL::DEV; using namespace ZL::DEV;
using namespace ZL::Rtsp; using namespace ZL::Rtsp;
@ -32,7 +32,7 @@ public:
static RtmpMediaSource::Ptr onMakeRtmp(const string &strApp, const string &strId); static RtmpMediaSource::Ptr onMakeRtmp(const string &strApp, const string &strId);
private: private:
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
MP4FileHandle m_hMP4File = MP4_INVALID_FILE_HANDLE; MP4FileHandle m_hMP4File = MP4_INVALID_FILE_HANDLE;
MP4TrackId m_video_trId = MP4_INVALID_TRACK_ID; MP4TrackId m_video_trId = MP4_INVALID_TRACK_ID;
uint32_t m_video_ms = 0; uint32_t m_video_ms = 0;
@ -76,7 +76,7 @@ private:
inline bool readAudioSample(int iTimeInc = 0); inline bool readAudioSample(int iTimeInc = 0);
inline void writeH264(uint8_t *pucData,int iLen,uint32_t uiStamp); inline void writeH264(uint8_t *pucData,int iLen,uint32_t uiStamp);
inline void writeAAC(uint8_t *pucData,int iLen,uint32_t uiStamp); inline void writeAAC(uint8_t *pucData,int iLen,uint32_t uiStamp);
#endif #endif //ENABLE_MP4V2
}; };
} /* namespace MediaFile */ } /* namespace MediaFile */

View File

@ -19,42 +19,47 @@ namespace ZL {
namespace MediaFile { namespace MediaFile {
MediaRecorder::MediaRecorder(const string &strApp,const string &strId,const std::shared_ptr<PlayerBase> &pPlayer) { MediaRecorder::MediaRecorder(const string &strApp,const string &strId,const std::shared_ptr<PlayerBase> &pPlayer) {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_HLS
static string hlsPrefix = mINI::Instance()[Config::Http::kHttpPrefix]; static string hlsPrefix = mINI::Instance()[Config::Http::kHttpPrefix];
static string hlsPath = mINI::Instance()[Config::Hls::kFilePath]; static string hlsPath = mINI::Instance()[Config::Hls::kFilePath];
static uint32_t hlsBufSize = mINI::Instance()[Config::Hls::kFileBufSize].as<uint32_t>(); static uint32_t hlsBufSize = mINI::Instance()[Config::Hls::kFileBufSize].as<uint32_t>();
static uint32_t hlsDuration = mINI::Instance()[Config::Hls::kSegmentDuration].as<uint32_t>(); static uint32_t hlsDuration = mINI::Instance()[Config::Hls::kSegmentDuration].as<uint32_t>();
static uint32_t hlsNum = mINI::Instance()[Config::Hls::kSegmentNum].as<uint32_t>(); static uint32_t hlsNum = mINI::Instance()[Config::Hls::kSegmentNum].as<uint32_t>();
static string recordPath = mINI::Instance()[Config::Record::kFilePath];
static string recordAppName = mINI::Instance()[Config::Record::kAppName];
m_hlsMaker.reset(new HLSMaker(hlsPath + "/" + strApp + "/" + strId + "/hls.m3u8", m_hlsMaker.reset(new HLSMaker(hlsPath + "/" + strApp + "/" + strId + "/hls.m3u8",
hlsPrefix + "/" + strApp + "/" + strId + "/", hlsPrefix + "/" + strApp + "/" + strId + "/",
hlsBufSize,hlsDuration,hlsNum)); hlsBufSize,hlsDuration,hlsNum));
#endif //ENABLE_HLS
#ifdef ENABLE_MP4V2
static string recordPath = mINI::Instance()[Config::Record::kFilePath];
static string recordAppName = mINI::Instance()[Config::Record::kAppName];
m_mp4Maker.reset(new Mp4Maker(recordPath + "/" + recordAppName + "/" + strApp + "/" + strId + "/", m_mp4Maker.reset(new Mp4Maker(recordPath + "/" + recordAppName + "/" + strApp + "/" + strId + "/",
strApp,strId,pPlayer)); strApp,strId,pPlayer));
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
} }
MediaRecorder::~MediaRecorder() { MediaRecorder::~MediaRecorder() {
} }
void MediaRecorder::inputH264(void* pData, uint32_t ui32Length, uint32_t ui32TimeStamp, int iType) { void MediaRecorder::inputH264(void* pData, uint32_t ui32Length, uint32_t ui32TimeStamp, int iType) {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_HLS
m_hlsMaker->inputH264(pData, ui32Length, ui32TimeStamp * 90, iType); m_hlsMaker->inputH264(pData, ui32Length, ui32TimeStamp * 90, iType);
m_mp4Maker->inputH264(pData, ui32Length, ui32TimeStamp, iType); #endif //ENABLE_HLS
#endif //ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
m_mp4Maker->inputH264(pData, ui32Length, ui32TimeStamp, iType);
#endif //ENABLE_MP4V2
} }
void MediaRecorder::inputAAC(void* pData, uint32_t ui32Length, uint32_t ui32TimeStamp) { void MediaRecorder::inputAAC(void* pData, uint32_t ui32Length, uint32_t ui32TimeStamp) {
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_HLS
m_hlsMaker->inputAAC(pData, ui32Length, ui32TimeStamp * 90); m_hlsMaker->inputAAC(pData, ui32Length, ui32TimeStamp * 90);
#endif //ENABLE_HLS
#ifdef ENABLE_MP4V2
m_mp4Maker->inputAAC(pData, ui32Length, ui32TimeStamp); m_mp4Maker->inputAAC(pData, ui32Length, ui32TimeStamp);
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
} }
} /* namespace MediaFile */ } /* namespace MediaFile */

View File

@ -10,10 +10,14 @@
#include <memory> #include <memory>
#include "Player/PlayerBase.h" #include "Player/PlayerBase.h"
#ifdef ENABLE_MEDIAFILE
#ifdef ENABLE_MP4V2
#include "Mp4Maker.h" #include "Mp4Maker.h"
#endif //ENABLE_MP4V2
#ifdef ENABLE_HLS
#include "HLSMaker.h" #include "HLSMaker.h"
#endif //ENABLE_MEDIAFILE #endif //ENABLE_HLS
using namespace std; using namespace std;
using namespace ZL::Player; using namespace ZL::Player;
@ -37,10 +41,14 @@ public:
uint32_t ui32Length, uint32_t ui32Length,
uint32_t ui32TimeStamp); uint32_t ui32TimeStamp);
private: private:
#ifdef ENABLE_MEDIAFILE
#ifdef ENABLE_HLS
std::shared_ptr<HLSMaker> m_hlsMaker; std::shared_ptr<HLSMaker> m_hlsMaker;
#endif //ENABLE_HLS
#ifdef ENABLE_MP4V2
std::shared_ptr<Mp4Maker> m_mp4Maker; std::shared_ptr<Mp4Maker> m_mp4Maker;
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2
}; };

View File

@ -1,5 +1,5 @@
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -187,4 +187,4 @@ void Mp4Maker::closeFile() {
} /* namespace ZL */ } /* namespace ZL */
#endif //ENABLE_MEDIAFILE #endif //ENABLE_MP4V2

View File

@ -8,7 +8,7 @@
#ifndef MP4MAKER_H_ #ifndef MP4MAKER_H_
#define MP4MAKER_H_ #define MP4MAKER_H_
#ifdef ENABLE_MEDIAFILE #ifdef ENABLE_MP4V2
#include <mutex> #include <mutex>
#include <memory> #include <memory>
@ -77,6 +77,6 @@ private:
} /* namespace MediaFile */ } /* namespace MediaFile */
} /* namespace ZL */ } /* namespace ZL */
#endif ///ENABLE_MEDIAFILE #endif ///ENABLE_MP4V2
#endif /* MP4MAKER_H_ */ #endif /* MP4MAKER_H_ */