From f508191f9d794e7762270d19a4211739470cfe0d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 27 Feb 2018 22:56:42 +0000 Subject: [PATCH] Remove some unused code. --- src/lib/ffmpeg.cc | 59 ------------------------------- src/lib/ffmpeg.h | 2 -- src/lib/internet.cc | 65 ----------------------------------- src/lib/internet.h | 1 - src/lib/playlist.cc | 45 ------------------------ src/lib/playlist.h | 3 -- src/lib/video_ring_buffers.cc | 11 ------ src/lib/video_ring_buffers.h | 1 - 8 files changed, 187 deletions(-) diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index ac179e1d6..5171166d5 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -276,65 +276,6 @@ FFmpeg::subtitle_period (AVSubtitle const & sub) ); } -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 diff --git a/src/lib/ffmpeg.h b/src/lib/ffmpeg.h index dab67ead9..d2f797658 100644 --- a/src/lib/ffmpeg.h +++ b/src/lib/ffmpeg.h @@ -58,8 +58,6 @@ protected: ) 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 _ffmpeg_content; diff --git a/src/lib/internet.cc b/src/lib/internet.cc index 67f6ed2bc..c1bb5e88f 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -126,68 +126,3 @@ get_from_zip_url (string url, string file, bool pasv, function (); } - -static size_t -ftp_ls_data (void* buffer, size_t size, size_t nmemb, void* data) -{ - string* s = reinterpret_cast (data); - uint8_t* b = reinterpret_cast (buffer); - for (size_t i = 0; i < (size * nmemb); ++i) { - *s += b[i]; - } - return size * nmemb; -} - -list -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 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; -} diff --git a/src/lib/internet.h b/src/lib/internet.h index b477bb447..9b88bde97 100644 --- a/src/lib/internet.h +++ b/src/lib/internet.h @@ -23,4 +23,3 @@ #include boost::optional get_from_zip_url (std::string url, std::string file, bool pasv, boost::function load); -std::list ftp_ls (std::string dir, bool pasv = true); diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 12832cfd7..d2ac95cd3 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -544,51 +544,6 @@ Playlist::content_summary (DCPTimePeriod period) const return best_summary; } -bool -Playlist::video_content_at (DCPTime time) const -{ - BOOST_FOREACH (shared_ptr 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 i, _content) { - if (!i->audio) { - continue; - } - if (i->position() <= time && time < i->end()) { - return true; - } - } - - return false; -} - -shared_ptr -Playlist::next_audio_content (DCPTime time) const -{ - shared_ptr next; - DCPTime next_position; - BOOST_FOREACH (shared_ptr i, _content) { - if (!i->audio) { - continue; - } - if (i->position() >= time && (!next || i->position() < next_position)) { - next = i; - next_position = i->position(); - } - } - - return next; -} - pair Playlist::speed_up_range (int dcp_video_frame_rate) const { diff --git a/src/lib/playlist.h b/src/lib/playlist.h index f8f51ac2d..fe19c93c9 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -55,9 +55,6 @@ public: void move_later (boost::shared_ptr); ContentList content () const; - bool video_content_at (DCPTime time) const; - bool audio_content_at (DCPTime time) const; - boost::shared_ptr next_audio_content (DCPTime time) const; std::string video_identifier () const; diff --git a/src/lib/video_ring_buffers.cc b/src/lib/video_ring_buffers.cc index 2fc39d53c..0167f4aec 100644 --- a/src/lib/video_ring_buffers.cc +++ b/src/lib/video_ring_buffers.cc @@ -73,17 +73,6 @@ VideoRingBuffers::clear () _data.clear (); } -optional -VideoRingBuffers::earliest () const -{ - boost::mutex::scoped_lock lm (_mutex); - if (_data.empty ()) { - return optional (); - } - - return _data.front().second; -} - pair VideoRingBuffers::memory_used () const { diff --git a/src/lib/video_ring_buffers.h b/src/lib/video_ring_buffers.h index 887a5dc2f..f3e521553 100644 --- a/src/lib/video_ring_buffers.h +++ b/src/lib/video_ring_buffers.h @@ -37,7 +37,6 @@ public: void clear (); Frame size () const; bool empty () const; - boost::optional earliest () const; std::pair memory_used () const; -- 2.30.2