summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-03 20:44:02 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-03 20:44:02 +0100
commit675e849d19812f5ed2d63b3bc0e34f142e6abb89 (patch)
tree1c33c70c40d60d926513f27c74acce46c6843a72 /src/lib
parent6198597b190c3c730057bee54e0421fcd7bcb795 (diff)
Allow UI to set up FFmpeg streams again.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc62
-rw-r--r--src/lib/film.h4
-rw-r--r--src/lib/playlist.cc40
-rw-r--r--src/lib/playlist.h5
4 files changed, 62 insertions, 49 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 091b35d47..fd72aa1d5 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1161,28 +1161,82 @@ Film::video_length () const
return _playlist->video_length ();
}
+/** Unfortunately this is needed as the GUI has FFmpeg-specific controls */
+shared_ptr<FFmpegContent>
+Film::ffmpeg () const
+{
+ boost::mutex::scoped_lock lm (_state_mutex);
+
+ for (ContentList::const_iterator i = _content.begin (); i != _content.end(); ++i) {
+ shared_ptr<FFmpegContent> f = boost::dynamic_pointer_cast<FFmpegContent> (*i);
+ if (f) {
+ return f;
+ }
+ }
+
+ return shared_ptr<FFmpegContent> ();
+}
+
vector<FFmpegSubtitleStream>
Film::ffmpeg_subtitle_streams () const
{
- return _playlist->ffmpeg_subtitle_streams ();
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ return f->subtitle_streams ();
+ }
+
+ return vector<FFmpegSubtitleStream> ();
}
boost::optional<FFmpegSubtitleStream>
Film::ffmpeg_subtitle_stream () const
{
- return _playlist->ffmpeg_subtitle_stream ();
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ return f->subtitle_stream ();
+ }
+
+ return boost::none;
}
vector<FFmpegAudioStream>
Film::ffmpeg_audio_streams () const
{
- return _playlist->ffmpeg_audio_streams ();
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ return f->audio_streams ();
+ }
+
+ return vector<FFmpegAudioStream> ();
}
boost::optional<FFmpegAudioStream>
Film::ffmpeg_audio_stream () const
{
- return _playlist->ffmpeg_audio_stream ();
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ return f->audio_stream ();
+ }
+
+ return boost::none;
+}
+
+void
+Film::set_ffmpeg_subtitle_stream (FFmpegSubtitleStream s)
+{
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ f->set_subtitle_stream (s);
+ }
+}
+
+void
+Film::set_ffmpeg_audio_stream (FFmpegAudioStream s)
+{
+ boost::shared_ptr<FFmpegContent> f = ffmpeg ();
+ if (f) {
+ f->set_audio_stream (s);
+ }
}
void
diff --git a/src/lib/film.h b/src/lib/film.h
index e71fe2606..a03fd5d97 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -119,6 +119,9 @@ public:
boost::optional<FFmpegSubtitleStream> ffmpeg_subtitle_stream () const;
std::vector<FFmpegAudioStream> ffmpeg_audio_streams () const;
boost::optional<FFmpegAudioStream> ffmpeg_audio_stream () const;
+
+ void set_ffmpeg_subtitle_stream (FFmpegSubtitleStream);
+ void set_ffmpeg_audio_stream (FFmpegAudioStream);
/** Identifiers for the parts of our state;
used for signalling changes.
@@ -313,6 +316,7 @@ private:
std::string video_state_identifier () const;
void read_metadata ();
void content_changed (int);
+ boost::shared_ptr<FFmpegContent> ffmpeg () const;
/** Log to write to */
boost::shared_ptr<Log> _log;
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index 0c29650b6..3da7f938b 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -207,46 +207,6 @@ Playlist::has_audio () const
return _audio_from != AUDIO_NONE;
}
-vector<FFmpegSubtitleStream>
-Playlist::ffmpeg_subtitle_streams () const
-{
- if (_video_from != VIDEO_FFMPEG || !_ffmpeg) {
- return vector<FFmpegSubtitleStream> ();
- }
-
- return _ffmpeg->subtitle_streams ();
-}
-
-boost::optional<FFmpegSubtitleStream>
-Playlist::ffmpeg_subtitle_stream () const
-{
- if (_video_from != VIDEO_FFMPEG || !_ffmpeg) {
- return boost::none;
- }
-
- return _ffmpeg->subtitle_stream ();
-}
-
-vector<FFmpegAudioStream>
-Playlist::ffmpeg_audio_streams () const
-{
- if (_video_from != VIDEO_FFMPEG || !_ffmpeg) {
- return vector<FFmpegAudioStream> ();
- }
-
- return _ffmpeg->audio_streams ();
-}
-
-boost::optional<FFmpegAudioStream>
-Playlist::ffmpeg_audio_stream () const
-{
- if (_video_from != VIDEO_FFMPEG || !_ffmpeg) {
- return boost::none;
- }
-
- return _ffmpeg->audio_stream ();
-}
-
Player::Player (boost::shared_ptr<const Film> f, boost::shared_ptr<const Playlist> p)
: _film (f)
, _playlist (p)
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index c461151d4..480f1b2ed 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -53,11 +53,6 @@ public:
libdcp::Size video_size () const;
ContentVideoFrame video_length () const;
- std::vector<FFmpegSubtitleStream> ffmpeg_subtitle_streams () const;
- boost::optional<FFmpegSubtitleStream> ffmpeg_subtitle_stream () const;
- std::vector<FFmpegAudioStream> ffmpeg_audio_streams () const;
- boost::optional<FFmpegAudioStream> ffmpeg_audio_stream () const;
-
enum VideoFrom {
VIDEO_NONE,
VIDEO_FFMPEG,