atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
movie.c File Reference

Functions to encode a movie / render an image from the OpenGL rendering. More...

#include "global.h"
#include "interface.h"
#include "project.h"
#include "glwindow.h"
#include "glview.h"
#include "movie.h"
+ Include dependency graph for movie.c:

Go to the source code of this file.

Macros

#define PIXEL_FORMAT   PIX_FMT_YUV420P
 
#define AVS_FRAME_ALIGN   16
 
#define RGB_TO_Y(pixels, loc)   (0.29900 * pixels[loc] + 0.58700 * pixels[loc+1] + 0.11400 * pixels[loc+2])
 
#define RGB_TO_U(pixels, loc)   (-0.16874 * pixels[loc] - 0.33126 * pixels[loc+1] + 0.50000 * pixels[loc+2]+128.0)
 
#define RGB_TO_V(pixels, loc)   (0.50000 * pixels[loc] - 0.41869 * pixels[loc+1] - 0.08131 * pixels[loc+2]+128.0)
 
#define AVIO_FLAG_READ   1
 
#define AVIO_FLAG_WRITE   2
 
#define AVIO_FLAG_READ_WRITE   (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
 
#define AV_ROUND_PASS_MINMAX   8192
 
#define URL_WRONLY   1
 

Functions

void convert_rgb_pixbuf_to_yuv (GdkPixbuf *pixbuf, AVFrame *picture, int w, int h)
 convert an RGB pixbuf to an YUV picture frame
 
void fill_image (VideoStream *vs, int width, int height, glwin *view)
 render an image from an OpenGL rendering
 
AVCodecContext * add_codec_context (AVFormatContext *fc, const AVCodec *vc, video_options *vopts)
 create a video codec context
 
VideoStreamadd_video_stream (AVFormatContext *fc, const AVCodec *vc, video_options *vopts)
 create video stream and the associated data buffers
 
void set_old_cmap (image *img, int stp, int id)
 preserve color map information
 
gboolean check_to_update_shaders (glwin *view, image *img_a, image *img_b, int ogl_q)
 test if it is required to update the OpenGL shaders, and which one(s)
 
gboolean create_movie (glwin *view, video_options *vopts, gchar *videofile)
 render a movie from the saved animation parameters
 
void init_frame_buffer (int x, int y)
 init a frame buffer
 
void close_frame_buffer ()
 close the frame buffer
 
G_MODULE_EXPORT void run_save_movie (GtkDialog *info, gint response_id, gpointer data)
 saving a movie - running the dialog
 
void save_movie (glwin *view, video_options *vopts)
 saving a movie - prepare the dialog
 

Variables

char * codec_name [VIDEO_CODECS]
 
char * codec_list [VIDEO_CODECS]
 
int codec_id [VIDEO_CODECS]
 
GdkPixbuf * pixbuf
 
uint8_t * video_outbuf
 
int video_outbuf_size
 
int num_frames
 
int frame_start
 
int * old_cmap [2]
 
GtkWidget * encoding_pb
 

Detailed Description

Functions to encode a movie / render an image from the OpenGL rendering.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file movie.c.

Macro Definition Documentation

◆ AV_ROUND_PASS_MINMAX

#define AV_ROUND_PASS_MINMAX   8192

Definition at line 83 of file movie.c.

◆ AVIO_FLAG_READ

#define AVIO_FLAG_READ   1

Definition at line 78 of file movie.c.

◆ AVIO_FLAG_READ_WRITE

#define AVIO_FLAG_READ_WRITE   (AVIO_FLAG_READ|AVIO_FLAG_WRITE)

Definition at line 80 of file movie.c.

◆ AVIO_FLAG_WRITE

#define AVIO_FLAG_WRITE   2

Definition at line 79 of file movie.c.

◆ AVS_FRAME_ALIGN

#define AVS_FRAME_ALIGN   16

Definition at line 72 of file movie.c.

◆ PIXEL_FORMAT

#define PIXEL_FORMAT   PIX_FMT_YUV420P

Definition at line 67 of file movie.c.

◆ RGB_TO_U

#define RGB_TO_U ( pixels,
loc )   (-0.16874 * pixels[loc] - 0.33126 * pixels[loc+1] + 0.50000 * pixels[loc+2]+128.0)

Definition at line 75 of file movie.c.

◆ RGB_TO_V

#define RGB_TO_V ( pixels,
loc )   (0.50000 * pixels[loc] - 0.41869 * pixels[loc+1] - 0.08131 * pixels[loc+2]+128.0)

Definition at line 76 of file movie.c.

◆ RGB_TO_Y

