diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-02-21 10:43:54 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-02-21 10:43:54 +0000 |
| commit | df8f80913c8083c2d5d3408da6f8dd67193d890b (patch) | |
| tree | 2879af3a184938421916b0ed3aaedeed1b3fd1f9 /src | |
| parent | cd34ac8e2e5a835b5907a8a67b241e29240eb7b9 (diff) | |
Make FFmpegStream::_id private.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 44 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 16 | ||||
| -rw-r--r-- | src/wx/audio_panel.cc | 6 | ||||
| -rw-r--r-- | src/wx/subtitle_panel.cc | 6 |
4 files changed, 30 insertions, 42 deletions
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 2c888baaf..bb2b629c8 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 = String::compose ("id %1", _audio_stream->id ()); } string ss = "none"; if (_subtitle_stream) { - ss = String::compose ("id %1", _subtitle_stream->id); + ss = String::compose ("id %1", _subtitle_stream->id ()); } pair<string, string> filt = Filter::ffmpeg_strings (_filters); @@ -326,34 +326,22 @@ FFmpegContent::output_audio_frame_rate () const } bool -operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b) +operator== (FFmpegStream const & a, FFmpegStream const & b) { - return a.id == b.id; + return a._id == b._id; } bool -operator!= (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b) +operator!= (FFmpegStream const & a, FFmpegStream const & b) { - return a.id != b.id; -} - -bool -operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b) -{ - return a.id == b.id; -} - -bool -operator!= (FFmpegAudioStream const & a, FFmpegAudioStream const & b) -{ - return a.id != b.id; + return a._id != b._id; } FFmpegStream::FFmpegStream (shared_ptr<const cxml::Node> node, int version) - : _legacy_id (false) + : name (node->string_child ("Name")) + , _id (node->number_child<int> ("Id")) + , _legacy_id (false) { - name = node->string_child ("Name"); - id = node->number_child<int> ("Id"); if (version == 4 || node->optional_bool_child ("LegacyId")) { _legacy_id = true; } @@ -363,7 +351,7 @@ void FFmpegStream::as_xml (xmlpp::Node* root) const { root->add_child("Name")->add_child_text (name); - root->add_child("Id")->add_child_text (lexical_cast<string> (id)); + root->add_child("Id")->add_child_text (lexical_cast<string> (_id)); if (_legacy_id) { /* Write this so that version > 4 files are read in correctly if the Id came originally from a version <= 4 file. @@ -397,12 +385,12 @@ bool FFmpegStream::uses_index (AVFormatContext const * fc, int index) const { if (_legacy_id) { - return id == index; + return _id == index; } size_t i = 0; while (i < fc->nb_streams) { - if (fc->streams[i]->id == id) { + if (fc->streams[i]->id == _id) { return int (i) == index; } ++i; @@ -415,16 +403,16 @@ AVStream * FFmpegStream::stream (AVFormatContext const * fc) const { if (_legacy_id) { - if (id >= int (fc->nb_streams)) { + if (_id >= int (fc->nb_streams)) { return 0; } - return fc->streams[id]; + return fc->streams[_id]; } size_t i = 0; while (i < fc->nb_streams) { - if (fc->streams[i]->id == id) { + if (fc->streams[i]->id == _id) { return fc->streams[i]; } ++i; @@ -500,7 +488,7 @@ FFmpegContent::identifier () const boost::mutex::scoped_lock lm (_mutex); if (_subtitle_stream) { - s << "_" << _subtitle_stream->id; + s << "_" << _subtitle_stream->id (); } for (vector<Filter const *>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index d1aa3a0b5..2339705d0 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -37,7 +37,7 @@ class FFmpegStream public: FFmpegStream (std::string n, int i) : name (n) - , id (i) + , _id (i) , _legacy_id (false) {} @@ -52,10 +52,16 @@ public: bool uses_index (AVFormatContext const * c, int index) const; AVStream* stream (AVFormatContext const * c) const; + int id () const { + return _id; + } std::string name; - int id; + + friend bool operator== (FFmpegStream const & a, FFmpegStream const & b); + friend bool operator!= (FFmpegStream const & a, FFmpegStream const & b); private: + int _id; /** If this is true, id is in fact the index */ bool _legacy_id; }; @@ -93,9 +99,6 @@ private: {} }; -extern bool operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b); -extern bool operator!= (FFmpegAudioStream const & a, FFmpegAudioStream const & b); - class FFmpegSubtitleStream : public FFmpegStream { public: @@ -108,9 +111,6 @@ public: void as_xml (xmlpp::Node *) const; }; -extern bool operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b); -extern bool operator!= (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b); - class FFmpegContentProperty : public VideoContentProperty { public: diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index ba458f1ff..683751264 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<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 (lexical_cast<string> ((*i)->id ())))); } if (fcs->audio_stream()) { - checked_set (_stream, lexical_cast<string> (fcs->audio_stream()->id)); + checked_set (_stream, lexical_cast<string> (fcs->audio_stream()->id ())); 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() && lexical_cast<string> ((*i)->id ()) != s) { ++i; } diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index 02c8776d6..24e3688f8 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<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 (lexical_cast<string> ((*i)->id ())))); } if (fcs->subtitle_stream()) { - checked_set (_stream, lexical_cast<string> (fcs->subtitle_stream()->id)); + checked_set (_stream, lexical_cast<string> (fcs->subtitle_stream()->id ())); } 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() && lexical_cast<string> ((*i)->id ()) != s) { ++i; } |
