1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2007 libmkv
6 * Authors: John A. Stebbins
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
26 int mk_createStringTag(mk_Writer
* w
, char *tag_id
, char *value
)
30 if (w
->tags
== NULL
) {
32 if ((w
->tags
= mk_createContext(w
, w
->root
, MATROSKA_ID_TAGS
)) == NULL
)
35 if ((w
->tag
= mk_createContext(w
, w
->tags
, MATROSKA_ID_TAG
)) == NULL
)
39 if ((simple
= mk_createContext(w
, w
->tag
, MATROSKA_ID_SIMPLETAG
)) == NULL
)
42 CHECK(mk_writeStr(simple
, MATROSKA_ID_TAGNAME
, tag_id
)); /* TagName */
43 CHECK(mk_writeStr(simple
, MATROSKA_ID_TAGSTRING
, value
)); /* TagString */
44 CHECK(mk_closeContext(simple
, 0));
49 int mk_writeTags(mk_Writer
* w
)
51 if ((w
->tags
== NULL
) || (w
->tag
== NULL
))
53 CHECK(mk_closeContext(w
->tag
, 0));
54 CHECK(mk_closeContext(w
->tags
, 0));