summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-20 17:18:35 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-20 17:18:35 +0100
commit2de990b0155fcb5c3dac821ef8c2659e903d2f6e (patch)
tree11cb6b7cc0f30c58dfd1e62f8a76f906d6b216b4 /src
parent0c66eaeac227d6aeb63a7a36e202ef87081dc222 (diff)
Various incomplete hacks on regions / audio mapping.
Diffstat (limited to 'src')
-rw-r--r--src/lib/audio_content.h2
-rw-r--r--src/lib/ffmpeg_content.cc12
-rw-r--r--src/lib/ffmpeg_content.h3
-rw-r--r--src/lib/film.cc4
-rw-r--r--src/lib/player.cc12
-rw-r--r--src/lib/player.h4
-rw-r--r--src/lib/playlist.cc30
-rw-r--r--src/lib/playlist.h8
-rw-r--r--src/lib/sndfile_content.cc3
-rw-r--r--src/lib/sndfile_content.h6
-rw-r--r--src/wx/audio_mapping_view.cc19
-rw-r--r--src/wx/audio_mapping_view.h3
-rw-r--r--src/wx/ffmpeg_content_dialog.cc33
-rw-r--r--src/wx/ffmpeg_content_dialog.h6
-rw-r--r--src/wx/film_editor.cc52
-rw-r--r--src/wx/film_editor.h4
-rw-r--r--src/wx/timeline.cc6
17 files changed, 114 insertions, 93 deletions
diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h
index 51f05efb0..36c36992e 100644
--- a/src/lib/audio_content.h
+++ b/src/lib/audio_content.h
@@ -23,7 +23,6 @@
#define DCPOMATIC_AUDIO_CONTENT_H
#include "content.h"
-#include "audio_mapping.h"
namespace cxml {
class Node;
@@ -50,7 +49,6 @@ public:
virtual ContentAudioFrame audio_length () const = 0;
virtual int content_audio_frame_rate () const = 0;
virtual int output_audio_frame_rate (boost::shared_ptr<const Film>) const = 0;
- virtual AudioMapping audio_mapping () const = 0;
};
#endif
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index d730f3ecb..e898c02d0 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -266,7 +266,6 @@ operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
}
FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node)
- : mapping (node->node_child ("Mapping"))
{
name = node->string_child ("Name");
id = node->number_child<int> ("Id");
@@ -281,7 +280,6 @@ FFmpegAudioStream::as_xml (xmlpp::Node* root) const
root->add_child("Id")->add_child_text (lexical_cast<string> (id));
root->add_child("FrameRate")->add_child_text (lexical_cast<string> (frame_rate));
root->add_child("Channels")->add_child_text (lexical_cast<string> (channels));
- mapping.as_xml (root->add_child("Mapping"));
}
/** Construct a SubtitleStream from a value returned from to_string().
@@ -313,13 +311,3 @@ FFmpegContent::length (shared_ptr<const Film> film) const
FrameRateConversion frc (video_frame_rate (), film->dcp_video_frame_rate ());
return video_length() * frc.factor() * TIME_HZ / film->dcp_video_frame_rate ();
}
-
-AudioMapping
-FFmpegContent::audio_mapping () const
-{
- if (!_audio_stream) {
- return AudioMapping ();
- }
-
- return _audio_stream->mapping;
-}
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index d26c73125..6c141b6c1 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -34,7 +34,6 @@ public:
, id (i)
, frame_rate (f)
, channels (c)
- , mapping (c)
{}
FFmpegAudioStream (boost::shared_ptr<const cxml::Node>);
@@ -45,7 +44,6 @@ public:
int id;
int frame_rate;
int channels;
- AudioMapping mapping;
};
extern bool operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b);
@@ -100,7 +98,6 @@ public:
ContentAudioFrame audio_length () const;
int content_audio_frame_rate () const;
int output_audio_frame_rate (boost::shared_ptr<const Film>) const;
- AudioMapping audio_mapping () const;
std::vector<FFmpegSubtitleStream> subtitle_streams () const {
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 646b114da..1b5779f2d 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1,3 +1,5 @@
+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
/*
Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
@@ -699,7 +701,7 @@ Film::set_trust_content_headers (bool t)
if (!_trust_content_headers && !regions.empty()) {
/* We just said that we don't trust the content's header */
for (Playlist::RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- examine_content (i->content);
+ examine_content ((*i)->content);
}
}
}
diff --git a/src/lib/player.cc b/src/lib/player.cc
index e38b12ec3..675fcae5c 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -93,8 +93,8 @@ Player::pass ()
Time next_wait = TIME_MAX;
for (list<shared_ptr<RegionDecoder> >::iterator i = _decoders.begin(); i != _decoders.end(); ++i) {
- Time const ts = (*i)->region.time;
- Time const te = (*i)->region.time + (*i)->region.content->length (_film);
+ Time const ts = (*i)->region->time;
+ Time const te = (*i)->region->time + (*i)->region->content->length (_film);
if (ts <= _position && te > _position) {
Time const pos = ts + (*i)->last;
if (pos < earliest_pos) {
@@ -125,7 +125,7 @@ Player::process_video (shared_ptr<RegionDecoder> rd, shared_ptr<const Image> ima
{
shared_ptr<VideoDecoder> vd = dynamic_pointer_cast<VideoDecoder> (rd->decoder);
- Time const global_time = rd->region.time + time;
+ Time const global_time = rd->region->time + time;
while ((global_time - _last_video) > 1) {
/* Fill in with black */
emit_black_frame ();
@@ -224,7 +224,7 @@ Player::setup_decoders ()
/* XXX: into content? */
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (i->content);
+ shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> ((*i)->content);
if (fc) {
shared_ptr<FFmpegDecoder> fd (new FFmpegDecoder (_film, fc, _video, _audio, _subtitles));
@@ -234,7 +234,7 @@ Player::setup_decoders ()
rd->decoder = fd;
}
- shared_ptr<const ImageMagickContent> ic = dynamic_pointer_cast<const ImageMagickContent> (i->content);
+ shared_ptr<const ImageMagickContent> ic = dynamic_pointer_cast<const ImageMagickContent> ((*i)->content);
if (ic) {
shared_ptr<ImageMagickDecoder> id;
@@ -254,7 +254,7 @@ Player::setup_decoders ()
rd->decoder = id;
}
- shared_ptr<const SndfileContent> sc = dynamic_pointer_cast<const SndfileContent> (i->content);
+ shared_ptr<const SndfileContent> sc = dynamic_pointer_cast<const SndfileContent> ((*i)->content);
if (sc) {
shared_ptr<AudioDecoder> sd (new SndfileDecoder (_film, sc));
sd->Audio.connect (bind (&Player::process_audio, this, rd, _1, _2));
diff --git a/src/lib/player.h b/src/lib/player.h
index c9bf2a00b..4979778ed 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -1,3 +1,5 @@
+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
/*
Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
@@ -66,7 +68,7 @@ private:
: last (0)
{}
- Playlist::Region region;
+ boost::shared_ptr<Playlist::Region> region;
boost::shared_ptr<Decoder> decoder;
Time last;
};
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index 912d90f0e..8db5c5fc2 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -59,7 +59,7 @@ Playlist::Playlist (shared_ptr<const Playlist> other)
: _loop (other->_loop)
{
for (RegionList::const_iterator i = other->_regions.begin(); i != other->_regions.end(); ++i) {
- _regions.push_back (Region (i->content->clone(), i->time, this));
+ _regions.push_back (shared_ptr<Region> (new Region ((*i)->content->clone(), (*i)->time, this)));
}
}
@@ -75,13 +75,13 @@ Playlist::audio_digest () const
string t;
for (RegionList::const_iterator i = _regions.begin(); i != _regions.end(); ++i) {
- if (!dynamic_pointer_cast<const AudioContent> (i->content)) {
+ if (!dynamic_pointer_cast<const AudioContent> ((*i)->content)) {
continue;
}
- t += i->content->digest ();
+ t += (*i)->content->digest ();
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (i->content);
+ shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> ((*i)->content);
if (fc) {
t += lexical_cast<string> (fc->audio_stream()->id);
}
@@ -98,12 +98,12 @@ Playlist::video_digest () const
string t;
for (RegionList::const_iterator i = _regions.begin(); i != _regions.end(); ++i) {
- if (!dynamic_pointer_cast<const VideoContent> (i->content)) {
+ if (!dynamic_pointer_cast<const VideoContent> ((*i)->content)) {
continue;
}
- t += i->content->digest ();
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (i->content);
+ t += (*i)->content->digest ();
+ shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> ((*i)->content);
if (fc && fc->subtitle_stream()) {
t += fc->subtitle_stream()->id;
}
@@ -119,7 +119,7 @@ Playlist::set_from_xml (shared_ptr<const cxml::Node> node)
{
list<shared_ptr<cxml::Node> > c = node->node_children ("Region");
for (list<shared_ptr<cxml::Node> >::iterator i = c.begin(); i != c.end(); ++i) {
- _regions.push_back (Region (*i, this));
+ _regions.push_back (shared_ptr<Region> (new Region (*i, this)));
}
_loop = node->number_child<int> ("Loop");
@@ -129,7 +129,7 @@ void
Playlist::as_xml (xmlpp::Node* node)
{
for (RegionList::iterator i = _regions.begin(); i != _regions.end(); ++i) {
- i->as_xml (node->add_child ("Region"));
+ (*i)->as_xml (node->add_child ("Region"));
}
node->add_child("Loop")->add_child_text(lexical_cast<string> (_loop));
@@ -138,7 +138,7 @@ Playlist::as_xml (xmlpp::Node* node)
void
Playlist::add (shared_ptr<Content> c)
{
- _regions.push_back (Region (c, 0, this));
+ _regions.push_back (shared_ptr<Region> (new Region (c, 0, this)));
Changed ();
}
@@ -146,7 +146,7 @@ void
Playlist::remove (shared_ptr<Content> c)
{
RegionList::iterator i = _regions.begin ();
- while (i != _regions.end() && i->content != c) {
+ while (i != _regions.end() && (*i)->content != c) {
++i;
}
@@ -167,7 +167,7 @@ bool
Playlist::has_subtitles () const
{
for (RegionList::const_iterator i = _regions.begin(); i != _regions.end(); ++i) {
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (i->content);
+ shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> ((*i)->content);
if (fc && !fc->subtitle_streams().empty()) {
return true;
}
@@ -197,6 +197,7 @@ Playlist::Region::Region (shared_ptr<const cxml::Node> node, Playlist* p)
}
time = node->number_child<Time> ("Time");
+ audio_mapping = AudioMapping (node->node_child ("AudioMapping"));
connection = content->Changed.connect (bind (&Playlist::content_changed, p, _1, _2));
}
@@ -206,6 +207,7 @@ Playlist::Region::as_xml (xmlpp::Node* node) const
xmlpp::Node* sub = node->add_child ("Content");
content->as_xml (sub);
node->add_child ("Time")->add_child_text (lexical_cast<string> (time));
+ audio_mapping.as_xml (node->add_child ("AudioMapping"));
}
class FrameRateCandidate
@@ -247,7 +249,7 @@ Playlist::best_dcp_frame_rate () const
float this_error = std::numeric_limits<float>::max ();
for (RegionList::const_iterator j = _regions.begin(); j != _regions.end(); ++j) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (j->content);
+ shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> ((*j)->content);
if (!vc) {
continue;
}
@@ -275,7 +277,7 @@ Playlist::length (shared_ptr<const Film> film) const
{
Time len = 0;
for (RegionList::const_iterator i = _regions.begin(); i != _regions.end(); ++i) {
- Time const t = i->time + i->content->length (film);
+ Time const t = (*i)->time + (*i)->content->length (film);
len = max (len, t);
}
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index 5b9299795..f677f0ad7 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -1,3 +1,5 @@
+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
/*
Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
@@ -77,10 +79,14 @@ public:
boost::shared_ptr<Content> content;
Time time;
+ /* XXX: obviously not used for video-only; there should
+ really by AudioRegion / VideoRegion etc.
+ */
+ AudioMapping audio_mapping;
boost::signals2::connection connection;
};
- typedef std::vector<Region> RegionList;
+ typedef std::vector<boost::shared_ptr<Region> > RegionList;
RegionList regions () const {
return _regions;
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 963abb58e..13b118fb2 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -50,7 +50,6 @@ SndfileContent::SndfileContent (shared_ptr<const cxml::Node> node)
_audio_channels = node->number_child<int> ("AudioChannels");
_audio_length = node->number_child<ContentAudioFrame> ("AudioLength");
_audio_frame_rate = node->number_child<int> ("AudioFrameRate");
- _mapping = AudioMapping (node->node_child ("Mapping"));
}
string
@@ -106,7 +105,6 @@ SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick)
_audio_channels = dec.audio_channels ();
_audio_length = dec.audio_length ();
_audio_frame_rate = dec.audio_frame_rate ();
- _mapping = AudioMapping (_audio_channels);
}
signal_changed (AudioContentProperty::AUDIO_CHANNELS);
@@ -122,7 +120,6 @@ SndfileContent::as_xml (xmlpp::Node* node) const
node->add_child("AudioChannels")->add_child_text (lexical_cast<string> (_audio_channels));
node->add_child("AudioLength")->add_child_text (lexical_cast<string> (_audio_length));
node->add_child("AudioFrameRate")->add_child_text (lexical_cast<string> (_audio_frame_rate));
- _mapping.as_xml (node->add_child("Mapping"));
}
int
diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h
index e0d66b992..d930d7061 100644
--- a/src/lib/sndfile_content.h
+++ b/src/lib/sndfile_content.h
@@ -63,16 +63,10 @@ public:
int output_audio_frame_rate (boost::shared_ptr<const Film>) const;
- AudioMapping audio_mapping () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _mapping;
- }
-
static bool valid_file (boost::filesystem::path);
private:
int _audio_channels;
ContentAudioFrame _audio_length;
int _audio_frame_rate;
- AudioMapping _mapping;
};
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index 8d049e05f..d0deca69e 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -114,9 +114,9 @@ AudioMappingView::AudioMappingView (wxWindow* parent)
_grid->AutoSize ();
- wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
- s->Add (_grid, 1, wxEXPAND);
- SetSizerAndFit (s);
+ _sizer = new wxBoxSizer (wxVERTICAL);
+ _sizer->Add (_grid, 1, wxEXPAND | wxALL);
+ SetSizerAndFit (_sizer);
Connect (wxID_ANY, wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler (AudioMappingView::left_click), 0, this);
}
@@ -133,6 +133,17 @@ AudioMappingView::left_click (wxGridEvent& ev)
} else {
_grid->SetCellValue (ev.GetRow(), ev.GetCol(), wxT("1"));
}
+
+ AudioMapping mapping;
+ for (int i = 0; i < _grid->GetNumberRows(); ++i) {
+ for (int j = 0; j < _grid->GetNumberCols(); ++j) {
+ if (_grid->GetCellValue (i, j) == wxT ("1")) {
+ mapping.add (i, static_cast<libdcp::Channel> (j));
+ }
+ }
+ }
+
+ Changed (mapping);
}
void
@@ -161,7 +172,5 @@ AudioMappingView::set_mapping (AudioMapping map)
}
++n;
}
-
- _grid->AutoSize ();
}
diff --git a/src/wx/audio_mapping_view.h b/src/wx/audio_mapping_view.h
index 9385f492d..76e20ad9a 100644
--- a/src/wx/audio_mapping_view.h
+++ b/src/wx/audio_mapping_view.h
@@ -31,8 +31,11 @@ public:
void set_mapping (AudioMapping);
+ boost::signals2::signal<void (AudioMapping)> Changed;
+
private:
void left_click (wxGridEvent &);
wxGrid* _grid;
+ wxSizer* _sizer;
};
diff --git a/src/wx/ffmpeg_content_dialog.cc b/src/wx/ffmpeg_content_dialog.cc
index 762ec3774..8bf8a8e35 100644
--- a/src/wx/ffmpeg_content_dialog.cc
+++ b/src/wx/ffmpeg_content_dialog.cc
@@ -21,17 +21,22 @@
#include <boost/lexical_cast.hpp>
#include "lib/ffmpeg_content.h"
+#include "lib/playlist.h"
#include "ffmpeg_content_dialog.h"
#include "wx_util.h"
#include "audio_mapping_view.h"
using std::vector;
using std::string;
+using std::cout;
using boost::shared_ptr;
using boost::lexical_cast;
+using boost::dynamic_pointer_cast;
-FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegContent> content)
+FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<Playlist::Region> region)
: wxDialog (parent, wxID_ANY, _("Video"))
+ , _region (region)
+ , _content (dynamic_pointer_cast<FFmpegContent> (region->content))
{
wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
grid->AddGrowableCol (1, 1);
@@ -47,9 +52,8 @@ FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegCon
grid->Add (_subtitle_stream, 1, wxEXPAND | wxALL, 6);
grid->AddSpacer (0);
- _audio_mapping = new AudioMappingView (this);
- grid->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
- grid->AddSpacer (0);
+ shared_ptr<FFmpegContent> content = _content.lock ();
+ assert (content);
_audio_stream->Clear ();
vector<FFmpegAudioStream> a = content->audio_streams ();
@@ -76,11 +80,14 @@ FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegCon
_subtitle_stream->SetSelection (wxNOT_FOUND);
}
- _audio_mapping->set_mapping (content->audio_mapping ());
-
wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+
overall_sizer->Add (grid, 1, wxEXPAND | wxALL, 6);
+ _audio_mapping = new AudioMappingView (this);
+ _audio_mapping->set_mapping (region->audio_mapping);
+ overall_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
+
wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
if (buttons) {
overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
@@ -92,6 +99,7 @@ FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegCon
_audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::audio_stream_changed), 0, this);
_subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::subtitle_stream_changed), 0, this);
+ _audio_mapping->Changed.connect (bind (&FFmpegContentDialog::audio_mapping_changed, this, _1));
}
void
@@ -148,3 +156,16 @@ FFmpegContentDialog::subtitle_stream_changed (wxCommandEvent &)
c->set_subtitle_stream (*i);
}
}
+
+void
+FFmpegContentDialog::audio_mapping_changed (AudioMapping m)
+{
+ shared_ptr<FFmpegContent> content = _content.lock ();
+
+ if (!content || !content->audio_stream()) {
+ return;
+ }
+
+ /* XXX: set mapping in playlist */
+}
+
diff --git a/src/wx/ffmpeg_content_dialog.h b/src/wx/ffmpeg_content_dialog.h
index a04645f69..380b31f21 100644
--- a/src/wx/ffmpeg_content_dialog.h
+++ b/src/wx/ffmpeg_content_dialog.h
@@ -22,6 +22,8 @@
#include <wx/wx.h>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
+#include "lib/audio_mapping.h"
+#include "lib/playlist.h"
class wxSpinCtrl;
class FFmpegContent;
@@ -30,12 +32,14 @@ class AudioMappingView;
class FFmpegContentDialog : public wxDialog
{
public:
- FFmpegContentDialog (wxWindow *, boost::shared_ptr<FFmpegContent>);
+ FFmpegContentDialog (wxWindow *, boost::shared_ptr<Playlist::Region>);
private:
void audio_stream_changed (wxCommandEvent &);
void subtitle_stream_changed (wxCommandEvent &);
+ void audio_mapping_changed (AudioMapping);
+ boost::weak_ptr<Playlist::Region> _region;
boost::weak_ptr<FFmpegContent> _content;
wxChoice* _audio_stream;
wxStaticText* _audio_description;
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index d96d146f9..226feaca2 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -712,7 +712,7 @@ FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
} else if (property == VideoContentProperty::VIDEO_LENGTH || property == AudioContentProperty::AUDIO_LENGTH) {
setup_length ();
boost::shared_ptr<Content> c = content.lock ();
- if (c && c == selected_content()) {
+ if (selected_region() && c == selected_region()->content) {
setup_content_information ();
}
} else if (property == FFmpegContentProperty::AUDIO_STREAM) {
@@ -1122,8 +1122,8 @@ FilmEditor::setup_content ()
Playlist::RegionList regions = _film->regions ();
for (Playlist::RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
int const t = _content->GetItemCount ();
- _content->InsertItem (t, std_to_wx (i->content->summary ()));
- if (i->content->summary() == selected_summary) {
+ _content->InsertItem (t, std_to_wx ((*i)->content->summary ()));
+ if ((*i)->content->summary() == selected_summary) {
_content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
}
@@ -1166,9 +1166,9 @@ FilmEditor::content_add_clicked (wxCommandEvent &)
void
FilmEditor::content_remove_clicked (wxCommandEvent &)
{
- shared_ptr<Content> c = selected_content ();
- if (c) {
- _film->remove_content (c);
+ shared_ptr<Playlist::Region> r = selected_region ();
+ if (r) {
+ _film->remove_content (r->content);
}
}
@@ -1178,33 +1178,31 @@ FilmEditor::content_activated (wxListEvent& ev)
Playlist::RegionList r = _film->regions ();
assert (ev.GetIndex() >= 0 && size_t (ev.GetIndex()) < r.size ());
- content_properties (r[ev.GetIndex()].content);
+ region_properties (r[ev.GetIndex()]);
}
void
FilmEditor::content_properties_clicked (wxCommandEvent &)
{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
+ shared_ptr<Playlist::Region> r = selected_region ();
+ if (!r) {
return;
}
- content_properties (c);
+ content_properties (r);
}
void
-FilmEditor::content_properties (shared_ptr<Content> content)
+FilmEditor::region_properties (shared_ptr<Playlist::Region> region)
{
- shared_ptr<ImageMagickContent> im = dynamic_pointer_cast<ImageMagickContent> (content);
- if (im) {
- ImageMagickContentDialog* d = new ImageMagickContentDialog (this, im);
+ if (dynamic_pointer_cast<ImageMagickContent> (region->content)) {
+ ImageMagickContentDialog* d = new ImageMagickContentDialog (this, region);
d->ShowModal ();
d->Destroy ();
}
- shared_ptr<FFmpegContent> ff = dynamic_pointer_cast<FFmpegContent> (content);
- if (ff) {
- FFmpegContentDialog* d = new FFmpegContentDialog (this, ff);
+ if (dynamic_pointer_cast<FFmpegContent> (region->content)) {
+ FFmpegContentDialog* d = new FFmpegContentDialog (this, region);
d->ShowModal ();
d->Destroy ();
}
@@ -1220,13 +1218,13 @@ FilmEditor::content_selection_changed (wxListEvent &)
void
FilmEditor::setup_content_information ()
{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
+ shared_ptr<Playlist::Region> r = selected_region ();
+ if (!r) {
_content_information->SetValue (wxT (""));
return;
}
- _content_information->SetValue (std_to_wx (c->information ()));
+ _content_information->SetValue (std_to_wx (r->content->information ()));
}
void
@@ -1234,31 +1232,31 @@ FilmEditor::setup_content_button_sensitivity ()
{
_content_add->Enable (_generally_sensitive);
- shared_ptr<Content> selection = selected_content ();
+ shared_ptr<Playlist::Region> selection = selected_region ();
_content_properties->Enable (
selection && _generally_sensitive &&
- (dynamic_pointer_cast<ImageMagickContent> (selection) || dynamic_pointer_cast<FFmpegContent> (selection))
+ (dynamic_pointer_cast<ImageMagickContent> (selection->content) || dynamic_pointer_cast<FFmpegContent> (selection->content))
);
_content_remove->Enable (selection && _generally_sensitive);
_content_timeline->Enable (_generally_sensitive);
}
-shared_ptr<Content>
-FilmEditor::selected_content ()
+shared_ptr<Playlist::Region>
+FilmEditor::selected_region ()
{
int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (s == -1) {
- return shared_ptr<Content> ();
+ return shared_ptr<Playlist::Region> ();
}
Playlist::RegionList r = _film->regions ();
if (s < 0 || size_t (s) >= r.size ()) {
- return shared_ptr<Content> ();
+ return shared_ptr<Playlist::Region> ();
}
- return r[s].content;
+ return r[s];
}
void
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 4bdba9979..c74d631ad 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -111,8 +111,8 @@ private:
void setup_loop_sensitivity ();
void active_jobs_changed (bool);
- boost::shared_ptr<Content> selected_content ();
- void content_properties (boost::shared_ptr<Content>);
+ boost::shared_ptr<Playlist::Region> selected_region ();
+ void region_properties (boost::shared_ptr<Playlist::Region>);
wxNotebook* _notebook;
wxPanel* _film_panel;
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index af38dfc28..7e2243ccd 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -322,10 +322,10 @@ Timeline::playlist_changed ()
Playlist::RegionList regions = fl->playlist()->regions ();
for (Playlist::RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- if (dynamic_pointer_cast<VideoContent> (i->content)) {
- _views.push_back (shared_ptr<View> (new VideoContentView (*this, i->content, i->time, 0)));
+ if (dynamic_pointer_cast<VideoContent> ((*i)->content)) {
+ _views.push_back (shared_ptr<View> (new VideoContentView (*this, (*i)->content, (*i)->time, 0)));
} else {
- _views.push_back (shared_ptr<View> (new AudioContentView (*this, i->content, i->time, 1)));
+ _views.push_back (shared_ptr<View> (new AudioContentView (*this, (*i)->content, (*i)->time, 1)));
}
}