Skip to content

Commit 9a95df6

Browse files
iammarco11Aniketh01
authored andcommitted
Window: Make the video dimensions dynamic
This commit does: - Rescales the video playback according to the window size
1 parent fee9f90 commit 9a95df6

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

main_window.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@ int main(int argc, const char **argv)
2323
err_log("Couldn't init GLFW");
2424
return 1;
2525
}
26-
27-
window = glfwCreateWindow(1280, 720, "QUIC streamer", NULL, NULL);
28-
if (window == NULL)
29-
{
30-
err_log("Window: Couldn't open window");
31-
glfwTerminate();
32-
return 1;
33-
}
34-
26+
3527
decoder_t dec;
3628
if (!quicsy_decoder_open(&dec, argv[1]))
3729
{
@@ -40,6 +32,14 @@ int main(int argc, const char **argv)
4032
}
4133
log("opening the input file (%s) and loading format (container) header", argv[1]);
4234

35+
window = glfwCreateWindow(dec.width, dec.height, "QUIC streamer", NULL, NULL);
36+
if (window == NULL)
37+
{
38+
err_log("Window: Couldn't open window");
39+
glfwTerminate();
40+
return 1;
41+
}
42+
4343
glfwMakeContextCurrent(window);
4444

4545
// Generate texture
@@ -101,16 +101,16 @@ int main(int argc, const char **argv)
101101
glBindTexture(GL_TEXTURE_2D, tex_handle);
102102
glBegin(GL_QUADS);
103103
glTexCoord2d(0, 0);
104-
glVertex2i(200, 200);
104+
glVertex2i(0,0);
105105
glTexCoord2d(1, 0);
106-
glVertex2i(200 + frame_width, 200);
106+
glVertex2i(window_width, 0);
107107
glTexCoord2d(1, 1);
108-
glVertex2i(200 + frame_width, 200 + frame_height);
108+
glVertex2i(window_width, window_height);
109109
glTexCoord2d(0, 1);
110-
glVertex2i(200, 200 + frame_height);
110+
glVertex2i(0, window_height);
111111
glEnd();
112112
glDisable(GL_TEXTURE_2D);
113-
113+
114114
glfwSwapBuffers(window);
115115
glfwPollEvents();
116116
}

0 commit comments

Comments
 (0)