int video_load(lua_State *L, const char *path, const char *name) { video_t video; memset(&video, 0, sizeof(video_t)); if (!video_open(&video, path)) return luaL_error(L, "cannot open video %s", path); glGenTextures(1, &video.tex); glBindTexture(GL_TEXTURE_2D, video.tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, video.width, video.height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL ); *push_video(L) = video; return 1; }
void DLL EncodeFrame(EncoderJob &jobSpec, MediaFrame &frame) { // Send a frame of video and audio to the encoder // Check job: if (!jobSpec.IsValid) return; push_video(jobSpec, frame); // <-- may change fragment here push_audio(jobSpec, frame); push_data(jobSpec, frame); }