1 // PHZ 2 // 2018-5-16 3 4 #ifndef XOP_MEDIA_H 5 #define XOP_MEDIA_H 6 7 #include <cstdint> 8 #include <vector> 9 10 namespace xop 11 { 12 13 /* RTSP服务支持的媒体类型 */ 14 enum MediaType 15 { 16 //PCMU = 0, 17 PCMA = 8, 18 H264 = 96, 19 AAC = 37, 20 H265 = 265, 21 NONE 22 }; 23 24 enum FrameType 25 { 26 VIDEO_FRAME_I = 0x01, 27 VIDEO_FRAME_P = 0x02, 28 VIDEO_FRAME_B = 0x03, 29 AUDIO_FRAME = 0x11, 30 }; 31 32 struct AVFrame 33 { AVFrameAVFrame34 AVFrame() : type(0), timestamp(0) {} AVFrameAVFrame35 AVFrame(const uint8_t *data, std::size_t size) : AVFrame() 36 { 37 buffer.reserve(size); 38 buffer.assign(data, data + size); 39 } 40 41 std::vector<uint8_t> buffer; /* 帧数据 */ 42 uint8_t type; /* 帧类型 */ 43 int64_t timestamp; /* 时间戳 */ 44 }; 45 46 static const int MAX_MEDIA_CHANNEL = 2; 47 48 enum MediaChannelId 49 { 50 channel_0, 51 channel_1 52 }; 53 54 typedef uint32_t MediaSessionId; 55 56 } 57 58 #endif 59 60