Skip to content

Commit

Permalink
Add timing info to hevc sps
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Feb 28, 2022
1 parent 500e968 commit 0342745
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/h264grabber/h264grabber/h264grabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,36 @@ unsigned char SPS4_3_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x67, 0x64, 0x00,
0xAC, 0x2C, 0xA8, 0x07, 0x80, 0x22, 0x5E, 0x59,
0xA8, 0x08, 0x08, 0x0A, 0x00, 0x00, 0x03, 0x03,
0xE8, 0x00, 0x00, 0x9C, 0x41, 0x08};
unsigned char SPS5_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x7B, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x08};
unsigned char SPS5_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x7B, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x40,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x05, 0x02};
unsigned char SPS5_2_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0xBA, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x08};
unsigned char SPS5_2_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0xBA, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x40,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x05, 0x02};
unsigned char VPS5_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0C, 0x01,
0xFF, 0xFF, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
Expand Down Expand Up @@ -993,6 +1023,10 @@ int main(int argc, char **argv) {
fwrite(SPS4_2304X1296_TI, 1, sizeof(SPS4_2304X1296_TI), fOut);
} else if (stream_type.sps_type_high == 0x0203) {
fwrite(SPS4_2_2304X1296_TI, 1, sizeof(SPS4_2_2304X1296_TI), fOut);
} else if (stream_type.vps_type_high & 0x0102) {
fwrite(SPS5_1920X1080_TI, 1, sizeof(SPS5_1920X1080_TI), fOut);
} else if (stream_type.vps_type_high & 0x0202) {
fwrite(SPS5_2_1920X1080_TI, 1, sizeof(SPS5_2_1920X1080_TI), fOut);
} else {
if (buf_idx_start + frame_len > addr + buf_size) {
fwrite(buf_idx_start, 1, addr + buf_size - buf_idx_start, fOut);
Expand Down
36 changes: 36 additions & 0 deletions src/rRTSPServer/src/rRTSPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,36 @@ unsigned char SPS4_3_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x67, 0x64, 0x00,
0xAC, 0x2C, 0xA8, 0x07, 0x80, 0x22, 0x5E, 0x59,
0xA8, 0x08, 0x08, 0x0A, 0x00, 0x00, 0x03, 0x03,
0xE8, 0x00, 0x00, 0x9C, 0x41, 0x08};
unsigned char SPS5_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x7B, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x08};
unsigned char SPS5_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x7B, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x40,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x05, 0x02};
unsigned char SPS5_2_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0xBA, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x08};
unsigned char SPS5_2_1920X1080_TI[] = {0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01,
0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0xBA, 0xA0,
0x03, 0xC0, 0x80, 0x10, 0xE7, 0xF9, 0x6B, 0xB9,
0x12, 0x20, 0xB2, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3,
0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C,
0xF3, 0xCB, 0x73, 0x70, 0x10, 0x10, 0x10, 0x40,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x05, 0x02};
unsigned char VPS5_1920X1080[] = {0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0C, 0x01,
0xFF, 0xFF, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
Expand Down Expand Up @@ -708,6 +738,12 @@ void *capture(void *ptr)
} else if (stream_type.sps_type_high == 0x0203) {
frame_len = sizeof(SPS4_2_2304X1296_TI);
s2cb_memcpy(cb_current, SPS4_2_2304X1296_TI, sizeof(SPS4_2_2304X1296_TI));
} else if (stream_type.vps_type_high & 0x0102) {
frame_len = sizeof(SPS5_1920X1080_TI);
s2cb_memcpy(cb_current, SPS5_1920X1080_TI, sizeof(SPS5_1920X1080_TI));
} else if (stream_type.vps_type_high & 0x0202) {
frame_len = sizeof(SPS5_2_1920X1080_TI);
s2cb_memcpy(cb_current, SPS5_2_1920X1080_TI, sizeof(SPS5_2_1920X1080_TI));
} else {
// don't change frame_len
cb2cb_memcpy(cb_current, &input_buffer, frame_len);
Expand Down

0 comments on commit 0342745

Please sign in to comment.