summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2002-10-23 02:13:51 +0000
committerMike Melanson <mike@multimedia.cx>2002-10-23 02:13:51 +0000
commit1481276ea7c9b6c3e04911ab5a2003d00a5b46da (patch)
tree29024f44dd179166b723317df47228e151da8d50
parentb903701ebe8b14bd03b09e7edb344f761397fe48 (diff)
downloadxine-lib-1481276ea7c9b6c3e04911ab5a2003d00a5b46da.tar.gz
xine-lib-1481276ea7c9b6c3e04911ab5a2003d00a5b46da.tar.bz2
bring the Id CIN video decoder in line with the latest API revision
CVS patchset: 2947 CVS date: 2002/10/23 02:13:51
-rw-r--r--src/libxinevdec/idcinvideo.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/libxinevdec/idcinvideo.c b/src/libxinevdec/idcinvideo.c
index af763b015..2ada636dd 100644
--- a/src/libxinevdec/idcinvideo.c
+++ b/src/libxinevdec/idcinvideo.c
@@ -21,7 +21,7 @@
* the Id CIN format, visit:
* http://www.csse.monash.edu.au/~timf/
*
- * $Id: idcinvideo.c,v 1.5 2002/09/05 22:19:02 mroi Exp $
+ * $Id: idcinvideo.c,v 1.6 2002/10/23 02:13:51 tmmm Exp $
*/
#include <stdio.h>
@@ -38,11 +38,17 @@
#define VIDEOBUFSIZE 128*1024
+typedef struct {
+ video_decoder_class_t decoder_class;
+} idcinvideo_class_t;
+
typedef struct idcinvideo_decoder_s {
video_decoder_t video_decoder; /* parent video decoder structure */
+ idcinvideo_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;
@@ -196,22 +202,6 @@ void huff_build_tree(int prev) {
*************************************************************************/
/*
- * 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 idcinvideo_init (video_decoder_t *this_gen,
- vo_instance_t *video_out) {
- idcinvideo_decoder_t *this = (idcinvideo_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.
*/
@@ -256,7 +246,7 @@ static void idcinvideo_decode_data (video_decoder_t *this_gen,
}
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);
@@ -271,7 +261,7 @@ static void idcinvideo_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;
init_yuv_planes(&this->yuv_planes, this->width, this->height);
@@ -293,7 +283,7 @@ static void idcinvideo_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,
42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS);
@@ -341,11 +331,10 @@ static void idcinvideo_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 idcinvideo_close (video_decoder_t *this_gen) {
+static void idcinvideo_dispose (video_decoder_t *this_gen) {
+
idcinvideo_decoder_t *this = (idcinvideo_decoder_t *) this_gen;
if (this->buf) {
@@ -355,46 +344,57 @@ static void idcinvideo_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 *idcinvideo_get_id(void) {
- return "Id CIN Video";
-}
-/*
- * This function frees the video decoder instance allocated to the decoder.
- */
-static void idcinvideo_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) {
- idcinvideo_decoder_t *this ;
+ idcinvideo_decoder_t *this ;
- this = (idcinvideo_decoder_t *) malloc (sizeof (idcinvideo_decoder_t));
- memset(this, 0, sizeof (idcinvideo_decoder_t));
+ this = (idcinvideo_decoder_t *) xine_xmalloc (sizeof (idcinvideo_decoder_t));
- this->video_decoder.init = idcinvideo_init;
this->video_decoder.decode_data = idcinvideo_decode_data;
this->video_decoder.flush = idcinvideo_flush;
this->video_decoder.reset = idcinvideo_reset;
- this->video_decoder.close = idcinvideo_close;
- this->video_decoder.get_identifier = idcinvideo_get_id;
this->video_decoder.dispose = idcinvideo_dispose;
+ this->size = 0;
+
+ this->stream = stream;
+ this->class = (idcinvideo_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 "Id CIN Video";
+}
+
+static char *get_description (video_decoder_class_t *this) {
+ return "Id Quake II Cinematic video decoder plugin";
+}
+
+static void dispose_class (video_decoder_class_t *this) {
+ free (this);
+}
+
+static void *init_plugin (xine_t *xine, void *data) {
+
+ idcinvideo_class_t *this;
+
+ this = (idcinvideo_class_t *) xine_xmalloc (sizeof (idcinvideo_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 (video_decoder_t *) this;
+ return this;
}
/* plugin catalog information */
@@ -402,11 +402,11 @@ static uint32_t supported_types[] = { BUF_VIDEO_IDCIN, 0 };
static decoder_info_t video_decoder_info = {
supported_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, "Id CIN Video", XINE_VERSION_CODE, &video_decoder_info, &init_video_decoder_plugin },
+ { PLUGIN_VIDEO_DECODER, 11, "idcinvideo", XINE_VERSION_CODE, &video_decoder_info, &init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};