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/lib | |
| parent | cd34ac8e2e5a835b5907a8a67b241e29240eb7b9 (diff) | |
Make FFmpegStream::_id private.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 44 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 16 |
2 files changed, 24 insertions, 36 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: |
