#include "audio_buffers.h"
#include "audio_decoder_stream.h"
#include "audio_content.h"
+#include "log.h"
+#include "compose.hpp"
#include <boost/foreach.hpp>
#include <iostream>
using std::cout;
using std::map;
using boost::shared_ptr;
+using boost::optional;
AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log)
: DecoderPart (parent, log)
void
AudioDecoder::flush ()
{
- for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
+ for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
i->second->flush ();
}
}
void
AudioDecoder::seek (ContentTime t, bool accurate)
{
- for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
+ _log->log (String::compose ("AD seek to %1", to_string(t)), LogEntry::TYPE_DEBUG_DECODE);
+ for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
i->second->seek (t, accurate);
}
}
void
AudioDecoder::set_fast ()
{
- for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
+ for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
i->second->set_fast ();
}
}
+
+optional<ContentTime>
+AudioDecoder::position () const
+{
+ optional<ContentTime> pos;
+ for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) {
+ if (!pos || (i->second->position() && i->second->position().get() < pos.get())) {
+ pos = i->second->position();
+ }
+ }
+ return pos;
+}