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
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.
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;
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)
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,
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
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