Compare commits

...

2 Commits

Author SHA1 Message Date
Mid
cca8f02870 Bug in README.md 2025-09-27 20:56:40 +03:00
Mid
d0ccaff719 C++-friendly headers 2025-09-27 20:56:05 +03:00
3 changed files with 26 additions and 10 deletions

View File

@ -41,7 +41,7 @@ TODO: signed integer writing
} }
static void on_exit_element(EBMLReader *reader) { static void on_exit_element(EBMLReader *reader) {
// If needed, the current element ID can be found at `reader->inside.id`. // If needed, the exitee element ID can be found at `reader->idStack[reader->currentDepth - 1]`.
// Use accumulated buffer here. // Use accumulated buffer here.

View File

@ -5,6 +5,10 @@
#include"ebml.h" #include"ebml.h"
#ifdef __cplusplus
extern "C" {
#endif
#include<stddef.h> #include<stddef.h>
#include<stdint.h> #include<stdint.h>
@ -42,7 +46,11 @@ typedef struct EBMLReader {
void *ud; void *ud;
} EBMLReader; } EBMLReader;
void ebml_reader_init(EBMLReader *this); void ebml_reader_init(EBMLReader*);
int ebml_reader_feed(EBMLReader *this, const uint8_t *data, size_t length); int ebml_reader_feed(EBMLReader*, const uint8_t *data, size_t length);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -6,6 +6,10 @@
#include<stddef.h> #include<stddef.h>
#include<stdbool.h> #include<stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#define EBML_WRITE_MAXIMUM_DEPTH 128 #define EBML_WRITE_MAXIMUM_DEPTH 128
struct EBMLWriter; struct EBMLWriter;
@ -27,15 +31,19 @@ typedef struct EBMLWriter {
void *ud; void *ud;
} EBMLWriter; } EBMLWriter;
void ebml_writer_init(EBMLWriter *this); void ebml_writer_init(EBMLWriter*);
void ebml_writer_free(EBMLWriter *this); void ebml_writer_free(EBMLWriter*);
void ebml_writer_push_ind(EBMLWriter *this, uint64_t id); void ebml_writer_push_ind(EBMLWriter*, uint64_t id);
void ebml_writer_push(EBMLWriter *this, uint64_t id); void ebml_writer_push(EBMLWriter*, uint64_t id);
void ebml_writer_pop(EBMLWriter *this); void ebml_writer_pop(EBMLWriter*);
bool ebml_writer_flush(EBMLWriter *this); bool ebml_writer_flush(EBMLWriter*);
void ebml_writer_put(EBMLWriter *this, uint64_t id, EBMLElementType type, EBMLPrimitive primitive); void ebml_writer_put(EBMLWriter*, uint64_t id, EBMLElementType type, EBMLPrimitive primitive);
#ifdef __cplusplus
}
#endif
#endif #endif