]> git.sesse.net Git - nageru/blobdiff - nageru/mixer.cpp
Support changing overall playing speed at runtime, using a slider or a MIDI controller.
[nageru] / nageru / mixer.cpp
index 23ad51480e78be9cd4ab52b9d086305415e3b99e..9fd1e153ce71592adc782dba326a187463d72fcf 100644 (file)
@@ -795,10 +795,15 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
        card->last_timecode = timecode;
 
        PBOFrameAllocator::Userdata *userdata = (PBOFrameAllocator::Userdata *)video_frame.userdata;
+       if (card->type == CardType::FFMPEG_INPUT) {
+               FFmpegCapture *ffmpeg_capture = static_cast<FFmpegCapture *>(card->capture.get());
+               userdata->has_last_subtitle = ffmpeg_capture->get_has_last_subtitle();
+               userdata->last_subtitle = ffmpeg_capture->get_last_subtitle();
+       }
 
        size_t cbcr_width, cbcr_height, cbcr_offset, y_offset;
        size_t expected_length = video_format.stride * (video_format.height + video_format.extra_lines_top + video_format.extra_lines_bottom);
-       if (userdata->pixel_format == PixelFormat_8BitYCbCrPlanar) {
+       if (userdata != nullptr && userdata->pixel_format == PixelFormat_8BitYCbCrPlanar) {
                // The calculation above is wrong for planar Y'CbCr, so just override it.
                assert(card->type == CardType::FFMPEG_INPUT);
                assert(video_offset == 0);
@@ -860,6 +865,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
                }
                frame_upload_start = steady_clock::now();
        }
+       assert(userdata != nullptr);
        userdata->last_interlaced = video_format.interlaced;
        userdata->last_has_signal = video_format.has_signal;
        userdata->last_is_connected = video_format.is_connected;