static const uint8_t start_sequence[] = { 0x00, 0x00, 0x00, 0x01 };
-static av_cold PayloadContext *hevc_new_context(void)
-{
- return av_mallocz(sizeof(PayloadContext));
-}
-
-static av_cold void hevc_free_context(PayloadContext *data)
-{
- av_free(data);
-}
-
-static av_cold int hevc_init(AVFormatContext *ctx, int st_index,
- PayloadContext *data)
-{
- av_dlog(ctx, "hevc_init() for stream %d\n", st_index);
-
- if (st_index < 0)
- return 0;
-
- ctx->streams[st_index]->need_parsing = AVSTREAM_PARSE_FULL;
-
- return 0;
-}
-
static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
AVStream *stream,
PayloadContext *hevc_data,
}
/*
- decode the HEVC payload header according to section 4 of draft version 6:
-
- 0 1
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- |F| Type | LayerId | TID |
- +-------------+-----------------+
-
- Forbidden zero (F): 1 bit
- NAL unit type (Type): 6 bits
- NUH layer ID (LayerId): 6 bits
- NUH temporal ID plus 1 (TID): 3 bits
- */
+ * decode the HEVC payload header according to section 4 of draft version 6:
+ *
+ * 0 1
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |F| Type | LayerId | TID |
+ * +-------------+-----------------+
+ *
+ * Forbidden zero (F): 1 bit
+ * NAL unit type (Type): 6 bits
+ * NUH layer ID (LayerId): 6 bits
+ * NUH temporal ID plus 1 (TID): 3 bits
+ */
nal_type = (buf[0] >> 1) & 0x3f;
lid = ((buf[0] << 5) & 0x20) | ((buf[1] >> 3) & 0x1f);
tid = buf[1] & 0x07;
buf += RTP_HEVC_PAYLOAD_HEADER_SIZE;
len -= RTP_HEVC_PAYLOAD_HEADER_SIZE;
+ /* pass the HEVC DONL field */
+ if (rtp_hevc_ctx->using_donl_field) {
+ buf += RTP_HEVC_DONL_FIELD_SIZE;
+ len -= RTP_HEVC_DONL_FIELD_SIZE;
+ }
+
res = ff_h264_handle_aggregated_packet(ctx, rtp_hevc_ctx, pkt, buf, len,
rtp_hevc_ctx->using_donl_field ?
- RTP_HEVC_DONL_FIELD_SIZE : 0,
+ RTP_HEVC_DOND_FIELD_SIZE : 0,
NULL, 0);
if (res < 0)
return res;
len -= RTP_HEVC_PAYLOAD_HEADER_SIZE;
/*
- decode the FU header
-
- 0 1 2 3 4 5 6 7
- +-+-+-+-+-+-+-+-+
- |S|E| FuType |
- +---------------+
-
- Start fragment (S): 1 bit
- End fragment (E): 1 bit
- FuType: 6 bits
- */
+ * decode the FU header
+ *
+ * 0 1 2 3 4 5 6 7
+ * +-+-+-+-+-+-+-+-+
+ * |S|E| FuType |
+ * +---------------+
+ *
+ * Start fragment (S): 1 bit
+ * End fragment (E): 1 bit
+ * FuType: 6 bits
+ */
first_fragment = buf[0] & 0x80;
last_fragment = buf[0] & 0x40;
fu_type = buf[0] & 0x3f;
.enc_name = "H265",
.codec_type = AVMEDIA_TYPE_VIDEO,
.codec_id = AV_CODEC_ID_HEVC,
- .init = hevc_init,
+ .need_parsing = AVSTREAM_PARSE_FULL,
+ .priv_data_size = sizeof(PayloadContext),
.parse_sdp_a_line = hevc_parse_sdp_line,
- .alloc = hevc_new_context,
- .free = hevc_free_context,
- .parse_packet = hevc_handle_packet
+ .parse_packet = hevc_handle_packet,
};