summaryrefslogtreecommitdiff
path: root/bitstream.h
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2023-05-01 17:43:43 +0200
committerMikhail Burakov <mburakov@mailbox.org>2023-05-01 17:43:43 +0200
commit9546ab4acf17ea6a81f058eb28b8a72e1174a671 (patch)
treebe80fc2aa4d8c857a64c6cb3bbb9ee35470a38aa /bitstream.h
parent68fbbd6e8a10bc034dbc003392e536cd898806bc (diff)
Add simplistic bitstream writer implementation
Diffstat (limited to 'bitstream.h')
-rw-r--r--bitstream.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/bitstream.h b/bitstream.h
new file mode 100644
index 0000000..87edec3
--- /dev/null
+++ b/bitstream.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2023 Mikhail Burakov. This file is part of streamer.
+ *
+ * streamer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * streamer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with streamer. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef STREAMER_BITSTREAM_H_
+#define STREAMER_BITSTREAM_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+struct Bitstream {
+ void* data;
+ size_t size;
+};
+
+void BitstreamAppend(struct Bitstream* bitstream, size_t size, uint32_t bits);
+void BitstreamAppendUE(struct Bitstream* bitstream, uint32_t bits);
+void BitstreamAppendSE(struct Bitstream* bitstream, int32_t bits);
+void BitstreamByteAlign(struct Bitstream* bitstream);
+
+#endif // STREAMER_BITSTREAM_H_