int rmff_dump_header(struct rmff_header_t *h,uint8_t *buffer) { int written=0; struct rmff_mdpr_t **stream=h->streams; rmff_dump_fileheader(h->fileheader, &buffer[written]); written+=h->fileheader->size; rmff_dump_prop(h->prop, &buffer[written]); written+=h->prop->size; rmff_dump_cont(h->cont, &buffer[written]); written+=h->cont->size; if (stream) { while(*stream) { rmff_dump_mdpr(*stream, &buffer[written]); written+=(*stream)->size; stream++; } } rmff_dump_dataheader(h->data, &buffer[written]); written+=18; return written; }
int rmff_dump_header(rmff_header_t *h, char *buffer, int max) { int written=0, size; rmff_mdpr_t **stream=h->streams; if ((size=rmff_dump_fileheader(h->fileheader, &buffer[written], max)) < 0) goto buftoosmall; written+=size; max -= size; if ((size=rmff_dump_prop(h->prop, &buffer[written], max)) < 0) goto buftoosmall; written+=size; max -= size; if ((size=rmff_dump_cont(h->cont, &buffer[written], max)) < 0) goto buftoosmall; written+=size; max -= size; if (stream) { while(*stream) { if ((size=rmff_dump_mdpr(*stream, &buffer[written], max)) < 0) goto buftoosmall; written+=size; max -= size; stream++; } } if ((size=rmff_dump_dataheader(h->data, &buffer[written], max)) < 0) goto buftoosmall; written+=size; return written; buftoosmall: mp_msg(MSGT_STREAM, MSGL_ERR, "rmff_dumpheader: buffer too small, aborting. Please report\n"); return -1; }