34 #define WIN32_LEAN_AND_MEAN 38 #include <OpenGL/gl3.h> 45 #if HAVE_GLXGETPROCADDRESS 76 #define FF_GL_RED_COMPONENT GL_RED 77 #elif defined(GL_LUMINANCE) 78 #define FF_GL_RED_COMPONENT GL_LUMINANCE 80 #define FF_GL_RED_COMPONENT 0x1903; //GL_RED 84 #define FF_GL_UNSIGNED_BYTE_3_3_2 0x8032 85 #define FF_GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 86 #define FF_GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 87 #define FF_GL_UNPACK_ROW_LENGTH 0x0CF2 90 #define FF_GL_ARRAY_BUFFER 0x8892 91 #define FF_GL_ELEMENT_ARRAY_BUFFER 0x8893 92 #define FF_GL_STATIC_DRAW 0x88E4 93 #define FF_GL_FRAGMENT_SHADER 0x8B30 94 #define FF_GL_VERTEX_SHADER 0x8B31 95 #define FF_GL_COMPILE_STATUS 0x8B81 96 #define FF_GL_LINK_STATUS 0x8B82 97 #define FF_GL_INFO_LOG_LENGTH 0x8B84 152 #define OPENGL_ERROR_CHECK(ctx) \ 155 if ((err_code = glGetError()) != GL_NO_ERROR) { \ 156 av_log(ctx, AV_LOG_ERROR, "OpenGL error occurred in '%s', line %d: %d\n", __FUNCTION__, __LINE__, err_code); \ 179 SDL_GLContext glcontext;
199 GLuint texture_name[4];
208 GLint texture_location[4];
212 GLfloat projection_matrix[16];
213 GLfloat model_view_matrix[16];
214 GLfloat color_map[16];
353 while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0) {
354 switch (event.type) {
358 switch (event.key.keysym.sym) {
364 case SDL_WINDOWEVENT:
365 switch(event.window.event) {
366 case SDL_WINDOWEVENT_RESIZED:
367 case SDL_WINDOWEVENT_SIZE_CHANGED:
368 SDL_GL_GetDrawableSize(opengl->window, &message.
width, &message.
height);
382 if (SDL_Init(SDL_INIT_VIDEO)) {
387 SDL_WINDOWPOS_UNDEFINED,
388 SDL_WINDOWPOS_UNDEFINED,
390 SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
391 if (!opengl->window) {
392 av_log(opengl,
AV_LOG_ERROR,
"Unable to create default window: %s\n", SDL_GetError());
395 opengl->glcontext = SDL_GL_CreateContext(opengl->window);
396 if (!opengl->glcontext) {
397 av_log(opengl,
AV_LOG_ERROR,
"Unable to create OpenGL context on default window: %s\n", SDL_GetError());
400 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
401 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
402 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
403 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
404 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
406 SDL_GL_GetDrawableSize(opengl->window, &message.
width, &message.
height);
414 #define LOAD_OPENGL_FUN(name, type) \ 415 procs->name = (type)SDL_GL_GetProcAddress(#name); \ 416 if (!procs->name) { \ 417 av_log(opengl, AV_LOG_ERROR, "Cannot load OpenGL function: '%s'\n", #name); \ 418 return AVERROR(ENOSYS); \ 449 #undef LOAD_OPENGL_FUN 453 #if defined(__APPLE__) 460 return opengl_sdl_load_procedures(opengl);
495 #if HAVE_GLXGETPROCADDRESS 496 #define SelectedGetProcAddress glXGetProcAddress 497 #elif HAVE_WGLGETPROCADDRESS 498 #define SelectedGetProcAddress wglGetProcAddress 501 #define LOAD_OPENGL_FUN(name, type) \ 502 procs->name = (type)SelectedGetProcAddress(#name); \ 503 if (!procs->name) { \ 504 av_log(opengl, AV_LOG_ERROR, "Cannot load OpenGL function: '%s'\n", #name); \ 505 return AVERROR(ENOSYS); \ 510 return opengl_sdl_load_procedures(opengl);
541 #undef SelectedGetProcAddress 542 #undef LOAD_OPENGL_FUN 548 memset(matrix, 0, 16 *
sizeof(
float));
549 matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.0f;
553 float bottom,
float top,
float nearZ,
float farZ)
555 float ral = right + left;
556 float rsl = right - left;
557 float tab = top + bottom;
558 float tsb = top - bottom;
559 float fan = farZ + nearZ;
560 float fsn = farZ - nearZ;
562 memset(matrix, 0, 16 *
sizeof(
float));
563 matrix[0] = 2.0f / rsl;
564 matrix[5] = 2.0f / tsb;
565 matrix[10] = -2.0f / fsn;
566 matrix[12] = -ral / rsl;
567 matrix[13] = -tab / tsb;
568 matrix[14] = -fan / fsn;
575 const char *extension;
578 } required_extensions[] = {
579 {
"GL_ARB_multitexture", 1, 3 },
580 {
"GL_ARB_vertex_buffer_object", 1, 5 },
581 {
"GL_ARB_vertex_shader", 2, 0 },
582 {
"GL_ARB_fragment_shader", 2, 0 },
583 {
"GL_ARB_shader_objects", 2, 0 },
587 const char *extensions, *
version;
589 version = glGetString(GL_VERSION);
590 extensions = glGetString(GL_EXTENSIONS);
593 sscanf(version,
"%d.%d", &major, &minor);
595 for (i = 0; required_extensions[i].extension; i++) {
596 if (major < required_extensions[i].major &&
597 (major == required_extensions[i].major && minor < required_extensions[i].minor) &&
598 !strstr(extensions, required_extensions[i].extension)) {
600 required_extensions[i].extension);
607 opengl->
non_pow_2_textures = major >= 2 || strstr(extensions,
"GL_ARB_texture_non_power_of_two");
608 #if defined(GL_ES_VERSION_2_0) 609 opengl->
unpack_subimage = !!strstr(extensions,
"GL_EXT_unpack_subimage");
639 case GL_UNSIGNED_SHORT:
641 case GL_UNSIGNED_SHORT_5_6_5:
643 case GL_UNSIGNED_BYTE:
689 int *out_width,
int *out_height)
692 *out_width = in_width;
693 *out_height = in_height;
696 unsigned power_of_2 = 1;
697 while (power_of_2 < max)
699 *out_height = power_of_2;
700 *out_width = power_of_2;
702 in_width, in_height, *out_width, *out_height);
723 #define FILL_COMPONENT(i) { \ 724 shift = (desc->comp[i].depth - 1) >> 3; \ 725 opengl->color_map[(i << 2) + (desc->comp[i].offset >> shift)] = 1.0; \ 735 #undef FILL_COMPONENT 774 if (!fragment_shader_code) {
787 fragment_shader_code);
844 glBindTexture(GL_TEXTURE_2D, texture);
845 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
846 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
847 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
848 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
849 glTexImage2D(GL_TEXTURE_2D, 0, opengl->
format, new_width, new_height, 0,
909 for (i = 0; i < 4; i++)
935 if ((ret = opengl_sdl_create_window(h)) < 0) {
940 av_log(opengl,
AV_LOG_ERROR,
"FFmpeg is compiled without SDL. Cannot create default window.\n");
945 message.
x = message.
y = 0;
949 &message ,
sizeof(message))) < 0) {
967 SDL_GL_DeleteContext(opengl->glcontext);
968 SDL_DestroyWindow(opengl->window);
1022 for (i = 1; i < num_planes; i++)
1038 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1041 (
float)opengl->
background[2] / 255.0f, 1.0f);
1100 glClear(GL_COLOR_BUFFER_BIT);
1104 SDL_GL_SwapWindow(opengl->window);
1136 data += opengl->
width * opengl->
height * wordsize;
1139 data += opengl->
width * opengl->
height * wordsize;
1140 data += width_chroma * height_chroma * wordsize;
1143 data += opengl->
width * opengl->
height * wordsize;
1144 data += 2 * width_chroma * height_chroma * wordsize;
1152 #define LOAD_TEXTURE_DATA(comp_index, sub) \ 1154 int width = sub ? AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w) : opengl->width; \ 1155 int height = sub ? AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h): opengl->height; \ 1157 int plane = desc->comp[comp_index].plane; \ 1159 glBindTexture(GL_TEXTURE_2D, opengl->texture_name[comp_index]); \ 1161 GLint length = ((AVFrame *)input)->linesize[plane]; \ 1162 int bytes_per_pixel = opengl_type_size(opengl->type); \ 1163 if (!(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) \ 1164 bytes_per_pixel *= desc->nb_components; \ 1165 data = ((AVFrame *)input)->data[plane]; \ 1166 if (!(length % bytes_per_pixel) && \ 1167 (opengl->unpack_subimage || ((length / bytes_per_pixel) == width))) { \ 1168 length /= bytes_per_pixel; \ 1169 if (length != width) \ 1170 glPixelStorei(FF_GL_UNPACK_ROW_LENGTH, length); \ 1171 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, \ 1172 opengl->format, opengl->type, data); \ 1173 if (length != width) \ 1174 glPixelStorei(FF_GL_UNPACK_ROW_LENGTH, 0); \ 1177 for (h = 0; h < height; h++) { \ 1178 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, h, width, 1, \ 1179 opengl->format, opengl->type, data); \ 1184 data = opengl_get_plane_pointer(opengl, input, comp_index, desc); \ 1185 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, \ 1186 opengl->format, opengl->type, data); \ 1198 if (!opengl->
no_window && (ret = opengl_sdl_process_events(h)) < 0)
1207 glClear(GL_COLOR_BUFFER_BIT);
1211 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1240 SDL_GL_SwapWindow(opengl->window);
1266 #define OFFSET(x) offsetof(OpenGLContext, x) 1267 #define ENC AV_OPT_FLAG_ENCODING_PARAM 1270 {
"no_window",
"disable default window",
OFFSET(no_window),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, ENC },
1296 .priv_class = &opengl_class,
GLint max_texture_size
Maximum texture size.
Window size change message.
GLfloat model_view_matrix[16]
Modev view matrix.
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
int plane
Which of the 4 planes contains the component.
#define AV_PIX_FMT_YUVA422P16
static const GLushort g_index[6]
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGBA_PLANAR
Fragment shader for planar RGBA formats.
static enum AVPixelFormat pix_fmt
static int shift(int a, int b)
#define FF_GL_FRAGMENT_SHADER
FF_PFNGLDELETESHADERPROC glDeleteShader
static const char * format[]
static int opengl_prepare(OpenGLContext *opengl)
Prepare window buffer message.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
GLfloat chroma_div_h
Chroma subsampling h ratio.
int x
x coordinate of top left corner
int picture_width
Rendered width.
void(APIENTRY * FF_PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, char *infoLog)
FF_PFNGLDELETEPROGRAMPROC glDeleteProgram
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
static int opengl_type_size(GLenum type)
#define LOAD_OPENGL_FUN(name, type)
#define LIBAVUTIL_VERSION_INT
packed RGB 8:8:8, 24bpp, RGBRGB...
void(APIENTRY * FF_PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params)
#define FF_GL_LINK_STATUS
#define AV_PIX_FMT_RGBA64
GLint model_view_matrix_location
int inited
Set to 1 when write_header was successfully called.
int no_window
0 for create default window
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
const char * av_default_item_name(void *ptr)
Return the context name.
#define AV_PIX_FMT_BGRA64
void(APIENTRY * FF_PFNGLUNIFORM1IPROC)(GLint location, GLint v0)
#define OPENGL_ERROR_CHECK(ctx)
void(APIENTRY * FF_PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, char *infoLog)
AVS_VideoFrame int int int int new_height
static av_cold int opengl_write_trailer(AVFormatContext *h)
static const char *const FF_OPENGL_VERTEX_SHADER
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
FF_PFNGLATTACHSHADERPROC glAttachShader
GLint texture_location[4]
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void opengl_compute_display_area(AVFormatContext *s)
This struct describes the properties of an encoded stream.
FF_PFNGLUSEPROGRAMPROC glUseProgram
Display window buffer message.
static void usage(const char *program_name)
static av_cold int opengl_init_context(OpenGLContext *opengl)
Create window buffer message.
FF_PFNGLCOMPILESHADERPROC glCompileShader
static int opengl_write_packet(AVFormatContext *h, AVPacket *pkt)
FF_PFNGLSHADERSOURCEPROC glShaderSource
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type, void *data, size_t data_size)
Send control message from device to application.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_cold void opengl_fill_color_map(OpenGLContext *opengl)
#define FF_GL_ELEMENT_ARRAY_BUFFER
FF_PFNGLUNIFORM1FPROC glUniform1f
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define FF_GL_UNSIGNED_BYTE_3_3_2
FF_PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
GLint position_attrib
Attibutes' locations.
static av_cold int end(AVCodecContext *avctx)
FF_PFNGLGETSHADERIVPROC glGetShaderiv
FF_PFNGLBINDBUFFERPROC glBindBuffer
void(APIENTRY * FF_PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const char **string, const GLint *length)
static int opengl_resize(AVFormatContext *h, int width, int height)
GLint(APIENTRY * FF_PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const char *name)
AVStream ** streams
A list of all streams in the file.
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
void(APIENTRY * FF_PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers)
FF_PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray
GLfloat chroma_div_w
Chroma subsampling w ratio.
#define AV_PIX_FMT_YUV444P16
static int opengl_draw(AVFormatContext *h, void *intput, int repaint, int is_pkt)
static int opengl_control_message(AVFormatContext *h, int type, void *data, size_t data_size)
GLuint vertex_buffer
Vertex buffer.
#define AV_PIX_FMT_YUVA420P16
GLuint fragment_shader
Fragment shader for current pix_pmt.
GLuint(APIENTRY * FF_PFNGLCREATESHADERPROC)(GLenum type)
GLuint texture_name[4]
Textures' IDs.
FF_PFNGLLINKPROGRAMPROC glLinkProgram
GLint texture_coords_attrib
Main libavdevice API header.
FFOpenGLFunctions glprocs
#define FF_GL_VERTEX_SHADER
void(APIENTRY * FF_PFNGLUSEPROGRAMPROC)(GLuint program)
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
GLuint(APIENTRY * FF_PFNGLCREATEPROGRAMPROC)(void)
FF_PFNGLDELETEBUFFERSPROC glDeleteBuffers
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
AVOutputFormat ff_opengl_muxer
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
char * url
input or output URL.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_PIX_FMT_YUVA444P16
enum AVMediaType codec_type
General type of the encoded data.
simple assert() macros that are a bit more flexible than ISO C assert().
static const char *const FF_OPENGL_FRAGMENT_SHADER_YUVA_PLANAR
Fragment shader for planar YUVA formats.
int non_pow_2_textures
1 when non power of 2 textures are supported
GLint chroma_div_w_location
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGB_PLANAR
Fragment shader for planar RGB formats.
void(APIENTRY * FF_PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params)
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define AV_PIX_FMT_GBRAP16
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
uint8_t background[4]
Background color.
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGBA_PACKET
Fragment shader for packet RGBA formats.
static SDL_Window * window
uint8_t nb_components
The number of components each pixel has, (1-4)
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GRAY16
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static av_cold int opengl_write_header(AVFormatContext *h)
static av_cold void opengl_deinit_context(OpenGLContext *opengl)
static int write_trailer(AVFormatContext *s1)
static const char * opengl_get_fragment_shader_code(enum AVPixelFormat format)
enum AVPixelFormat pix_fmt
Stream pixel format.
FF_PFNGLCREATEPROGRAMPROC glCreateProgram
static const AVOption options[]
#define FF_GL_RED_COMPONENT
void(APIENTRY * FF_PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0)
static av_cold GLuint opengl_load_shader(OpenGLContext *opengl, GLenum type, const char *source)
packed RGB 8:8:8, 24bpp, BGRBGR...
OpenGLVertexInfo vertex[4]
VBO.
FF_PFNGLBUFFERDATAPROC glBufferData
void(APIENTRY * FF_PFNGLDELETESHADERPROC)(GLuint shader)
void(APIENTRY * FF_PFNGLDELETEPROGRAMPROC)(GLuint program)
#define FF_ARRAY_ELEMS(a)
Destroy window buffer message.
#define FF_GL_STATIC_DRAW
#define FILL_COMPONENT(i)
void(APIENTRY * FF_PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_BGR555
GLint chroma_div_h_location
static int opengl_release_window(AVFormatContext *h)
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
GLint(APIENTRY * FF_PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const char *name)
#define AV_LOG_INFO
Standard information.
FF_PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog
char * av_strdup(const char *s)
Duplicate a string.
typedef void(RENAME(mix_any_func_type))
static const struct OpenGLFormatDesc opengl_format_desc[]
GLfloat projection_matrix[16]
Projection matrix.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
FF_PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv
static av_cold void opengl_get_texture_size(OpenGLContext *opengl, int in_width, int in_height, int *out_width, int *out_height)
static av_cold void opengl_get_texture_params(OpenGLContext *opengl)
static const char *const FF_OPENGL_FRAGMENT_SHADER_GRAY
static int opengl_create_window(AVFormatContext *h)
#define FF_GL_INFO_LOG_LENGTH
static av_cold int opengl_read_limits(OpenGLContext *opengl)
void(APIENTRY * FF_PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer)
static const char * window_title
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
static void opengl_make_ortho(float matrix[16], float left, float right, float bottom, float top, float nearZ, float farZ)
Rational number (pair of numerator and denominator).
FF_PFNGLGENBUFFERSPROC glGenBuffers
FF_PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog
#define FF_GL_ARRAY_BUFFER
static av_cold int opengl_prepare_vertex(AVFormatContext *s)
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
GLuint vertex_shader
Vertex shader.
FF_PFNGLUNIFORM1IPROC glUniform1i
static int av_cold opengl_load_procedures(OpenGLContext *opengl)
offset must point to two consecutive integers
#define FF_GL_UNSIGNED_BYTE_2_3_3_REV
int picture_height
Rendered height.
#define AV_PIX_FMT_BGR565
FF_PFNGLGETPROGRAMIVPROC glGetProgramiv
void(APIENTRY * FF_PFNGLBUFFERDATAPROC)(GLenum target, ptrdiff_t size, const GLvoid *data, GLenum usage)
GLuint program
Shader program.
char * window_title
Title of the window.
#define FF_GL_UNSIGNED_SHORT_1_5_5_5_REV
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int unpack_subimage
1 when GL_EXT_unpack_subimage is available
const char const char * params
static int opengl_write_frame(AVFormatContext *h, int stream_index, AVFrame **frame, unsigned flags)
FF_PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static av_cold int opengl_compile_shaders(OpenGLContext *opengl, enum AVPixelFormat pix_fmt)
FF_PFNGLACTIVETEXTUREPROC glActiveTexture
common internal and external API header
planar GBRA 4:4:4:4 32bpp
GLint max_viewport_height
Maximum viewport size.
FF_PFNGLCREATESHADERPROC glCreateShader
GLint max_viewport_width
Maximum viewport size.
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
#define AV_PIX_FMT_RGB555
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define FF_GL_COMPILE_STATUS
GLfloat color_map[16]
RGBA color map matrix.
static const char *const FF_OPENGL_FRAGMENT_SHADER_YUV_PLANAR
Fragment shader for planar YUV formats.
static const AVClass opengl_class
void * priv_data
Format private data.
GLuint index_buffer
Index buffer.
static void write_header(FFV1Context *f)
static uint8_t * opengl_get_plane_pointer(OpenGLContext *opengl, AVPacket *pkt, int comp_index, const AVPixFmtDescriptor *desc)
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGB_PACKET
Fragment shader for packet RGB formats.
static const struct twinvq_data tab
#define LOAD_TEXTURE_DATA(comp_index, sub)
#define AV_PIX_FMT_RGB565
static av_cold int opengl_configure_texture(OpenGLContext *opengl, GLuint texture, GLsizei width, GLsizei height)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
void(APIENTRY * FF_PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
FF_PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int y
y coordinate of top left corner
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void(APIENTRY * FF_PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index)
void(APIENTRY * FF_PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, uintptr_t pointer)
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
void(APIENTRY * FF_PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
static void opengl_make_identity(float matrix[16])
#define AVERROR_EXTERNAL
Generic error in an external library.
void(APIENTRY * FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
AVPixelFormat
Pixel format.
This structure stores compressed data.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
void(APIENTRY * FF_PFNGLCOMPILESHADERPROC)(GLuint shader)
#define AV_PIX_FMT_YUV422P16
#define AV_CEIL_RSHIFT(a, b)
void(APIENTRY * FF_PFNGLLINKPROGRAMPROC)(GLuint program)
GLint projection_matrix_location
Uniforms' locations.