diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-27 23:17:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-27 23:17:34 +0100 |
| commit | 90933dc804de225df47897ddd3a19c5a60ec67e0 (patch) | |
| tree | 4ab78073ea1899b7bd7934b7c592e5f8e01c7c87 /src/lib | |
| parent | f49d66270bff2577d39474a0c1c18a7a1b1f14f6 (diff) | |
Fix some DCP generation bugs and update some tests.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/filter_graph.cc | 5 | ||||
| -rw-r--r-- | src/lib/player.cc | 9 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 119e82851..a1a6636fb 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -539,7 +539,7 @@ FFmpegDecoder::decode_audio_packet () ); assert (_audio_codec_context->channels == _ffmpeg_content->audio_channels()); - Audio (deinterleave_audio (_frame->data, data_size), source_pts_seconds); + audio (deinterleave_audio (_frame->data, data_size), source_pts_seconds); } copy_packet.data += decode_result; @@ -608,11 +608,11 @@ FFmpegDecoder::decode_video_packet () Time FFmpegDecoder::next () const { - if (_decode_video && _decode_audio) { + if (_decode_video && _decode_audio && _audio_codec_context) { return min (_next_video, _next_audio); } - if (_decode_audio) { + if (_decode_audio && _audio_codec_context) { return _next_audio; } diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 4564033d5..7ec2466c5 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -40,6 +40,7 @@ extern "C" { using std::stringstream; using std::string; using std::list; +using std::cout; using boost::shared_ptr; using boost::weak_ptr; using libdcp::Size; @@ -86,8 +87,8 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size stringstream a; a << "video_size=" << _size.width << "x" << _size.height << ":" << "pix_fmt=" << _pixel_format << ":" - << "time_base=0/1:" - << "pixel_aspect=0/1"; + << "time_base=1/1:" + << "pixel_aspect=1/1"; int r; diff --git a/src/lib/player.cc b/src/lib/player.cc index 34894ff0e..2926796ef 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -172,8 +172,8 @@ Player::process_audio (weak_ptr<Content> weak_content, shared_ptr<const AudioBuf if (time > _next_audio) { /* We can emit some audio from our buffers */ - assert (_film->time_to_audio_frames (time - _next_audio) <= _audio_buffers.frames()); OutputAudioFrame const N = _film->time_to_audio_frames (time - _next_audio); + assert (N <= _audio_buffers.frames()); shared_ptr<AudioBuffers> emit (new AudioBuffers (_audio_buffers.channels(), N)); emit->copy_from (&_audio_buffers, N, 0, 0); Audio (emit, _next_audio); @@ -189,6 +189,7 @@ Player::process_audio (weak_ptr<Content> weak_content, shared_ptr<const AudioBuf /* Now accumulate the new audio into our buffers */ _audio_buffers.ensure_size (_audio_buffers.frames() + audio->frames()); _audio_buffers.accumulate_frames (audio.get(), 0, 0, audio->frames ()); + _audio_buffers.set_frames (_audio_buffers.frames() + audio->frames()); } /** @return true on error */ @@ -324,9 +325,11 @@ Player::setup_pieces () if (diff > 0) { add_black_piece (video_pos, diff); } - video_pos = (*i)->content->end(); - } else { + } + + shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> ((*i)->content); + if (ac && ac->audio_channels()) { Time const diff = (*i)->content->start() - audio_pos; if (diff > 0) { add_silent_piece (video_pos, diff); diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index d32ec6ba8..5ee764a8e 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -73,7 +73,6 @@ void Playlist::content_changed (weak_ptr<Content> c, int p) { if (p == ContentProperty::LENGTH && _sequence_video && !_sequencing_video) { - cout << "sequencing.\n"; _sequencing_video = true; ContentList cl = _content; @@ -85,7 +84,6 @@ Playlist::content_changed (weak_ptr<Content> c, int p) } (*i)->set_start (last); - cout << (*i)->file() << " -> " << last << "\n"; last = (*i)->end (); } |