#define RGB_TO_Y ( pixels,
loc )   (0.29900 * pixels[loc] + 0.58700 * pixels[loc+1] + 0.11400 * pixels[loc+2])

Definition at line 74 of file movie.c.

◆ URL_WRONLY

#define URL_WRONLY   1

Definition at line 87 of file movie.c.

Function Documentation

◆ add_codec_context()

AVCodecContext * add_codec_context ( AVFormatContext * fc,
const AVCodec * vc,
video_options * vopts )

create a video codec context

Parameters
fcthe format context
vcthe codec
voptsthe video encoding options

Definition at line 396 of file movie.c.

◆ add_video_stream()

VideoStream * add_video_stream ( AVFormatContext * fc,
const AVCodec * vc,
video_options * vopts )

create video stream and the associated data buffers

Parameters
fcthe format context
vcthe codec
voptsthe video encoding options

Definition at line 451 of file movie.c.

◆ check_to_update_shaders()

gboolean check_to_update_shaders ( glwin * view,
image * img_a,
image * img_b,
int ogl_q )

test if it is required to update the OpenGL shaders, and which one(s)

Parameters
viewthe target glwin
img_athe previous image
img_bthe next image
ogl_qOpenGL quality

Definition at line 519 of file movie.c.

◆ close_frame_buffer()

void close_frame_buffer ( )

close the frame buffer

Definition at line 1206 of file movie.c.

◆ convert_rgb_pixbuf_to_yuv()

void convert_rgb_pixbuf_to_yuv ( GdkPixbuf * pixbuf,
AVFrame * picture,
int w,
int h )

convert an RGB pixbuf to an YUV picture frame

Parameters
pixbufthe Gdk RGB pixbuf to convert
picturethe AVFrame to store the data
wimage width
himage height

Definition at line 138 of file movie.c.

◆ create_movie()

gboolean create_movie ( glwin * view,
video_options * vopts,
gchar * videofile )

render a movie from the saved animation parameters

Parameters
viewthe target glwin
voptsthe video encoding options
videofilevideo file name

Definition at line 1003 of file movie.c.

◆ fill_image()

void fill_image ( VideoStream * vs,
int width,
int height,
glwin * view )

render an image from an OpenGL rendering

Parameters
vsthe video stream
widthimage width
heightimage height
viewthe target glwin

Definition at line 273 of file movie.c.

◆ init_frame_buffer()

void init_frame_buffer ( int x,
int y )

init a frame buffer

Parameters
xx size - image width
yy size - image height

Definition at line 1178 of file movie.c.

◆ run_save_movie()

G_MODULE_EXPORT void run_save_movie ( GtkDialog * info,
gint response_id,
gpointer data )

saving a movie - running the dialog

Parameters
infothe GtkDialog sending the signal
response_idthe response id
datathe associated data pointer

Definition at line 1236 of file movie.c.

◆ save_movie()

void save_movie ( glwin * view,
video_options * vopts )

saving a movie - prepare the dialog

Parameters
viewthe target glwin
voptsthe video encoding options

Definition at line 1291 of file movie.c.

◆ set_old_cmap()

void set_old_cmap ( image * img,
int stp,
int id )

preserve color map information

Parameters
imgthe target image
stpMD step
idcolor map id (0 = atom(s), 1 = polyhedra)

Definition at line 504 of file movie.c.

Variable Documentation

◆ codec_id

int codec_id[VIDEO_CODECS]
Initial value:
= {CODEC_ID_MPEG2VIDEO,
CODEC_ID_MPEG4,
CODEC_ID_H264,
CODEC_ID_THEORA,
CODEC_ID_FLV1}

Definition at line 109 of file movie.c.

◆ codec_list

char* codec_list[VIDEO_CODECS]
Initial value:
= {"mpeg",
"avi",
"mkv",
"ogv",
"flv"}

Definition at line 96 of file movie.c.

◆ codec_name

char* codec_name[VIDEO_CODECS]
Initial value:
= {"MPEG-1/2",
"MPEG-4",
"H264",
"Theora",
"Flash"}

Definition at line 90 of file movie.c.

◆ encoding_pb

GtkWidget* encoding_pb
extern

Definition at line 266 of file w_encode.c.

◆ frame_start

int frame_start

Definition at line 126 of file movie.c.

◆ num_frames

int num_frames

Definition at line 125 of file movie.c.

◆ old_cmap

int* old_cmap[2]

Definition at line 493 of file movie.c.

◆ pixbuf

GdkPixbuf* pixbuf

Definition at line 122 of file movie.c.

◆ video_outbuf

uint8_t* video_outbuf

Definition at line 123 of file movie.c.

◆ video_outbuf_size

int video_outbuf_size

Definition at line 124 of file movie.c.