projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0fabbb1
)
Show audio bit depth in content properties (#559).
author
Carl Hetherington
<cth@carlh.net>
Sun, 25 Dec 2022 21:34:21 +0000
(22:34 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Sun, 25 Dec 2022 21:34:21 +0000
(22:34 +0100)
src/lib/audio_content.cc
patch
|
blob
|
history
src/lib/audio_stream.cc
patch
|
blob
|
history
src/lib/audio_stream.h
patch
|
blob
|
history
src/lib/content_factory.cc
patch
|
blob
|
history
src/lib/dcp_content.cc
patch
|
blob
|
history
src/lib/ffmpeg_audio_stream.cc
patch
|
blob
|
history
src/lib/ffmpeg_audio_stream.h
patch
|
blob
|
history
src/lib/ffmpeg_examiner.cc
patch
|
blob
|
history
test/frame_rate_test.cc
patch
|
blob
|
history
diff --git
a/src/lib/audio_content.cc
b/src/lib/audio_content.cc
index 192a500680d1f0b7811e8ac7efdee434a7dc53e4..6a93ff11943cd66958116266408bd6e9267117bc 100644
(file)
--- a/
src/lib/audio_content.cc
+++ b/
src/lib/audio_content.cc
@@
-314,6
+314,9
@@
AudioContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p
if (stream) {
p.push_back (UserProperty(UserProperty::AUDIO, _("Channels"), stream->channels()));
p.push_back (UserProperty(UserProperty::AUDIO, _("Content sample rate"), stream->frame_rate(), _("Hz")));
if (stream) {
p.push_back (UserProperty(UserProperty::AUDIO, _("Channels"), stream->channels()));
p.push_back (UserProperty(UserProperty::AUDIO, _("Content sample rate"), stream->frame_rate(), _("Hz")));
+ if (auto bits = stream->bit_depth()) {
+ p.push_back(UserProperty(UserProperty::AUDIO, _("Content bit depth"), *bits, _("bits")));
+ }
}
FrameRateChange const frc (_parent->active_video_frame_rate(film), film->video_frame_rate());
}
FrameRateChange const frc (_parent->active_video_frame_rate(film), film->video_frame_rate());
diff --git
a/src/lib/audio_stream.cc
b/src/lib/audio_stream.cc
index bd53c9b26aa2d4a26f3713b9cc4dfd152903cc16..f771d44a2ffc7845737ab4f91a565285cc2ccfc0 100644
(file)
--- a/
src/lib/audio_stream.cc
+++ b/
src/lib/audio_stream.cc
@@
-24,19
+24,24
@@
#include "constants.h"
#include "constants.h"
-AudioStream::AudioStream (int frame_rate, Frame length, int channels)
+using boost::optional;
+
+
+AudioStream::AudioStream(int frame_rate, Frame length, int channels, optional<int> bit_depth)
: _frame_rate (frame_rate)
, _length (length)
, _mapping (AudioMapping (channels, MAX_DCP_AUDIO_CHANNELS))
: _frame_rate (frame_rate)
, _length (length)
, _mapping (AudioMapping (channels, MAX_DCP_AUDIO_CHANNELS))
+ , _bit_depth(bit_depth)
{
}
{
}
-AudioStream::AudioStream
(int frame_rate, Frame length, AudioMapping mapping
)
+AudioStream::AudioStream
(int frame_rate, Frame length, AudioMapping mapping, optional<int> bit_depth
)
: _frame_rate (frame_rate)
, _length (length)
, _mapping (mapping)
: _frame_rate (frame_rate)
, _length (length)
, _mapping (mapping)
+ , _bit_depth(bit_depth)
{
}
{
}
@@
-56,3
+61,11
@@
AudioStream::channels () const
boost::mutex::scoped_lock lm (_mutex);
return _mapping.input_channels ();
}
boost::mutex::scoped_lock lm (_mutex);
return _mapping.input_channels ();
}
+
+optional<int>
+AudioStream::bit_depth() const
+{
+ boost::mutex::scoped_lock lm(_mutex);
+ return _bit_depth;
+}
+
diff --git
a/src/lib/audio_stream.h
b/src/lib/audio_stream.h
index 470d9c854a5acf34b1e91f4053560af4babff69e..cf874242f10b494353a682f382bd32595e8c63c9 100644
(file)
--- a/
src/lib/audio_stream.h
+++ b/
src/lib/audio_stream.h
@@
-33,8
+33,8
@@
struct audio_sampling_rate_test;
class AudioStream
{
public:
class AudioStream
{
public:
- AudioStream
(int frame_rate, Frame length, int channels
);
- AudioStream
(int frame_rate, Frame length, AudioMapping mapping
);
+ AudioStream
(int frame_rate, Frame length, int channels, boost::optional<int> bit_depth
);
+ AudioStream
(int frame_rate, Frame length, AudioMapping mapping, boost::optional<int> bit_depth
);
virtual ~AudioStream () {}
void set_mapping (AudioMapping mapping);
virtual ~AudioStream () {}
void set_mapping (AudioMapping mapping);
@@
-55,6
+55,7
@@
public:
}
int channels () const;
}
int channels () const;
+ boost::optional<int> bit_depth() const;
protected:
mutable boost::mutex _mutex;
protected:
mutable boost::mutex _mutex;
@@
-66,6
+67,7
@@
private:
int _frame_rate;
Frame _length;
AudioMapping _mapping;
int _frame_rate;
Frame _length;
AudioMapping _mapping;
+ boost::optional<int> _bit_depth;
};
};
diff --git
a/src/lib/content_factory.cc
b/src/lib/content_factory.cc
index 5f1e6c9b71b13b44cad388e4abfc906a48e35908..b23a088b4d0cb0d4ac51def352a72ac0b32cad46 100644
(file)
--- a/
src/lib/content_factory.cc
+++ b/
src/lib/content_factory.cc
@@
-81,7
+81,8
@@
content_factory (cxml::ConstNodePtr node, int version, list<string>& notes)
"Stream", 0,
node->number_child<int> ("AudioFrameRate"),
node->number_child<Frame> ("AudioLength"),
"Stream", 0,
node->number_child<int> ("AudioFrameRate"),
node->number_child<Frame> ("AudioLength"),
- AudioMapping (node->node_child ("AudioMapping"), version)
+ AudioMapping(node->node_child("AudioMapping"), version),
+ 16
)
);
)
);
diff --git
a/src/lib/dcp_content.cc
b/src/lib/dcp_content.cc
index 3cc724b8e16a634e5f73a0e31b10850852829da6..cdf104f0377ba3b2aee4d714effb0b2f2f1b7e24 100644
(file)
--- a/
src/lib/dcp_content.cc
+++ b/
src/lib/dcp_content.cc
@@
-105,7
+105,8
@@
DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
node->optional_number_child<Frame>("AudioLength").get_value_or (
video->length() * node->number_child<int>("AudioFrameRate") / video_frame_rate().get()
),
node->optional_number_child<Frame>("AudioLength").get_value_or (
video->length() * node->number_child<int>("AudioFrameRate") / video_frame_rate().get()
),
- AudioMapping (node->node_child ("AudioMapping"), version)
+ AudioMapping(node->node_child("AudioMapping"), version),
+ 24
)
);
}
)
);
}
@@
-238,7
+239,7
@@
DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
boost::mutex::scoped_lock lm (_mutex);
audio = make_shared<AudioContent>(this);
}
boost::mutex::scoped_lock lm (_mutex);
audio = make_shared<AudioContent>(this);
}
- auto as = make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels());
+ auto as = make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels()
, 24
);
audio->set_stream (as);
auto m = as->mapping ();
m.make_default (film ? film->audio_processor() : 0);
audio->set_stream (as);
auto m = as->mapping ();
m.make_default (film ? film->audio_processor() : 0);
diff --git
a/src/lib/ffmpeg_audio_stream.cc
b/src/lib/ffmpeg_audio_stream.cc
index 05e1a3fc807ef0802772a6b41252fa6ead30df8d..9400eb60dddd6c46fc2d90853b5339e098ca40b5 100644
(file)
--- a/
src/lib/ffmpeg_audio_stream.cc
+++ b/
src/lib/ffmpeg_audio_stream.cc
@@
-39,7
+39,8
@@
FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
, AudioStream (
node->number_child<int>("FrameRate"),
node->optional_number_child<Frame>("Length").get_value_or(0),
, AudioStream (
node->number_child<int>("FrameRate"),
node->optional_number_child<Frame>("Length").get_value_or(0),
- AudioMapping (node->node_child("Mapping"), version)
+ AudioMapping(node->node_child("Mapping"), version),
+ node->optional_number_child<int>("BitDepth")
)
{
optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type>("FirstAudio");
)
{
optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type>("FirstAudio");
@@
-63,4
+64,7
@@
FFmpegAudioStream::as_xml (xmlpp::Node* root) const
if (codec_name) {
root->add_child("CodecName")->add_child_text(codec_name.get());
}
if (codec_name) {
root->add_child("CodecName")->add_child_text(codec_name.get());
}
+ if (bit_depth()) {
+ root->add_child("BitDepth")->add_child_text(raw_convert<string>(bit_depth().get()));
+ }
}
}
diff --git
a/src/lib/ffmpeg_audio_stream.h
b/src/lib/ffmpeg_audio_stream.h
index a5ed90c972e46f0a6297ff31eb17810bd8026fa3..aae982f9e81ff6ecaff40f62b384dc893cf067dc 100644
(file)
--- a/
src/lib/ffmpeg_audio_stream.h
+++ b/
src/lib/ffmpeg_audio_stream.h
@@
-30,20
+30,20
@@
struct ffmpeg_pts_offset_test;
class FFmpegAudioStream : public FFmpegStream, public AudioStream
{
public:
class FFmpegAudioStream : public FFmpegStream, public AudioStream
{
public:
- FFmpegAudioStream
(std::string name, int id, int frame_rate, Frame length, int channels
)
+ FFmpegAudioStream
(std::string name, int id, int frame_rate, Frame length, int channels, int bit_depth
)
: FFmpegStream (name, id)
: FFmpegStream (name, id)
- , AudioStream
(frame_rate, length, channels
)
+ , AudioStream
(frame_rate, length, channels, bit_depth
)
{}
{}
- FFmpegAudioStream
(std::string name, std::string codec_name_, int id, int frame_rate, Frame length, int channels
)
+ FFmpegAudioStream
(std::string name, std::string codec_name_, int id, int frame_rate, Frame length, int channels, int bit_depth
)
: FFmpegStream (name, id)
: FFmpegStream (name, id)
- , AudioStream
(frame_rate, length, channels
)
+ , AudioStream
(frame_rate, length, channels, bit_depth
)
, codec_name (codec_name_)
{}
, codec_name (codec_name_)
{}
- FFmpegAudioStream
(std::string name, int id, int frame_rate, Frame length, AudioMapping mapping
)
+ FFmpegAudioStream
(std::string name, int id, int frame_rate, Frame length, AudioMapping mapping, int bit_depth
)
: FFmpegStream (name, id)
: FFmpegStream (name, id)
- , AudioStream
(frame_rate, length, mapping
)
+ , AudioStream
(frame_rate, length, mapping, bit_depth
)
{}
FFmpegAudioStream (cxml::ConstNodePtr, int);
{}
FFmpegAudioStream (cxml::ConstNodePtr, int);
@@
-61,7
+61,7
@@
private:
/* Constructor for tests */
FFmpegAudioStream ()
: FFmpegStream ("", 0)
/* Constructor for tests */
FFmpegAudioStream ()
: FFmpegStream ("", 0)
- , AudioStream
(
0, 0, 0)
+ , AudioStream
(0,
0, 0, 0)
{}
};
{}
};
diff --git
a/src/lib/ffmpeg_examiner.cc
b/src/lib/ffmpeg_examiner.cc
index fdcacb465602693fba0bf668cc82d7bd9b82ddd6..46f4f236e889515eca0254da7f7195be74efb5bb 100644
(file)
--- a/
src/lib/ffmpeg_examiner.cc
+++ b/
src/lib/ffmpeg_examiner.cc
@@
-91,7
+91,8
@@
FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
s->id,
s->codecpar->sample_rate,
llrint ((double(_format_context->duration) / AV_TIME_BASE) * s->codecpar->sample_rate),
s->id,
s->codecpar->sample_rate,
llrint ((double(_format_context->duration) / AV_TIME_BASE) * s->codecpar->sample_rate),
- s->codecpar->channels
+ s->codecpar->channels,
+ s->codecpar->bits_per_raw_sample ? s->codecpar->bits_per_raw_sample : s->codecpar->bits_per_coded_sample
)
);
)
);
diff --git
a/test/frame_rate_test.cc
b/test/frame_rate_test.cc
index 90216af5cfa5b3a800031a42f769e768aedce351..610ac03809abf23e61610015d24e9bd7e0671330 100644
(file)
--- a/
test/frame_rate_test.cc
+++ b/
test/frame_rate_test.cc
@@
-263,7
+263,7
@@
BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
afr.push_back (30);
Config::instance()->set_allowed_dcp_frame_rates (afr);
afr.push_back (30);
Config::instance()->set_allowed_dcp_frame_rates (afr);
-
shared_ptr<FFmpegAudioStream> stream (new FFmpegAudioStream ("foo", 0, 0, 0, 0)
);
+
auto stream = std::make_shared<FFmpegAudioStream>("foo", 0, 0, 0, 0, 0
);
content->audio.reset (new AudioContent (content.get()));
content->audio->add_stream (stream);
content->_video_frame_rate = 24;
content->audio.reset (new AudioContent (content.get()));
content->audio->add_stream (stream);
content->_video_frame_rate = 24;