00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <atlcoll.h>
00025 #include "STS.h"
00026
00027
00028 typedef struct {CStringW name, email, url;} author_t;
00029 typedef struct {CStringW code, text;} language_t;
00030 typedef struct {CStringW title, date, comment; author_t author; language_t language, languageext;} metadata_t;
00031
00032 typedef struct {CStringW alignment, relativeto, horizontal_margin, vertical_margin, rotate[3];} posattriblist_t;
00033 typedef struct {CStringW face, size, color[4], weight, italic, underline, alpha, outline, shadow, wrap;} fontstyle_t;
00034 typedef struct {CStringW name; fontstyle_t fontstyle; posattriblist_t pal;} style_t;
00035
00036 typedef struct {CStringW position; fontstyle_t fontstyle; posattriblist_t pal;} keyframe_t;
00037 typedef struct {CStringW name; CAutoPtrList<keyframe_t> keyframes;} effect_t;
00038
00039 typedef struct {int start, stop; CStringW effect, style, str; posattriblist_t pal;} text_t;
00040
00041 class CUSFSubtitles
00042 {
00043 bool ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode);
00044 void ParseMetadata(CComPtr<IXMLDOMNode> pNode, metadata_t& m);
00045 void ParseStyle(CComPtr<IXMLDOMNode> pNode, style_t* s);
00046 void ParseFontstyle(CComPtr<IXMLDOMNode> pNode, fontstyle_t& fs);
00047 void ParsePal(CComPtr<IXMLDOMNode> pNode, posattriblist_t& pal);
00048 void ParseEffect(CComPtr<IXMLDOMNode> pNode, effect_t* e);
00049 void ParseKeyframe(CComPtr<IXMLDOMNode> pNode, keyframe_t* k);
00050 void ParseSubtitle(CComPtr<IXMLDOMNode> pNode, int start, int stop);
00051 void ParseText(CComPtr<IXMLDOMNode> pNode, CStringW& assstr);
00052 void ParseShape(CComPtr<IXMLDOMNode> pNode);
00053
00054 public:
00055 CUSFSubtitles();
00056 virtual ~CUSFSubtitles();
00057
00058 bool Read(LPCTSTR fn);
00059
00060
00061 metadata_t metadata;
00062 CAutoPtrList<style_t> styles;
00063 CAutoPtrList<effect_t> effects;
00064 CAutoPtrList<text_t> texts;
00065
00066 bool ConvertToSTS(CSimpleTextSubtitle& sts);
00067
00068 };