simage  1.8.3
Coin3D texture image library
Loading...
Searching...
No Matches
movie.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include <simage.h>
#include <simage_private.h>
#include <string.h>
#include "../mpeg2enc/api.h"

Data Structures

struct  simage_movie_exporter
 
struct  simage_movie_importer
 
struct  simage_movie_s
 

Functions

static void add_internal_exporters (void)
 
static void add_internal_importers (void)
 
void s_movie_close (s_movie *movie)
 
s_movies_movie_create (const char *filename, s_params *params)
 
void s_movie_destroy (s_movie *movie)
 
void s_movie_exporter_add (s_movie_create_func *create, s_movie_put_func *put, s_movie_close_func *close)
 
s_images_movie_get_image (s_movie *movie, s_image *prealloc, s_params *params)
 
void s_movie_importer_add (s_movie_open_func *open, s_movie_get_func *get, s_movie_close_func *close)
 
s_movies_movie_open (const char *filename)
 
s_paramss_movie_params (s_movie *movie)
 
int s_movie_put_image (s_movie *movie, s_image *image, s_params *params)
 

Variables

static struct simage_movie_exporterexporters
 
static struct simage_movie_importerimporters
 

Function Documentation

◆ add_internal_exporters()

static void add_internal_exporters ( void )
static

◆ add_internal_importers()

static void add_internal_importers ( void )
static

◆ s_movie_close()

void s_movie_close ( s_movie * movie)

Closes the newly created movie file.

◆ s_movie_create()

s_movie * s_movie_create ( const char * filename,
s_params * params )

Will create a new move file named filename and attempt to locate a suitable encoder based on the parameters ( params ) supplied.

Returns a pointer to the opened movie on success, NULL on failure

Common parameters:

  • "mime-type" <string> : The requested encoder type. There are currently 2 encoders available, with mime-types "video/mpeg" and "video/avi".
  • width <int> : Frame width (all input images must have this width)
  • height <int> : Frame height (all input images must have this height)

Parameters specific for the AVI encoder

  • fps <int> : Number of frames per second in output file
  • parameter file <int> : If this parameter is missing (or empty ""), a GUI will pop up each time this functions is run, asking the user to specify compression settings. If a filename is specified and the file doesn't exist, a GUI pops up, and the compression settings are saved in a new file with the specified filename. If the file exists, no GUI pops up, and the compression settings are read from the file. The format of the file is unspecified, and copying such a file between different computers probably won't work.
  • width and height must be divisible by 4

◆ s_movie_destroy()

void s_movie_destroy ( s_movie * movie)

Cleans up all resources allocated by "<s_movie_create>"(...)

◆ s_movie_exporter_add()

void s_movie_exporter_add ( s_movie_create_func * create,
s_movie_put_func * put,
s_movie_close_func * close )

◆ s_movie_get_image()

s_image * s_movie_get_image ( s_movie * movie,
s_image * prealloc,
s_params * params )

◆ s_movie_importer_add()

void s_movie_importer_add ( s_movie_open_func * open,
s_movie_get_func * get,
s_movie_close_func * close )

◆ s_movie_open()

s_movie * s_movie_open ( const char * filename)

◆ s_movie_params()

s_params * s_movie_params ( s_movie * movie)

◆ s_movie_put_image()

int s_movie_put_image ( s_movie * movie,
s_image * image,
s_params * params )

Adds (encodes) the image as one frame to the movie. params is currently used only for optimizing AVI encoding: - "allow image modification" <int> : Set to "1" to allow the encoder to modify the image buffer. If this parameter is not set, the encoder will make a local copy of the image before it is encoded.

Example code:

s_params *imgparams = s_params_create();
s_params_set(imgparams,
"allow image modification", S_INTEGER_PARAM_TYPE, 1,
NULL);
for(;;) {
s_image_set(image, width, height, 1, <get image from somewhere>);
for (int i=0; i<repeatCount;i++)
s_movie_put_image(movie, image, imgparams);
}
s_params_destroy(imgparams);
int s_movie_put_image(s_movie *movie, s_image *image, s_params *params)
Definition movie.c:169
void s_params_destroy(s_params *params)
Definition params.c:57
s_params * s_params_create(void)
Definition params.c:49
void s_params_set(s_params *params,...)
Definition params.c:187
void s_image_set(s_image *image, int w, int h, int components, unsigned char *data, int copydata)
Definition simage12.c:126
@ S_INTEGER_PARAM_TYPE
Definition simage.h:385
Definition params.c:44

Returns 1 on success, 0 on failure

Variable Documentation

◆ exporters

struct simage_movie_exporter* exporters
static

◆ importers

struct simage_movie_importer* importers
static