summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
AgeCommit message (Collapse)Author
2025-09-02Untested conversion to num/den DCPTime.arbitrary-hzCarl Hetherington
Summary of required changes: Replace ::from_frames with a constructor that takes num/den. Provide and use member to_debug_string() instead of to_string(). Provide and use member to_serializable_string() and string constructor instead of fmt::to_string on .get() and number constructor. Provide and use content_time() member instead of ContentTime constructor from DCPTime. Use frames_round(96000) instead of get() when comparing times to see if they are "close enough". Provide and use DCPTime(x, FrameRateChange) constructor when converting from ContentTime. Use .seconds() when calculating proportions or sometimes when dividing by HZ. Provide and use operator bool(). Pass explicit 96000 denominator in a lot of places. Add member max() and use it instead of static max() Change BOOST_CHECK_EQUAL to BOOST_CHECK Provide operator/ and use it instead of .get() / 2.
2025-07-10Remove compose.hpp includes.Carl Hetherington
sed -i "/include.*compose.hpp/d;" src/lib/*.cc src/wx/*.cc src/wx/*.h src/tools/*.cc src/lib/*.h test/*.cc
2025-07-10Replace String::compose with fmt.Carl Hetherington
sed -i "/Plural-Forms/n;/%100/n;/scanf/n;s/%[123456789]/{}/g" src/lib/*.cc src/lib/*.h src/wx/*.cc src/tools/*.cc src/lib/po/*.po src/wx/po/*.po src/tools/po/*.po test/*.cc sed -i "s/String::compose */fmt::format/g" src/lib/*.cc src/lib/*.h src/wx/*.cc src/tools/*.cc test/*.cc
2025-03-25Tidy comment.Carl Hetherington
2024-12-14Reset _flush_state on seek().Carl Hetherington
Otherwise we do the wrong thing at the end of a file on the second run-through.
2024-12-09Fix decoding of SSA subs in files decoded by FFmpeg (#2904).Carl Hetherington
Suddenly we have 8 commas, not 9, perhaps because of 29412821241050c846dbceaad4b9752857659977 in ffmpeg (although that's strange, because it was a long time ago).
2024-12-09Fix doubled subtitles (again).Carl Hetherington
This was re-introduced when 94618a724124cbf5fe9f0b47a3fdce601fcd5581 reverted a previous attempt at a fix. At the time I couldn't understand the doubled-subtitles problem, but it's apparent in the test introduced in the next commit. This is another attempt to fix it by only sending a "stop" for a subtitle if we didn't already stop the subtitle because the next one arrived.
2024-12-09Cleanup: use default initializers.Carl Hetherington
2024-09-03Adapt to some libdcp class renaming to allow open captions/closed subtitles.Carl Hetherington
2024-05-29Merge remote-tracking branch 'origin/main' into v2.17.xCarl Hetherington
2024-05-26Fix build with newer libsub.Carl Hetherington
2024-05-19Add and use Content::has_mapped_audio().Carl Hetherington
2024-05-16Merge branch 'main' into v2.17.xCarl Hetherington
2024-05-13Don't bother decoding audio if none of it is mapped (#2809).Carl Hetherington
On a test adding subs from an MKV to an existing DCP this reduces the processing time from ~2h to ~1m because it doesn't resample the audio from the whole of the MKV, only to discard it.
2024-04-18Merge remote-tracking branch 'origin/main' into v2.17.xCarl Hetherington
2024-04-01Fix hanging/overlapping dvb subtitles (#2792).Carl Hetherington
This reverts a change made in 8ca6fd6d97e6d42492afddb655fa85130946853c "Fix doubled subtitles if subtitle stop times are specified." That change breaks the case where a subtitle _does_ have a stop time, but it's wrong (30s from the start time) and we want the next subtitle to clear the previous one. I can't now see how reverting this could cause doubled subtitles, so maybe that problem wlil come back. At least now there's a test for #2792.
2024-02-22Merge tag 'v2.16.78' into v2.17.xv2.17.12Carl Hetherington
2024-02-21Make DCPExaminer::size() optional and deal with the consequences.v2.16.78Carl Hetherington
This means we can fix the case of a VF having no known size in a nice way, in turn fixing problems caused by the fix to #2775.
2024-01-28Change how video timing is done.Carl Hetherington
This commit changes the approach with video timing. Previously, we would (more-or-less) try to use every video frame from the content in the output, hoping that they come at a constant frame rate. This is not always the case, however. Here we preserve the PTS of video frames, and then when one arrives we output whatever DCP video frames we can (at the regular DCP frame rate). Hopefully this will solve a range of sync problems, but it could also introduce new ones.
2024-01-28Bump ffmpeg to 5.1.2 "Riemann"Carl Hetherington
2024-01-20Build fix for HAVE_AVSUBTITLERECT_PICT case.Carl Hetherington
2024-01-12Fix scaling of bitmap subs when the corresponding video is cropped (#2670).Carl Hetherington
Previously we would scale the bitmap size/position to a proportion of the original video frame, then scale it back up again to the DCP container. This didn't take into account some cropped cases where the picture would end up the same shape but the subtitles would be stretched.
2023-11-16Fix crash with subtitles for which we have no codec.Carl Hetherington
2023-09-29Fix errors with WAVs containing markers (#2617).Carl Hetherington
I'm not 100% sure about this but they seem to end up giving audio packets with no channels and no frames. Here we handle such packets better.
2023-08-15Cleanup: remove unused variable.Carl Hetherington
2023-08-15Remove now-unnecessary assertion.Carl Hetherington
Since e29ce33a36c2e20444d57196defc86d5072bce81 channels is the number of channels in the frame, and also the number in data, so we don't need to check this any more.
2023-05-11Remove incorrect silencing (#2526).Carl Hetherington
On switching to the new FFmpeg send/receive API in e29ce33a36c2e20444d57196defc86d5072bce81 the channels variable in deinterleave_audio() was switched from stream channels to frame channels. I'm not sure if this is right, but it does mean that audio has `channels` channels, so calling make_silent() up to the stream channel count is clearly wrong if the stream has more channels than the frame.
2022-11-15Improve flushing behaviour when there is a lot of space to fill (#2364).Carl Hetherington
Previously a call to flush() could result in a lot of audio being emitted from the decoder (if there is a big gap between the end of the audio and the video). This would end up being emitted in one chunk from the player, crashing the audio analyser with an OOM in some cases.
2022-11-15Clarify one log message and add another.Carl Hetherington
2022-10-18Extract VideoFilterGraphSet.Carl Hetherington
2022-10-18Remove believed-unnecessary mutex.Carl Hetherington
2022-10-01Fix checking of frame channels vs stream channels.Carl Hetherington
The comment says that we're handling differences between channel counts in the frame and stream but the code wasn't doing that.
2022-09-17Fix typo in log message.Carl Hetherington
2022-09-10Some improved logging.Carl Hetherington
2022-09-03Bump libdcp for better ContentKind support, and libsubCarl Hetherington
for fixes to \c tags in SSA files.
2022-06-12Set up TextDecoder position based on the time that the next thing willv2.16.14Carl Hetherington
be emitted, instead of the time that the last thing was (#2268). This is to avoid problems with the example shown in the test, where just because a subtitle in source A comes before a subtitle in source B, source A is pass()ed next and may then emit a subtitle which should be after the next one in B.
2022-04-28Handle multiple bitmap subtitles at the same time correctly (#2239).Carl Hetherington
Previously if there were two images at the same time we would start them both, then the stop time would be set in the second one but not the first. This meant that the first one would hang around forever.
2022-04-28Make emit_bitmap_start take a ContentBitmapText.Carl Hetherington
2022-04-03C++11 and whitespace cleanups.Carl Hetherington
2022-02-17Try to handle EAGAIN from avcodec_send_packet() properly.Carl Hetherington
The docs say on EAGAIN we should call avcodec_receive_frame() and then re-send the same packet again. This should do that. This is a fix for errors trigged by the accompanying test.
2022-01-11Fix failure to decode multiple video frames from one packet (#2159).v2.15.183Carl Hetherington
2022-01-11Cleanup: move some stuff into process_video_frame().Carl Hetherington
2022-01-11Use a separate AVFrame for each stream when decoding.Carl Hetherington
This seems to be what ffplay does and it feels like it makes sense as frames may be built from multiple packets AFAICS.
2021-10-13Ignore errors from avcodec_send_packet.Carl Hetherington
After seeking it appears that we often get irrelevant errors from this method. ffplay.c seems to ignore them, and this commit means that we do too (just logging them). I think these errors during a non-seeking "encoding" run could be cause for concern; perhaps we should take more note of them in that case.
2021-09-27Replace aligned bool with enum Alignment.Carl Hetherington
2021-09-27Various alignment adjustments.Carl Hetherington
2021-09-13Fix missing subtitles embedded in files decoded by FFmpeg (#2060).Carl Hetherington
Since the FFmpeg 4.4 update it seems that AVSubtitle::pts is no longer set (it's AV_NOPTS_VALUE, i think). Instead we apparently need to get the PTS from the packet, which in turn requires the stream's timebase.
2021-09-13Add missing avsubtitle_free().Carl Hetherington
2021-06-04Fix errors when seeking FFmpeg for some formats.Carl Hetherington
The comments discuss this in a bit more depth, but basically we see errors from avcodec_send_packet after seek. ffplay etc. seem basically to ignore all errors from avcodec_send_packet, and I can't find a "proper" fix, so here's a half-way house hack: ignore some errors after seek. Nasty.
2021-06-03Ignore errors from avcodec_receive_frame when flushing video (#2035).Carl Hetherington
The test fails if we don't do this; it doesn't really seem 100% convincing but we are already doing this for audio.