2007-01-21 07:30:19 +01:00
|
|
|
// Copyright (c) 2007, Rodrigo Braz Monteiro
|
2006-03-01 05:32:00 +01:00
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file subtitles_provider.h
|
|
|
|
/// @brief Declaration of base-class for subtitle renderers
|
|
|
|
/// @ingroup main_headers subtitle_rendering
|
|
|
|
///
|
2006-03-01 05:32:00 +01:00
|
|
|
|
2009-09-11 21:21:19 +02:00
|
|
|
#pragma once
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2014-03-24 15:54:22 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2007-01-21 07:30:19 +01:00
|
|
|
|
|
|
|
class AssFile;
|
2013-07-01 05:15:43 +02:00
|
|
|
struct VideoFrame;
|
2009-07-30 06:24:23 +02:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
class SubtitlesProvider {
|
2014-05-02 19:39:38 +02:00
|
|
|
std::vector<char> buffer;
|
|
|
|
virtual void LoadSubtitles(const char *data, size_t len)=0;
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
public:
|
2014-04-25 19:01:07 +02:00
|
|
|
virtual ~SubtitlesProvider() = default;
|
2014-05-02 19:39:38 +02:00
|
|
|
void LoadSubtitles(AssFile *subs, int time = -1);
|
2014-03-24 15:54:22 +01:00
|
|
|
virtual void DrawSubtitles(VideoFrame &dst, double time)=0;
|
2015-02-08 18:13:53 +01:00
|
|
|
virtual void Reinitialize() { }
|
2007-01-21 07:30:19 +01:00
|
|
|
};
|
|
|
|
|
2014-03-25 17:51:38 +01:00
|
|
|
namespace agi { class BackgroundRunner; }
|
|
|
|
|
2014-03-24 15:54:22 +01:00
|
|
|
struct SubtitlesProviderFactory {
|
2014-03-25 17:51:38 +01:00
|
|
|
static std::unique_ptr<SubtitlesProvider> GetProvider(agi::BackgroundRunner *br);
|
2014-03-24 15:54:22 +01:00
|
|
|
static std::vector<std::string> GetClasses();
|
2008-03-07 03:32:29 +01:00
|
|
|
};
|