Commit a3cc519d authored by Martin Storsjö's avatar Martin Storsjö

rtpdec_h264: Prepare h264_handle_packet_stap_a for sharing with hevc

Add a parameter for skipping a number of bytes at the start of each nal.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 48183b3a
...@@ -177,7 +177,8 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s, ...@@ -177,7 +177,8 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
} }
static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt, static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt,
const uint8_t *buf, int len) const uint8_t *buf, int len,
int start_skip)
{ {
int pass = 0; int pass = 0;
int total_length = 0; int total_length = 0;
...@@ -189,6 +190,9 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt, ...@@ -189,6 +190,9 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt,
const uint8_t *src = buf; const uint8_t *src = buf;
int src_len = len; int src_len = len;
src += start_skip;
src_len -= start_skip;
while (src_len > 2) { while (src_len > 2) {
uint16_t nal_size = AV_RB16(src); uint16_t nal_size = AV_RB16(src);
...@@ -215,8 +219,8 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt, ...@@ -215,8 +219,8 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt,
} }
// eat what we handled // eat what we handled
src += nal_size; src += nal_size + start_skip;
src_len -= nal_size; src_len -= nal_size + start_skip;
} }
if (pass == 0) { if (pass == 0) {
...@@ -304,7 +308,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, ...@@ -304,7 +308,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
// consume the STAP-A NAL // consume the STAP-A NAL
buf++; buf++;
len--; len--;
result = h264_handle_packet_stap_a(ctx, pkt, buf, len); result = h264_handle_packet_stap_a(ctx, pkt, buf, len, 0);
break; break;
case 25: // STAP-B case 25: // STAP-B
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment