projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd34ac8
)
Make FFmpegStream::_id private.
author
Carl Hetherington
<cth@carlh.net>
Fri, 21 Feb 2014 10:43:54 +0000
(10:43 +0000)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 21 Feb 2014 10:43:54 +0000
(10:43 +0000)
src/lib/ffmpeg_content.cc
patch
|
blob
|
history
src/lib/ffmpeg_content.h
patch
|
blob
|
history
src/wx/audio_panel.cc
patch
|
blob
|
history
src/wx/subtitle_panel.cc
patch
|
blob
|
history
test/stream_test.cc
patch
|
blob
|
history
diff --git
a/src/lib/ffmpeg_content.cc
b/src/lib/ffmpeg_content.cc
index 2c888baaf087fa49a5c1239900db35617d2f5593..bb2b629c8cfdcee73c5337cf1f03f0b9e9c7454f 100644
(file)
--- 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) {
{
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) {
}
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);
}
pair<string, string> filt = Filter::ffmpeg_strings (_filters);
@@
-326,34
+326,22
@@
FFmpegContent::output_audio_frame_rate () const
}
bool
}
bool
-operator== (FFmpegS
ubtitleStream const & a, FFmpegSubtitle
Stream const & b)
+operator== (FFmpegS
tream const & a, FFmpeg
Stream const & b)
{
{
- return a.
id == b.
id;
+ return a.
_id == b._
id;
}
bool
}
bool
-operator!= (FFmpegS
ubtitleStream const & a, FFmpegSubtitle
Stream const & b)
+operator!= (FFmpegS
tream const & a, FFmpeg
Stream 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)
}
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;
}
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);
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.
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) {
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) {
}
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;
return int (i) == index;
}
++i;
@@
-415,16
+403,16
@@
AVStream *
FFmpegStream::stream (AVFormatContext const * fc) const
{
if (_legacy_id) {
FFmpegStream::stream (AVFormatContext const * fc) const
{
if (_legacy_id) {
- if (id >= int (fc->nb_streams)) {
+ if (
_
id >= int (fc->nb_streams)) {
return 0;
}
return 0;
}
- return fc->streams[id];
+ return fc->streams[
_
id];
}
size_t i = 0;
while (i < fc->nb_streams) {
}
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;
return fc->streams[i];
}
++i;
@@
-500,7
+488,7
@@
FFmpegContent::identifier () const
boost::mutex::scoped_lock lm (_mutex);
if (_subtitle_stream) {
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) {
}
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 d1aa3a0b56ec88f04e1078b5998f99f2f639d912..2339705d0d17377768b9bd1dbae0f7d2cbda3f2c 100644
(file)
--- 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)
public:
FFmpegStream (std::string n, int i)
: name (n)
- , id (i)
+ ,
_
id (i)
, _legacy_id (false)
{}
, _legacy_id (false)
{}
@@
-52,10
+52,16
@@
public:
bool uses_index (AVFormatContext const * c, int index) const;
AVStream* stream (AVFormatContext const * c) const;
bool uses_index (AVFormatContext const * c, int index) const;
AVStream* stream (AVFormatContext const * c) const;
+ int id () const {
+ return _id;
+ }
std::string name;
std::string name;
- int id;
+
+ friend bool operator== (FFmpegStream const & a, FFmpegStream const & b);
+ friend bool operator!= (FFmpegStream const & a, FFmpegStream const & b);
private:
private:
+ int _id;
/** If this is true, id is in fact the index */
bool _legacy_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:
class FFmpegSubtitleStream : public FFmpegStream
{
public:
@@
-108,9
+111,6
@@
public:
void as_xml (xmlpp::Node *) const;
};
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:
class FFmpegContentProperty : public VideoContentProperty
{
public:
diff --git
a/src/wx/audio_panel.cc
b/src/wx/audio_panel.cc
index ba458f1ff813f58dc596a850884b7b7c666df874..683751264c874f162878f038afa0aaa2cbb95695 100644
(file)
--- 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) {
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()) {
}
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 ();
}
}
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 ()));
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;
}
++i;
}
diff --git
a/src/wx/subtitle_panel.cc
b/src/wx/subtitle_panel.cc
index 02c8776d6f8c5ea3a57e50e4885cf34bd6196d72..24e3688f894b1f0c9df36631a3683133b0ca0995 100644
(file)
--- 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) {
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()) {
}
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);
}
} 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 ()));
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;
}
++i;
}
diff --git
a/test/stream_test.cc
b/test/stream_test.cc
index 6abcf6e22aedf95a0dec879a05746accf4a5d443..3e18d0d14a0ea70201ac9823540e873bed4f8aad 100644
(file)
--- a/
test/stream_test.cc
+++ b/
test/stream_test.cc
@@
-67,7
+67,7
@@
BOOST_AUTO_TEST_CASE (stream_test)
FFmpegAudioStream a (shared_ptr<cxml::Node> (new cxml::Node (root)), 5);
FFmpegAudioStream a (shared_ptr<cxml::Node> (new cxml::Node (root)), 5);
- BOOST_CHECK_EQUAL (a.id, 4);
+ BOOST_CHECK_EQUAL (a.id
()
, 4);
BOOST_CHECK_EQUAL (a.frame_rate, 44100);
BOOST_CHECK_EQUAL (a.channels, 2);
BOOST_CHECK_EQUAL (a.name, "hello there world");
BOOST_CHECK_EQUAL (a.frame_rate, 44100);
BOOST_CHECK_EQUAL (a.channels, 2);
BOOST_CHECK_EQUAL (a.name, "hello there world");