From: Carl Hetherington Date: Fri, 21 Feb 2014 11:41:50 +0000 (+0000) Subject: Remove FFmpegStream id accessor. X-Git-Tag: v2.0.48~905^2~4 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=817620394821a4581ea8cfd02fb23f2524169405 Remove FFmpegStream id accessor. --- diff --git a/src/lib/content.h b/src/lib/content.h index 4ee7c267f..596a0a905 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -57,6 +57,9 @@ public: virtual void examine (boost::shared_ptr); 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; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 34486d08b..5524efc65 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -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 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::const_iterator i = _filters.begin(); i != _filters.end(); ++i) { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index ed2169de0..6dbff41d1 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -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 (_id); } + + std::string identifier () const { + return boost::lexical_cast (_id); + } + std::string name; friend bool operator== (FFmpegStream const & a, FFmpegStream const & b); diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 683751264..0838fa8ab 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -134,11 +134,11 @@ AudioPanel::film_content_changed (int property) if (fcs) { vector > a = fcs->audio_streams (); for (vector >::iterator i = a.begin(); i != a.end(); ++i) { - _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast ((*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 (fcs->audio_stream()->id ())); + checked_set (_stream, fcs->audio_stream()->identifier ()); setup_stream_description (); } } @@ -206,7 +206,7 @@ AudioPanel::stream_changed () vector > a = fcs->audio_streams (); vector >::iterator i = a.begin (); string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ())); - while (i != a.end() && lexical_cast ((*i)->id ()) != s) { + while (i != a.end() && (*i)->identifier () != s) { ++i; } diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index 24e3688f8..63a18b0ce 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -120,11 +120,11 @@ SubtitlePanel::film_content_changed (int property) if (fcs) { vector > s = fcs->subtitle_streams (); for (vector >::iterator i = s.begin(); i != s.end(); ++i) { - _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast ((*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 (fcs->subtitle_stream()->id ())); + checked_set (_stream, fcs->subtitle_stream()->identifier ()); } else { _stream->SetSelection (wxNOT_FOUND); } @@ -179,7 +179,7 @@ SubtitlePanel::stream_changed () vector > a = fcs->subtitle_streams (); vector >::iterator i = a.begin (); string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ())); - while (i != a.end() && lexical_cast ((*i)->id ()) != s) { + while (i != a.end() && (*i)->identifier () != s) { ++i; } diff --git a/test/stream_test.cc b/test/stream_test.cc index 3e18d0d14..fed3ecabe 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (stream_test) FFmpegAudioStream a (shared_ptr (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");