summaryrefslogtreecommitdiff
path: root/src/dxr3/dxr3_mpeg_encoders.c
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-05-25 18:36:51 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-05-25 18:36:51 +0000
commit753923ca99019885a2290f25aa0234f7d75a51d4 (patch)
treef9df014793dbb7ef56832aa391b12bc252598645 /src/dxr3/dxr3_mpeg_encoders.c
parent8a964239cdbe666e012774c0cd30859579319cf1 (diff)
downloadxine-lib-753923ca99019885a2290f25aa0234f7d75a51d4.tar.gz
xine-lib-753923ca99019885a2290f25aa0234f7d75a51d4.tar.bz2
enable the new libavcodec MPEG encoder and make it the default, because
it works without any additionally installed libraries CVS patchset: 4931 CVS date: 2003/05/25 18:36:51
Diffstat (limited to 'src/dxr3/dxr3_mpeg_encoders.c')
-rw-r--r--src/dxr3/dxr3_mpeg_encoders.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c
index 00a1dc2dc..109853c35 100644
--- a/src/dxr3/dxr3_mpeg_encoders.c
+++ b/src/dxr3/dxr3_mpeg_encoders.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2001 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a unix video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dxr3_mpeg_encoders.c,v 1.10 2002/10/26 14:35:04 mroi Exp $
+ * $Id: dxr3_mpeg_encoders.c,v 1.11 2003/05/25 18:36:51 mroi Exp $
*/
/* mpeg encoders for the dxr3 video out plugin.
@@ -41,6 +41,7 @@
#include <stdlib.h>
#include <sys/ioctl.h>
#include <string.h>
+#include <dlfcn.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
@@ -106,6 +107,12 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv,
dxr3_frame_t *frame);
#endif
+/* initialization function */
+int dxr3_lavc_init(dxr3_driver_t *drv, plugin_node_t *node);
+
+/* close function from encoder api */
+static int lavc_on_close(dxr3_driver_t *drv);
+
#ifdef HAVE_LIBRTE
int dxr3_rte_init(dxr3_driver_t *drv)
@@ -572,3 +579,33 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_
return 1;
}
#endif
+
+
+int dxr3_lavc_init(dxr3_driver_t *drv, plugin_node_t *node)
+{
+ void *ffmpeg;
+ int (*init)(dxr3_driver_t *);
+ int result;
+
+ ffmpeg = dlopen(node->filename, RTLD_LAZY);
+ if (!ffmpeg) return 0;
+
+ init = dlsym(ffmpeg, "dxr3_encoder_init");
+ if (!init) return 0;
+
+ result = init(drv);
+ /* the close function is implemented here, because it will call dlclose()
+ * and that should not be done be the library we are closing... */
+ drv->enc->on_close = lavc_on_close;
+ drv->enc->handle = ffmpeg;
+ return result;
+}
+
+static int lavc_on_close(dxr3_driver_t *drv)
+{
+ drv->enc->on_unneeded(drv);
+ dlclose(drv->enc->handle);
+ free(drv->enc);
+ drv->enc = NULL;
+ return 1;
+}