projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Accessor for ClosedCaptionsDialog.
[dcpomatic.git]
/
src
/
lib
/
audio_decoder.cc
diff --git
a/src/lib/audio_decoder.cc
b/src/lib/audio_decoder.cc
index c0f00780ad58cb852fed8c6e65a1d559aa17e075..a5e86f22b8e352d529fa39e69149ad10cca9fec4 100644
(file)
--- a/
src/lib/audio_decoder.cc
+++ b/
src/lib/audio_decoder.cc
@@
-21,6
+21,7
@@
#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_content.h"
#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_content.h"
+#include "dcpomatic_log.h"
#include "log.h"
#include "resampler.h"
#include "compose.hpp"
#include "log.h"
#include "resampler.h"
#include "compose.hpp"
@@
-29,16
+30,15
@@
#include "i18n.h"
#include "i18n.h"
-#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
using std::cout;
using std::map;
using std::pair;
using boost::shared_ptr;
using boost::optional;
using std::cout;
using std::map;
using std::pair;
using boost::shared_ptr;
using boost::optional;
+using namespace dcpomatic;
-AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content,
shared_ptr<Log> log,
bool fast)
- : DecoderPart (parent
, log
)
+AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, bool fast)
+ : DecoderPart (parent)
, _content (content)
, _fast (fast)
{
, _content (content)
, _fast (fast)
{
@@
-49,7
+49,7
@@
AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> cont
}
void
}
void
-AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time)
+AudioDecoder::emit (
shared_ptr<const Film> film,
AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time)
{
if (ignore ()) {
return;
{
if (ignore ()) {
return;
@@
-66,23
+66,23
@@
AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
silence (_content->delay ());
}
time += ContentTime::from_seconds (_content->delay() / 1000.0);
silence (_content->delay ());
}
time += ContentTime::from_seconds (_content->delay() / 1000.0);
- _positions[stream] = time.frames_round (_content->resampled_frame_rate
(
));
+ _positions[stream] = time.frames_round (_content->resampled_frame_rate
(film
));
}
shared_ptr<Resampler> resampler;
}
shared_ptr<Resampler> resampler;
-
map<AudioStreamPtr, shared_ptr<Resampler> >
::iterator i = _resamplers.find(stream);
+
ResamplerMap
::iterator i = _resamplers.find(stream);
if (i != _resamplers.end ()) {
resampler = i->second;
} else {
if (i != _resamplers.end ()) {
resampler = i->second;
} else {
- if (stream->frame_rate() != _content->resampled_frame_rate()) {
+ if (stream->frame_rate() != _content->resampled_frame_rate(
film
)) {
LOG_GENERAL (
"Creating new resampler from %1 to %2 with %3 channels",
stream->frame_rate(),
LOG_GENERAL (
"Creating new resampler from %1 to %2 with %3 channels",
stream->frame_rate(),
- _content->resampled_frame_rate(),
+ _content->resampled_frame_rate(
film
),
stream->channels()
);
stream->channels()
);
- resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(), stream->channels()));
+ resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(
film
), stream->channels()));
if (_fast) {
resampler->set_fast ();
}
if (_fast) {
resampler->set_fast ();
}
@@
-104,36
+104,36
@@
AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
/** @return Time just after the last thing that was emitted from a given stream */
ContentTime
/** @return Time just after the last thing that was emitted from a given stream */
ContentTime
-AudioDecoder::stream_position (AudioStreamPtr stream) const
+AudioDecoder::stream_position (
shared_ptr<const Film> film,
AudioStreamPtr stream) const
{
{
-
map<AudioStreamPtr, Frame>
::const_iterator i = _positions.find (stream);
+
PositionMap
::const_iterator i = _positions.find (stream);
DCPOMATIC_ASSERT (i != _positions.end ());
DCPOMATIC_ASSERT (i != _positions.end ());
- return ContentTime::from_frames (i->second, _content->resampled_frame_rate());
+ return ContentTime::from_frames (i->second, _content->resampled_frame_rate(
film
));
}
}
-ContentTime
-AudioDecoder::position () const
+boost::optional<ContentTime>
+AudioDecoder::position (
shared_ptr<const Film> film
) const
{
optional<ContentTime> p;
{
optional<ContentTime> p;
- for (
map<AudioStreamPtr, Frame>
::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
- ContentTime const ct = stream_position (i->first);
+ for (
PositionMap
::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
+ ContentTime const ct = stream_position (
film,
i->first);
if (!p || ct < *p) {
p = ct;
}
}
if (!p || ct < *p) {
p = ct;
}
}
- return p
.get_value_or(ContentTime())
;
+ return p;
}
void
AudioDecoder::seek ()
{
}
void
AudioDecoder::seek ()
{
- for (
map<AudioStreamPtr, shared_ptr<Resampler> >
::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
+ for (
ResamplerMap
::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
i->second->flush ();
i->second->reset ();
}
i->second->flush ();
i->second->reset ();
}
- for (
map<AudioStreamPtr, Frame>
::iterator i = _positions.begin(); i != _positions.end(); ++i) {
+ for (
PositionMap
::iterator i = _positions.begin(); i != _positions.end(); ++i) {
i->second = 0;
}
}
i->second = 0;
}
}
@@
-141,7
+141,7
@@
AudioDecoder::seek ()
void
AudioDecoder::flush ()
{
void
AudioDecoder::flush ()
{
- for (
map<AudioStreamPtr, shared_ptr<Resampler> >
::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
+ for (
ResamplerMap
::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
shared_ptr<const AudioBuffers> ro = i->second->flush ();
if (ro->frames() > 0) {
Data (i->first, ContentAudio (ro, _positions[i->first]));
shared_ptr<const AudioBuffers> ro = i->second->flush ();
if (ro->frames() > 0) {
Data (i->first, ContentAudio (ro, _positions[i->first]));