diff options
Diffstat (limited to 'src/libxinevdec/fli.c')
-rw-r--r-- | src/libxinevdec/fli.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c index 9cf7a9142..47cb8028d 100644 --- a/src/libxinevdec/fli.c +++ b/src/libxinevdec/fli.c @@ -23,7 +23,7 @@ * avoid when implementing a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: fli.c,v 1.7 2002/10/06 03:48:13 komadori Exp $ + * $Id: fli.c,v 1.8 2002/10/23 03:21:20 tmmm Exp $ */ #include <stdio.h> @@ -55,11 +55,17 @@ * fli specific decode functions *************************************************************************/ +typedef struct { + video_decoder_class_t decoder_class; +} fli_class_t; + typedef struct fli_decoder_s { video_decoder_t video_decoder; /* parent video decoder structure */ + fli_class_t *class; + xine_stream_t *stream; + /* these are traditional variables in a video decoder object */ - vo_instance_t *video_out; /* object that will receive frames */ uint64_t video_step; /* frame duration in pts units */ int decoder_ok; /* current decoder status */ int skipframes; @@ -401,22 +407,6 @@ void decode_fli_frame(fli_decoder_t *this) { *************************************************************************/ /* - * This function is responsible is called to initialize the video decoder - * for use. Initialization usually involves setting up the fields in your - * private video decoder object. - */ -static void fli_init (video_decoder_t *this_gen, - vo_instance_t *video_out) { - fli_decoder_t *this = (fli_decoder_t *) this_gen; - - /* set our own video_out object to the one that xine gives us */ - this->video_out = video_out; - - /* indicate that the decoder is not quite ready yet */ - this->decoder_ok = 0; -} - -/* * This function receives a buffer of data from the demuxer layer and * figures out how to handle it based on its header flags. */ @@ -431,7 +421,7 @@ static void fli_decode_data (video_decoder_t *this_gen, return; if (buf->decoder_flags & BUF_FLAG_HEADER) { /* need to initialize */ - this->video_out->open (this->video_out); + this->stream->video_out->open (this->stream->video_out); if(this->buf) free(this->buf); @@ -449,7 +439,7 @@ static void fli_decode_data (video_decoder_t *this_gen, this->buf = malloc(this->bufsize); this->size = 0; - this->video_out->open (this->video_out); + this->stream->video_out->open (this->stream->video_out); this->decoder_ok = 1; return; @@ -469,7 +459,7 @@ static void fli_decode_data (video_decoder_t *this_gen, if (buf->decoder_flags & BUF_FLAG_FRAME_END) { - img = this->video_out->get_frame (this->video_out, + img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -517,11 +507,10 @@ static void fli_reset (video_decoder_t *this_gen) { } /* - * This function is called when xine shuts down the decoder. It should - * free any memory and release any other resources allocated during the - * execution of the decoder. + * This function frees the video decoder instance allocated to the decoder. */ -static void fli_close (video_decoder_t *this_gen) { +static void fli_dispose (video_decoder_t *this_gen) { + fli_decoder_t *this = (fli_decoder_t *) this_gen; if (this->buf) { @@ -534,44 +523,55 @@ static void fli_close (video_decoder_t *this_gen) { if (this->decoder_ok) { this->decoder_ok = 0; - this->video_out->close(this->video_out); + this->stream->video_out->close(this->stream->video_out); } -} - -/* - * This function returns the human-readable ID string to identify - * this decoder. - */ -static char *fli_get_id(void) { - return "FLI Video"; -} -/* - * This function frees the video decoder instance allocated to the decoder. - */ -static void fli_dispose (video_decoder_t *this_gen) { free (this_gen); } -/* - * This function should be the plugin's only advertised function to the - * outside world. It allows xine to query the plugin module for the addresses - * to the necessary functions in the video decoder object. - */ -static void *init_video_decoder_plugin (xine_t *xine, void *data) { +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { - fli_decoder_t *this ; + fli_decoder_t *this ; - this = (fli_decoder_t *) malloc (sizeof (fli_decoder_t)); - memset(this, 0, sizeof (fli_decoder_t)); + this = (fli_decoder_t *) xine_xmalloc (sizeof (fli_decoder_t)); - this->video_decoder.init = fli_init; this->video_decoder.decode_data = fli_decode_data; this->video_decoder.flush = fli_flush; this->video_decoder.reset = fli_reset; - this->video_decoder.close = fli_close; - this->video_decoder.get_identifier = fli_get_id; this->video_decoder.dispose = fli_dispose; + this->size = 0; + + this->stream = stream; + this->class = (fli_class_t *) class_gen; + + this->decoder_ok = 0; + this->buf = NULL; + + return &this->video_decoder; +} + +static char *get_identifier (video_decoder_class_t *this) { + return "FLI Video"; +} + +static char *get_description (video_decoder_class_t *this) { + return "Autodesk Animator FLI/FLC video decoder plugin"; +} + +static void dispose_class (video_decoder_class_t *this) { + free (this); +} + +static void *init_plugin (xine_t *xine, void *data) { + + fli_class_t *this; + + this = (fli_class_t *) xine_xmalloc (sizeof (fli_class_t)); + + this->decoder_class.open_plugin = open_plugin; + this->decoder_class.get_identifier = get_identifier; + this->decoder_class.get_description = get_description; + this->decoder_class.dispose = dispose_class; return this; } @@ -587,12 +587,12 @@ static uint32_t video_types[] = { static decoder_info_t dec_info_video = { video_types, /* supported types */ - 1 /* priority */ + 5 /* priority */ }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 10, "fli", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_VIDEO_DECODER, 11, "fli", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |