diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-07-29 11:59:09 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-07-29 11:59:09 +0000 |
commit | 833a8b579b03c478de72f1d5e8aafb9b369380bd (patch) | |
tree | 27b9c58ca9173b3f8af52260cd2c96dbcbaf3f75 /ext/xvid/gstxvid.c | |
parent | 0e115bc63918feb9973b10fd5066bae101a3113b (diff) | |
download | gst-plugins-bad-833a8b579b03c478de72f1d5e8aafb9b369380bd.tar.gz gst-plugins-bad-833a8b579b03c478de72f1d5e8aafb9b369380bd.tar.bz2 gst-plugins-bad-833a8b579b03c478de72f1d5e8aafb9b369380bd.zip |
call xvid_init() only once, and move duplicated code into one place
Original commit message from CVS:
call xvid_init() only once, and move duplicated code into one place
Diffstat (limited to 'ext/xvid/gstxvid.c')
-rw-r--r-- | ext/xvid/gstxvid.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c index fb7d06f4..8496a9d4 100644 --- a/ext/xvid/gstxvid.c +++ b/ext/xvid/gstxvid.c @@ -26,6 +26,38 @@ #include "gstxviddec.h" #include "gstxvidenc.h" +gboolean +gst_xvid_init (void) +{ + XVID_INIT_PARAM xinit; + gint ret; + static gboolean is_init = FALSE; + + /* only init once */ + if (is_init == TRUE) { + return TRUE; + } + + /* set up xvid initially (function pointers, CPU flags) */ + memset(&xinit, 0, sizeof(XVID_INIT_PARAM)); + xinit.cpu_flags = 0; + if ((ret = xvid_init(NULL, 0, &xinit, NULL)) != XVID_ERR_OK) { + g_warning("Failed to initialize XviD: %s (%d)", + gst_xvid_error(ret), ret); + return FALSE; + } + + if (xinit.api_version != API_VERSION) { + g_warning("Xvid API version mismatch! %d.%d (that's us) != %d.%d (lib)", + (API_VERSION >> 8) & 0xff, API_VERSION & 0xff, + (xinit.api_version >> 8) & 0xff, xinit.api_version & 0xff); + return FALSE; + } + + is_init = TRUE; + return TRUE; +} + gchar * gst_xvid_error (int errorcode) { |