├── .gitignore ├── Makefile ├── README.md ├── capture_and_encoding.cpp ├── capture_and_encoding.h ├── imp-common.c ├── imp-common.h ├── include ├── imp_sys │ ├── imp │ │ ├── imp_audio.h │ │ ├── imp_common.h │ │ ├── imp_decoder.h │ │ ├── imp_encoder.h │ │ ├── imp_encoder_t31.h │ │ ├── imp_framesource.h │ │ ├── imp_isp.h │ │ ├── imp_ivs.h │ │ ├── imp_ivs_base_move.h │ │ ├── imp_ivs_move.h │ │ ├── imp_log.h │ │ ├── imp_osd.h │ │ ├── imp_system.h │ │ └── imp_utils.h │ └── sysutils │ │ ├── su_adc.h │ │ ├── su_base.h │ │ ├── su_battery.h │ │ ├── su_cipher.h │ │ └── su_misc.h └── live555 │ ├── basicUsageEnvironment │ ├── BasicHashTable.hh │ ├── BasicUsageEnvironment.hh │ ├── BasicUsageEnvironment0.hh │ ├── BasicUsageEnvironment_version.hh │ ├── DelayQueue.hh │ └── HandlerSet.hh │ ├── groupsock │ ├── GroupEId.hh │ ├── Groupsock.hh │ ├── GroupsockHelper.hh │ ├── IOHandlers.hh │ ├── NetAddress.hh │ ├── NetCommon.h │ ├── NetInterface.hh │ ├── TunnelEncaps.hh │ └── groupsock_version.hh │ ├── liveMedia │ ├── AC3AudioFileServerMediaSubsession.hh │ ├── AC3AudioRTPSink.hh │ ├── AC3AudioRTPSource.hh │ ├── AC3AudioStreamFramer.hh │ ├── ADTSAudioFileServerMediaSubsession.hh │ ├── ADTSAudioFileSource.hh │ ├── AMRAudioFileServerMediaSubsession.hh │ ├── AMRAudioFileSink.hh │ ├── AMRAudioFileSource.hh │ ├── AMRAudioRTPSink.hh │ ├── AMRAudioRTPSource.hh │ ├── AMRAudioSource.hh │ ├── AVIFileSink.hh │ ├── AudioInputDevice.hh │ ├── AudioRTPSink.hh │ ├── Base64.hh │ ├── BasicUDPSink.hh │ ├── BasicUDPSource.hh │ ├── BitVector.hh │ ├── ByteStreamFileSource.hh │ ├── ByteStreamMemoryBufferSource.hh │ ├── ByteStreamMultiFileSource.hh │ ├── DVVideoFileServerMediaSubsession.hh │ ├── DVVideoRTPSink.hh │ ├── DVVideoRTPSource.hh │ ├── DVVideoStreamFramer.hh │ ├── DeviceSource.hh │ ├── DigestAuthentication.hh │ ├── FileServerMediaSubsession.hh │ ├── FileSink.hh │ ├── FramedFileSource.hh │ ├── FramedFilter.hh │ ├── FramedSource.hh │ ├── GSMAudioRTPSink.hh │ ├── GenericMediaServer.hh │ ├── H261VideoRTPSource.hh │ ├── H263plusVideoFileServerMediaSubsession.hh │ ├── H263plusVideoRTPSink.hh │ ├── H263plusVideoRTPSource.hh │ ├── H263plusVideoStreamFramer.hh │ ├── H264VideoFileServerMediaSubsession.hh │ ├── H264VideoFileSink.hh │ ├── H264VideoRTPSink.hh │ ├── H264VideoRTPSource.hh │ ├── H264VideoStreamDiscreteFramer.hh │ ├── H264VideoStreamFramer.hh │ ├── H264or5VideoFileSink.hh │ ├── H264or5VideoRTPSink.hh │ ├── H264or5VideoStreamDiscreteFramer.hh │ ├── H264or5VideoStreamFramer.hh │ ├── H265VideoFileServerMediaSubsession.hh │ ├── H265VideoFileSink.hh │ ├── H265VideoRTPSink.hh │ ├── H265VideoRTPSource.hh │ ├── H265VideoStreamDiscreteFramer.hh │ ├── H265VideoStreamFramer.hh │ ├── InputFile.hh │ ├── JPEGVideoRTPSink.hh │ ├── JPEGVideoRTPSource.hh │ ├── JPEGVideoSource.hh │ ├── Locale.hh │ ├── MP3ADU.hh │ ├── MP3ADURTPSink.hh │ ├── MP3ADURTPSource.hh │ ├── MP3ADUTranscoder.hh │ ├── MP3ADUinterleaving.hh │ ├── MP3AudioFileServerMediaSubsession.hh │ ├── MP3FileSource.hh │ ├── MP3Transcoder.hh │ ├── MPEG1or2AudioRTPSink.hh │ ├── MPEG1or2AudioRTPSource.hh │ ├── MPEG1or2AudioStreamFramer.hh │ ├── MPEG1or2Demux.hh │ ├── MPEG1or2DemuxedElementaryStream.hh │ ├── MPEG1or2DemuxedServerMediaSubsession.hh │ ├── MPEG1or2FileServerDemux.hh │ ├── MPEG1or2VideoFileServerMediaSubsession.hh │ ├── MPEG1or2VideoRTPSink.hh │ ├── MPEG1or2VideoRTPSource.hh │ ├── MPEG1or2VideoStreamDiscreteFramer.hh │ ├── MPEG1or2VideoStreamFramer.hh │ ├── MPEG2IndexFromTransportStream.hh │ ├── MPEG2TransportFileServerMediaSubsession.hh │ ├── MPEG2TransportStreamAccumulator.hh │ ├── MPEG2TransportStreamFramer.hh │ ├── MPEG2TransportStreamFromESSource.hh │ ├── MPEG2TransportStreamFromPESSource.hh │ ├── MPEG2TransportStreamIndexFile.hh │ ├── MPEG2TransportStreamMultiplexor.hh │ ├── MPEG2TransportStreamTrickModeFilter.hh │ ├── MPEG2TransportUDPServerMediaSubsession.hh │ ├── MPEG4ESVideoRTPSink.hh │ ├── MPEG4ESVideoRTPSource.hh │ ├── MPEG4GenericRTPSink.hh │ ├── MPEG4GenericRTPSource.hh │ ├── MPEG4LATMAudioRTPSink.hh │ ├── MPEG4LATMAudioRTPSource.hh │ ├── MPEG4VideoFileServerMediaSubsession.hh │ ├── MPEG4VideoStreamDiscreteFramer.hh │ ├── MPEG4VideoStreamFramer.hh │ ├── MPEGVideoStreamFramer.hh │ ├── MatroskaFile.hh │ ├── MatroskaFileServerDemux.hh │ ├── Media.hh │ ├── MediaSession.hh │ ├── MediaSink.hh │ ├── MediaSource.hh │ ├── MediaTranscodingTable.hh │ ├── MultiFramedRTPSink.hh │ ├── MultiFramedRTPSource.hh │ ├── OggFile.hh │ ├── OggFileServerDemux.hh │ ├── OggFileSink.hh │ ├── OnDemandServerMediaSubsession.hh │ ├── OutputFile.hh │ ├── PassiveServerMediaSubsession.hh │ ├── ProxyServerMediaSession.hh │ ├── ProxyServerMediaSession.hh.orig │ ├── QCELPAudioRTPSource.hh │ ├── QuickTimeFileSink.hh │ ├── QuickTimeGenericRTPSource.hh │ ├── RTCP.hh │ ├── RTPInterface.hh │ ├── RTPSink.hh │ ├── RTPSource.hh │ ├── RTSPClient.hh │ ├── RTSPCommon.hh │ ├── RTSPRegisterSender.hh │ ├── RTSPServer.hh │ ├── RTSPServerSupportingHTTPStreaming.hh │ ├── SIPClient.hh │ ├── ServerMediaSession.hh │ ├── SimpleRTPSink.hh │ ├── SimpleRTPSource.hh │ ├── StreamReplicator.hh │ ├── T140TextRTPSink.hh │ ├── TCPStreamSink.hh │ ├── TextRTPSink.hh │ ├── TheoraVideoRTPSink.hh │ ├── TheoraVideoRTPSource.hh │ ├── VP8VideoRTPSink.hh │ ├── VP8VideoRTPSource.hh │ ├── VP9VideoRTPSink.hh │ ├── VP9VideoRTPSource.hh │ ├── VideoRTPSink.hh │ ├── VorbisAudioRTPSink.hh │ ├── VorbisAudioRTPSource.hh │ ├── WAVAudioFileServerMediaSubsession.hh │ ├── WAVAudioFileSource.hh │ ├── liveMedia.hh │ ├── liveMedia_version.hh │ ├── ourMD5.hh │ └── uLawAudioFilter.hh │ └── usageEnvironment │ ├── Boolean.hh │ ├── HashTable.hh │ ├── UsageEnvironment.hh │ ├── UsageEnvironment_version.hh │ └── strDup.hh ├── lib ├── imp_sys │ ├── glibc │ │ ├── libalog.a │ │ ├── libalog.so │ │ ├── libaudioProcess.so │ │ ├── libimp.a │ │ ├── libimp.so │ │ ├── libsysutils.a │ │ └── libsysutils.so │ └── uclibc │ │ ├── libalog.a │ │ ├── libalog.so │ │ ├── libaudioProcess.so │ │ ├── libimp.a │ │ ├── libimp.so │ │ ├── libsysutils.a │ │ ├── libsysutils.so │ │ └── t31 │ │ └── libimp.so └── livelib │ ├── libBasicUsageEnvironment.a │ ├── libUsageEnvironment.a │ ├── libgroupsock.a │ └── libliveMedia.a ├── logodata_100x100_bgra.h ├── on_demand_rtsp_server.cpp ├── pwm.c ├── pwm.h └── version.tpl.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | version.h 3 | t20-rtspd 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | INCLUDES = -I./include/live555/usageEnvironment/ -I./include/live555/groupsock/ \ 2 | -I./include/live555/liveMedia/ -I./include/live555/basicUsageEnvironment \ 3 | -I./include/imp_sys 4 | LIVE555_LIBS = ./lib/livelib/libliveMedia.a ./lib/livelib/libgroupsock.a \ 5 | ./lib/livelib/libBasicUsageEnvironment.a ./lib/livelib/libUsageEnvironment.a 6 | SDK_LIB_DIR = ./lib/imp_sys/uclibc 7 | IMP_LIBS = $(SDK_LIB_DIR)/libimp.so $(SDK_LIB_DIR)/libalog.so 8 | LIBS = $(LIVE555_LIBS) $(IMP_LIBS) 9 | 10 | CROSS_COMPILE?= mips-linux-uclibc-gnu- 11 | 12 | STRIP = $(CROSS_COMPILE)strip 13 | COMPILE_OPTS = $(INCLUDES) -I. -O2 -Wall -march=mips32r2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLOCALE_NOT_USED -g 14 | C = c 15 | C_COMPILER = $(CROSS_COMPILE)gcc 16 | C_FLAGS = $(COMPILE_OPTS) $(CPPFLAGS) $(CFLAGS) 17 | CPP = cpp 18 | CPLUSPLUS_COMPILER = $(CROSS_COMPILE)g++ 19 | CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 $(CPPFLAGS) $(CXXFLAGS) 20 | OBJ = o 21 | LINK = $(CROSS_COMPILE)g++ -o 22 | #LINK_OPTS = -ldl -lm -lpthread -ldl -g 23 | LINK_OPTS = -lpthread -lm -lrt -ldl 24 | CONSOLE_LINK_OPTS = $(LINK_OPTS) 25 | LINK_OBJ = pwm.o imp-common.o capture_and_encoding.o on_demand_rtsp_server.o 26 | 27 | ifeq ($(TARGET),wcv3) 28 | COMPILE_OPTS += -DSENSOR_GC2053 -DSENSOR_FRAME_RATE_NUM=20 \ 29 | -DIRCUT_EN_GPIO=53 -DIRCUT_DIS_GPIO=52 \ 30 | -DEXP_NIGHT_THRESHOLD=30000 -DEXP_DAY_THRESHOLD=5900 -DEXP_IR_THRESHOLD=30000 31 | 32 | # T31 changes 33 | COMPILE_OPTS += -DPLATFORM_T31 34 | IMP_LIBS := $(IMP_LIBS:libimp.so=t31/libimp.so) 35 | else 36 | COMPILE_OPTS += -DSENSOR_JXF23 -DSENSOR_FRAME_RATE_NUM=15 \ 37 | -DIRCUT_EN_GPIO=25 -DIRCUT_DIS_GPIO=26 \ 38 | -DEXP_NIGHT_THRESHOLD=1900000 -DEXP_DAY_THRESHOLD=479832 -DEXP_IR_THRESHOLD=3000000 39 | COMPILE_OPTS += -DPLATFORM_T20L 40 | endif 41 | 42 | APP = t20-rtspd 43 | 44 | commit_tag=$(shell git rev-parse --short HEAD) 45 | .PHONY:all 46 | all : version $(APP) 47 | version : 48 | @if ! grep "$(commit_tag)" version.h >/dev/null ; then \ 49 | echo "update version.h" ; \ 50 | sed 's/COMMIT_TAG/"$(commit_tag)"/g' version.tpl.h > version.h ; \ 51 | fi 52 | 53 | $(APP): 54 | .$(C).$(OBJ): 55 | $(C_COMPILER) -c $(C_FLAGS) $< 56 | .$(CPP).$(OBJ): 57 | $(CPLUSPLUS_COMPILER) -c $(CPLUSPLUS_FLAGS) $< 58 | $(APP): $(LINK_OBJ) 59 | $(LINK)$@ $(LINK_OBJ) $(LIBS) $(CONSOLE_LINK_OPTS) 60 | $(STRIP) -s $@ 61 | cp $(APP) ~/tftproot/ 62 | 63 | clean: 64 | -rm -rf *.$(OBJ) $(APP) core *.core *~ include/*~ version.h 65 | 66 | -------------------------------------------------------------------------------- /capture_and_encoding.h: -------------------------------------------------------------------------------- 1 | #ifndef __CAPTURE_AND_ENCODING_H 2 | #define __CAPTURE_AND_ENCODING_H 3 | 4 | int capture_and_encoding(void); 5 | int destory(void); 6 | int get_stream(int fd, int chn); 7 | 8 | // implemented in imp-common.c 9 | extern "C" { 10 | int set_cam_option(const char *option, int value); 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /include/imp_sys/imp/imp_ivs_base_move.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IMP IVS Move func header file. 3 | * 4 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 5 | */ 6 | 7 | #ifndef __IMP_IVS_BASE_MOVE_H__ 8 | #define __IMP_IVS_BASE_MOVE_H__ 9 | 10 | #ifdef __cplusplus 11 | #if __cplusplus 12 | extern "C" 13 | { 14 | #endif 15 | #endif /* __cplusplus */ 16 | 17 | #define IMP_IVS_MOVE_MAX_ROI_CNT 16 18 | 19 | #include 20 | 21 | /** 22 | * @file 23 | * IMP IVS 移动侦测模块 24 | */ 25 | 26 | /** 27 | * @defgroup MoveDetection 28 | * @ingroup IMP_IVS 29 | * @brief 移动侦测接口 30 | * @{ 31 | */ 32 | 33 | /** 34 | * 基本移动侦测算法的输入结构体 35 | */ 36 | typedef struct { 37 | int skipFrameCnt; /*< 隔帧检测的个数 */ 38 | int referenceNum; /*<指定相对于当前帧的第-referenceNum帧为参考帧*/ 39 | int sadMode; /*< SAD模式,0表示8*8*/ 40 | int sense; /*<灵敏度,0-3,值越大灵敏度越大*/ 41 | IMPFrameInfo frameInfo; /**< 帧尺寸信息,只需要配置width和height */ 42 | 43 | } IMP_IVS_BaseMoveParam; 44 | 45 | /* 46 | * 基本移动侦测算法的输出结构体 47 | */ 48 | typedef struct { 49 | int ret; 50 | uint8_t* data; 51 | int datalen; 52 | } IMP_IVS_BaseMoveOutput; 53 | 54 | /** 55 | * 创建移动侦测接口资源 56 | * 57 | * @fn IMPIVSInterface *IMP_IVS_CreateBaseMoveInterface(IMP_IVS_BaseMoveParam *param); 58 | * 59 | * @param[in] param 移动侦测算法的输入结构体参数 60 | * 61 | * @retval 非NULL 成功,返回移动侦测算法接口指针句柄 62 | * @retval NULL 失败 63 | * 64 | * @attention 无 65 | */ 66 | IMPIVSInterface *IMP_IVS_CreateBaseMoveInterface(IMP_IVS_BaseMoveParam *param); 67 | 68 | /** 69 | * 销毁移动侦测接口资源 70 | * 71 | * @fn void IMP_IVS_DestroyBaseMoveInterface(IMPIVSInterface *moveInterface); 72 | * 73 | * @param[in] moveInterface 移动侦测算法接口指针句柄 74 | * 75 | * @retval 无返回值 76 | * 77 | * @attention 无 78 | */ 79 | void IMP_IVS_DestroyBaseMoveInterface(IMPIVSInterface *moveInterface); 80 | 81 | 82 | #ifdef __cplusplus 83 | #if __cplusplus 84 | } 85 | #endif 86 | #endif /* __cplusplus */ 87 | #endif /* __IMP_IVS_MOVE_H__ */ 88 | -------------------------------------------------------------------------------- /include/imp_sys/imp/imp_ivs_move.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IMP IVS Move func header file. 3 | * 4 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 5 | */ 6 | 7 | #ifndef __IMP_IVS_MOVE_H__ 8 | #define __IMP_IVS_MOVE_H__ 9 | 10 | #ifdef __cplusplus 11 | #if __cplusplus 12 | extern "C" 13 | { 14 | #endif 15 | #endif /* __cplusplus */ 16 | 17 | #define IMP_IVS_MOVE_MAX_ROI_CNT 52 18 | 19 | #include 20 | 21 | /** 22 | * @file 23 | * IMP IVS 移动侦测模块 24 | */ 25 | 26 | /** 27 | * @defgroup MoveDetection 28 | * @ingroup IMP_IVS 29 | * @brief 移动侦测接口 30 | * @{ 31 | */ 32 | 33 | /** 34 | * 移动侦测算法的输入结构体 35 | */ 36 | typedef struct { 37 | int sense[IMP_IVS_MOVE_MAX_ROI_CNT]; /**< 移动侦测的灵敏度, 对正常摄像机范围是0-4,对全景摄像机范围是0-8 */ 38 | int skipFrameCnt; /*< 隔帧检测的个数 */ 39 | IMPFrameInfo frameInfo; /**< 帧尺寸信息,只需要配置width和height */ 40 | IMPRect roiRect[IMP_IVS_MOVE_MAX_ROI_CNT]; /*< 需要检测的roi区域坐标信息 */ 41 | int roiRectCnt; /*< 需要检测的roi区域数量,范围为0-51,若为0:则不检测,1:检测roiRect 0 42 | 区域,2、检测roiRect 0,1区域,3、检测roiRect 0,1,2区域,依次类推 */ 43 | } IMP_IVS_MoveParam; 44 | 45 | /* 46 | * 移动侦测算法的输出结构体 47 | */ 48 | typedef struct { 49 | int retRoi[IMP_IVS_MOVE_MAX_ROI_CNT]; /*< 区域检测移动结果,与roiRect坐标信息严格对应,0:表示未检测到运动,1:表示检测到运动 */ 50 | } IMP_IVS_MoveOutput; 51 | 52 | /** 53 | * 创建移动侦测接口资源 54 | * 55 | * @fn IMPIVSInterface *IMP_IVS_CreateMoveInterface(IMP_IVS_MoveParam *param); 56 | * 57 | * @param[in] param 移动侦测算法的输入结构体参数 58 | * 59 | * @retval 非NULL 成功,返回移动侦测算法接口指针句柄 60 | * @retval NULL 失败 61 | * 62 | * @attention 无 63 | */ 64 | IMPIVSInterface *IMP_IVS_CreateMoveInterface(IMP_IVS_MoveParam *param); 65 | 66 | /** 67 | * 销毁移动侦测接口资源 68 | * 69 | * @fn void IMP_IVS_DestroyMoveInterface(IMPIVSInterface *moveInterface); 70 | * 71 | * @param[in] moveInterface 移动侦测算法接口指针句柄 72 | * 73 | * @retval 无返回值 74 | * 75 | * @attention 无 76 | */ 77 | void IMP_IVS_DestroyMoveInterface(IMPIVSInterface *moveInterface); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #ifdef __cplusplus 84 | #if __cplusplus 85 | } 86 | #endif 87 | #endif /* __cplusplus */ 88 | #endif /* __IMP_IVS_MOVE_H__ */ 89 | -------------------------------------------------------------------------------- /include/imp_sys/imp/imp_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IMP utils header file. 3 | * 4 | * Copyright (C) 2014 Ingenic Semiconductor Co.,Ltd 5 | */ 6 | 7 | #ifndef __IMP_UTILS_H__ 8 | #define __IMP_UTILS_H__ 9 | 10 | #include "imp_common.h" 11 | 12 | #ifdef __cplusplus 13 | #if __cplusplus 14 | extern "C"{ 15 | #endif 16 | #endif /* __cplusplus */ 17 | 18 | /** 19 | * @file 20 | * IMP utils头文件 21 | */ 22 | 23 | #undef offsetof 24 | #ifdef __compiler_offsetof 25 | #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) 26 | #else 27 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 28 | #endif 29 | 30 | /** 31 | * container_of - cast a member of a structure out to the containing structure 32 | * Copy from kernel.h 33 | * @ptr: the pointer to the member. 34 | * @type: the type of the container struct this is embedded in. 35 | * @member: the name of the member within the struct. 36 | * 37 | */ 38 | #define container_of(ptr, type, member) ({ \ 39 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 40 | (type *)( (char *)__mptr - offsetof(type,member) );}) 41 | 42 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 43 | 44 | char *IMPPixfmtToString(IMPPixelFormat pixfmt); 45 | 46 | #ifdef __cplusplus 47 | #if __cplusplus 48 | } 49 | #endif 50 | #endif /* __cplusplus */ 51 | 52 | #endif /* __IMP_UTILS_H__ */ 53 | -------------------------------------------------------------------------------- /include/imp_sys/sysutils/su_adc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SU ADC header file. 3 | * 4 | * Copyright (C) 2015 Ingenic Semiconductor Co.,Ltd 5 | */ 6 | 7 | #ifndef __SU_ADC_H__ 8 | #define __SU_ADC_H__ 9 | 10 | #ifdef __cplusplus 11 | #if __cplusplus 12 | extern "C" 13 | { 14 | #endif 15 | #endif /* __cplusplus */ 16 | 17 | /** 18 | * @file 19 | * ADC模块头文件 20 | */ 21 | 22 | /** 23 | * @defgroup Sysutils_ADC 24 | * @ingroup sysutils 25 | * @brief 模数转化模块 26 | * 27 | * 使用方法请参考Samples 28 | * @{ 29 | */ 30 | 31 | /** 32 | * @fn int SU_ADC_Init(void); 33 | * 34 | * 初始化ADC模块 35 | * 36 | * @retval 0 成功 37 | * @retval 非0 失败,返回错误码 38 | * 39 | * @remark 使用ADC之前,一定要调用这个函数。 40 | * 41 | * @attention 无。 42 | */ 43 | int SU_ADC_Init(void); 44 | 45 | /** 46 | * @fn int SU_ADC_Exit(void); 47 | * 48 | * 去初始化ADC模块 49 | * 50 | * @retval 0 成功 51 | * @retval 非0 失败,返回错误码 52 | * 53 | * @remark 不使用ADC之后,一定要调用这个函数。 54 | * 55 | * @attention 无。 56 | */ 57 | int SU_ADC_Exit(void); 58 | 59 | /** 60 | * @fn int SU_ADC_EnableChn(uint32_t chn_num); 61 | * 62 | * 启动通道 63 | * 64 | * @param[in] chn_num 启动第几路通道 65 | * 66 | * @retval 0 成功 67 | * @retval 非0 失败,返回错误码 68 | * 69 | * @remark 无 70 | * 71 | * @attention 无. 72 | */ 73 | int SU_ADC_EnableChn(uint32_t chn_num); 74 | 75 | /** 76 | * @fn int SU_ADC_DisableChn(uint32_t chn_num); 77 | * 78 | * 关闭通道 79 | * 80 | * @param[in] chn_num 停止第几路通道 81 | * 82 | * @retval 0 成功 83 | * @retval 非0 失败,返回错误码 84 | * 85 | * @remark 无 86 | * 87 | * @attention 无 88 | */ 89 | int SU_ADC_DisableChn(uint32_t chn_num); 90 | 91 | /** 92 | * @fn int SU_ADC_GetChnValue(uint32_t chn_num, int *value); 93 | * 94 | * 得到第chn_num通道的ADC值 95 | * 96 | * @param[in] chn_num 第几路通道 97 | * 98 | * @param[out] value 得到的ADC值 99 | * 100 | * @retval 0 成功 101 | * @retval 非0 失败,返回错误码 102 | * 103 | * @remark 无 104 | * 105 | * @attention 无 106 | */ 107 | int SU_ADC_GetChnValue(uint32_t chn_num, int *value); 108 | 109 | #ifdef __cplusplus 110 | #if __cplusplus 111 | } 112 | #endif 113 | #endif /* __cplusplus */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | #endif /* __SU_ADC_H__ */ 120 | -------------------------------------------------------------------------------- /include/imp_sys/sysutils/su_battery.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Battery utils header file. 3 | * 4 | * Copyright (C) 2014 Ingenic Semiconductor Co.,Ltd 5 | */ 6 | 7 | #ifndef __SU_BATTERY_H__ 8 | #define __SU_BATTERY_H__ 9 | 10 | #ifdef __cplusplus 11 | #if __cplusplus 12 | extern "C" 13 | { 14 | #endif 15 | #endif /* __cplusplus */ 16 | 17 | /** 18 | * @file 19 | * Sysutils 电池管理头文件 20 | */ 21 | 22 | /** 23 | * @defgroup Sysutils_Battery 24 | * @ingroup sysutils 25 | * @brief 电池管理 26 | * @{ 27 | */ 28 | 29 | /** 30 | * 电池状态. 31 | */ 32 | typedef enum { 33 | Unknown = -1, /**< 未知状态或者没有电池*/ 34 | Charging, /**< 充电中 */ 35 | Discharging, /**< 未充电 */ 36 | Full, /**< 充满电 */ 37 | } SUBatStatus; 38 | 39 | /** 40 | * 电池事件. 41 | */ 42 | typedef enum { 43 | AC_ONLINE, /**< AC Adapter插入 */ 44 | AC_OFFLINE, /**< AC Adapter拔出 */ 45 | USB_ONLINE, /**< USB插入 */ 46 | USB_OFFLINE, /**< USB拔出 */ 47 | } SUBatEvent; 48 | 49 | /** 50 | * @fn int SU_Battery_GetStatus(SUBatStatus *status) 51 | * 52 | * 获取电池状态. 53 | * 54 | * @param[in] status 电池状态指针. 55 | * 56 | * @retval 0 成功. 57 | * @retval 非0 失败. 58 | * 59 | * @remarks 该函数直接返回,无阻塞. 60 | * 61 | * @attention 无. 62 | */ 63 | int SU_Battery_GetStatus(SUBatStatus *status); 64 | 65 | /** 66 | * @fn int SU_Battery_GetEvent(SUBatEvent *event) 67 | * 68 | * 获取电池事件. 69 | * 70 | * @param[out] event 电池事件指针. 71 | * 72 | * @retval 0 成功. 73 | * @retval 非0 失败. 74 | * 75 | * @remarks 该函数阻塞,直到有事件发生返回. 76 | * 77 | * @attention 无. 78 | */ 79 | int SU_Battery_GetEvent(SUBatEvent *event); 80 | 81 | /** 82 | * @fn int SU_Battery_GetCapacity(void) 83 | * 84 | * 获取电池电量百分比. 85 | * 86 | * @param 无. 87 | * 88 | * @retval >=0 电池电量百分比. 89 | * @retval 非0 失败. 90 | * 91 | * @remarks 无. 92 | * 93 | * @attention 无. 94 | */ 95 | int SU_Battery_GetCapacity(void); 96 | 97 | /** 98 | * @fn int SU_Battery_GetVoltageUV(void) 99 | * 100 | * 获取电池当前电压. 101 | * 102 | * @param 无. 103 | * 104 | * @retval >=0 电池电压,单位uV. 105 | * @retval 非0 失败. 106 | * 107 | * @remarks 无. 108 | * 109 | * @attention 无. 110 | */ 111 | int SU_Battery_GetVoltageUV(void); 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #ifdef __cplusplus 118 | #if __cplusplus 119 | } 120 | #endif 121 | #endif /* __cplusplus */ 122 | 123 | #endif /* __SU_BATTERY_H__ */ 124 | -------------------------------------------------------------------------------- /include/live555/basicUsageEnvironment/BasicUsageEnvironment_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "BasicUsageEnvironment" library 2 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH 5 | #define _BASICUSAGEENVIRONMENT_VERSION_HH 6 | 7 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2017.01.26" 8 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1485388800 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/live555/basicUsageEnvironment/HandlerSet.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 17 | // Basic Usage Environment: for a simple, non-scripted, console application 18 | // C++ header 19 | 20 | #ifndef _HANDLER_SET_HH 21 | #define _HANDLER_SET_HH 22 | 23 | #ifndef _BOOLEAN_HH 24 | #include "Boolean.hh" 25 | #endif 26 | 27 | ////////// HandlerSet (etc.) definition ////////// 28 | 29 | class HandlerDescriptor { 30 | HandlerDescriptor(HandlerDescriptor* nextHandler); 31 | virtual ~HandlerDescriptor(); 32 | 33 | public: 34 | int socketNum; 35 | int conditionSet; 36 | TaskScheduler::BackgroundHandlerProc* handlerProc; 37 | void* clientData; 38 | 39 | private: 40 | // Descriptors are linked together in a doubly-linked list: 41 | friend class HandlerSet; 42 | friend class HandlerIterator; 43 | HandlerDescriptor* fNextHandler; 44 | HandlerDescriptor* fPrevHandler; 45 | }; 46 | 47 | class HandlerSet { 48 | public: 49 | HandlerSet(); 50 | virtual ~HandlerSet(); 51 | 52 | void assignHandler(int socketNum, int conditionSet, TaskScheduler::BackgroundHandlerProc* handlerProc, void* clientData); 53 | void clearHandler(int socketNum); 54 | void moveHandler(int oldSocketNum, int newSocketNum); 55 | 56 | private: 57 | HandlerDescriptor* lookupHandler(int socketNum); 58 | 59 | private: 60 | friend class HandlerIterator; 61 | HandlerDescriptor fHandlers; 62 | }; 63 | 64 | class HandlerIterator { 65 | public: 66 | HandlerIterator(HandlerSet& handlerSet); 67 | virtual ~HandlerIterator(); 68 | 69 | HandlerDescriptor* next(); // returns NULL if none 70 | void reset(); 71 | 72 | private: 73 | HandlerSet& fOurSet; 74 | HandlerDescriptor* fNextPtr; 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /include/live555/groupsock/GroupEId.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "multikit" Multicast Application Shell 17 | // Copyright (c) 1996-2017, Live Networks, Inc. All rights reserved 18 | // "Group Endpoint Id" 19 | // C++ header 20 | 21 | #ifndef _GROUPEID_HH 22 | #define _GROUPEID_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | #ifndef _NET_ADDRESS_HH 29 | #include "NetAddress.hh" 30 | #endif 31 | 32 | class GroupEId { 33 | public: 34 | GroupEId(struct in_addr const& groupAddr, 35 | portNumBits portNum, u_int8_t ttl); 36 | // used for a 'source-independent multicast' group 37 | GroupEId(struct in_addr const& groupAddr, 38 | struct in_addr const& sourceFilterAddr, 39 | portNumBits portNum); 40 | // used for a 'source-specific multicast' group 41 | 42 | struct in_addr const& groupAddress() const { return fGroupAddress; } 43 | struct in_addr const& sourceFilterAddress() const { return fSourceFilterAddress; } 44 | 45 | Boolean isSSM() const; 46 | 47 | portNumBits portNum() const { return fPortNum; } 48 | 49 | u_int8_t ttl() const { return fTTL; } 50 | 51 | private: 52 | void init(struct in_addr const& groupAddr, 53 | struct in_addr const& sourceFilterAddr, 54 | portNumBits portNum, 55 | u_int8_t ttl); 56 | 57 | private: 58 | struct in_addr fGroupAddress; 59 | struct in_addr fSourceFilterAddress; 60 | portNumBits fPortNum; // in network byte order 61 | u_int8_t fTTL; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/live555/groupsock/IOHandlers.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "mTunnel" multicast access service 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // IO event handlers 19 | // C++ header 20 | 21 | #ifndef _IO_HANDLERS_HH 22 | #define _IO_HANDLERS_HH 23 | 24 | #ifndef _NET_INTERFACE_HH 25 | #include "NetInterface.hh" 26 | #endif 27 | 28 | // Handles incoming data on sockets: 29 | void socketReadHandler(Socket* sock, int mask); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/live555/groupsock/groupsock_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "groupsock" library 2 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _GROUPSOCK_VERSION_HH 5 | #define _GROUPSOCK_VERSION_HH 6 | 7 | #define GROUPSOCK_LIBRARY_VERSION_STRING "2017.01.26" 8 | #define GROUPSOCK_LIBRARY_VERSION_INT 1485388800 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AC3AudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AC3 audio file. 20 | // C++ header 21 | 22 | #ifndef _AC3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AC3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class AC3AudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static AC3AudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | AC3AudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~AC3AudioFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AC3AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for AC3 audio 19 | // C++ header 20 | 21 | #ifndef _AC3_AUDIO_RTP_SINK_HH 22 | #define _AC3_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class AC3AudioRTPSink: public AudioRTPSink { 29 | public: 30 | static AC3AudioRTPSink* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs, 32 | u_int8_t rtpPayloadFormat, 33 | u_int32_t rtpTimestampFrequency); 34 | 35 | protected: 36 | AC3AudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 37 | u_int8_t rtpPayloadFormat, 38 | u_int32_t rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~AC3AudioRTPSink(); 42 | 43 | private: // redefined virtual functions: 44 | virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 45 | unsigned numBytesInFrame) const; 46 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 47 | unsigned char* frameStart, 48 | unsigned numBytesInFrame, 49 | struct timeval framePresentationTime, 50 | unsigned numRemainingBytes); 51 | virtual unsigned specialHeaderSize() const; 52 | 53 | private: 54 | unsigned char fTotNumFragmentsUsed; // used only if a frame gets fragmented across multiple packets 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AC3AudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // AC3 Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _AC3_AUDIO_RTP_SOURCE_HH 22 | #define _AC3_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class AC3AudioRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static AC3AudioRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~AC3AudioRTPSource(); 37 | 38 | private: 39 | AC3AudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AC3AudioStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an AC3 audio elementary stream into frames 19 | // C++ header 20 | 21 | #ifndef _AC3_AUDIO_STREAM_FRAMER_HH 22 | #define _AC3_AUDIO_STREAM_FRAMER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | class AC3AudioStreamFramer: public FramedFilter { 29 | public: 30 | static AC3AudioStreamFramer* 31 | createNew(UsageEnvironment& env, FramedSource* inputSource, 32 | unsigned char streamCode = 0); 33 | // If "streamCode" != 0, then we assume that there's a 1-byte code at the beginning of each chunk of data that we read from 34 | // our source. If that code is not the value we want, we discard the chunk of data. 35 | // However, if "streamCode" == 0 (the default), then we don't expect this 1-byte code. 36 | 37 | unsigned samplingRate(); 38 | 39 | void flushInput(); // called if there is a discontinuity (seeking) in the input 40 | 41 | private: 42 | AC3AudioStreamFramer(UsageEnvironment& env, FramedSource* inputSource, 43 | unsigned char streamCode); 44 | // called only by createNew() 45 | virtual ~AC3AudioStreamFramer(); 46 | 47 | static void handleNewData(void* clientData, 48 | unsigned char* ptr, unsigned size, 49 | struct timeval presentationTime); 50 | void handleNewData(unsigned char* ptr, unsigned size); 51 | 52 | void parseNextFrame(); 53 | 54 | private: 55 | // redefined virtual functions: 56 | virtual void doGetNextFrame(); 57 | 58 | private: 59 | struct timeval currentFramePlayTime() const; 60 | 61 | private: 62 | struct timeval fNextFramePresentationTime; 63 | 64 | private: // parsing state 65 | class AC3AudioStreamParser* fParser; 66 | unsigned char fOurStreamCode; 67 | friend class AC3AudioStreamParser; // hack 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/live555/liveMedia/ADTSAudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AAC audio file in ADTS format 20 | // C++ header 21 | 22 | #ifndef _ADTS_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _ADTS_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class ADTSAudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static ADTSAudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | protected: 35 | ADTSAudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~ADTSAudioFileServerMediaSubsession(); 39 | 40 | protected: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/ADTSAudioFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A source object for AAC audio files in ADTS format 19 | // C++ header 20 | 21 | #ifndef _ADTS_AUDIO_FILE_SOURCE_HH 22 | #define _ADTS_AUDIO_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_FILE_SOURCE_HH 25 | #include "FramedFileSource.hh" 26 | #endif 27 | 28 | class ADTSAudioFileSource: public FramedFileSource { 29 | public: 30 | static ADTSAudioFileSource* createNew(UsageEnvironment& env, 31 | char const* fileName); 32 | 33 | unsigned samplingFrequency() const { return fSamplingFrequency; } 34 | unsigned numChannels() const { return fNumChannels; } 35 | char const* configStr() const { return fConfigStr; } 36 | // returns the 'AudioSpecificConfig' for this stream (in ASCII form) 37 | 38 | private: 39 | ADTSAudioFileSource(UsageEnvironment& env, FILE* fid, u_int8_t profile, 40 | u_int8_t samplingFrequencyIndex, u_int8_t channelConfiguration); 41 | // called only by createNew() 42 | 43 | virtual ~ADTSAudioFileSource(); 44 | 45 | private: 46 | // redefined virtual functions: 47 | virtual void doGetNextFrame(); 48 | 49 | private: 50 | unsigned fSamplingFrequency; 51 | unsigned fNumChannels; 52 | unsigned fuSecsPerFrame; 53 | char fConfigStr[5]; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AMR audio file. 20 | // C++ header 21 | 22 | #ifndef _AMR_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AMR_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class AMRAudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static AMRAudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | AMRAudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~AMRAudioFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // AMR Audio File Sinks 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_FILE_SINK_HH 22 | #define _AMR_AUDIO_FILE_SINK_HH 23 | 24 | #ifndef _FILE_SINK_HH 25 | #include "FileSink.hh" 26 | #endif 27 | 28 | class AMRAudioFileSink: public FileSink { 29 | public: 30 | static AMRAudioFileSink* createNew(UsageEnvironment& env, char const* fileName, 31 | unsigned bufferSize = 10000, 32 | Boolean oneFilePerFrame = False); 33 | // (See "FileSink.hh" for a description of these parameters.) 34 | 35 | protected: 36 | AMRAudioFileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize, 37 | char const* perFrameFileNamePrefix); 38 | // called only by createNew() 39 | virtual ~AMRAudioFileSink(); 40 | 41 | protected: // redefined virtual functions: 42 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 43 | virtual void afterGettingFrame(unsigned frameSize, 44 | unsigned numTruncatedBytes, 45 | struct timeval presentationTime); 46 | 47 | protected: 48 | Boolean fHaveWrittenHeader; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A source object for AMR audio files (as defined in RFC 4867, section 5) 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_FILE_SOURCE_HH 22 | #define _AMR_AUDIO_FILE_SOURCE_HH 23 | 24 | #ifndef _AMR_AUDIO_SOURCE_HH 25 | #include "AMRAudioSource.hh" 26 | #endif 27 | 28 | class AMRAudioFileSource: public AMRAudioSource { 29 | public: 30 | static AMRAudioFileSource* createNew(UsageEnvironment& env, 31 | char const* fileName); 32 | 33 | private: 34 | AMRAudioFileSource(UsageEnvironment& env, FILE* fid, 35 | Boolean isWideband, unsigned numChannels); 36 | // called only by createNew() 37 | 38 | virtual ~AMRAudioFileSource(); 39 | 40 | private: 41 | // redefined virtual functions: 42 | virtual void doGetNextFrame(); 43 | 44 | private: 45 | FILE* fFid; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for AMR audio (RFC 4867) 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_RTP_SINK_HH 22 | #define _AMR_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class AMRAudioRTPSink: public AudioRTPSink { 29 | public: 30 | static AMRAudioRTPSink* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | Boolean sourceIsWideband = False, 34 | unsigned numChannelsInSource = 1); 35 | 36 | Boolean sourceIsWideband() const { return fSourceIsWideband; } 37 | 38 | protected: 39 | AMRAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | Boolean sourceIsWideband, unsigned numChannelsInSource); 42 | // called only by createNew() 43 | 44 | virtual ~AMRAudioRTPSink(); 45 | 46 | private: // redefined virtual functions: 47 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 48 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 49 | unsigned char* frameStart, 50 | unsigned numBytesInFrame, 51 | struct timeval framePresentationTime, 52 | unsigned numRemainingBytes); 53 | virtual Boolean 54 | frameCanAppearAfterPacketStart(unsigned char const* frameStart, 55 | unsigned numBytesInFrame) const; 56 | 57 | virtual unsigned specialHeaderSize() const; 58 | virtual char const* auxSDPLine(); 59 | 60 | private: 61 | Boolean fSourceIsWideband; 62 | char* fFmtpSDPLine; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // AMR Audio RTP Sources (RFC 4867) 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_RTP_SOURCE_HH 22 | #define _AMR_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _RTP_SOURCE_HH 25 | #include "RTPSource.hh" 26 | #endif 27 | #ifndef _AMR_AUDIO_SOURCE_HH 28 | #include "AMRAudioSource.hh" 29 | #endif 30 | 31 | class AMRAudioRTPSource { 32 | public: 33 | static AMRAudioSource* createNew(UsageEnvironment& env, 34 | Groupsock* RTPgs, 35 | RTPSource*& resultRTPSource, 36 | unsigned char rtpPayloadFormat, 37 | Boolean isWideband = False, 38 | unsigned numChannels = 1, 39 | Boolean isOctetAligned = True, 40 | unsigned interleaving = 0, 41 | // relevant only if "isOctetAligned" 42 | // The maximum # of frame-blocks in a group 43 | // 0 means: no interleaving 44 | Boolean robustSortingOrder = False, 45 | // relevant only if "isOctetAligned" 46 | Boolean CRCsArePresent = False 47 | // relevant only if "isOctetAligned" 48 | ); 49 | // This returns a source to read from, but "resultRTPSource" will 50 | // point to RTP-related state. 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AMRAudioSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A source object for AMR audio sources 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_SOURCE_HH 22 | #define _AMR_AUDIO_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class AMRAudioSource: public FramedSource { 29 | public: 30 | Boolean isWideband() const { return fIsWideband; } 31 | unsigned numChannels() const { return fNumChannels; } 32 | 33 | u_int8_t lastFrameHeader() const { return fLastFrameHeader; } 34 | // The frame header for the most recently read frame (RFC 4867, sec. 5.3) 35 | 36 | protected: 37 | AMRAudioSource(UsageEnvironment& env, Boolean isWideband, unsigned numChannels); 38 | // virtual base class 39 | virtual ~AMRAudioSource(); 40 | 41 | private: 42 | // redefined virtual functions: 43 | virtual char const* MIMEtype() const; 44 | virtual Boolean isAMRAudioSource() const; 45 | 46 | protected: 47 | Boolean fIsWideband; 48 | unsigned fNumChannels; 49 | u_int8_t fLastFrameHeader; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AudioInputDevice.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 17 | // Generic audio input device (such as a microphone, or an input sound card) 18 | // C++ header 19 | 20 | #ifndef _AUDIO_INPUT_DEVICE_HH 21 | #define _AUDIO_INPUT_DEVICE_HH 22 | 23 | #ifndef _FRAMED_SOURCE_HH 24 | #include "FramedSource.hh" 25 | #endif 26 | 27 | class AudioPortNames { 28 | public: 29 | AudioPortNames(); 30 | virtual ~AudioPortNames(); 31 | 32 | unsigned numPorts; 33 | char** portName; 34 | }; 35 | 36 | class AudioInputDevice: public FramedSource { 37 | public: 38 | unsigned char bitsPerSample() const { return fBitsPerSample; } 39 | unsigned char numChannels() const { return fNumChannels; } 40 | unsigned samplingFrequency() const { return fSamplingFrequency; } 41 | 42 | virtual Boolean setInputPort(int portIndex) = 0; 43 | virtual double getAverageLevel() const = 0; 44 | 45 | static AudioInputDevice* 46 | createNew(UsageEnvironment& env, int inputPortNumber, 47 | unsigned char bitsPerSample, unsigned char numChannels, 48 | unsigned samplingFrequency, unsigned granularityInMS = 20); 49 | static AudioPortNames* getPortNames(); 50 | 51 | static char** allowedDeviceNames; 52 | // If this is set to non-NULL, then it's a NULL-terminated array of strings 53 | // of device names that we are allowed to access. 54 | 55 | protected: 56 | AudioInputDevice(UsageEnvironment& env, 57 | unsigned char bitsPerSample, 58 | unsigned char numChannels, 59 | unsigned samplingFrequency, 60 | unsigned granularityInMS); 61 | // we're an abstract base class 62 | 63 | virtual ~AudioInputDevice(); 64 | 65 | protected: 66 | unsigned char fBitsPerSample, fNumChannels; 67 | unsigned fSamplingFrequency; 68 | unsigned fGranularityInMS; 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /include/live555/liveMedia/AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for audio codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _AUDIO_RTP_SINK_HH 22 | #define _AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class AudioRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | AudioRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName, 34 | unsigned numChannels = 1); 35 | // (we're an abstract base class) 36 | virtual ~AudioRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual char const* sdpMediaType() const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/live555/liveMedia/Base64.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Base64 encoding and decoding 19 | // C++ header 20 | 21 | #ifndef _BASE64_HH 22 | #define _BASE64_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | unsigned char* base64Decode(char const* in, unsigned& resultSize, 29 | Boolean trimTrailingZeros = True); 30 | // returns a newly allocated array - of size "resultSize" - that 31 | // the caller is responsible for delete[]ing. 32 | 33 | unsigned char* base64Decode(char const* in, unsigned inSize, 34 | unsigned& resultSize, 35 | Boolean trimTrailingZeros = True); 36 | // As above, but includes the size of the input string (i.e., the number of bytes to decode) as a parameter. 37 | // This saves an extra call to "strlen()" if we already know the length of the input string. 38 | 39 | char* base64Encode(char const* orig, unsigned origLength); 40 | // returns a 0-terminated string that 41 | // the caller is responsible for delete[]ing. 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/live555/liveMedia/BasicUDPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A simple UDP sink (i.e., without RTP or other headers added); one frame per packet 19 | // C++ header 20 | 21 | #ifndef _BASIC_UDP_SINK_HH 22 | #define _BASIC_UDP_SINK_HH 23 | 24 | #ifndef _MEDIA_SINK_HH 25 | #include "MediaSink.hh" 26 | #endif 27 | #ifndef _GROUPSOCK_HH 28 | #include 29 | #endif 30 | 31 | class BasicUDPSink: public MediaSink { 32 | public: 33 | static BasicUDPSink* createNew(UsageEnvironment& env, Groupsock* gs, 34 | unsigned maxPayloadSize = 1450); 35 | protected: 36 | BasicUDPSink(UsageEnvironment& env, Groupsock* gs, unsigned maxPayloadSize); 37 | // called only by createNew() 38 | virtual ~BasicUDPSink(); 39 | 40 | private: // redefined virtual functions: 41 | virtual Boolean continuePlaying(); 42 | 43 | private: 44 | void continuePlaying1(); 45 | 46 | static void afterGettingFrame(void* clientData, unsigned frameSize, 47 | unsigned numTruncatedBytes, 48 | struct timeval presentationTime, 49 | unsigned durationInMicroseconds); 50 | void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, 51 | unsigned durationInMicroseconds); 52 | 53 | static void sendNext(void* firstArg); 54 | 55 | private: 56 | Groupsock* fGS; 57 | unsigned fMaxPayloadSize; 58 | unsigned char* fOutputBuffer; 59 | struct timeval fNextSendTime; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/live555/liveMedia/BasicUDPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A simple UDP source, where every UDP payload is a complete frame 19 | // C++ header 20 | 21 | #ifndef _BASIC_UDP_SOURCE_HH 22 | #define _BASIC_UDP_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | #ifndef _GROUPSOCK_HH 28 | #include "Groupsock.hh" 29 | #endif 30 | 31 | class BasicUDPSource: public FramedSource { 32 | public: 33 | static BasicUDPSource* createNew(UsageEnvironment& env, Groupsock* inputGS); 34 | 35 | virtual ~BasicUDPSource(); 36 | 37 | Groupsock* gs() const { return fInputGS; } 38 | 39 | private: 40 | BasicUDPSource(UsageEnvironment& env, Groupsock* inputGS); 41 | // called only by createNew() 42 | 43 | static void incomingPacketHandler(BasicUDPSource* source, int mask); 44 | void incomingPacketHandler1(); 45 | 46 | private: // redefined virtual functions: 47 | virtual void doGetNextFrame(); 48 | virtual void doStopGettingFrames(); 49 | 50 | private: 51 | Groupsock* fInputGS; 52 | Boolean fHaveStartedReading; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/live555/liveMedia/BitVector.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Bit Vector data structure 19 | // C++ header 20 | 21 | #ifndef _BIT_VECTOR_HH 22 | #define _BIT_VECTOR_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | class BitVector { 29 | public: 30 | BitVector(unsigned char* baseBytePtr, 31 | unsigned baseBitOffset, 32 | unsigned totNumBits); 33 | 34 | void setup(unsigned char* baseBytePtr, 35 | unsigned baseBitOffset, 36 | unsigned totNumBits); 37 | 38 | void putBits(unsigned from, unsigned numBits); // "numBits" <= 32 39 | void put1Bit(unsigned bit); 40 | 41 | unsigned getBits(unsigned numBits); // "numBits" <= 32 42 | unsigned get1Bit(); 43 | Boolean get1BitBoolean() { return get1Bit() != 0; } 44 | 45 | void skipBits(unsigned numBits); 46 | 47 | unsigned curBitIndex() const { return fCurBitIndex; } 48 | unsigned totNumBits() const { return fTotNumBits; } 49 | unsigned numBitsRemaining() const { return fTotNumBits - fCurBitIndex; } 50 | 51 | unsigned get_expGolomb(); 52 | // Returns the value of the next bits, assuming that they were encoded using an exponential-Golomb code of order 0 53 | 54 | private: 55 | unsigned char* fBaseBytePtr; 56 | unsigned fBaseBitOffset; 57 | unsigned fTotNumBits; 58 | unsigned fCurBitIndex; 59 | }; 60 | 61 | // A general bit copy operation: 62 | void shiftBits(unsigned char* toBasePtr, unsigned toBitOffset, 63 | unsigned char const* fromBasePtr, unsigned fromBitOffset, 64 | unsigned numBits); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /include/live555/liveMedia/ByteStreamMultiFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A source that consists of multiple byte-stream files, read sequentially 19 | // C++ header 20 | 21 | #ifndef _BYTE_STREAM_MULTI_FILE_SOURCE_HH 22 | #define _BYTE_STREAM_MULTI_FILE_SOURCE_HH 23 | 24 | #ifndef _BYTE_STREAM_FILE_SOURCE_HH 25 | #include "ByteStreamFileSource.hh" 26 | #endif 27 | 28 | class ByteStreamMultiFileSource: public FramedSource { 29 | public: 30 | static ByteStreamMultiFileSource* 31 | createNew(UsageEnvironment& env, char const** fileNameArray, 32 | unsigned preferredFrameSize = 0, unsigned playTimePerFrame = 0); 33 | // A 'filename' of NULL indicates the end of the array 34 | 35 | Boolean haveStartedNewFile() const { return fHaveStartedNewFile; } 36 | // True iff the most recently delivered frame was the first from a newly-opened file 37 | 38 | protected: 39 | ByteStreamMultiFileSource(UsageEnvironment& env, char const** fileNameArray, 40 | unsigned preferredFrameSize, unsigned playTimePerFrame); 41 | // called only by createNew() 42 | 43 | virtual ~ByteStreamMultiFileSource(); 44 | 45 | private: 46 | // redefined virtual functions: 47 | virtual void doGetNextFrame(); 48 | 49 | private: 50 | static void onSourceClosure(void* clientData); 51 | void onSourceClosure1(); 52 | static void afterGettingFrame(void* clientData, 53 | unsigned frameSize, unsigned numTruncatedBytes, 54 | struct timeval presentationTime, 55 | unsigned durationInMicroseconds); 56 | 57 | private: 58 | unsigned fPreferredFrameSize; 59 | unsigned fPlayTimePerFrame; 60 | unsigned fNumSources; 61 | unsigned fCurrentlyReadSourceNumber; 62 | Boolean fHaveStartedNewFile; 63 | char const** fFileNameArray; 64 | ByteStreamFileSource** fSourceArray; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/live555/liveMedia/DVVideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a DV video file. 20 | // C++ header 21 | 22 | #ifndef _DV_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _DV_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class DVVideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static DVVideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | DVVideoFileServerMediaSubsession(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 36 | // called only by createNew(); 37 | virtual ~DVVideoFileServerMediaSubsession(); 38 | 39 | private: // redefined virtual functions 40 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource); 41 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 42 | virtual void setStreamSourceDuration(FramedSource* inputSource, double streamDuration, u_int64_t& numBytes); 43 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); 44 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 45 | virtual float duration() const; 46 | 47 | private: 48 | float fFileDuration; // in seconds 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/DVVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for DV video (RFC 3189) 19 | // (Thanks to Ben Hutchings for prototyping this.) 20 | // C++ header 21 | 22 | #ifndef _DV_VIDEO_RTP_SINK_HH 23 | #define _DV_VIDEO_RTP_SINK_HH 24 | 25 | #ifndef _VIDEO_RTP_SINK_HH 26 | #include "VideoRTPSink.hh" 27 | #endif 28 | #ifndef _DV_VIDEO_STREAM_FRAMER_HH 29 | #include "DVVideoStreamFramer.hh" 30 | #endif 31 | 32 | class DVVideoRTPSink: public VideoRTPSink { 33 | public: 34 | static DVVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 35 | char const* auxSDPLineFromFramer(DVVideoStreamFramer* framerSource); 36 | 37 | protected: 38 | DVVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 39 | // called only by createNew() 40 | 41 | virtual ~DVVideoRTPSink(); 42 | 43 | private: // redefined virtual functions: 44 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 45 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 46 | unsigned char* frameStart, 47 | unsigned numBytesInFrame, 48 | struct timeval framePresentationTime, 49 | unsigned numRemainingBytes); 50 | virtual unsigned computeOverflowForNewFrame(unsigned newFrameSize) const; 51 | virtual char const* auxSDPLine(); 52 | 53 | private: 54 | char* fFmtpSDPLine; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/live555/liveMedia/DVVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // DV Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _DV_VIDEO_RTP_SOURCE_HH 22 | #define _DV_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class DVVideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static DVVideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~DVVideoRTPSource(); 37 | 38 | private: 39 | DVVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/DeviceSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A template for a MediaSource encapsulating an audio/video input device 19 | // 20 | // NOTE: Sections of this code labeled "%%% TO BE WRITTEN %%%" are incomplete, and needto be written by the programmer 21 | // (depending on the features of the particulardevice). 22 | // C++ header 23 | 24 | #ifndef _DEVICE_SOURCE_HH 25 | #define _DEVICE_SOURCE_HH 26 | 27 | #ifndef _FRAMED_SOURCE_HH 28 | #include "FramedSource.hh" 29 | #endif 30 | 31 | // The following class can be used to define specific encoder parameters 32 | class DeviceParameters { 33 | //%%% TO BE WRITTEN %%% 34 | }; 35 | 36 | class DeviceSource: public FramedSource { 37 | public: 38 | static DeviceSource* createNew(UsageEnvironment& env, 39 | DeviceParameters params); 40 | 41 | public: 42 | static EventTriggerId eventTriggerId; 43 | // Note that this is defined here to be a static class variable, because this code is intended to illustrate how to 44 | // encapsulate a *single* device - not a set of devices. 45 | // You can, however, redefine this to be a non-static member variable. 46 | 47 | protected: 48 | DeviceSource(UsageEnvironment& env, DeviceParameters params); 49 | // called only by createNew(), or by subclass constructors 50 | virtual ~DeviceSource(); 51 | 52 | private: 53 | // redefined virtual functions: 54 | virtual void doGetNextFrame(); 55 | //virtual void doStopGettingFrames(); // optional 56 | 57 | private: 58 | static void deliverFrame0(void* clientData); 59 | void deliverFrame(); 60 | 61 | private: 62 | static unsigned referenceCount; // used to count how many instances of this class currently exist 63 | DeviceParameters fParams; 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /include/live555/liveMedia/FileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a file. 20 | // C++ header 21 | 22 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _SERVER_MEDIA_SESSION_HH 26 | #include "ServerMediaSession.hh" 27 | #endif 28 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 29 | #include "OnDemandServerMediaSubsession.hh" 30 | #endif 31 | 32 | class FileServerMediaSubsession: public OnDemandServerMediaSubsession { 33 | protected: // we're a virtual base class 34 | FileServerMediaSubsession(UsageEnvironment& env, char const* fileName, 35 | Boolean reuseFirstSource); 36 | virtual ~FileServerMediaSubsession(); 37 | 38 | protected: 39 | char const* fFileName; 40 | u_int64_t fFileSize; // if known 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/live555/liveMedia/FramedFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Framed File Sources 19 | // C++ header 20 | 21 | #ifndef _FRAMED_FILE_SOURCE_HH 22 | #define _FRAMED_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class FramedFileSource: public FramedSource { 29 | protected: 30 | FramedFileSource(UsageEnvironment& env, FILE* fid); // abstract base class 31 | virtual ~FramedFileSource(); 32 | 33 | protected: 34 | FILE* fFid; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/live555/liveMedia/FramedFilter.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Framed Filters 19 | // C++ header 20 | 21 | #ifndef _FRAMED_FILTER_HH 22 | #define _FRAMED_FILTER_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class FramedFilter: public FramedSource { 29 | public: 30 | FramedSource* inputSource() const { return fInputSource; } 31 | 32 | void reassignInputSource(FramedSource* newInputSource) { fInputSource = newInputSource; } 33 | 34 | // Call before destruction if you want to prevent the destructor from closing the input source 35 | void detachInputSource(); 36 | 37 | protected: 38 | FramedFilter(UsageEnvironment& env, FramedSource* inputSource); 39 | // abstract base class 40 | virtual ~FramedFilter(); 41 | 42 | protected: 43 | // Redefined virtual functions (with default 'null' implementations): 44 | virtual char const* MIMEtype() const; 45 | virtual void getAttributes() const; 46 | virtual void doStopGettingFrames(); 47 | 48 | protected: 49 | FramedSource* fInputSource; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/live555/liveMedia/GSMAudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for GSM audio 19 | // C++ header 20 | 21 | #ifndef _GSM_AUDIO_RTP_SINK_HH 22 | #define _GSM_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class GSMAudioRTPSink: public AudioRTPSink { 29 | public: 30 | static GSMAudioRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs); 31 | 32 | protected: 33 | GSMAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 34 | // called only by createNew() 35 | 36 | virtual ~GSMAudioRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual 40 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 41 | unsigned numBytesInFrame) const; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H261VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.261 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H261_VIDEO_RTP_SOURCE_HH 22 | #define _H261_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class H261VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static H261VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 31, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | u_int32_t lastSpecialHeader() const {return fLastSpecialHeader;} 36 | 37 | protected: 38 | virtual ~H261VideoRTPSource(); 39 | 40 | private: 41 | H261VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 42 | unsigned char rtpPayloadFormat, 43 | unsigned rtpTimestampFrequency); 44 | // called only by createNew() 45 | 46 | private: 47 | // redefined virtual functions: 48 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 49 | unsigned& resultSpecialHeaderSize); 50 | virtual char const* MIMEtype() const; 51 | 52 | private: 53 | u_int32_t fLastSpecialHeader; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H263plusVideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H.263 video file. 20 | // C++ header 21 | 22 | #ifndef _H263PLUS_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _H263PLUS_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class H263plusVideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static H263plusVideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | H263plusVideoFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~H263plusVideoFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H263plusVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for H.263+ video (RFC 4629) 19 | // C++ header 20 | 21 | #ifndef _H263_PLUS_VIDEO_RTP_SINK_HH 22 | #define _H263_PLUS_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class H263plusVideoRTPSink: public VideoRTPSink { 29 | public: 30 | static H263plusVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, 31 | unsigned char rtpPayloadFormat, 32 | u_int32_t rtpTimestampFrequency = 90000); 33 | 34 | protected: 35 | H263plusVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 36 | unsigned char rtpPayloadFormat, 37 | u_int32_t rtpTimestampFrequency); 38 | // called only by createNew() 39 | 40 | virtual ~H263plusVideoRTPSink(); 41 | 42 | private: // redefined virtual functions: 43 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 44 | unsigned char* frameStart, 45 | unsigned numBytesInFrame, 46 | struct timeval framePresentationTime, 47 | unsigned numRemainingBytes); 48 | virtual 49 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 50 | unsigned numBytesInFrame) const; 51 | virtual unsigned specialHeaderSize() const; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H263plusVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.263+ Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H263_PLUS_VIDEO_RTP_SOURCE_HH 22 | #define _H263_PLUS_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | #define SPECIAL_HEADER_BUFFER_SIZE 1000 29 | 30 | class H263plusVideoRTPSource: public MultiFramedRTPSource { 31 | public: 32 | static H263plusVideoRTPSource* 33 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 34 | unsigned char rtpPayloadFormat, 35 | unsigned rtpTimestampFrequency = 90000); 36 | 37 | // A data structure that stores copies of the special header bytes 38 | // from the most recent frame's RTP packets: 39 | unsigned char fNumSpecialHeaders; 40 | unsigned fSpecialHeaderBytesLength; 41 | unsigned char fSpecialHeaderBytes[SPECIAL_HEADER_BUFFER_SIZE]; 42 | unsigned fPacketSizes[256]; 43 | 44 | protected: 45 | virtual ~H263plusVideoRTPSource(); 46 | 47 | private: 48 | H263plusVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 49 | unsigned char rtpPayloadFormat, 50 | unsigned rtpTimestampFrequency); 51 | // called only by createNew() 52 | 53 | private: 54 | // redefined virtual functions: 55 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 56 | unsigned& resultSpecialHeaderSize); 57 | virtual char const* MIMEtype() const; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H263plusVideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an H263 video elementary stream into frames. 19 | // Author Benhard Feiten 20 | 21 | #ifndef _H263PLUS_VIDEO_STREAM_FRAMER_HH 22 | #define _H263PLUS_VIDEO_STREAM_FRAMER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | 29 | class H263plusVideoStreamFramer: public FramedFilter { 30 | public: 31 | 32 | static H263plusVideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource); 33 | 34 | Boolean& pictureEndMarker() { return fPictureEndMarker; } // a hack for implementing the RTP 'M' bit 35 | 36 | protected: 37 | // Constructor called only by createNew(), or by subclass constructors 38 | H263plusVideoStreamFramer(UsageEnvironment& env, 39 | FramedSource* inputSource, 40 | Boolean createParser = True); 41 | virtual ~H263plusVideoStreamFramer(); 42 | 43 | 44 | public: 45 | static void continueReadProcessing(void* clientData, 46 | unsigned char* ptr, unsigned size, 47 | struct timeval presentationTime); 48 | void continueReadProcessing(); 49 | 50 | private: 51 | virtual void doGetNextFrame(); 52 | virtual Boolean isH263plusVideoStreamFramer() const; 53 | 54 | protected: 55 | double fFrameRate; 56 | unsigned fPictureCount; // hack used to implement doGetNextFrame() ?? 57 | Boolean fPictureEndMarker; 58 | 59 | private: 60 | class H263plusVideoStreamParser* fParser; 61 | struct timeval fPresentationTimeBase; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H264 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _H264_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _H264_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class H264VideoFileServerMediaSubsession: public FileServerMediaSubsession { 30 | public: 31 | static H264VideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | // Used to implement "getAuxSDPLine()": 35 | void checkForAuxSDPLine1(); 36 | void afterPlayingDummy1(); 37 | 38 | protected: 39 | H264VideoFileServerMediaSubsession(UsageEnvironment& env, 40 | char const* fileName, Boolean reuseFirstSource); 41 | // called only by createNew(); 42 | virtual ~H264VideoFileServerMediaSubsession(); 43 | 44 | void setDoneFlag() { fDoneFlag = ~0; } 45 | 46 | protected: // redefined virtual functions 47 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, 48 | FramedSource* inputSource); 49 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 50 | unsigned& estBitrate); 51 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 52 | unsigned char rtpPayloadTypeIfDynamic, 53 | FramedSource* inputSource); 54 | 55 | private: 56 | char* fAuxSDPLine; 57 | char fDoneFlag; // used when setting up "fAuxSDPLine" 58 | RTPSink* fDummyRTPSink; // ditto 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.264 Video File Sinks 19 | // C++ header 20 | 21 | #ifndef _H264_VIDEO_FILE_SINK_HH 22 | #define _H264_VIDEO_FILE_SINK_HH 23 | 24 | #ifndef _H264_OR_5_VIDEO_FILE_SINK_HH 25 | #include "H264or5VideoFileSink.hh" 26 | #endif 27 | 28 | class H264VideoFileSink: public H264or5VideoFileSink { 29 | public: 30 | static H264VideoFileSink* createNew(UsageEnvironment& env, char const* fileName, 31 | char const* sPropParameterSetsStr = NULL, 32 | // "sPropParameterSetsStr" is an optional 'SDP format' string 33 | // (comma-separated Base64-encoded) representing SPS and/or PPS NAL-units 34 | // to prepend to the output 35 | unsigned bufferSize = 100000, 36 | Boolean oneFilePerFrame = False); 37 | // See "FileSink.hh" for a description of these parameters. 38 | 39 | protected: 40 | H264VideoFileSink(UsageEnvironment& env, FILE* fid, 41 | char const* sPropParameterSetsStr, 42 | unsigned bufferSize, char const* perFrameFileNamePrefix); 43 | // called only by createNew() 44 | virtual ~H264VideoFileSink(); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for H.264 video (RFC 3984) 19 | // C++ header 20 | 21 | #ifndef _H264_VIDEO_RTP_SINK_HH 22 | #define _H264_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _H264_OR_5_VIDEO_RTP_SINK_HH 25 | #include "H264or5VideoRTPSink.hh" 26 | #endif 27 | 28 | class H264VideoRTPSink: public H264or5VideoRTPSink { 29 | public: 30 | static H264VideoRTPSink* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 32 | static H264VideoRTPSink* 33 | createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, 34 | u_int8_t const* sps, unsigned spsSize, u_int8_t const* pps, unsigned ppsSize); 35 | // an optional variant of "createNew()", useful if we know, in advance, 36 | // the stream's SPS and PPS NAL units. 37 | // This avoids us having to 'pre-read' from the input source in order to get these values. 38 | static H264VideoRTPSink* 39 | createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, 40 | char const* sPropParameterSetsStr); 41 | // an optional variant of "createNew()", useful if we know, in advance, 42 | // the stream's SPS and PPS NAL units. 43 | // This avoids us having to 'pre-read' from the input source in order to get these values. 44 | 45 | protected: 46 | H264VideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, 47 | u_int8_t const* sps = NULL, unsigned spsSize = 0, 48 | u_int8_t const* pps = NULL, unsigned ppsSize = 0); 49 | // called only by createNew() 50 | virtual ~H264VideoRTPSink(); 51 | 52 | protected: // redefined virtual functions: 53 | virtual char const* auxSDPLine(); 54 | 55 | private: // redefined virtual functions: 56 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.264 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H264_VIDEO_RTP_SOURCE_HH 22 | #define _H264_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class H264VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static H264VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | H264VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 37 | unsigned char rtpPayloadFormat, 38 | unsigned rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~H264VideoRTPSource(); 42 | 43 | protected: 44 | // redefined virtual functions: 45 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 46 | unsigned& resultSpecialHeaderSize); 47 | virtual char const* MIMEtype() const; 48 | 49 | private: 50 | friend class H264BufferedPacket; 51 | unsigned char fCurPacketNALUnitType; 52 | }; 53 | 54 | class SPropRecord { 55 | public: 56 | ~SPropRecord() { delete[] sPropBytes; } 57 | 58 | unsigned sPropLength; // in bytes 59 | unsigned char* sPropBytes; 60 | }; 61 | 62 | SPropRecord* parseSPropParameterSets(char const* sPropParameterSetsStr, 63 | // result parameter: 64 | unsigned& numSPropRecords); 65 | // Returns the binary value of each 'parameter set' specified in a 66 | // "sprop-parameter-sets" string (in the SDP description for a H.264/RTP stream). 67 | // The value is returned as an array (length "numSPropRecords") of "SPropRecord"s. 68 | // This array is dynamically allocated by this routine, and must be delete[]d by the caller. 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoStreamDiscreteFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A simplified version of "H264VideoStreamFramer" that takes only complete, 19 | // discrete frames (rather than an arbitrary byte stream) as input. 20 | // This avoids the parsing and data copying overhead of the full 21 | // "H264VideoStreamFramer". 22 | // C++ header 23 | 24 | #ifndef _H264_VIDEO_STREAM_DISCRETE_FRAMER_HH 25 | #define _H264_VIDEO_STREAM_DISCRETE_FRAMER_HH 26 | 27 | #ifndef _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH 28 | #include "H264or5VideoStreamDiscreteFramer.hh" 29 | #endif 30 | 31 | class H264VideoStreamDiscreteFramer: public H264or5VideoStreamDiscreteFramer { 32 | public: 33 | static H264VideoStreamDiscreteFramer* 34 | createNew(UsageEnvironment& env, FramedSource* inputSource); 35 | 36 | protected: 37 | H264VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource); 38 | // called only by createNew() 39 | virtual ~H264VideoStreamDiscreteFramer(); 40 | 41 | private: 42 | // redefined virtual functions: 43 | virtual Boolean isH264VideoStreamFramer() const; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264VideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up a H.264 Video Elementary Stream into NAL units. 19 | // C++ header 20 | 21 | #ifndef _H264_VIDEO_STREAM_FRAMER_HH 22 | #define _H264_VIDEO_STREAM_FRAMER_HH 23 | 24 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH 25 | #include "H264or5VideoStreamFramer.hh" 26 | #endif 27 | 28 | class H264VideoStreamFramer: public H264or5VideoStreamFramer { 29 | public: 30 | static H264VideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource, 31 | Boolean includeStartCodeInOutput = False); 32 | 33 | protected: 34 | H264VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, 35 | Boolean createParser, Boolean includeStartCodeInOutput); 36 | // called only by "createNew()" 37 | virtual ~H264VideoStreamFramer(); 38 | 39 | // redefined virtual functions: 40 | virtual Boolean isH264VideoStreamFramer() const; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264or5VideoFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.264 or H.265 Video File Sinks 19 | // C++ header 20 | 21 | #ifndef _H264_OR_5_VIDEO_FILE_SINK_HH 22 | #define _H264_OR_5_VIDEO_FILE_SINK_HH 23 | 24 | #ifndef _FILE_SINK_HH 25 | #include "FileSink.hh" 26 | #endif 27 | 28 | class H264or5VideoFileSink: public FileSink { 29 | protected: 30 | H264or5VideoFileSink(UsageEnvironment& env, FILE* fid, 31 | unsigned bufferSize, char const* perFrameFileNamePrefix, 32 | char const* sPropParameterSetsStr1, 33 | char const* sPropParameterSetsStr2 = NULL, 34 | char const* sPropParameterSetsStr3 = NULL); 35 | // we're an abstract base class 36 | virtual ~H264or5VideoFileSink(); 37 | 38 | protected: // redefined virtual functions: 39 | virtual void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime); 40 | 41 | private: 42 | char const* fSPropParameterSetsStr[3]; 43 | Boolean fHaveWrittenFirstFrame; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264or5VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for H.264 or H.265 video 19 | // C++ header 20 | 21 | #ifndef _H264_OR_5_VIDEO_RTP_SINK_HH 22 | #define _H264_OR_5_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | #ifndef _FRAMED_FILTER_HH 28 | #include "FramedFilter.hh" 29 | #endif 30 | 31 | class H264or5VideoRTPSink: public VideoRTPSink { 32 | protected: 33 | H264or5VideoRTPSink(int hNumber, // 264 or 265 34 | UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, 35 | u_int8_t const* vps = NULL, unsigned vpsSize = 0, 36 | u_int8_t const* sps = NULL, unsigned spsSize = 0, 37 | u_int8_t const* pps = NULL, unsigned ppsSize = 0); 38 | // we're an abstrace base class 39 | virtual ~H264or5VideoRTPSink(); 40 | 41 | private: // redefined virtual functions: 42 | virtual Boolean continuePlaying(); 43 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 44 | unsigned char* frameStart, 45 | unsigned numBytesInFrame, 46 | struct timeval framePresentationTime, 47 | unsigned numRemainingBytes); 48 | virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 49 | unsigned numBytesInFrame) const; 50 | 51 | protected: 52 | int fHNumber; 53 | FramedFilter* fOurFragmenter; 54 | char* fFmtpSDPLine; 55 | u_int8_t* fVPS; unsigned fVPSSize; 56 | u_int8_t* fSPS; unsigned fSPSSize; 57 | u_int8_t* fPPS; unsigned fPPSSize; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H264or5VideoStreamDiscreteFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A simplified version of "H264or5VideoStreamFramer" that takes only complete, 19 | // discrete frames (rather than an arbitrary byte stream) as input. 20 | // This avoids the parsing and data copying overhead of the full 21 | // "H264or5VideoStreamFramer". 22 | // C++ header 23 | 24 | #ifndef _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH 25 | #define _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH 26 | 27 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH 28 | #include "H264or5VideoStreamFramer.hh" 29 | #endif 30 | 31 | class H264or5VideoStreamDiscreteFramer: public H264or5VideoStreamFramer { 32 | protected: 33 | H264or5VideoStreamDiscreteFramer(int hNumber, UsageEnvironment& env, FramedSource* inputSource); 34 | // we're an abstract base class 35 | virtual ~H264or5VideoStreamDiscreteFramer(); 36 | 37 | protected: 38 | // redefined virtual functions: 39 | virtual void doGetNextFrame(); 40 | 41 | protected: 42 | static void afterGettingFrame(void* clientData, unsigned frameSize, 43 | unsigned numTruncatedBytes, 44 | struct timeval presentationTime, 45 | unsigned durationInMicroseconds); 46 | void afterGettingFrame1(unsigned frameSize, 47 | unsigned numTruncatedBytes, 48 | struct timeval presentationTime, 49 | unsigned durationInMicroseconds); 50 | 51 | virtual Boolean nalUnitEndsAccessUnit(u_int8_t nal_unit_type); 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H265VideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H265 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _H265_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _H265_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class H265VideoFileServerMediaSubsession: public FileServerMediaSubsession { 30 | public: 31 | static H265VideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | // Used to implement "getAuxSDPLine()": 35 | void checkForAuxSDPLine1(); 36 | void afterPlayingDummy1(); 37 | 38 | protected: 39 | H265VideoFileServerMediaSubsession(UsageEnvironment& env, 40 | char const* fileName, Boolean reuseFirstSource); 41 | // called only by createNew(); 42 | virtual ~H265VideoFileServerMediaSubsession(); 43 | 44 | void setDoneFlag() { fDoneFlag = ~0; } 45 | 46 | protected: // redefined virtual functions 47 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, 48 | FramedSource* inputSource); 49 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 50 | unsigned& estBitrate); 51 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 52 | unsigned char rtpPayloadTypeIfDynamic, 53 | FramedSource* inputSource); 54 | 55 | private: 56 | char* fAuxSDPLine; 57 | char fDoneFlag; // used when setting up "fAuxSDPLine" 58 | RTPSink* fDummyRTPSink; // ditto 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H265VideoFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.265 Video File Sinks 19 | // C++ header 20 | 21 | #ifndef _H265_VIDEO_FILE_SINK_HH 22 | #define _H265_VIDEO_FILE_SINK_HH 23 | 24 | #ifndef _H264_OR_5_VIDEO_FILE_SINK_HH 25 | #include "H264or5VideoFileSink.hh" 26 | #endif 27 | 28 | class H265VideoFileSink: public H264or5VideoFileSink { 29 | public: 30 | static H265VideoFileSink* createNew(UsageEnvironment& env, char const* fileName, 31 | char const* sPropVPSStr = NULL, 32 | char const* sPropSPSStr = NULL, 33 | char const* sPropPPSStr = NULL, 34 | // The "sProp*Str" parameters are optional 'SDP format' strings 35 | // (comma-separated Base64-encoded) representing VPS, SPS, and/or PPS NAL-units 36 | // to prepend to the output 37 | unsigned bufferSize = 100000, 38 | Boolean oneFilePerFrame = False); 39 | // See "FileSink.hh" for a description of these parameters. 40 | 41 | protected: 42 | H265VideoFileSink(UsageEnvironment& env, FILE* fid, 43 | char const* sPropVPSStr, 44 | char const* sPropSPSStr, 45 | char const* sPropPPSStr, 46 | unsigned bufferSize, char const* perFrameFileNamePrefix); 47 | // called only by createNew() 48 | virtual ~H265VideoFileSink(); 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H265VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // H.265 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H265_VIDEO_RTP_SOURCE_HH 22 | #define _H265_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class H265VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static H265VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | Boolean expectDONFields = False, 34 | unsigned rtpTimestampFrequency = 90000); 35 | // "expectDONFields" is True iff we expect incoming H.265/RTP packets to contain 36 | // DONL and DOND fields. I.e., if "tx-mode == "MST" or sprop-depack-buf-nalus > 0". 37 | 38 | u_int64_t currentNALUnitAbsDon() const { return fCurrentNALUnitAbsDon; } 39 | // the 'absolute decoding order number (AbsDon)' for the most-recently delivered NAL unit 40 | 41 | protected: 42 | H265VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 43 | unsigned char rtpPayloadFormat, 44 | Boolean expectDONFields, 45 | unsigned rtpTimestampFrequency); 46 | // called only by createNew() 47 | 48 | virtual ~H265VideoRTPSource(); 49 | 50 | protected: 51 | // redefined virtual functions: 52 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 53 | unsigned& resultSpecialHeaderSize); 54 | virtual char const* MIMEtype() const; 55 | 56 | private: 57 | void computeAbsDonFromDON(u_int16_t DON); 58 | 59 | private: 60 | friend class H265BufferedPacket; 61 | Boolean fExpectDONFields; 62 | unsigned char fCurPacketNALUnitType; 63 | u_int16_t fPreviousNALUnitDON; 64 | u_int64_t fCurrentNALUnitAbsDon; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H265VideoStreamDiscreteFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A simplified version of "H265VideoStreamFramer" that takes only complete, 19 | // discrete frames (rather than an arbitrary byte stream) as input. 20 | // This avoids the parsing and data copying overhead of the full 21 | // "H265VideoStreamFramer". 22 | // C++ header 23 | 24 | #ifndef _H265_VIDEO_STREAM_DISCRETE_FRAMER_HH 25 | #define _H265_VIDEO_STREAM_DISCRETE_FRAMER_HH 26 | 27 | #ifndef _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH 28 | #include "H264or5VideoStreamDiscreteFramer.hh" 29 | #endif 30 | 31 | class H265VideoStreamDiscreteFramer: public H264or5VideoStreamDiscreteFramer { 32 | public: 33 | static H265VideoStreamDiscreteFramer* 34 | createNew(UsageEnvironment& env, FramedSource* inputSource); 35 | 36 | protected: 37 | H265VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource); 38 | // called only by createNew() 39 | virtual ~H265VideoStreamDiscreteFramer(); 40 | 41 | private: 42 | // redefined virtual functions: 43 | virtual Boolean isH265VideoStreamFramer() const; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/live555/liveMedia/H265VideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up a H.265 Video Elementary Stream into NAL units. 19 | // C++ header 20 | 21 | #ifndef _H265_VIDEO_STREAM_FRAMER_HH 22 | #define _H265_VIDEO_STREAM_FRAMER_HH 23 | 24 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH 25 | #include "H264or5VideoStreamFramer.hh" 26 | #endif 27 | 28 | class H265VideoStreamFramer: public H264or5VideoStreamFramer { 29 | public: 30 | static H265VideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource, 31 | Boolean includeStartCodeInOutput = False); 32 | 33 | protected: 34 | H265VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean createParser, Boolean includeStartCodeInOutput); 35 | // called only by "createNew()" 36 | virtual ~H265VideoStreamFramer(); 37 | 38 | // redefined virtual functions: 39 | virtual Boolean isH265VideoStreamFramer() const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/live555/liveMedia/JPEGVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for JPEG video (RFC 2435) 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_RTP_SINK_HH 22 | #define _JPEG_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class JPEGVideoRTPSink: public VideoRTPSink { 29 | public: 30 | static JPEGVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs); 31 | 32 | protected: 33 | JPEGVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 34 | // called only by createNew() 35 | 36 | virtual ~JPEGVideoRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 40 | 41 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 42 | unsigned char* frameStart, 43 | unsigned numBytesInFrame, 44 | struct timeval framePresentationTime, 45 | unsigned numRemainingBytes); 46 | virtual 47 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 48 | unsigned numBytesInFrame) const; 49 | virtual unsigned specialHeaderSize() const; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/live555/liveMedia/JPEGVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // JPEG Video (RFC 2435) RTP Sources 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_RTP_SOURCE_HH 22 | #define _JPEG_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | #define MAX_JPEG_HEADER_SIZE 1024 29 | 30 | class JPEGVideoRTPSource: public MultiFramedRTPSource { 31 | public: 32 | static JPEGVideoRTPSource* 33 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 34 | unsigned char rtpPayloadFormat = 26, 35 | unsigned rtpPayloadFrequency = 90000, 36 | unsigned defaultWidth = 0, unsigned defaultHeight = 0); 37 | 38 | protected: 39 | virtual ~JPEGVideoRTPSource(); 40 | 41 | private: 42 | JPEGVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 43 | unsigned char rtpPayloadFormat, 44 | unsigned rtpTimestampFrequency, 45 | unsigned defaultWidth, unsigned defaultHeight); 46 | // called only by createNew() 47 | 48 | // Image dimensions from the SDP description, if any 49 | unsigned fDefaultWidth, fDefaultHeight; 50 | 51 | private: 52 | // redefined virtual functions: 53 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 54 | unsigned& resultSpecialHeaderSize); 55 | 56 | virtual char const* MIMEtype() const; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/live555/liveMedia/JPEGVideoSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // JPEG video sources 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_SOURCE_HH 22 | #define _JPEG_VIDEO_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class JPEGVideoSource: public FramedSource { 29 | public: 30 | virtual u_int8_t type() = 0; 31 | virtual u_int8_t qFactor() = 0; 32 | virtual u_int8_t width() = 0; // # pixels/8 (or 0 for 2048 pixels) 33 | virtual u_int8_t height() = 0; // # pixels/8 (or 0 for 2048 pixels) 34 | 35 | virtual u_int8_t const* quantizationTables(u_int8_t& precision, 36 | u_int16_t& length); 37 | // If "qFactor()" returns a value >= 128, then this function is called 38 | // to tell us the quantization tables that are being used. 39 | // (The default implementation of this function just returns NULL.) 40 | // "precision" and "length" are as defined in RFC 2435, section 3.1.8. 41 | 42 | virtual u_int16_t restartInterval(); 43 | // If restart intervals are being used (i.e., 64 <= type() <= 127), then this function must be 44 | // redefined - by a subclass - to return a non-zero value. 45 | 46 | protected: 47 | JPEGVideoSource(UsageEnvironment& env); // abstract base class 48 | virtual ~JPEGVideoSource(); 49 | 50 | private: 51 | // redefined virtual functions: 52 | virtual Boolean isJPEGVideoSource() const; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MP3ADURTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for 'ADUized' MP3 frames ("mpa-robust") 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_RTP_SINK_HH 22 | #define _MP3_ADU_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class MP3ADURTPSink: public AudioRTPSink { 29 | public: 30 | static MP3ADURTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, 31 | unsigned char RTPPayloadType); 32 | 33 | protected: 34 | virtual ~MP3ADURTPSink(); 35 | 36 | private: 37 | MP3ADURTPSink(UsageEnvironment& env, Groupsock* RTPgs, 38 | unsigned char RTPPayloadType); 39 | // called only by createNew() 40 | 41 | 42 | private: 43 | // Redefined virtual functions: 44 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 45 | unsigned char* frameStart, 46 | unsigned numBytesInFrame, 47 | struct timeval framePresentationTime, 48 | unsigned numRemainingBytes); 49 | virtual unsigned specialHeaderSize() const; 50 | 51 | private: 52 | unsigned fCurADUSize; // used when fragmenting over multiple RTP packets 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MP3ADURTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP source for 'ADUized' MP3 frames ("mpa-robust") 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_SOURCE_HH 22 | #define _MP3_ADU_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MP3ADURTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MP3ADURTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MP3ADURTPSource(); 37 | 38 | private: 39 | MP3ADURTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual char const* MIMEtype() const; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MP3ADUTranscoder.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Transcoder for ADUized MP3 frames 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_TRANSCODER_HH 22 | #define _MP3_ADU_TRANSCODER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | class MP3ADUTranscoder: public FramedFilter { 29 | public: 30 | static MP3ADUTranscoder* createNew(UsageEnvironment& env, 31 | unsigned outBitrate /* in kbps */, 32 | FramedSource* inputSource); 33 | 34 | unsigned outBitrate() const { return fOutBitrate; } 35 | protected: 36 | MP3ADUTranscoder(UsageEnvironment& env, 37 | unsigned outBitrate /* in kbps */, 38 | FramedSource* inputSource); 39 | // called only by createNew() 40 | virtual ~MP3ADUTranscoder(); 41 | 42 | private: 43 | // redefined virtual functions: 44 | virtual void doGetNextFrame(); 45 | virtual void getAttributes() const; 46 | 47 | private: 48 | static void afterGettingFrame(void* clientData, 49 | unsigned numBytesRead, unsigned numTruncatedBytes, 50 | struct timeval presentationTime, 51 | unsigned durationInMicroseconds); 52 | void afterGettingFrame1(unsigned numBytesRead, unsigned numTruncatedBytes, 53 | struct timeval presentationTime, 54 | unsigned durationInMicroseconds); 55 | 56 | private: 57 | unsigned fOutBitrate; // in kbps 58 | unsigned fAvailableBytesForBackpointer; 59 | 60 | unsigned char* fOrigADU; 61 | // used to store incoming ADU prior to transcoding 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MP3FileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // MP3 File Sources 19 | // C++ header 20 | 21 | #ifndef _MP3_FILE_SOURCE_HH 22 | #define _MP3_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_FILE_SOURCE_HH 25 | #include "FramedFileSource.hh" 26 | #endif 27 | 28 | class MP3StreamState; // forward 29 | 30 | class MP3FileSource: public FramedFileSource { 31 | public: 32 | static MP3FileSource* createNew(UsageEnvironment& env, char const* fileName); 33 | 34 | float filePlayTime() const; 35 | unsigned fileSize() const; 36 | void setPresentationTimeScale(unsigned scale); 37 | void seekWithinFile(double seekNPT, double streamDuration); 38 | // if "streamDuration" is >0.0, then we limit the stream to that duration, before treating it as EOF 39 | 40 | protected: 41 | MP3FileSource(UsageEnvironment& env, FILE* fid); 42 | // called only by createNew() 43 | 44 | virtual ~MP3FileSource(); 45 | 46 | protected: 47 | void assignStream(FILE* fid, unsigned filesize); 48 | Boolean initializeStream(); 49 | 50 | MP3StreamState* streamState() {return fStreamState;} 51 | 52 | private: 53 | // redefined virtual functions: 54 | virtual void doGetNextFrame(); 55 | virtual char const* MIMEtype() const; 56 | virtual void getAttributes() const; 57 | 58 | private: 59 | virtual Boolean doGetNextFrame1(); 60 | 61 | private: 62 | MP3StreamState* fStreamState; 63 | Boolean fHaveJustInitialized; 64 | struct timeval fFirstFramePresentationTime; // set on stream init 65 | Boolean fLimitNumBytesToStream; 66 | unsigned fNumBytesToStream; // used iff "fLimitNumBytesToStream" is True 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MP3Transcoder.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // MP3 Transcoder 19 | // C++ header 20 | 21 | #ifndef _MP3_TRANSCODER_HH 22 | #define _MP3_TRANSCODER_HH 23 | 24 | #ifndef _MP3_ADU_HH 25 | #include "MP3ADU.hh" 26 | #endif 27 | #ifndef _MP3_ADU_TRANSCODER_HH 28 | #include "MP3ADUTranscoder.hh" 29 | #endif 30 | 31 | class MP3Transcoder: public MP3FromADUSource { 32 | public: 33 | static MP3Transcoder* createNew(UsageEnvironment& env, 34 | unsigned outBitrate /* in kbps */, 35 | FramedSource* inputSource); 36 | 37 | protected: 38 | MP3Transcoder(UsageEnvironment& env, 39 | MP3ADUTranscoder* aduTranscoder); 40 | // called only by createNew() 41 | virtual ~MP3Transcoder(); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for MPEG audio (RFC 2250) 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_AUDIO_RTP_SINK_HH 22 | #define _MPEG_1OR2_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class MPEG1or2AudioRTPSink: public AudioRTPSink { 29 | public: 30 | static MPEG1or2AudioRTPSink* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs); 32 | 33 | protected: 34 | MPEG1or2AudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 35 | // called only by createNew() 36 | 37 | virtual ~MPEG1or2AudioRTPSink(); 38 | 39 | private: // redefined virtual functions: 40 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 41 | unsigned char* frameStart, 42 | unsigned numBytesInFrame, 43 | struct timeval framePresentationTime, 44 | unsigned numRemainingBytes); 45 | virtual unsigned specialHeaderSize() const; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2AudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // MPEG-1 or MPEG-2 Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_AUDIO_RTP_SOURCE_HH 22 | #define _MPEG_1OR2_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG1or2AudioRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG1or2AudioRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 14, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MPEG1or2AudioRTPSource(); 37 | 38 | private: 39 | MPEG1or2AudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2AudioStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an MPEG (1,2) audio elementary stream into frames 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_AUDIO_STREAM_FRAMER_HH 22 | #define _MPEG_1OR2_AUDIO_STREAM_FRAMER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | class MPEG1or2AudioStreamFramer: public FramedFilter { 29 | public: 30 | static MPEG1or2AudioStreamFramer* 31 | createNew(UsageEnvironment& env, FramedSource* inputSource, 32 | Boolean syncWithInputSource = False); 33 | // If "syncWithInputSource" is True, the stream's presentation time 34 | // will be reset to that of the input source, whenever new data 35 | // is read from it. 36 | 37 | void flushInput(); // called if there is a discontinuity (seeking) in the input 38 | 39 | private: 40 | MPEG1or2AudioStreamFramer(UsageEnvironment& env, FramedSource* inputSource, 41 | Boolean syncWithInputSource); 42 | // called only by createNew() 43 | virtual ~MPEG1or2AudioStreamFramer(); 44 | 45 | static void continueReadProcessing(void* clientData, 46 | unsigned char* ptr, unsigned size, 47 | struct timeval presentationTime); 48 | void continueReadProcessing(); 49 | 50 | void resetPresentationTime(struct timeval newPresentationTime); 51 | // useful if we're being synced with a separate (e.g., video) stream 52 | 53 | private: 54 | // redefined virtual functions: 55 | virtual void doGetNextFrame(); 56 | 57 | private: 58 | void reset(); 59 | struct timeval currentFramePlayTime() const; 60 | 61 | private: 62 | Boolean fSyncWithInputSource; 63 | struct timeval fNextFramePresentationTime; 64 | 65 | private: // parsing state 66 | class MPEG1or2AudioStreamParser* fParser; 67 | friend class MPEG1or2AudioStreamParser; // hack 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2DemuxedElementaryStream.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A MPEG 1 or 2 Elementary Stream, demultiplexed from a Program Stream 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH 22 | #define _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH 23 | 24 | #ifndef _MPEG_1OR2_DEMUX_HH 25 | #include "MPEG1or2Demux.hh" 26 | #endif 27 | 28 | class MPEG1or2DemuxedElementaryStream: public FramedSource { 29 | public: 30 | MPEG1or2Demux::SCR lastSeenSCR() const { return fLastSeenSCR; } 31 | 32 | unsigned char mpegVersion() const { return fMPEGversion; } 33 | 34 | MPEG1or2Demux& sourceDemux() const { return fOurSourceDemux; } 35 | 36 | private: // We are created only by a MPEG1or2Demux (a friend) 37 | MPEG1or2DemuxedElementaryStream(UsageEnvironment& env, 38 | u_int8_t streamIdTag, 39 | MPEG1or2Demux& sourceDemux); 40 | virtual ~MPEG1or2DemuxedElementaryStream(); 41 | 42 | private: 43 | // redefined virtual functions: 44 | virtual void doGetNextFrame(); 45 | virtual void doStopGettingFrames(); 46 | virtual char const* MIMEtype() const; 47 | virtual unsigned maxFrameSize() const; 48 | 49 | private: 50 | static void afterGettingFrame(void* clientData, 51 | unsigned frameSize, unsigned numTruncatedBytes, 52 | struct timeval presentationTime, 53 | unsigned durationInMicroseconds); 54 | 55 | void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, 56 | struct timeval presentationTime, 57 | unsigned durationInMicroseconds); 58 | 59 | private: 60 | u_int8_t fOurStreamIdTag; 61 | MPEG1or2Demux& fOurSourceDemux; 62 | char const* fMIMEtype; 63 | MPEG1or2Demux::SCR fLastSeenSCR; 64 | unsigned char fMPEGversion; 65 | 66 | friend class MPEG1or2Demux; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2DemuxedServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a MPEG-1 or 2 demuxer. 20 | // C++ header 21 | 22 | #ifndef _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 26 | #include "OnDemandServerMediaSubsession.hh" 27 | #endif 28 | #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH 29 | #include "MPEG1or2FileServerDemux.hh" 30 | #endif 31 | 32 | class MPEG1or2DemuxedServerMediaSubsession: public OnDemandServerMediaSubsession{ 33 | public: 34 | static MPEG1or2DemuxedServerMediaSubsession* 35 | createNew(MPEG1or2FileServerDemux& demux, u_int8_t streamIdTag, 36 | Boolean reuseFirstSource, 37 | Boolean iFramesOnly = False, double vshPeriod = 5.0); 38 | // The last two parameters are relevant for video streams only 39 | 40 | private: 41 | MPEG1or2DemuxedServerMediaSubsession(MPEG1or2FileServerDemux& demux, 42 | u_int8_t streamIdTag, Boolean reuseFirstSource, 43 | Boolean iFramesOnly, double vshPeriod); 44 | // called only by createNew(); 45 | virtual ~MPEG1or2DemuxedServerMediaSubsession(); 46 | 47 | private: // redefined virtual functions 48 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 49 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 50 | unsigned& estBitrate); 51 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 52 | unsigned char rtpPayloadTypeIfDynamic, 53 | FramedSource* inputSource); 54 | virtual float duration() const; 55 | 56 | private: 57 | MPEG1or2FileServerDemux& fOurDemux; 58 | u_int8_t fStreamIdTag; 59 | Boolean fIFramesOnly; // for video streams 60 | double fVSHPeriod; // for video streams 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2FileServerDemux.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A server demultiplexer for a MPEG 1 or 2 Program Stream 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH 22 | #define _MPEG_1OR2_FILE_SERVER_DEMUX_HH 23 | 24 | #ifndef _SERVER_MEDIA_SESSION_HH 25 | #include "ServerMediaSession.hh" 26 | #endif 27 | #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH 28 | #include "MPEG1or2DemuxedElementaryStream.hh" 29 | #endif 30 | 31 | class MPEG1or2FileServerDemux: public Medium { 32 | public: 33 | static MPEG1or2FileServerDemux* 34 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 35 | 36 | ServerMediaSubsession* newAudioServerMediaSubsession(); // MPEG-1 or 2 audio 37 | ServerMediaSubsession* newVideoServerMediaSubsession(Boolean iFramesOnly = False, 38 | double vshPeriod = 5.0 39 | /* how often (in seconds) to inject a Video_Sequence_Header, 40 | if one doesn't already appear in the stream */); 41 | ServerMediaSubsession* newAC3AudioServerMediaSubsession(); // AC-3 audio (from VOB) 42 | 43 | unsigned fileSize() const { return fFileSize; } 44 | float fileDuration() const { return fFileDuration; } 45 | 46 | private: 47 | MPEG1or2FileServerDemux(UsageEnvironment& env, char const* fileName, 48 | Boolean reuseFirstSource); 49 | // called only by createNew(); 50 | virtual ~MPEG1or2FileServerDemux(); 51 | 52 | private: 53 | friend class MPEG1or2DemuxedServerMediaSubsession; 54 | MPEG1or2DemuxedElementaryStream* newElementaryStream(unsigned clientSessionId, 55 | u_int8_t streamIdTag); 56 | 57 | private: 58 | char const* fFileName; 59 | unsigned fFileSize; 60 | float fFileDuration; 61 | Boolean fReuseFirstSource; 62 | MPEG1or2Demux* fSession0Demux; 63 | MPEG1or2Demux* fLastCreatedDemux; 64 | unsigned fLastClientSessionId; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2VideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a MPEG-1 or 2 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _MPEG_1OR2_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG_1OR2_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class MPEG1or2VideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static MPEG1or2VideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource, 33 | Boolean iFramesOnly = False, 34 | double vshPeriod = 5.0 35 | /* how often (in seconds) to inject a Video_Sequence_Header, 36 | if one doesn't already appear in the stream */); 37 | 38 | private: 39 | MPEG1or2VideoFileServerMediaSubsession(UsageEnvironment& env, 40 | char const* fileName, 41 | Boolean reuseFirstSource, 42 | Boolean iFramesOnly, 43 | double vshPeriod); 44 | // called only by createNew(); 45 | virtual ~MPEG1or2VideoFileServerMediaSubsession(); 46 | 47 | private: // redefined virtual functions 48 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 49 | unsigned& estBitrate); 50 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 51 | unsigned char rtpPayloadTypeIfDynamic, 52 | FramedSource* inputSource); 53 | 54 | private: 55 | Boolean fIFramesOnly; 56 | double fVSHPeriod; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // MPEG-1 or MPEG-2 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_VIDEO_RTP_SOURCE_HH 22 | #define _MPEG_1OR2_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG1or2VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG1or2VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 32, 33 | unsigned rtpPayloadFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MPEG1or2VideoRTPSource(); 37 | 38 | private: 39 | MPEG1or2VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual Boolean packetIsUsableInJitterCalculation(unsigned char* packet, 49 | unsigned packetSize); 50 | virtual char const* MIMEtype() const; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG1or2VideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an MPEG 1 or 2 video elementary stream into 19 | // frames for: Video_Sequence_Header, GOP_Header, Picture_Header 20 | // C++ header 21 | 22 | #ifndef _MPEG_1OR2_VIDEO_STREAM_FRAMER_HH 23 | #define _MPEG_1OR2_VIDEO_STREAM_FRAMER_HH 24 | 25 | #ifndef _MPEG_VIDEO_STREAM_FRAMER_HH 26 | #include "MPEGVideoStreamFramer.hh" 27 | #endif 28 | 29 | class MPEG1or2VideoStreamFramer: public MPEGVideoStreamFramer { 30 | public: 31 | static MPEG1or2VideoStreamFramer* 32 | createNew(UsageEnvironment& env, FramedSource* inputSource, 33 | Boolean iFramesOnly = False, 34 | double vshPeriod = 5.0 35 | /* how often (in seconds) to inject a Video_Sequence_Header, 36 | if one doesn't already appear in the stream */); 37 | 38 | protected: 39 | MPEG1or2VideoStreamFramer(UsageEnvironment& env, 40 | FramedSource* inputSource, 41 | Boolean iFramesOnly, double vshPeriod, 42 | Boolean createParser = True); 43 | // called only by createNew(), or by subclass constructors 44 | virtual ~MPEG1or2VideoStreamFramer(); 45 | 46 | private: 47 | // redefined virtual functions: 48 | virtual Boolean isMPEG1or2VideoStreamFramer() const; 49 | 50 | private: 51 | double getCurrentPTS() const; 52 | 53 | friend class MPEG1or2VideoStreamParser; // hack 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG2TransportStreamFromESSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter for converting one or more MPEG Elementary Streams 19 | // to a MPEG-2 Transport Stream 20 | // C++ header 21 | 22 | #ifndef _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH 23 | #define _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH 24 | 25 | #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH 26 | #include "MPEG2TransportStreamMultiplexor.hh" 27 | #endif 28 | 29 | class MPEG2TransportStreamFromESSource: public MPEG2TransportStreamMultiplexor { 30 | public: 31 | static MPEG2TransportStreamFromESSource* createNew(UsageEnvironment& env); 32 | 33 | void addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1); 34 | // Note: For MPEG-4 video, set "mpegVersion" to 4; for H.264 video, set "mpegVersion" to 5. 35 | void addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1); 36 | // Note: In these functions, if "PID" is not -1, then it (currently, just the low 8 bits) 37 | // is used as the stream's PID. Otherwise (if "PID" is -1) the 'stream_id' is used as 38 | // the PID. 39 | 40 | static unsigned maxInputESFrameSize; 41 | 42 | protected: 43 | MPEG2TransportStreamFromESSource(UsageEnvironment& env); 44 | // called only by createNew() 45 | virtual ~MPEG2TransportStreamFromESSource(); 46 | 47 | void addNewInputSource(FramedSource* inputSource, 48 | u_int8_t streamId, int mpegVersion, int16_t PID = -1); 49 | // used to implement addNew*Source() above 50 | 51 | private: 52 | // Redefined virtual functions: 53 | virtual void doStopGettingFrames(); 54 | virtual void awaitNewBuffer(unsigned char* oldBuffer); 55 | 56 | private: 57 | friend class InputESSourceRecord; 58 | class InputESSourceRecord* fInputSources; 59 | unsigned fVideoSourceCounter, fAudioSourceCounter; 60 | Boolean fAwaitingBackgroundDelivery; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG2TransportStreamFromPESSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A filter for converting a stream of MPEG PES packets to a MPEG-2 Transport Stream 19 | // C++ header 20 | 21 | #ifndef _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH 22 | #define _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH 23 | 24 | #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH 25 | #include "MPEG2TransportStreamMultiplexor.hh" 26 | #endif 27 | #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH 28 | #include "MPEG1or2DemuxedElementaryStream.hh" 29 | #endif 30 | 31 | class MPEG2TransportStreamFromPESSource: public MPEG2TransportStreamMultiplexor { 32 | public: 33 | static MPEG2TransportStreamFromPESSource* 34 | createNew(UsageEnvironment& env, MPEG1or2DemuxedElementaryStream* inputSource); 35 | 36 | protected: 37 | MPEG2TransportStreamFromPESSource(UsageEnvironment& env, 38 | MPEG1or2DemuxedElementaryStream* inputSource); 39 | // called only by createNew() 40 | virtual ~MPEG2TransportStreamFromPESSource(); 41 | 42 | private: 43 | // Redefined virtual functions: 44 | virtual void doStopGettingFrames(); 45 | virtual void awaitNewBuffer(unsigned char* oldBuffer); 46 | 47 | private: 48 | static void afterGettingFrame(void* clientData, unsigned frameSize, 49 | unsigned numTruncatedBytes, 50 | struct timeval presentationTime, 51 | unsigned durationInMicroseconds); 52 | void afterGettingFrame1(unsigned frameSize, 53 | unsigned numTruncatedBytes, 54 | struct timeval presentationTime, 55 | unsigned durationInMicroseconds); 56 | 57 | private: 58 | MPEG1or2DemuxedElementaryStream* fInputSource; 59 | unsigned char* fInputBuffer; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG2TransportUDPServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an incoming UDP (or RTP/UDP) MPEG-2 Transport Stream 20 | // C++ header 21 | 22 | #ifndef _MPEG2_TRANSPORT_UDP_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG2_TRANSPORT_UDP_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 26 | #include "OnDemandServerMediaSubsession.hh" 27 | #endif 28 | 29 | class MPEG2TransportUDPServerMediaSubsession: public OnDemandServerMediaSubsession { 30 | public: 31 | static MPEG2TransportUDPServerMediaSubsession* 32 | createNew(UsageEnvironment& env, 33 | char const* inputAddressStr, // An IP multicast address, or use "0.0.0.0" or NULL for unicast input 34 | Port const& inputPort, 35 | Boolean inputStreamIsRawUDP = False); // otherwise (default) the input stream is RTP/UDP 36 | protected: 37 | MPEG2TransportUDPServerMediaSubsession(UsageEnvironment& env, 38 | char const* inputAddressStr, Port const& inputPort, Boolean inputStreamIsRawUDP); 39 | // called only by createNew(); 40 | virtual ~MPEG2TransportUDPServerMediaSubsession(); 41 | 42 | protected: // redefined virtual functions 43 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 44 | unsigned& estBitrate); 45 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 46 | unsigned char rtpPayloadTypeIfDynamic, 47 | FramedSource* inputSource); 48 | protected: 49 | char const* fInputAddressStr; 50 | Port fInputPort; 51 | Groupsock* fInputGroupsock; 52 | Boolean fInputStreamIsRawUDP; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG4ESVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // MP4V-ES video RTP stream sources 19 | // C++ header 20 | 21 | #ifndef _MPEG4_ES_VIDEO_RTP_SOURCE_HH 22 | #define _MPEG4_ES_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG4ESVideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG4ESVideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~MPEG4ESVideoRTPSource(); 37 | 38 | private: 39 | MPEG4ESVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG4LATMAudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for MPEG-4 audio, using LATM multiplexing (RFC 3016) 19 | // (Note that the initial 'size' field is assumed to be present at the start of 20 | // each frame.) 21 | // C++ header 22 | 23 | #ifndef _MPEG4_LATM_AUDIO_RTP_SINK_HH 24 | #define _MPEG4_LATM_AUDIO_RTP_SINK_HH 25 | 26 | #ifndef _AUDIO_RTP_SINK_HH 27 | #include "AudioRTPSink.hh" 28 | #endif 29 | 30 | class MPEG4LATMAudioRTPSink: public AudioRTPSink { 31 | public: 32 | static MPEG4LATMAudioRTPSink* createNew(UsageEnvironment& env, 33 | Groupsock* RTPgs, 34 | unsigned char rtpPayloadFormat, 35 | u_int32_t rtpTimestampFrequency, 36 | char const* streamMuxConfigString, 37 | unsigned numChannels, 38 | Boolean allowMultipleFramesPerPacket = False); 39 | 40 | protected: 41 | MPEG4LATMAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 42 | unsigned char rtpPayloadFormat, 43 | u_int32_t rtpTimestampFrequency, 44 | char const* streamMuxConfigString, 45 | unsigned numChannels, 46 | Boolean allowMultipleFramesPerPacket); 47 | // called only by createNew() 48 | 49 | virtual ~MPEG4LATMAudioRTPSink(); 50 | 51 | private: // redefined virtual functions: 52 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 53 | unsigned char* frameStart, 54 | unsigned numBytesInFrame, 55 | struct timeval framePresentationTime, 56 | unsigned numRemainingBytes); 57 | virtual Boolean 58 | frameCanAppearAfterPacketStart(unsigned char const* frameStart, 59 | unsigned numBytesInFrame) const; 60 | 61 | virtual char const* auxSDPLine(); // for the "a=fmtp:" SDP line 62 | 63 | private: 64 | char const* fStreamMuxConfigString; 65 | char* fFmtpSDPLine; 66 | Boolean fAllowMultipleFramesPerPacket; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MPEG4VideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a MPEG-4 video file. 20 | // C++ header 21 | 22 | #ifndef _MPEG4_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG4_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class MPEG4VideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static MPEG4VideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | // Used to implement "getAuxSDPLine()": 35 | void checkForAuxSDPLine1(); 36 | void afterPlayingDummy1(); 37 | 38 | protected: 39 | MPEG4VideoFileServerMediaSubsession(UsageEnvironment& env, 40 | char const* fileName, Boolean reuseFirstSource); 41 | // called only by createNew(); 42 | virtual ~MPEG4VideoFileServerMediaSubsession(); 43 | 44 | void setDoneFlag() { fDoneFlag = ~0; } 45 | 46 | protected: // redefined virtual functions 47 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, 48 | FramedSource* inputSource); 49 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 50 | unsigned& estBitrate); 51 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 52 | unsigned char rtpPayloadTypeIfDynamic, 53 | FramedSource* inputSource); 54 | 55 | private: 56 | char* fAuxSDPLine; 57 | char fDoneFlag; // used when setting up "fAuxSDPLine" 58 | RTPSink* fDummyRTPSink; // ditto 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /include/live555/liveMedia/MediaSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Media Sources 19 | // C++ header 20 | 21 | #ifndef _MEDIA_SOURCE_HH 22 | #define _MEDIA_SOURCE_HH 23 | 24 | #ifndef _MEDIA_HH 25 | #include "Media.hh" 26 | #endif 27 | 28 | class MediaSource: public Medium { 29 | public: 30 | static Boolean lookupByName(UsageEnvironment& env, char const* sourceName, 31 | MediaSource*& resultSource); 32 | virtual void getAttributes() const; 33 | // attributes are returned in "env's" 'result message' 34 | 35 | // The MIME type of this source: 36 | virtual char const* MIMEtype() const; 37 | 38 | // Test for specific types of source: 39 | virtual Boolean isFramedSource() const; 40 | virtual Boolean isRTPSource() const; 41 | virtual Boolean isMPEG1or2VideoStreamFramer() const; 42 | virtual Boolean isMPEG4VideoStreamFramer() const; 43 | virtual Boolean isH264VideoStreamFramer() const; 44 | virtual Boolean isH265VideoStreamFramer() const; 45 | virtual Boolean isDVVideoStreamFramer() const; 46 | virtual Boolean isJPEGVideoSource() const; 47 | virtual Boolean isAMRAudioSource() const; 48 | 49 | protected: 50 | MediaSource(UsageEnvironment& env); // abstract base class 51 | virtual ~MediaSource(); 52 | 53 | private: 54 | // redefined virtual functions: 55 | virtual Boolean isSource() const; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/live555/liveMedia/OutputFile.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Common routines for opening/closing named output files 19 | // C++ header 20 | 21 | #ifndef _OUTPUT_FILE_HH 22 | #define _OUTPUT_FILE_HH 23 | 24 | #include 25 | #include 26 | 27 | FILE* OpenOutputFile(UsageEnvironment& env, char const* fileName); 28 | 29 | void CloseOutputFile(FILE* fid); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/live555/liveMedia/QCELPAudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Qualcomm "PureVoice" (aka. "QCELP") Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _QCELP_AUDIO_RTP_SOURCE_HH 22 | #define _QCELP_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _RTP_SOURCE_HH 25 | #include "RTPSource.hh" 26 | #endif 27 | 28 | class QCELPAudioRTPSource { 29 | public: 30 | static FramedSource* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs, 32 | RTPSource*& resultRTPSource, 33 | unsigned char rtpPayloadFormat = 12, 34 | unsigned rtpTimestampFrequency = 8000); 35 | // This returns a source to read from, but "resultRTPSource" will 36 | // point to RTP-related state. 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/live555/liveMedia/QuickTimeGenericRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP Sources containing generic QuickTime stream data, as defined in 19 | // 20 | // C++ header 21 | 22 | #ifndef _QUICKTIME_GENERIC_RTP_SOURCE_HH 23 | #define _QUICKTIME_GENERIC_RTP_SOURCE_HH 24 | 25 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 26 | #include "MultiFramedRTPSource.hh" 27 | #endif 28 | 29 | class QuickTimeGenericRTPSource: public MultiFramedRTPSource { 30 | public: 31 | static QuickTimeGenericRTPSource* 32 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 33 | unsigned char rtpPayloadFormat, unsigned rtpTimestampFrequency, 34 | char const* mimeTypeString); 35 | 36 | // QuickTime-specific information, set from the QuickTime header 37 | // in each packet. This, along with the data following the header, 38 | // is used by receivers. 39 | struct QTState { 40 | char PCK; 41 | unsigned timescale; 42 | char* sdAtom; 43 | unsigned sdAtomSize; 44 | unsigned short width, height; 45 | // later add other state as needed ##### 46 | } qtState; 47 | 48 | protected: 49 | virtual ~QuickTimeGenericRTPSource(); 50 | 51 | private: 52 | QuickTimeGenericRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 53 | unsigned char rtpPayloadFormat, 54 | unsigned rtpTimestampFrequency, 55 | char const* mimeTypeString); 56 | // called only by createNew() 57 | 58 | private: 59 | // redefined virtual functions: 60 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 61 | unsigned& resultSpecialHeaderSize); 62 | virtual char const* MIMEtype() const; 63 | 64 | private: 65 | char const* fMIMEtypeString; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/live555/liveMedia/RTSPCommon.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Common routines used by both RTSP clients and servers 19 | // C++ header 20 | 21 | #ifndef _RTSP_COMMON_HH 22 | #define _RTSP_COMMON_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | #ifndef _MEDIA_HH 29 | #include // includes some definitions perhaps needed for Borland compilers? 30 | #endif 31 | 32 | #if defined(__WIN32__) || defined(_WIN32) || defined(_QNX4) 33 | #define _strncasecmp _strnicmp 34 | #define snprintf _snprintf 35 | #else 36 | #define _strncasecmp strncasecmp 37 | #endif 38 | 39 | #define RTSP_PARAM_STRING_MAX 200 40 | 41 | Boolean parseRTSPRequestString(char const *reqStr, unsigned reqStrSize, 42 | char *resultCmdName, 43 | unsigned resultCmdNameMaxSize, 44 | char* resultURLPreSuffix, 45 | unsigned resultURLPreSuffixMaxSize, 46 | char* resultURLSuffix, 47 | unsigned resultURLSuffixMaxSize, 48 | char* resultCSeq, 49 | unsigned resultCSeqMaxSize, 50 | char* resultSessionId, 51 | unsigned resultSessionIdMaxSize, 52 | unsigned& contentLength); 53 | 54 | Boolean parseRangeParam(char const* paramStr, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow); 55 | Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow); 56 | 57 | Boolean parseScaleHeader(char const* buf, float& scale); 58 | 59 | Boolean RTSPOptionIsSupported(char const* commandName, char const* optionsResponseString); 60 | // Returns True iff the RTSP command "commandName" is mentioned as one of the commands supported in "optionsResponseString" 61 | // (which should be the 'resultString' from a previous RTSP "OPTIONS" request). 62 | 63 | char const* dateHeader(); // A "Date:" header that can be used in a RTSP (or HTTP) response 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/live555/liveMedia/SimpleRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A RTP source for a simple RTP payload format that 19 | // - doesn't have any special headers following the RTP header 20 | // (if necessary, the "offset" parameter can be used to specify a 21 | // special header that we just skip over) 22 | // - doesn't have any special framing apart from the packet data itself 23 | // C++ header 24 | 25 | #ifndef _SIMPLE_RTP_SOURCE_HH 26 | #define _SIMPLE_RTP_SOURCE_HH 27 | 28 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 29 | #include "MultiFramedRTPSource.hh" 30 | #endif 31 | 32 | class SimpleRTPSource: public MultiFramedRTPSource { 33 | public: 34 | static SimpleRTPSource* createNew(UsageEnvironment& env, Groupsock* RTPgs, 35 | unsigned char rtpPayloadFormat, 36 | unsigned rtpTimestampFrequency, 37 | char const* mimeTypeString, 38 | unsigned offset = 0, 39 | Boolean doNormalMBitRule = True); 40 | // "doNormalMBitRule" means: If the medium is not audio, use the RTP "M" 41 | // bit on each incoming packet to indicate the last (or only) fragment 42 | // of a frame. Otherwise (i.e., if "doNormalMBitRule" is False, or the medium is "audio"), the "M" bit is ignored. 43 | 44 | protected: 45 | virtual ~SimpleRTPSource(); 46 | 47 | protected: 48 | SimpleRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 49 | unsigned char rtpPayloadFormat, 50 | unsigned rtpTimestampFrequency, 51 | char const* mimeTypeString, unsigned offset, 52 | Boolean doNormalMBitRule); 53 | // called only by createNew() 54 | 55 | private: 56 | // redefined virtual functions: 57 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 58 | unsigned& resultSpecialHeaderSize); 59 | virtual char const* MIMEtype() const; 60 | 61 | private: 62 | char const* fMIMEtypeString; 63 | unsigned fOffset; 64 | Boolean fUseMBitForFrameEnd; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/live555/liveMedia/TCPStreamSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A sink representing a TCP output stream 19 | // C++ header 20 | 21 | #ifndef _TCP_STREAM_SINK_HH 22 | #define _TCP_STREAM_SINK_HH 23 | 24 | #ifndef _MEDIA_SINK_HH 25 | #include "MediaSink.hh" 26 | #endif 27 | 28 | #define TCP_STREAM_SINK_BUFFER_SIZE 10000 29 | 30 | class TCPStreamSink: public MediaSink { 31 | public: 32 | static TCPStreamSink* createNew(UsageEnvironment& env, int socketNum); 33 | // "socketNum" is the socket number of an existing, writable TCP socket (which should be non-blocking). 34 | // The caller is responsible for closing this socket later (when this object no longer exists). 35 | 36 | protected: 37 | TCPStreamSink(UsageEnvironment& env, int socketNum); // called only by "createNew()" 38 | virtual ~TCPStreamSink(); 39 | 40 | protected: 41 | // Redefined virtual functions: 42 | virtual Boolean continuePlaying(); 43 | 44 | private: 45 | void processBuffer(); // common routine, called from both the 'socket writable' and 'incoming data' handlers below 46 | 47 | static void socketWritableHandler(void* clientData, int mask); 48 | void socketWritableHandler1(); 49 | 50 | static void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, 51 | struct timeval /*presentationTime*/, unsigned /*durationInMicroseconds*/); 52 | void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes); 53 | 54 | static void ourOnSourceClosure(void* clientData); 55 | void ourOnSourceClosure1(); 56 | 57 | unsigned numUnwrittenBytes() const { return fUnwrittenBytesEnd - fUnwrittenBytesStart; } 58 | unsigned freeBufferSpace() const { return TCP_STREAM_SINK_BUFFER_SIZE - fUnwrittenBytesEnd; } 59 | 60 | private: 61 | unsigned char fBuffer[TCP_STREAM_SINK_BUFFER_SIZE]; 62 | unsigned fUnwrittenBytesStart, fUnwrittenBytesEnd; 63 | Boolean fInputSourceIsOpen, fOutputSocketIsWritable; 64 | int fOutputSocketNum; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/live555/liveMedia/TextRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for text codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _TEXT_RTP_SINK_HH 22 | #define _TEXT_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class TextRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | TextRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName); 34 | // (we're an abstract base class) 35 | virtual ~TextRTPSink(); 36 | 37 | private: // redefined virtual functions: 38 | virtual char const* sdpMediaType() const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/live555/liveMedia/TheoraVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Theora Video Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _THEORA_VIDEO_RTP_SOURCE_HH 22 | #define _THEORA_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class TheoraVideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static TheoraVideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat); 33 | 34 | u_int32_t curPacketIdent() const { return fCurPacketIdent; } // The current "Ident" field; only the low-order 24 bits are used 35 | 36 | protected: 37 | TheoraVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 38 | unsigned char rtpPayloadFormat); 39 | // called only by createNew() 40 | 41 | virtual ~TheoraVideoRTPSource(); 42 | 43 | protected: 44 | // redefined virtual functions: 45 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 46 | unsigned& resultSpecialHeaderSize); 47 | virtual char const* MIMEtype() const; 48 | 49 | private: 50 | u_int32_t fCurPacketIdent; // only the low-order 24 bits are used 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/live555/liveMedia/VP8VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for VP8 video 19 | // C++ header 20 | 21 | #ifndef _VP8_VIDEO_RTP_SINK_HH 22 | #define _VP8_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class VP8VideoRTPSink: public VideoRTPSink { 29 | public: 30 | static VP8VideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 31 | 32 | protected: 33 | VP8VideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 34 | // called only by createNew() 35 | 36 | virtual ~VP8VideoRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 40 | unsigned char* frameStart, 41 | unsigned numBytesInFrame, 42 | struct timeval framePresentationTime, 43 | unsigned numRemainingBytes); 44 | virtual 45 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 46 | unsigned numBytesInFrame) const; 47 | virtual unsigned specialHeaderSize() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/live555/liveMedia/VP8VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // VP8 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _VP8_VIDEO_RTP_SOURCE_HH 22 | #define _VP8_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class VP8VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static VP8VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | VP8VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 37 | unsigned char rtpPayloadFormat, 38 | unsigned rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~VP8VideoRTPSource(); 42 | 43 | protected: 44 | // redefined virtual functions: 45 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 46 | unsigned& resultSpecialHeaderSize); 47 | virtual char const* MIMEtype() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/live555/liveMedia/VP9VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // RTP sink for VP9 video 19 | // C++ header 20 | 21 | #ifndef _VP9_VIDEO_RTP_SINK_HH 22 | #define _VP9_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class VP9VideoRTPSink: public VideoRTPSink { 29 | public: 30 | static VP9VideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 31 | 32 | protected: 33 | VP9VideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 34 | // called only by createNew() 35 | 36 | virtual ~VP9VideoRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 40 | unsigned char* frameStart, 41 | unsigned numBytesInFrame, 42 | struct timeval framePresentationTime, 43 | unsigned numRemainingBytes); 44 | virtual 45 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 46 | unsigned numBytesInFrame) const; 47 | virtual unsigned specialHeaderSize() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/live555/liveMedia/VP9VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // VP9 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _VP9_VIDEO_RTP_SOURCE_HH 22 | #define _VP9_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class VP9VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static VP9VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | VP9VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 37 | unsigned char rtpPayloadFormat, 38 | unsigned rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~VP9VideoRTPSource(); 42 | 43 | protected: 44 | // redefined virtual functions: 45 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 46 | unsigned& resultSpecialHeaderSize); 47 | virtual char const* MIMEtype() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/live555/liveMedia/VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for video codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _VIDEO_RTP_SINK_HH 22 | #define _VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class VideoRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | VideoRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName); 34 | // (we're an abstract base class) 35 | virtual ~VideoRTPSink(); 36 | 37 | private: // redefined virtual functions: 38 | virtual char const* sdpMediaType() const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/live555/liveMedia/liveMedia_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "liveMedia" library 2 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _LIVEMEDIA_VERSION_HH 5 | #define _LIVEMEDIA_VERSION_HH 6 | 7 | #define LIVEMEDIA_LIBRARY_VERSION_STRING "2017.01.26" 8 | #define LIVEMEDIA_LIBRARY_VERSION_INT 1485388800 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/live555/liveMedia/ourMD5.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 18 | // Because MD5 may not be implemented (at least, with the same interface) on all systems, 19 | // we have our own implementation. 20 | // C++ header 21 | 22 | #ifndef _OUR_MD5_HH 23 | #define _OUR_MD5_HH 24 | 25 | extern char* our_MD5Data(unsigned char const* data, unsigned dataSize, char* outputDigest); 26 | // "outputDigest" must be either NULL (in which case this function returns a heap-allocated 27 | // buffer, which should be later delete[]d by the caller), or else it must point to 28 | // a (>=)33-byte buffer (which this function will also return). 29 | 30 | extern unsigned char* our_MD5DataRaw(unsigned char const* data, unsigned dataSize, 31 | unsigned char* outputDigest); 32 | // Like "ourMD5Data()", except that it returns the digest in 'raw' binary form, rather than 33 | // as an ASCII hex string. 34 | // "outputDigest" must be either NULL (in which case this function returns a heap-allocated 35 | // buffer, which should be later delete[]d by the caller), or else it must point to 36 | // a (>=)16-byte buffer (which this function will also return). 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/live555/usageEnvironment/Boolean.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | #ifndef _BOOLEAN_HH 17 | #define _BOOLEAN_HH 18 | 19 | #if defined(__BORLANDC__) || (!defined(USE_LIVE555_BOOLEAN) && defined(_MSC_VER) && _MSC_VER >= 1400) 20 | // Use the "bool" type defined by the Borland compiler, and MSVC++ 8.0, Visual Studio 2005 and higher 21 | typedef bool Boolean; 22 | #define False false 23 | #define True true 24 | #else 25 | typedef unsigned char Boolean; 26 | #ifndef __MSHTML_LIBRARY_DEFINED__ 27 | #ifndef False 28 | const Boolean False = 0; 29 | #endif 30 | #ifndef True 31 | const Boolean True = 1; 32 | #endif 33 | 34 | #endif 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/live555/usageEnvironment/HashTable.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 17 | // Generic Hash Table 18 | // C++ header 19 | 20 | #ifndef _HASH_TABLE_HH 21 | #define _HASH_TABLE_HH 22 | 23 | #ifndef _BOOLEAN_HH 24 | #include "Boolean.hh" 25 | #endif 26 | 27 | class HashTable { 28 | public: 29 | virtual ~HashTable(); 30 | 31 | // The following must be implemented by a particular 32 | // implementation (subclass): 33 | static HashTable* create(int keyType); 34 | 35 | virtual void* Add(char const* key, void* value) = 0; 36 | // Returns the old value if different, otherwise 0 37 | virtual Boolean Remove(char const* key) = 0; 38 | virtual void* Lookup(char const* key) const = 0; 39 | // Returns 0 if not found 40 | virtual unsigned numEntries() const = 0; 41 | Boolean IsEmpty() const { return numEntries() == 0; } 42 | 43 | // Used to iterate through the members of the table: 44 | class Iterator { 45 | public: 46 | // The following must be implemented by a particular 47 | // implementation (subclass): 48 | static Iterator* create(HashTable const& hashTable); 49 | 50 | virtual ~Iterator(); 51 | 52 | virtual void* next(char const*& key) = 0; // returns 0 if none 53 | 54 | protected: 55 | Iterator(); // abstract base class 56 | }; 57 | 58 | // A shortcut that can be used to successively remove each of 59 | // the entries in the table (e.g., so that their values can be 60 | // deleted, if they happen to be pointers to allocated memory). 61 | void* RemoveNext(); 62 | 63 | // Returns the first entry in the table. 64 | // (This is useful for deleting each entry in the table, if the entry's destructor also removes itself from the table.) 65 | void* getFirst(); 66 | 67 | protected: 68 | HashTable(); // abstract base class 69 | }; 70 | 71 | // Warning: The following are deliberately the same as in 72 | // Tcl's hash table implementation 73 | int const STRING_HASH_KEYS = 0; 74 | int const ONE_WORD_HASH_KEYS = 1; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /include/live555/usageEnvironment/UsageEnvironment_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "UsageEnvironment" library 2 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _USAGEENVIRONMENT_VERSION_HH 5 | #define _USAGEENVIRONMENT_VERSION_HH 6 | 7 | #define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2017.01.26" 8 | #define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1485388800 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/live555/usageEnvironment/strDup.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 3 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | 17 | #ifndef _STRDUP_HH 18 | #define _STRDUP_HH 19 | 20 | // Copyright (c) 1996-2017 Live Networks, Inc. All rights reserved. 21 | // A C++ equivalent to the standard C routine "strdup()". 22 | // This generates a char* that can be deleted using "delete[]" 23 | // Header 24 | 25 | #include 26 | 27 | char* strDup(char const* str); 28 | // Note: strDup(NULL) returns NULL 29 | 30 | char* strDupSize(char const* str); 31 | // Like "strDup()", except that it *doesn't* copy the original. 32 | // (Instead, it just allocates a string of the same size as the original.) 33 | 34 | char* strDupSize(char const* str, size_t& resultBufSize); 35 | // An alternative form of "strDupSize()" that also returns the size of the allocated buffer. 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libalog.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libalog.a -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libalog.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libalog.so -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libaudioProcess.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libaudioProcess.so -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libimp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libimp.a -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libimp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libimp.so -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libsysutils.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libsysutils.a -------------------------------------------------------------------------------- /lib/imp_sys/glibc/libsysutils.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/glibc/libsysutils.so -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libalog.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libalog.a -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libalog.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libalog.so -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libaudioProcess.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libaudioProcess.so -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libimp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libimp.a -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libimp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libimp.so -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libsysutils.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libsysutils.a -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/libsysutils.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/libsysutils.so -------------------------------------------------------------------------------- /lib/imp_sys/uclibc/t31/libimp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/imp_sys/uclibc/t31/libimp.so -------------------------------------------------------------------------------- /lib/livelib/libBasicUsageEnvironment.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/livelib/libBasicUsageEnvironment.a -------------------------------------------------------------------------------- /lib/livelib/libUsageEnvironment.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/livelib/libUsageEnvironment.a -------------------------------------------------------------------------------- /lib/livelib/libgroupsock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/livelib/libgroupsock.a -------------------------------------------------------------------------------- /lib/livelib/libliveMedia.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geekman/t20-rtspd/d75aae9605bc5d68ff503e332c150620c71fed8b/lib/livelib/libliveMedia.a -------------------------------------------------------------------------------- /pwm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pwm.c 3 | * "library" to assist with interfacing with the T20's PWM kernel driver 4 | * 5 | * Copyright (C) 2019 Darell Tan 6 | * Licensed under the 3-clause ("modified") BSD License. 7 | * SPDX-License-Identifier: BSD-3-Clause 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "pwm.h" 16 | 17 | #define PWM_PATH "/dev/pwm" 18 | 19 | #define PWM_IOCTL_CONFIG 0x001 20 | #define PWM_IOCTL_CONFIG_DUTY 0x002 21 | #define PWM_IOCTL_ENABLE 0x010 22 | #define PWM_IOCTL_DISABLE 0x100 23 | 24 | int pwm_fd = -1; 25 | 26 | int pwm_init() { 27 | pwm_fd = open(PWM_PATH, O_RDONLY); 28 | if (pwm_fd < 0) 29 | return -1; 30 | return 0; 31 | } 32 | 33 | void pwm_destroy() { 34 | if (pwm_fd < 0) 35 | close(pwm_fd); 36 | pwm_fd = -1; 37 | } 38 | 39 | static int _pwm_ioctl(unsigned long request, unsigned long param) { 40 | if (pwm_fd < 0) 41 | return -2; 42 | return ioctl(pwm_fd, request, param); 43 | } 44 | 45 | int pwm_config(struct pwm_ioctl_t *config) { 46 | return _pwm_ioctl(PWM_IOCTL_CONFIG, (unsigned long) config); 47 | } 48 | 49 | // Enables a channel. 50 | // The channel needs to already have been configured using pwm_config 51 | int pwm_enable(int channel) { 52 | return _pwm_ioctl(PWM_IOCTL_ENABLE, channel); 53 | } 54 | 55 | int pwm_disable(int channel) { 56 | return _pwm_ioctl(PWM_IOCTL_DISABLE, channel); 57 | } 58 | 59 | // Sets the duty cycle for the given channel 60 | // Note that the duty cycle should not exceed the period, that's your 61 | // responsibility to check. We cheat here, and the kernel module uses this 62 | // value instead of checking its own value 63 | int pwm_set_duty(int channel, int duty) { 64 | struct pwm_ioctl_t chn = { 65 | .channel = channel, 66 | .duty = duty, 67 | .period = duty, // we cheat here coz this wont be changed 68 | }; 69 | return _pwm_ioctl(PWM_IOCTL_CONFIG_DUTY, (unsigned long) &chn); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /pwm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pwm.h 3 | * "library" to assist with interfacing with the T20's PWM kernel driver 4 | * 5 | * Copyright (C) 2019 Darell Tan 6 | * Licensed under the 3-clause ("modified") BSD License. 7 | * SPDX-License-Identifier: BSD-3-Clause 8 | */ 9 | 10 | #ifndef __PWM_H__ 11 | #define __PWM_H__ 12 | 13 | struct pwm_ioctl_t { 14 | int channel; 15 | int duty; 16 | int period; 17 | int polarity; 18 | }; 19 | 20 | int pwm_init(); 21 | void pwm_destroy(); 22 | 23 | int pwm_config(struct pwm_ioctl_t *config); 24 | int pwm_enable(int channel); 25 | int pwm_disable(int channel); 26 | int pwm_set_duty(int channel, int duty); 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /version.tpl.h: -------------------------------------------------------------------------------- 1 | #ifndef VERSION_H_ 2 | #define VERSION_H_ 3 | 4 | #define COMPILE_TIME __DATE__"_"__TIME__ 5 | 6 | #define VERSION COMPILE_TIME "_" COMMIT_TAG 7 | 8 | #endif // end of define VERSION_H_ 9 | --------------------------------------------------------------------------------