summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-20 23:50:18 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-20 23:50:18 +0300
commitd72541b75cb66afa2135d7753bd799af976f9aea (patch)
treed534ec0d84ebb8a3160051ab907c643f5adad5dc /libmpdemux
parentc67d3dfcfc9ae088288af6fab4f4d9d83e9851e0 (diff)
downloadmpv-d72541b75cb66afa2135d7753bd799af976f9aea.tar.bz2
mpv-d72541b75cb66afa2135d7753bd799af976f9aea.tar.xz
bstr.[ch]: add new files for struct bstr related functionality
Move "struct bstr" definition from ebml.h to its own header and add some utility functions/macros. Change length field type from int to size_t and adjust using code accordingly. Partially based on a patch from Anton Khirnov.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_mkv.c4
-rw-r--r--libmpdemux/ebml.c4
-rw-r--r--libmpdemux/ebml.h6
3 files changed, 5 insertions, 9 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 17b4691183..0a63df400e 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -862,7 +862,7 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
(int) ((chapter.end / 60 / 1000) % 60),
(int) ((chapter.end / 1000) % 60),
(int) (chapter.end % 1000),
- name.len, name.start);
+ BSTR_P(name));
if (idx == selected_edition){
demuxer_add_chapter(demuxer, name.start, name.len,
@@ -920,7 +920,7 @@ static int demux_mkv_read_attachments(demuxer_t *demuxer)
demuxer_add_attachment(demuxer, name.start, name.len, mime.start,
mime.len, data, data_size);
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Attachment: %.*s, %.*s, %u bytes\n",
- name.len, name.start, mime.len, mime.start, data_size);
+ BSTR_P(name), BSTR_P(mime), data_size);
}
out:
diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c
index 166c5df5cd..28b4a4643a 100644
--- a/libmpdemux/ebml.c
+++ b/libmpdemux/ebml.c
@@ -612,9 +612,9 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
strptr->len = length;
if (ed->type == EBML_TYPE_STR)
mp_msg(MSGT_DEMUX, MSGL_DBG2, "string \"%.*s\"\n",
- strptr->len, strptr->start);
+ BSTR_P(*strptr));
else
- mp_msg(MSGT_DEMUX, MSGL_DBG2, "binary %d bytes\n",
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "binary %zd bytes\n",
strptr->len);
break;
diff --git a/libmpdemux/ebml.h b/libmpdemux/ebml.h
index b2fed46fb9..395ffc4df5 100644
--- a/libmpdemux/ebml.h
+++ b/libmpdemux/ebml.h
@@ -24,6 +24,7 @@
#include <stdbool.h>
#include "stream/stream.h"
+#include "bstr.h"
/* EBML version supported */
@@ -62,11 +63,6 @@ struct ebml_parse_ctx {
bool no_error_messages;
};
-struct bstr {
- uint8_t *start;
- int len;
-};
-
#include "ebml_types.h"
#define EBML_ID_INVALID 0xffffffff