summaryrefslogtreecommitdiff
path: root/src
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
parent6198597b190c3c730057bee54e0421fcd7bcb795 (diff)
Allow UI to set up FFmpeg streams again.
Diffstat (limited to 'src')
-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
-rw-r--r--src/wx/film_editor.cc46
5 files changed, 86 insertions, 71 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,
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 33919d946..d55104a95 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -1074,14 +1074,16 @@ FilmEditor::ffmpeg_audio_stream_changed (wxCommandEvent &)
return;
}
-#if 0
- _film->set_content_audio_stream (
- audio_stream_factory (
- string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ())),
- Film::state_version
- )
- );
-#endif
+ vector<FFmpegAudioStream> a = _film->ffmpeg_audio_streams ();
+ vector<FFmpegAudioStream>::iterator i = a.begin ();
+ string const s = string_client_data (_ffmpeg_audio_stream->GetClientObject (_ffmpeg_audio_stream->GetSelection ()));
+ while (i != a.end() && i->id != s) {
+ ++i;
+ }
+
+ if (i != a.end ()) {
+ _film->set_ffmpeg_audio_stream (*i);
+ }
}
void
@@ -1091,33 +1093,33 @@ FilmEditor::ffmpeg_subtitle_stream_changed (wxCommandEvent &)
return;
}
-#if 0
- _film->set_subtitle_stream (
- subtitle_stream_factory (
- string_client_data (_subtitle_stream->GetClientObject (_subtitle_stream->GetSelection ())),
- Film::state_version
- )
- );
-#endif
+ vector<FFmpegSubtitleStream> a = _film->ffmpeg_subtitle_streams ();
+ vector<FFmpegSubtitleStream>::iterator i = a.begin ();
+ string const s = string_client_data (_ffmpeg_subtitle_stream->GetClientObject (_ffmpeg_subtitle_stream->GetSelection ()));
+ while (i != a.end() && i->id != s) {
+ ++i;
+ }
+
+ if (i != a.end ()) {
+ _film->set_ffmpeg_subtitle_stream (*i);
+ }
}
void
FilmEditor::setup_audio_details ()
{
-#if 0
- if (!_film->content_audio_stream()) {
+ if (!_film->ffmpeg_audio_stream()) {
_audio->SetLabel (wxT (""));
} else {
stringstream s;
- if (_film->audio_stream()->channels() == 1) {
+ if (_film->audio_channels() == 1) {
s << wx_to_std (_("1 channel"));
} else {
- s << _film->audio_stream()->channels () << " " << wx_to_std (_("channels"));
+ s << _film->audio_channels() << " " << wx_to_std (_("channels"));
}
- s << ", " << _film->audio_stream()->sample_rate() << wx_to_std (_("Hz"));
+ s << ", " << _film->audio_channels() << wx_to_std (_("Hz"));
_audio->SetLabel (std_to_wx (s.str ()));
}
-#endif
}
void