);
}
-string
-FFmpeg::subtitle_id (AVSubtitle const & sub)
-{
- Digester digester;
- digester.add (sub.pts);
- for (unsigned int i = 0; i < sub.num_rects; ++i) {
- AVSubtitleRect* rect = sub.rects[i];
- if (rect->type == SUBTITLE_BITMAP) {
- digester.add (rect->x);
- digester.add (rect->y);
- digester.add (rect->w);
- digester.add (rect->h);
-#ifdef DCPOMATIC_HAVE_AVSUBTITLERECT_PICT
- int const line = rect->pict.linesize[0];
- for (int j = 0; j < rect->h; ++j) {
- digester.add (rect->pict.data[0] + j * line, line);
- }
-#else
- int const line = rect->linesize[0];
- for (int j = 0; j < rect->h; ++j) {
- digester.add (rect->data[0] + j * line, line);
- }
-#endif
- } else if (rect->type == SUBTITLE_TEXT) {
- digester.add (string (rect->text));
- } else if (rect->type == SUBTITLE_ASS) {
- digester.add (string (rect->ass));
- }
- }
- return digester.get ();
-}
-
-/** @return true if sub starts a new image subtitle */
-bool
-FFmpeg::subtitle_starts_image (AVSubtitle const & sub)
-{
- bool image = false;
- bool text = false;
-
- for (unsigned int i = 0; i < sub.num_rects; ++i) {
- switch (sub.rects[i]->type) {
- case SUBTITLE_BITMAP:
- image = true;
- break;
- case SUBTITLE_TEXT:
- case SUBTITLE_ASS:
- text = true;
- break;
- default:
- break;
- }
- }
-
- /* We can't cope with mixed image/text in one AVSubtitle */
- DCPOMATIC_ASSERT (!image || !text);
-
- return image;
-}
-
/** Compute the pts offset to use given a set of audio streams and some video details.
* Sometimes these parameters will have just been determined by an Examiner, sometimes
* they will have been retrieved from a piece of Content, hence the need for this method
) const;
static FFmpegSubtitlePeriod subtitle_period (AVSubtitle const & sub);
- static std::string subtitle_id (AVSubtitle const & sub);
- static bool subtitle_starts_image (AVSubtitle const & sub);
boost::shared_ptr<const FFmpegContent> _ffmpeg_content;
load (temp_cert.file ());
return optional<string> ();
}
-
-static size_t
-ftp_ls_data (void* buffer, size_t size, size_t nmemb, void* data)
-{
- string* s = reinterpret_cast<string *> (data);
- uint8_t* b = reinterpret_cast<uint8_t *> (buffer);
- for (size_t i = 0; i < (size * nmemb); ++i) {
- *s += b[i];
- }
- return size * nmemb;
-}
-
-list<string>
-ftp_ls (string url, bool pasv)
-{
- CURL* curl = curl_easy_init ();
- if (!curl) {
- throw NetworkError ("could not set up curl");
- }
-
- if (url.substr (url.length() - 1, 1) != "/") {
- url += "/";
- }
- curl_easy_setopt (curl, CURLOPT_URL, url.c_str ());
- /* 20s timeout */
- curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
-
- string ls_raw;
- struct curl_slist* commands = 0;
- commands = curl_slist_append (commands, "NLST");
- curl_easy_setopt (curl, CURLOPT_POSTQUOTE, commands);
- curl_easy_setopt (curl, CURLOPT_WRITEDATA, &ls_raw);
- curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ftp_ls_data);
- curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
- curl_easy_setopt (curl, CURLOPT_FTP_USE_EPRT, 0);
- curl_easy_setopt (curl, CURLOPT_VERBOSE, 1);
- if (!pasv) {
- curl_easy_setopt (curl, CURLOPT_FTPPORT, "-");
- }
- CURLcode const r = curl_easy_perform (curl);
- if (r != CURLE_OK) {
- curl_easy_cleanup (curl);
- throw NetworkError (curl_easy_strerror (r));
- }
-
- list<string> ls;
- string line;
- for (size_t i = 0; i < ls_raw.length(); ++i) {
- line += ls_raw[i];
- if (ls_raw[i] == '\n') {
- trim (line);
- if (line.length() > 55) {
- string const file = line.substr (55);
- if (file != "." && file != "..") {
- ls.push_back (file);
- }
- }
- line = "";
- }
- }
-
- curl_easy_cleanup (curl);
-
- return ls;
-}
#include <boost/filesystem.hpp>
boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, boost::function<void (boost::filesystem::path)> load);
-std::list<std::string> ftp_ls (std::string dir, bool pasv = true);
return best_summary;
}
-bool
-Playlist::video_content_at (DCPTime time) const
-{
- BOOST_FOREACH (shared_ptr<Content> i, _content) {
- if (i->video && i->position() <= time && time < i->end()) {
- return true;
- }
- }
-
- return false;
-}
-
-bool
-Playlist::audio_content_at (DCPTime time) const
-{
- BOOST_FOREACH (shared_ptr<Content> i, _content) {
- if (!i->audio) {
- continue;
- }
- if (i->position() <= time && time < i->end()) {
- return true;
- }
- }
-
- return false;
-}
-
-shared_ptr<Content>
-Playlist::next_audio_content (DCPTime time) const
-{
- shared_ptr<Content> next;
- DCPTime next_position;
- BOOST_FOREACH (shared_ptr<Content> i, _content) {
- if (!i->audio) {
- continue;
- }
- if (i->position() >= time && (!next || i->position() < next_position)) {
- next = i;
- next_position = i->position();
- }
- }
-
- return next;
-}
-
pair<double, double>
Playlist::speed_up_range (int dcp_video_frame_rate) const
{
void move_later (boost::shared_ptr<Content>);
ContentList content () const;
- bool video_content_at (DCPTime time) const;
- bool audio_content_at (DCPTime time) const;
- boost::shared_ptr<Content> next_audio_content (DCPTime time) const;
std::string video_identifier () const;
_data.clear ();
}
-optional<DCPTime>
-VideoRingBuffers::earliest () const
-{
- boost::mutex::scoped_lock lm (_mutex);
- if (_data.empty ()) {
- return optional<DCPTime> ();
- }
-
- return _data.front().second;
-}
-
pair<size_t, string>
VideoRingBuffers::memory_used () const
{
void clear ();
Frame size () const;
bool empty () const;
- boost::optional<DCPTime> earliest () const;
std::pair<size_t, std::string> memory_used () const;