Various incomplete hacks on regions / audio mapping.
authorCarl Hetherington <cth@carlh.net>
Mon, 20 May 2013 16:18:35 +0000 (17:18 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 May 2013 16:18:35 +0000 (17:18 +0100)
18 files changed:
branch-notes
src/lib/audio_content.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/film.cc
src/lib/player.cc
src/lib/player.h
src/lib/playlist.cc
src/lib/playlist.h
src/lib/sndfile_content.cc
src/lib/sndfile_content.h
src/wx/audio_mapping_view.cc
src/wx/audio_mapping_view.h
src/wx/ffmpeg_content_dialog.cc
src/wx/ffmpeg_content_dialog.h
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/timeline.cc

index dd90ed91f59c248b55be00863f3ea50cda8199b7..0ed4dbb6a25d1979016e6509ed7f22a75b64fdd0 100644 (file)
@@ -1,3 +1,3 @@
-audio map view is screwed up on windows, apparently not extended to full height
-still image stuff pretty slow
+ffmpeg content selected stream is really a playlist thing.
+
 
index 51f05efb0c9afcdfe3e506940d6d4dac3ba9b5c7..36c36992ea79fe9439e50366f3f26ddded6d248f 100644 (file)
@@ -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
index d730f3ecbc6057c4a65a660f962b8d3bbf590c52..e898c02d0a6c99c9e3bacf2dadb3bf2fce6d4353 100644 (file)
@@ -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;
-}
index d26c73125b663bf8c7f341fde049e9a185f37ea7..6c141b6c13173ae111cfc01b2ef690a73956e425 100644 (file)
@@ -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);
index 646b114da7e1858d0afa16a159ea4275f6f44f21..1b5779f2d0f43fbcb023b553edeba7b897b7126e 100644 (file)
@@ -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);
                }
        }
 }
index e38b12ec35286d64e299d499ba2f43a375a3b487..675fcae5cc1b6a3d927e926f8037885610cb0ca4 100644 (file)
@@ -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));
index c9bf2a00b45d9736652e713a141a1eeb5b7d3840..4979778ede20425c8cb3040bc944129c27650ded 100644 (file)
@@ -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;
        };
index 912d90f0e5f482d19404101e282e713a1268b48e..8db5c5fc2bced2a8745a28effd3d0a33b7824ff1 100644 (file)
@@ -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);
        }
 
index 5b9299795ffdc9ced4131d7c509b25970e0ee118..f677f0ad78b2f7bd7197edd22c194130539c1994 100644 (file)
@@ -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;
index 963abb58e0f63d3dc12e4f91859cc296a5b5f63f..13b118fb2104480ee16bce5952748e8555427b39 100644 (file)
@@ -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
index e0d66b9928e7de8ec21e6b8b71158afe3b6f5d79..d930d70619e95e426dd93e82ecbe1bcdae2f2b32 100644 (file)
@@ -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;
 };
index 8d049e05f7de38e4511d493e66b4d24d2ea76098..d0deca69e5a52088c1b6ce59e8cf4b1bb6a0a833 100644 (file)
@@ -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 ();
 }
 
index 9385f492db61aa134669c0a4ba6cee7746da1bf6..76e20ad9a2aef424783bdc7c9e5d7f15c770638d 100644 (file)
@@ -31,8 +31,11 @@ public:
 
        void set_mapping (AudioMapping);
 
+       boost::signals2::signal<void (AudioMapping)> Changed;
+
 private:
        void left_click (wxGridEvent &);
 
        wxGrid* _grid;
+       wxSizer* _sizer;
 };
index 762ec377464f6a0e8e8e068ed8636ed187f5b6c2..8bf8a8e3553b3ec9eb0fab9c39b1ab5c05fa12a1 100644 (file)
 
 #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 */
+}
+
index a04645f6947b5e054804bec7331e91574d86b51e..380b31f2154fbab50b9cd03dcbf199ac4e2a3441 100644 (file)
@@ -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;
index d96d146f982a7b3fa99fd4e504d52c035b4154b1..226feaca2ad263b764ca908adc410fe0487fb88b 100644 (file)
@@ -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
index 4bdba9979b1f53d3f0032cd04359547b1f5acf5a..c74d631ad82088cb7a2f55517b3dec97c4d469e7 100644 (file)
@@ -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;
index af38dfc2836506310552e05f2470d10fcfed0459..7e2243ccd3fee15be9136c7a45c38990aee64e0d 100644 (file)
@@ -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)));
                }
        }