Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

av1: depacketizer #347

Merged
merged 1 commit into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/re_av1.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,14 @@ typedef int (av1_packet_h)(bool marker, uint64_t rtp_ts,
int av1_packetize(bool *newp, bool marker, uint64_t rtp_ts,
const uint8_t *buf, size_t len, size_t maxlen,
av1_packet_h *pkth, void *arg);


/** AV1 Aggregation Header */
struct av1_aggr_hdr {
unsigned z:1; /* continuation of an OBU fragment from prev packet */
unsigned y:1; /* last OBU element will continue in the next packet */
unsigned w:2; /* number of OBU elements in the packet */
unsigned n:1; /* first packet of a coded video sequence */
};

int av1_aggr_hdr_decode(struct av1_aggr_hdr *hdr, struct mbuf *mb);
33 changes: 33 additions & 0 deletions src/av1/depack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file av1/depack.c AV1 De-packetizer
*
* Copyright (C) 2010 - 2022 Alfred E. Heggestad
*/

#include <string.h>
#include <re_types.h>
#include <re_mbuf.h>
#include <re_av1.h>


int av1_aggr_hdr_decode(struct av1_aggr_hdr *hdr, struct mbuf *mb)
{
uint8_t v;

if (!hdr || !mb)
return EINVAL;

memset(hdr, 0, sizeof(*hdr));

if (mbuf_get_left(mb) < 1)
return EBADMSG;

v = mbuf_read_u8(mb);

hdr->z = v>>7 & 0x1;
hdr->y = v>>6 & 0x1;
hdr->w = v>>4 & 0x3;
hdr->n = v>>3 & 0x1;

return 0;
}
1 change: 1 addition & 0 deletions src/av1/mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

SRCS += av1/obu.c
SRCS += av1/pkt.c
SRCS += av1/depack.c