#include <assert.h>
#include <epoxy/egl.h>
-#include <init.h>
#include <movit/effect_chain.h>
#include <movit/effect_util.h>
#include <movit/flat_input.h>
#include <movit/image_format.h>
+#include <movit/init.h>
#include <movit/resource_pool.h>
#include <movit/util.h>
#include <stdint.h>
#include "bmusb/bmusb.h"
#include "context.h"
#include "defs.h"
+#include "flags.h"
#include "h264encode.h"
#include "pbo_frame_allocator.h"
#include "ref_counted_gl_sync.h"
display_chain->set_dither_bits(0); // Don't bother.
display_chain->finalize();
- h264_encoder.reset(new H264Encoder(h264_encoder_surface, WIDTH, HEIGHT, &httpd));
+ h264_encoder.reset(new H264Encoder(h264_encoder_surface, global_flags.va_display, WIDTH, HEIGHT, &httpd));
for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
printf("Configuring card %d...\n", card_index);
// Set up stuff for NV12 conversion.
// Cb/Cr shader.
- string cbcr_vert_shader = read_file("vs-cbcr.130.vert");
+ string cbcr_vert_shader =
+ "#version 130 \n"
+ " \n"
+ "in vec2 position; \n"
+ "in vec2 texcoord; \n"
+ "out vec2 tc0; \n"
+ "uniform vec2 foo_chroma_offset_0; \n"
+ " \n"
+ "void main() \n"
+ "{ \n"
+ " // The result of glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0) is: \n"
+ " // \n"
+ " // 2.000 0.000 0.000 -1.000 \n"
+ " // 0.000 2.000 0.000 -1.000 \n"
+ " // 0.000 0.000 -2.000 -1.000 \n"
+ " // 0.000 0.000 0.000 1.000 \n"
+ " gl_Position = vec4(2.0 * position.x - 1.0, 2.0 * position.y - 1.0, -1.0, 1.0); \n"
+ " vec2 flipped_tc = texcoord; \n"
+ " tc0 = flipped_tc + foo_chroma_offset_0; \n"
+ "} \n";
string cbcr_frag_shader =
"#version 130 \n"
"in vec2 tc0; \n"
"uniform sampler2D cbcr_tex; \n"
+ "out vec4 FragColor; \n"
"void main() { \n"
- " gl_FragColor = texture2D(cbcr_tex, tc0); \n"
+ " FragColor = texture(cbcr_tex, tc0); \n"
"} \n";
vector<string> frag_shader_outputs;
cbcr_program_num = resource_pool->compile_glsl_program(cbcr_vert_shader, cbcr_frag_shader, frag_shader_outputs);
check_error();
glBindTexture(GL_TEXTURE_2D, 0);
check_error();
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
+ check_error();
GLsync fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
check_error();
assert(fence != nullptr);
h264_encoder->shutdown();
httpd.close_output_file();
httpd.open_output_file(filename.c_str());
- h264_encoder.reset(new H264Encoder(h264_encoder_surface, WIDTH, HEIGHT, &httpd));
+ h264_encoder.reset(new H264Encoder(h264_encoder_surface, global_flags.va_display, WIDTH, HEIGHT, &httpd));
}
#if 0
glUseProgram(0);
check_error();
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ check_error();
resource_pool->release_fbo(fbo);
glDeleteVertexArrays(1, &vao);