Remove FFmpegStream id accessor.
authorCarl Hetherington <cth@carlh.net>
Fri, 21 Feb 2014 11:41:50 +0000 (11:41 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 21 Feb 2014 11:41:50 +0000 (11:41 +0000)
src/lib/content.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/wx/audio_panel.cc
src/wx/subtitle_panel.cc
test/stream_test.cc

index 4ee7c267f354c5cf65da2f1c948f3b8d93b79424..596a0a905c95217d4daaf8ba116b8a6f518c6555 100644 (file)
@@ -57,6 +57,9 @@ public:
        
        virtual void examine (boost::shared_ptr<Job>);
        virtual std::string summary () const = 0;
+       /** @return Technical details of this content; these are written to logs to
+        *  help with debugging.
+        */
        virtual std::string technical_summary () const;
        virtual std::string information () const = 0;
        virtual void as_xml (xmlpp::Node *) const;
index 34486d08b22ce50af841c49ae65e3e5eac07ec64..5524efc65fc45cc6e24b5aa5e920da5f4d3739ea 100644 (file)
@@ -207,12 +207,12 @@ FFmpegContent::technical_summary () const
 {
        string as = "none";
        if (_audio_stream) {
-               as = String::compose ("id %1", _audio_stream->id ());
+               as = _audio_stream->technical_summary ();
        }
 
        string ss = "none";
        if (_subtitle_stream) {
-               ss = String::compose ("id %1", _subtitle_stream->id ());
+               ss = _subtitle_stream->technical_summary ();
        }
 
        pair<string, string> filt = Filter::ffmpeg_strings (_filters);
@@ -467,7 +467,7 @@ FFmpegContent::identifier () const
        boost::mutex::scoped_lock lm (_mutex);
 
        if (_subtitle_stream) {
-               s << "_" << _subtitle_stream->id ();
+               s << "_" << _subtitle_stream->identifier ();
        }
 
        for (vector<Filter const *>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
index ed2169de0b83387d2284a588be0dd2f0ea8c980a..6dbff41d1f43a306cb88976ef50636d3d3394447 100644 (file)
@@ -51,9 +51,14 @@ public:
        bool uses_index (AVFormatContext const * c, int index) const;
        AVStream* stream (AVFormatContext const * c) const;
 
-       int id () const {
-               return _id;
+       std::string technical_summary () const {
+               return "id " + boost::lexical_cast<std::string> (_id);
        }
+
+       std::string identifier () const {
+               return boost::lexical_cast<std::string> (_id);
+       }
+
        std::string name;
 
        friend bool operator== (FFmpegStream const & a, FFmpegStream const & b);
index 683751264c874f162878f038afa0aaa2cbb95695..0838fa8abb9a7a9241470db621091a3297169d1a 100644 (file)
@@ -134,11 +134,11 @@ AudioPanel::film_content_changed (int property)
                if (fcs) {
                        vector<shared_ptr<FFmpegAudioStream> > a = fcs->audio_streams ();
                        for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
-                               _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id ()))));
+                               _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ())));
                        }
                        
                        if (fcs->audio_stream()) {
-                               checked_set (_stream, lexical_cast<string> (fcs->audio_stream()->id ()));
+                               checked_set (_stream, fcs->audio_stream()->identifier ());
                                setup_stream_description ();
                        }
                }
@@ -206,7 +206,7 @@ AudioPanel::stream_changed ()
        vector<shared_ptr<FFmpegAudioStream> > a = fcs->audio_streams ();
        vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
        string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> ((*i)->id ()) != s) {
+       while (i != a.end() && (*i)->identifier () != s) {
                ++i;
        }
 
index 24e3688f894b1f0c9df36631a3683133b0ca0995..63a18b0ce874ce5daea97ded5204ef92287ac4ba 100644 (file)
@@ -120,11 +120,11 @@ SubtitlePanel::film_content_changed (int property)
                if (fcs) {
                        vector<shared_ptr<FFmpegSubtitleStream> > s = fcs->subtitle_streams ();
                        for (vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = s.begin(); i != s.end(); ++i) {
-                               _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id ()))));
+                               _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ())));
                        }
                        
                        if (fcs->subtitle_stream()) {
-                               checked_set (_stream, lexical_cast<string> (fcs->subtitle_stream()->id ()));
+                               checked_set (_stream, fcs->subtitle_stream()->identifier ());
                        } else {
                                _stream->SetSelection (wxNOT_FOUND);
                        }
@@ -179,7 +179,7 @@ SubtitlePanel::stream_changed ()
        vector<shared_ptr<FFmpegSubtitleStream> > a = fcs->subtitle_streams ();
        vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = a.begin ();
        string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> ((*i)->id ()) != s) {
+       while (i != a.end() && (*i)->identifier () != s) {
                ++i;
        }
 
index 3e18d0d14a0ea70201ac9823540e873bed4f8aad..fed3ecabeb99283bcad12a4e0f542c5bef664b2c 100644 (file)
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (stream_test)
                
        FFmpegAudioStream a (shared_ptr<cxml::Node> (new cxml::Node (root)), 5);
 
-       BOOST_CHECK_EQUAL (a.id(), 4);
+       BOOST_CHECK_EQUAL (a.identifier(), "4");
        BOOST_CHECK_EQUAL (a.frame_rate, 44100);
        BOOST_CHECK_EQUAL (a.channels, 2);
        BOOST_CHECK_EQUAL (a.name, "hello there world");