]> git.sesse.net Git - nageru/commitdiff
Use WIDTH and HEIGHT a few places instead of hard-coded 1280 and 720.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 18 Oct 2015 13:47:03 +0000 (15:47 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 18 Oct 2015 13:47:03 +0000 (15:47 +0200)
mixer.cpp

index a6179e80d32047c8052b96566d67668de8e5b897..f67b4cd41f34c4989cb75e77be2726aa7374e33c 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -103,7 +103,7 @@ Mixer::Mixer(const QSurfaceFormat &format)
                CaptureCard *card = &cards[card_index];
                card->usb = new BMUSBCapture(0x1edb, card_index == 0 ? 0xbd3b : 0xbd4f);
                card->usb->set_frame_callback(bind(&Mixer::bm_frame, this, card_index, _1, _2, _3, _4, _5, _6, _7));
-               card->frame_allocator.reset(new PBOFrameAllocator(1280 * 750 * 2 + 44, 1280, 720));
+               card->frame_allocator.reset(new PBOFrameAllocator(WIDTH * (HEIGHT+30) * 2 + 44, WIDTH, HEIGHT));
                card->usb->set_video_frame_allocator(card->frame_allocator.get());
                card->surface = create_surface(format);
                card->usb->set_dequeue_thread_callbacks(
@@ -241,7 +241,7 @@ void Mixer::bm_frame(int card_index, uint16_t timecode,
                if (card->should_quit) return;
        }
 
-       if (video_frame.len - video_offset != 1280 * 750 * 2) {
+       if (video_frame.len - video_offset != WIDTH * (HEIGHT+30) * 2) {
                if (video_frame.len != 0) {
                        printf("Card %d: Dropping video frame with wrong length (%ld)\n",
                                card_index, video_frame.len - video_offset);
@@ -276,11 +276,11 @@ void Mixer::bm_frame(int card_index, uint16_t timecode,
        // Upload the textures.
        glBindTexture(GL_TEXTURE_2D, userdata->tex_y);
        check_error();
-       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1280, 720, GL_RED, GL_UNSIGNED_BYTE, BUFFER_OFFSET((1280 * 750 * 2 + 44) / 2 + 1280 * 25 + 22));
+       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, WIDTH, HEIGHT, GL_RED, GL_UNSIGNED_BYTE, BUFFER_OFFSET((WIDTH * (HEIGHT+30) * 2 + 44) / 2 + WIDTH * 25 + 22));
        check_error();
        glBindTexture(GL_TEXTURE_2D, userdata->tex_cbcr);
        check_error();
-       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1280/2, 720, GL_RG, GL_UNSIGNED_BYTE, BUFFER_OFFSET(1280 * 25 + 22));
+       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, WIDTH/2, HEIGHT, GL_RG, GL_UNSIGNED_BYTE, BUFFER_OFFSET(WIDTH * 25 + 22));
        check_error();
        glBindTexture(GL_TEXTURE_2D, 0);
        check_error();