assert(len >= 2);
assert(src[0] == quote_chars[0]);
- p = dst = para_malloc(len - 1);
+ p = dst = alloc(len - 1);
backslash = false;
for (n = 1;; n++) {
char c;
MP_AFHI(channels)
/** \endcond */
+/**
+ * Return the duration of the audio file from the afh info structure.
+ *
+ * \param ctx See \ref mp_path().
+ *
+ * The duration is computed by multiplying the number of chunks and the
+ * duration of one chunk.
+ *
+ * \return The approximate number of milliseconds.
+ */
+int64_t mp_duration(struct mp_context *ctx)
+{
+ struct timeval tmp;
+ int ret = get_afhi(ctx);
+
+ if (ret < 0)
+ return 0;
+ tv_scale(ctx->afhi.chunks_total, &ctx->afhi.chunk_tv, &tmp);
+ return tv2ms(&tmp);
+}
+
/**
* Define a function which extracts and returns the value of a meta tag.
*
struct mp_context *ctx;
struct yy_buffer_state *buffer_state;
+ *result = NULL;
if (!definition || nbytes == 0) { /* dummy mood */
if (errmsg)
*errmsg = NULL;
- *result = NULL;
return 0;
}
- ctx = para_calloc(sizeof(*ctx));
+ ctx = zalloc(sizeof(*ctx));
ctx->errmsg = NULL;
ctx->ast = NULL;
mp_yy_delete_buffer(buffer_state, scanner);
mp_yylex_destroy(scanner);
if (ctx->errmsg) { /* parse error */
+ mp_free_ast(ctx->ast);
if (errmsg)
*errmsg = ctx->errmsg;
else
{
if (!ctx) /* dummy mood */
return true;
+ if (!ctx->ast) /* empty mood */
+ return true;
assert(aft_row);
ctx->aft_row = aft_row;
ctx->have_afsi = false;