summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_h264.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-02-19 21:40:48 +0200
committerMartin Storsjö <martin@martin.st>2015-02-21 11:32:36 +0200
commita3cc519d1f43bf93cc29fd53284a2b8aa6189a9a (patch)
tree9d20c6aebd0f78fb7d2d23b13105f4086a94d3fa /libavformat/rtpdec_h264.c
parent48183b3ad45c95e386a4cb02e1a68b53e6835ac5 (diff)
downloadffmpeg-a3cc519d1f43bf93cc29fd53284a2b8aa6189a9a.tar.gz
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: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpdec_h264.c')
-rw-r--r--libavformat/rtpdec_h264.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index bc563f2138..e6c8c26160 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -177,7 +177,8 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
}
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 total_length = 0;
@@ -189,6 +190,9 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt,
const uint8_t *src = buf;
int src_len = len;
+ src += start_skip;
+ src_len -= start_skip;
+
while (src_len > 2) {
uint16_t nal_size = AV_RB16(src);
@@ -215,8 +219,8 @@ static int h264_handle_packet_stap_a(AVFormatContext *ctx, AVPacket *pkt,
}
// eat what we handled
- src += nal_size;
- src_len -= nal_size;
+ src += nal_size + start_skip;
+ src_len -= nal_size + start_skip;
}
if (pass == 0) {
@@ -304,7 +308,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
// consume the STAP-A NAL
buf++;
len--;
- result = h264_handle_packet_stap_a(ctx, pkt, buf, len);
+ result = h264_handle_packet_stap_a(ctx, pkt, buf, len, 0);
break;
case 25: // STAP-B