X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_decoder.cc;h=ba96d71ff5da78a9fe084d1bd56bbb2d82be56d4;hb=ff639b3cf30afcc097bfd21d39c8d15f466cadd6;hp=82eccb576d5df8248926315b72f6748406e9daaf;hpb=c8a036eb727ceddc64a0304d781c916eb952c001;p=dcpomatic.git diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 82eccb576..ba96d71ff 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -452,6 +452,8 @@ FFmpegDecoder::process_audio_frame (shared_ptr stream) auto frame = audio_frame (stream); auto data = deinterleave_audio (frame); + auto const time_base = stream->stream(_format_context)->time_base; + ContentTime ct; if (frame->pts == AV_NOPTS_VALUE) { /* In some streams we see not every frame coming through with a timestamp; for those @@ -464,8 +466,16 @@ FFmpegDecoder::process_audio_frame (shared_ptr stream) } else { ct = ContentTime::from_seconds ( frame->best_effort_timestamp * - av_q2d (stream->stream(_format_context)->time_base)) + av_q2d(time_base)) + _pts_offset; + LOG_DEBUG_PLAYER( + "Process audio with timestamp %1 (BET %2, timebase %3/%4, (PTS offset %5)", + to_string(ct), + frame->best_effort_timestamp, + time_base.num, + time_base.den, + to_string(_pts_offset) + ); } _next_time[stream] = ct + ContentTime::from_frames(data->frames(), stream->frame_rate()); @@ -485,7 +495,7 @@ FFmpegDecoder::process_audio_frame (shared_ptr stream) data->frames(), stream->id(), frame->best_effort_timestamp, - av_q2d(stream->stream(_format_context)->time_base), + av_q2d(time_base), to_string(_pts_offset) ); } @@ -508,6 +518,7 @@ FFmpegDecoder::decode_and_process_audio_packet (AVPacket* packet) auto context = _codec_context[stream->index(_format_context)]; auto frame = audio_frame (stream); + LOG_DEBUG_PLAYER("Send audio packet on stream %1", stream->index(_format_context)); int r = avcodec_send_packet (context, packet); if (r < 0) { LOG_WARNING("avcodec_send_packet returned %1 for an audio packet", r); @@ -516,6 +527,7 @@ FFmpegDecoder::decode_and_process_audio_packet (AVPacket* packet) r = avcodec_receive_frame (context, frame); if (r == AVERROR(EAGAIN)) { /* More input is required */ + LOG_DEBUG_PLAYER_NC("EAGAIN after trying to receive audio frame"); return; } @@ -791,7 +803,8 @@ FFmpegDecoder::process_ass_subtitle (string ass, ContentTime from) base, text, _ffmpeg_content->video->size().width, - _ffmpeg_content->video->size().height + _ffmpeg_content->video->size().height, + sub::Colour(1, 1, 1) ); for (auto const& i: sub::collect>(raw)) {