M1 Movie Library

Functions:

movie_create
movie_open
movie_close
movie_get_info
movie_set_raw_info
movie_put_frame
movie_get_frame
movie_raw_get_frame_time
movie_search
movie_remove
Other functions

The Cheops Movie library provides a system for storing data on the M1 Module, organized for easy retrieval. The Movie library assumes the M1 Malloc system is being used to allocate and deallocate the actual memory used for storage of data, it merely provides a way of storing an index into the data and information about it. A movie stored using this library will remain resident until power is removed (it IS volatile memory, after all !) or the directory structure is reformatted. Magic7 reboots don't affect data stored using the movie library.

The data structures and function prototypes described herein are defined in ${CHEOPS_BASE}/local/include/cheops_movie.h, and are installed as libcheops_movie.a (-lcheops_movie link flag).

Several of the movie library functions are provided with command line interfaces by utility programs. The movie directory, along with the M1 malloc memory allocation structures, are initialized by the m1format command. It should be done once after power-up, but not necessarily at each restart of the Magic7 operating system. The ability to load a datfile into a movie is given by m1load. m1ls allows you to list them, and m1rm can be used to remove them.

Movie Creation, Opening and Closing

The Movie library currently supports raw two dimensional frames of data, as well as simple structured video objects, but can easily be used with or extended to support any data structure desired. The movie library may only be used to store the data object descriptor, or it may support a finer granularity of access in the case of supported movie types (such as raw two-d frames or structured video objects.)

Movies are initially referenced by a name, or character string of up to MAX_MOVIE_NAME characters. movie_open() is used to take a movie name, find it, and return the movie index (similar to a UNIX stdio file index) used by the remainder of the movie library functions.

When a movie is created, using movie_create(), a descriptive data structure is provided. If this data structure corresponds to a known movie type, appropriate auxiliary data structures (such as that required to store information about each frame in the raw movie mode) will be created as well. Other functions that are not specific to an individual movie type are: movie_open(), movie_close(), and movie_get_info()


movie_create

Arguments

Returns int

This function should be called if a new movie is being created for writing. It takes a partially filled movie_desc structure (containing information about the movie), and creates an entry for it in the directory on the indicated M1 module. It returns a movie index for referencing the movie (i.e. it creates the movie then opens it for you.)

The following fields of the movie_desc structure should be initialized before calling this routine :

No additional fields are required if the movie format is MOVIE_OBJ_FORMAT. If the movie format is MOVIE_RAW_FORMAT, the following fields should also be initialized :


movie_open

Arguments

Returns int

This function opens a movie that already exists, and returns a convenient index referencing it. The movie directory, if present, on each M1 module in a system is searched looking for exact matches to the movie name.


movie_close

Arguments

Returns int

This function should be called when you no longer want to access a movie. It releases all local memory used to cache data structures of the open movie, and updates the state of the movie.


Modifying and Reading a Movie

These are the functions that provide access to an individual dataset in a movie object. With the exception of movie_get_info(), these functions don't necessarily work for all movie formats, just the subset known as common fragged objects. This includes both MOVIE_RAW_FORMAT and MOVIE_OBJ_FORMAT movies.


movie_get_info

Arguments

Returns movie_obj_desc *

This [fast] function returns a pointer to the cached copy of the movie_desc structure for an open movie.


movie_set_raw_info

Arguments

Returns int

This function takes a pointer to a MOVIE_RAW_FORMAT movie_desc structure, such as that returned by movie_get_info() call, and modifies most of the indexed movie descriptor to match it. The fields NOT modified are:


movie_put_frame

Arguments

Returns int

This function copies the data in the struct passed as an argument into the movie's data structure. The common_view_desc struct must be completely initialized for the appropriate movie type.


movie_get_frame

Arguments

Returns int

This function fills the structure pointed to by new_frame with information about a particular frame of data (such as pointers to the data buffers.)


movie_raw_get_frame_time

Arguments

Returns stream_time

This [fast] function returns the stream time of a particular frame in a MOVIE_RAW_FORMAT movie. No error checking is done !


movie_search

Arguments

Returns int

This function searches all M1 cards for a movie with the indicated name plus an optional suffix. If multiple versions of a movie are found, the movie_name string is altered to reflect the name of the latest version.


movie_remove

Arguments

Returns int

This function takes an object name, and "deletes" it from the M1 card. It currently only removes it from the movie directory structure. Eventually it will free up the memory used as well !


There are other movie library functions, whose use is generally limited either to a single utility program or to Norman, which aren't described here.


Jump to
Software Tools
Jump to the Cheops Homepage
cheops-web@media.mit.edu
This is a "fix it yourself" page, located at ${CHEOPS_BASE}/WWW/software/movie.html