return _file_group.seek (pos, whence);
}
+
+FFmpegSubtitlePeriod
+FFmpeg::subtitle_period (AVSubtitle const & sub)
+{
+ ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
+
+ if (sub.end_display_time == static_cast<uint32_t> (-1)) {
+ /* End time is not known */
+ return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3));
+ }
+
+ return FFmpegSubtitlePeriod (
+ packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
+ packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
+ );
+}
#ifndef DCPOMATIC_FFMPEG_H
#define DCPOMATIC_FFMPEG_H
+#include "file_group.h"
+#include "ffmpeg_subtitle_period.h"
extern "C" {
#include <libavcodec/avcodec.h>
}
-#include "file_group.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
protected:
AVCodecContext* video_codec_context () const;
AVCodecContext* subtitle_codec_context () const;
+ static FFmpegSubtitlePeriod subtitle_period (AVSubtitle const &);
boost::shared_ptr<const FFmpegContent> _ffmpeg_content;
--- /dev/null
+/*
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "dcpomatic_time.h"
+#include <boost/optional.hpp>
+
+class FFmpegSubtitlePeriod
+{
+public:
+ FFmpegSubtitlePeriod (ContentTime f)
+ : from (f)
+ {}
+
+ FFmpegSubtitlePeriod (ContentTime f, ContentTime t)
+ : from (f)
+ , to (t)
+ {}
+
+ ContentTime from;
+ boost::optional<ContentTime> to;
+};
class AudioProcessor;
class AudioMapping;
class Ratio;
+class Job;
struct isdcf_name_test;
/** @class Film
return p;
}
-FFmpegSubtitlePeriod
-subtitle_period (AVSubtitle const & sub)
-{
- ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
-
- if (sub.end_display_time == static_cast<uint32_t> (-1)) {
- /* End time is not known */
- return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3));
- }
-
- return FFmpegSubtitlePeriod (
- packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
- packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
- );
-}
-
map<string, string>
split_get_request (string url)
{
extern std::string program_name;
-class Job;
struct AVSubtitle;
extern std::string seconds_to_hms (int);
extern dcp::Size fit_ratio_within (float ratio, dcp::Size);
extern int stride_round_up (int, int const *, int);
extern void* wrapped_av_malloc (size_t);
-
-class FFmpegSubtitlePeriod
-{
-public:
- FFmpegSubtitlePeriod (ContentTime f)
- : from (f)
- {}
-
- FFmpegSubtitlePeriod (ContentTime f, ContentTime t)
- : from (f)
- , to (t)
- {}
-
- ContentTime from;
- boost::optional<ContentTime> to;
-};
-
-extern FFmpegSubtitlePeriod subtitle_period (AVSubtitle const &);
extern void set_backtrace_file (boost::filesystem::path);
extern std::map<std::string, std::string> split_get_request (std::string url);
extern std::string video_asset_filename (boost::shared_ptr<dcp::PictureAsset> asset);