root->add_child("VideoFrameRate")->add_child_text (lexical_cast<string> (_video_frame_rate));
root->add_child("DCIDate")->add_child_text (boost::gregorian::to_iso_string (_dci_date));
root->add_child("AudioChannels")->add_child_text (lexical_cast<string> (_audio_channels));
- root->add_child("3D")->add_child_text (_three_d ? "1" : "0");
+ root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
_playlist->as_xml (root->add_child ("Playlist"));
_dci_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
_audio_channels = f.number_child<int> ("AudioChannels");
_sequence_video = f.bool_child ("SequenceVideo");
- _three_d = f.bool_child ("3D");
+ _three_d = f.bool_child ("ThreeD");
_playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"));
cout << "Pass " << *earliest << "\n";
#endif
earliest->decoder->pass ();
+
+ if (earliest->decoder->done()) {
+ shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (earliest->content);
+ assert (ac);
+ shared_ptr<Resampler> re = resampler (ac, false);
+ if (re) {
+ shared_ptr<const AudioBuffers> b = re->flush ();
+ if (b->frames ()) {
+ process_audio (earliest, b, ac->audio_length ());
+ }
+ }
+ }
}
break;
}
/* Resample */
if (content->content_audio_frame_rate() != content->output_audio_frame_rate()) {
- shared_ptr<Resampler> r = resampler (content);
+ shared_ptr<Resampler> r = resampler (content, true);
audio = r->run (audio);
}
}
shared_ptr<Resampler>
-Player::resampler (shared_ptr<AudioContent> c)
+Player::resampler (shared_ptr<AudioContent> c, bool create)
{
map<shared_ptr<AudioContent>, shared_ptr<Resampler> >::iterator i = _resamplers.find (c);
if (i != _resamplers.end ()) {
return i->second;
}
+
+ if (!create) {
+ return shared_ptr<Resampler> ();
+ }
shared_ptr<Resampler> r (new Resampler (c->content_audio_frame_rate(), c->output_audio_frame_rate(), c->audio_channels()));
_resamplers[c] = r;
void flush ();
void emit_black ();
void emit_silence (OutputAudioFrame);
- boost::shared_ptr<Resampler> resampler (boost::shared_ptr<AudioContent>);
+ boost::shared_ptr<Resampler> resampler (boost::shared_ptr<AudioContent>, bool);
void film_changed (Film::Property);
void update_subtitle ();
input and output layouts are the same.
*/
+ cout << "resamp for " << _channels << " " << _in_rate << " " << _out_rate << "\n";
+
_swr_context = swr_alloc_set_opts (
0,
av_get_default_channel_layout (_channels),
return resampled;
}
-/* XXX: no-one calls this */
shared_ptr<const AudioBuffers>
Resampler::flush ()
{