Minor fix.
[xy_vsfilter.git] / src / subtitles / USFSubtitles.h
blob0783e4a58988bd308f8703c1dd73c5c550deda11
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #pragma once
24 #include <atlcoll.h>
25 #include "STS.h"
27 // metadata
28 typedef struct {CStringW name, email, url;} author_t;
29 typedef struct {CStringW code, text;} language_t;
30 typedef struct {CStringW title, date, comment; author_t author; language_t language, languageext;} metadata_t;
31 // style
32 typedef struct {CStringW alignment, relativeto, horizontal_margin, vertical_margin, rotate[3];} posattriblist_t;
33 typedef struct {CStringW face, size, color[4], weight, italic, underline, alpha, outline, shadow, wrap;} fontstyle_t;
34 typedef struct {CStringW name; fontstyle_t fontstyle; posattriblist_t pal;} style_t;
35 // effect
36 typedef struct {CStringW position; fontstyle_t fontstyle; posattriblist_t pal;} keyframe_t;
37 typedef struct {CStringW name; CAutoPtrList<keyframe_t> keyframes;} effect_t;
38 // subtitle/text
39 typedef struct {int start, stop; CStringW effect, style, str; posattriblist_t pal;} text_t;
41 class CUSFSubtitles
43 bool ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode);
44 void ParseMetadata(CComPtr<IXMLDOMNode> pNode, metadata_t& m);
45 void ParseStyle(CComPtr<IXMLDOMNode> pNode, style_t* s);
46 void ParseFontstyle(CComPtr<IXMLDOMNode> pNode, fontstyle_t& fs);
47 void ParsePal(CComPtr<IXMLDOMNode> pNode, posattriblist_t& pal);
48 void ParseEffect(CComPtr<IXMLDOMNode> pNode, effect_t* e);
49 void ParseKeyframe(CComPtr<IXMLDOMNode> pNode, keyframe_t* k);
50 void ParseSubtitle(CComPtr<IXMLDOMNode> pNode, int start, int stop);
51 void ParseText(CComPtr<IXMLDOMNode> pNode, CStringW& assstr);
52 void ParseShape(CComPtr<IXMLDOMNode> pNode);
54 public:
55 CUSFSubtitles();
56 virtual ~CUSFSubtitles();
58 bool Read(LPCTSTR fn);
59 // bool Write(LPCTSTR fn); // TODO
61 metadata_t metadata;
62 CAutoPtrList<style_t> styles;
63 CAutoPtrList<effect_t> effects;
64 CAutoPtrList<text_t> texts;
66 bool ConvertToSTS(CSimpleTextSubtitle& sts);
67 // bool ConvertFromSTS(CSimpleTextSubtitle& sts); // TODO