]> git.sesse.net Git - nageru/blobdiff - jpeg_frame_view.cpp
Actually send the MJPEG frames on to the HTTP stream.
[nageru] / jpeg_frame_view.cpp
index 95f7453b7c6512caa85969e37bf41841eb8aabd7..16224ad3db7fbd19df2ab465e30aacae335f14e9 100644 (file)
@@ -20,8 +20,6 @@
 using namespace movit;
 using namespace std;
 
-string filename_for_frame(unsigned stream_idx, int64_t pts);
-
 struct JPEGID {
        unsigned stream_idx;
        int64_t pts;
@@ -271,8 +269,11 @@ void JPEGFrameView::resizeGL(int width, int height)
 
 void JPEGFrameView::paintGL()
 {
-       //glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
-       //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+       if (current_frame == nullptr) {
+               glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+               glClear(GL_COLOR_BUFFER_BIT);
+               return;
+       }
 
        check_error();
        chain->render_to_screen();
@@ -282,6 +283,9 @@ void JPEGFrameView::setDecodedFrame(std::shared_ptr<Frame> frame)
 {
        post_to_main_thread([this, frame] {
                current_frame = frame;
+               ycbcr_format.chroma_subsampling_x = frame->chroma_subsampling_x;
+               ycbcr_format.chroma_subsampling_y = frame->chroma_subsampling_y;
+               ycbcr_input->change_ycbcr_format(ycbcr_format);
                ycbcr_input->set_width(frame->width);
                ycbcr_input->set_height(frame->height);
                ycbcr_input->set_pixel_data(0, frame->y.get());
@@ -290,9 +294,6 @@ void JPEGFrameView::setDecodedFrame(std::shared_ptr<Frame> frame)
                ycbcr_input->set_pitch(0, frame->pitch_y);
                ycbcr_input->set_pitch(1, frame->pitch_chroma);
                ycbcr_input->set_pitch(2, frame->pitch_chroma);
-               ycbcr_format.chroma_subsampling_x = frame->chroma_subsampling_x;
-               ycbcr_format.chroma_subsampling_y = frame->chroma_subsampling_y;
-               ycbcr_input->change_ycbcr_format(ycbcr_format);
                update();
        });
 }