/*
* (C) 2003-2006 Gabest
* (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
#pragma once
#include
#include "STS.h"
// metadata
struct author_t {
CStringW name, email, url;
};
struct language_t {
CStringW code, text;
};
struct metadata_t {
CStringW title, date, comment;
author_t author;
language_t language, languageext;
};
// style
struct posattriblist_t {
CStringW alignment, relativeto, horizontal_margin, vertical_margin, rotate[3];
};
struct fontstyle_t {
CStringW face, size, color[4], weight, italic, underline, alpha, outline, shadow, wrap;
};
struct style_t {
CStringW name;
fontstyle_t fontstyle;
posattriblist_t pal;
};
// effect
struct keyframe_t {
CStringW position;
fontstyle_t fontstyle;
posattriblist_t pal;
};
struct effect_t {
CStringW name;
CAutoPtrList keyframes;
};
// subtitle/text
struct text_t {
int start, stop;
CStringW effect, style, str;
posattriblist_t pal;
};
class CUSFSubtitles
{
bool ParseUSFSubtitles(CComPtr pNode);
void ParseMetadata(CComPtr pNode, metadata_t& m);
void ParseStyle(CComPtr pNode, style_t* s);
void ParseFontstyle(CComPtr pNode, fontstyle_t& fs);
void ParsePal(CComPtr pNode, posattriblist_t& pal);
void ParseEffect(CComPtr pNode, effect_t* e);
void ParseKeyframe(CComPtr pNode, keyframe_t* k);
void ParseSubtitle(CComPtr pNode, int start, int stop);
void ParseText(CComPtr pNode, CStringW& assstr);
void ParseShape(CComPtr pNode);
public:
CUSFSubtitles();
virtual ~CUSFSubtitles();
bool Read(LPCTSTR fn);
//bool Write(LPCTSTR fn); // TODO
metadata_t metadata;
CAutoPtrList styles;
CAutoPtrList effects;
CAutoPtrList texts;
bool ConvertToSTS(CSimpleTextSubtitle& sts);
//bool ConvertFromSTS(CSimpleTextSubtitle& sts); // TODO
};