]> git.sesse.net Git - nageru/blobdiff - nageru/mixer.h
Move texture uploading out of a lambda.
[nageru] / nageru / mixer.h
index af07f8896665044291a281918af5bbd51961cd0a..1852e48ed8196fa79938a5d4527e9e55f7f7a14a 100644 (file)
@@ -450,6 +450,10 @@ private:
        void bm_frame(unsigned card_index, uint16_t timecode,
                bmusb::FrameAllocator::Frame video_frame, size_t video_offset, bmusb::VideoFormat video_format,
                bmusb::FrameAllocator::Frame audio_frame, size_t audio_offset, bmusb::AudioFormat audio_format);
+       void upload_texture_for_frame(
+               int field, bmusb::VideoFormat video_format,
+               size_t y_offset, size_t cbcr_offset, size_t video_offset,
+               PBOFrameAllocator::Userdata *userdata);
        void bm_hotplug_add(libusb_device *dev);
        void bm_hotplug_remove(unsigned card_index);
        void place_rectangle(movit::Effect *resample_effect, movit::Effect *padding_effect, float x0, float y0, float x1, float y1);
@@ -552,16 +556,15 @@ private:
                        int64_t length;  // In TIMEBASE units.
                        bool interlaced;
                        unsigned field;  // Which field (0 or 1) of the frame to use. Always 0 for progressive.
-                       std::function<void()> upload_func;  // Needs to be called to actually upload the texture to OpenGL.
+                       bool texture_uploaded = false;
                        unsigned dropped_frames = 0;  // Number of dropped frames before this one.
                        std::chrono::steady_clock::time_point received_timestamp = std::chrono::steady_clock::time_point::min();
                        movit::RGBTriplet neutral_color{1.0f, 1.0f, 1.0f};
 
-                       // Used for MJPEG encoding. (upload_func packs everything it needs
-                       // into the functor, but would otherwise also use these.)
+                       // Used for MJPEG encoding, and texture upload.
                        // width=0 or height=0 means a broken frame, ie., do not upload.
                        bmusb::VideoFormat video_format;
-                       size_t y_offset, cbcr_offset;
+                       size_t video_offset, y_offset, cbcr_offset;
                };
                std::deque<NewFrame> new_frames;
                std::condition_variable new_frames_changed;  // Set whenever new_frames is changed.