+static
+int bt_ctf_notif_iter_switch_packet(struct bt_ctf_notif_iter *notit)
+{
+ int ret = 0;
+
+ assert(notit);
+ stack_clear(notit->stack);
+ BT_PUT(notit->meta.stream_class);
+ BT_PUT(notit->meta.event_class);
+ BT_PUT(notit->packet);
+ put_all_dscopes(notit);
+
+ /*
+ * Adjust current buffer so that addr points to the beginning of the new
+ * packet.
+ */
+ if (notit->buf.addr) {
+ size_t consumed_bytes = (size_t) (notit->buf.at / CHAR_BIT);
+
+ /* Packets are assumed to start on a byte frontier. */
+ if (notit->buf.at % CHAR_BIT) {
+ ret = -1;
+ goto end;
+ }
+
+ notit->buf.addr += consumed_bytes;
+ notit->buf.sz -= consumed_bytes;
+ notit->buf.at = 0;
+ notit->buf.packet_offset = 0;
+ }
+
+ notit->cur_content_size = -1;
+ notit->cur_packet_size = -1;
+end:
+ return ret;
+}
+