mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:06:12 +00:00
gst/real/: Improved search algorithm for location of real .so files.
Original commit message from CVS: reviewed by: Edward Hervey <bilboed@bilboed.com> * gst/real/gstreal.c: (plugin_init): * gst/real/gstrealaudiodec.c: (gst_real_audio_dec_setcaps), (gst_real_audio_dec_finalize), (gst_real_audio_dec_set_property), (gst_real_audio_dec_get_property), (gst_real_audio_dec_class_init): * gst/real/gstrealvideodec.c: (open_library), (gst_real_video_dec_finalize), (gst_real_video_dec_set_property), (gst_real_video_dec_get_property), (gst_real_video_dec_class_init): * gst/real/gstrealvideodec.h: Improved search algorithm for location of real .so files. Fixes #393461
This commit is contained in:
parent
48ca19fbd6
commit
2a8bc6a2e1
5 changed files with 248 additions and 202 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2007-07-24 Hans de Goede <j.w.r.degoede@hhs.nl>
|
||||||
|
|
||||||
|
reviewed by: Edward Hervey <bilboed@bilboed.com>
|
||||||
|
|
||||||
|
* gst/real/gstreal.c: (plugin_init):
|
||||||
|
* gst/real/gstrealaudiodec.c: (gst_real_audio_dec_setcaps),
|
||||||
|
(gst_real_audio_dec_finalize), (gst_real_audio_dec_set_property),
|
||||||
|
(gst_real_audio_dec_get_property), (gst_real_audio_dec_class_init):
|
||||||
|
* gst/real/gstrealvideodec.c: (open_library),
|
||||||
|
(gst_real_video_dec_finalize), (gst_real_video_dec_set_property),
|
||||||
|
(gst_real_video_dec_get_property), (gst_real_video_dec_class_init):
|
||||||
|
* gst/real/gstrealvideodec.h:
|
||||||
|
Improved search algorithm for location of real .so files.
|
||||||
|
Fixes #393461
|
||||||
|
|
||||||
2007-07-24 Sebastian Dröge <slomo@circular-chaos.org>
|
2007-07-24 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -31,7 +31,7 @@ plugin_init (GstPlugin * p)
|
||||||
if (!gst_element_register (p, "realvideodec", GST_RANK_PRIMARY,
|
if (!gst_element_register (p, "realvideodec", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_REAL_VIDEO_DEC))
|
GST_TYPE_REAL_VIDEO_DEC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!gst_element_register (p, "realaudiodec", GST_RANK_PRIMARY,
|
if (!gst_element_register (p, "realaudiodec", GST_RANK_SECONDARY,
|
||||||
GST_TYPE_REAL_AUDIO_DEC))
|
GST_TYPE_REAL_AUDIO_DEC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstreal.h"
|
||||||
#include "gstrealaudiodec.h"
|
#include "gstrealaudiodec.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -45,28 +46,22 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||||
"depth = (int) [ 1, MAX ], "
|
"depth = (int) [ 1, MAX ], "
|
||||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
|
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
|
||||||
|
|
||||||
#ifdef HAVE_CPU_I386
|
#define DEFAULT_RACOOK_NAMES "cook.so:cook.so.6.0"
|
||||||
#define DEFAULT_PATH "/usr/lib/win32/"
|
#define DEFAULT_RAATRK_NAMES "atrc.so:atrc.so.6.0"
|
||||||
#endif
|
#define DEFAULT_RA14_4_NAMES "14_4.so.6.0"
|
||||||
#ifdef HAVE_CPU_X86_64
|
#define DEFAULT_RA28_8_NAMES "28_8.so.6.0"
|
||||||
#define DEFAULT_PATH "/usr/lib/"
|
#define DEFAULT_RASIPR_NAMES "sipr.so:sipr.so.6.0"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_PATH_RACOOK DEFAULT_PATH "cook.so.6.0"
|
|
||||||
#define DEFAULT_PATH_RAATRK DEFAULT_PATH "atrk.so.6.0"
|
|
||||||
#define DEFAULT_PATH_RA14_4 DEFAULT_PATH "14_4.so.6.0"
|
|
||||||
#define DEFAULT_PATH_RA28_8 DEFAULT_PATH "28_8.so.6.0"
|
|
||||||
#define DEFAULT_PATH_RASIPR DEFAULT_PATH "sipr.so.6.0"
|
|
||||||
#define DEFAULT_PWD "Ardubancel Quazanga"
|
#define DEFAULT_PWD "Ardubancel Quazanga"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_PATH_RACOOK,
|
PROP_REAL_CODECS_PATH,
|
||||||
PROP_PATH_RAATRK,
|
PROP_RACOOK_NAMES,
|
||||||
PROP_PATH_RA14_4,
|
PROP_RAATRK_NAMES,
|
||||||
PROP_PATH_RA28_8,
|
PROP_RA14_4_NAMES,
|
||||||
PROP_PATH_RASIPR,
|
PROP_RA28_8_NAMES,
|
||||||
|
PROP_RASIPR_NAMES,
|
||||||
PROP_PASSWORD
|
PROP_PASSWORD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,7 +116,8 @@ struct _GstRealAudioDec
|
||||||
gpointer context;
|
gpointer context;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
gchar *path_racook, *path_raatrk, *path_ra14_4, *path_ra28_8, *path_rasipr;
|
gchar *real_codecs_path, *racook_names, *raatrk_names, *ra14_4_names,
|
||||||
|
*ra28_8_names, *rasipr_names;
|
||||||
gchar *pwd;
|
gchar *pwd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,7 +192,8 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
gpointer ra_close_codec, ra_decode, ra_free_decoder;
|
gpointer ra_close_codec, ra_decode, ra_free_decoder;
|
||||||
gpointer ra_open_codec2, ra_init_decoder, ra_set_flavor;
|
gpointer ra_open_codec2, ra_init_decoder, ra_set_flavor;
|
||||||
gpointer set_dll_access_path = NULL, ra_set_pwd = NULL;
|
gpointer set_dll_access_path = NULL, ra_set_pwd = NULL;
|
||||||
gchar *path;
|
gchar *path, *names;
|
||||||
|
gchar **split_names, **split_path;
|
||||||
gint version, flavor, channels, rate, leaf_size, packet_size, width, height;
|
gint version, flavor, channels, rate, leaf_size, packet_size, width, height;
|
||||||
guint16 res;
|
guint16 res;
|
||||||
RAInit data;
|
RAInit data;
|
||||||
|
@ -204,9 +201,10 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
const GValue *v;
|
const GValue *v;
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
const gchar *name = gst_structure_get_name (s);
|
const gchar *name = gst_structure_get_name (s);
|
||||||
GModule *module;
|
GModule *module = NULL;
|
||||||
gpointer context = NULL;
|
gpointer context = NULL;
|
||||||
RealFunctions funcs = { NULL, };
|
RealFunctions funcs = { NULL, };
|
||||||
|
int i, j;
|
||||||
|
|
||||||
if (!strcmp (name, "audio/x-sipro"))
|
if (!strcmp (name, "audio/x-sipro"))
|
||||||
version = GST_REAL_AUDIO_DEC_VERSION_SIPR;
|
version = GST_REAL_AUDIO_DEC_VERSION_SIPR;
|
||||||
|
@ -227,27 +225,46 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
if ((v = gst_structure_get_value (s, "codec_data")))
|
if ((v = gst_structure_get_value (s, "codec_data")))
|
||||||
buf = g_value_peek_pointer (v);
|
buf = g_value_peek_pointer (v);
|
||||||
|
|
||||||
|
path = dec->real_codecs_path ? dec->real_codecs_path :
|
||||||
|
DEFAULT_REAL_CODECS_PATH;
|
||||||
|
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case GST_REAL_AUDIO_DEC_VERSION_COOK:
|
case GST_REAL_AUDIO_DEC_VERSION_COOK:
|
||||||
path = dec->path_racook ? dec->path_racook : DEFAULT_PATH_RACOOK;
|
names = dec->racook_names ? dec->racook_names : DEFAULT_RACOOK_NAMES;
|
||||||
break;
|
break;
|
||||||
case GST_REAL_AUDIO_DEC_VERSION_ATRK:
|
case GST_REAL_AUDIO_DEC_VERSION_ATRK:
|
||||||
path = dec->path_raatrk ? dec->path_raatrk : DEFAULT_PATH_RAATRK;
|
names = dec->raatrk_names ? dec->raatrk_names : DEFAULT_RAATRK_NAMES;
|
||||||
break;
|
break;
|
||||||
case GST_REAL_AUDIO_DEC_VERSION_14_4:
|
case GST_REAL_AUDIO_DEC_VERSION_14_4:
|
||||||
path = dec->path_ra14_4 ? dec->path_ra14_4 : DEFAULT_PATH_RA14_4;
|
names = dec->ra14_4_names ? dec->ra14_4_names : DEFAULT_RA14_4_NAMES;
|
||||||
break;
|
break;
|
||||||
case GST_REAL_AUDIO_DEC_VERSION_28_8:
|
case GST_REAL_AUDIO_DEC_VERSION_28_8:
|
||||||
path = dec->path_ra28_8 ? dec->path_ra28_8 : DEFAULT_PATH_RA28_8;
|
names = dec->ra28_8_names ? dec->ra28_8_names : DEFAULT_RA28_8_NAMES;
|
||||||
break;
|
break;
|
||||||
case GST_REAL_AUDIO_DEC_VERSION_SIPR:
|
case GST_REAL_AUDIO_DEC_VERSION_SIPR:
|
||||||
path = dec->path_rasipr ? dec->path_rasipr : DEFAULT_PATH_RASIPR;
|
names = dec->rasipr_names ? dec->rasipr_names : DEFAULT_RASIPR_NAMES;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto unknown_version;
|
goto unknown_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
split_path = g_strsplit (path, ":", 0);
|
||||||
|
split_names = g_strsplit (names, ":", 0);
|
||||||
|
|
||||||
|
for (i = 0; split_path[i]; i++) {
|
||||||
|
for (j = 0; split_names[j]; j++) {
|
||||||
|
gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
|
||||||
|
|
||||||
|
module = g_module_open (codec, G_MODULE_BIND_LAZY);
|
||||||
|
g_free (codec);
|
||||||
|
if (module)
|
||||||
|
goto codec_search_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
codec_search_done:
|
||||||
|
/* we keep the path for a while to set the dll access path */
|
||||||
|
g_strfreev (split_names);
|
||||||
|
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
goto could_not_open;
|
goto could_not_open;
|
||||||
|
@ -262,9 +279,7 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_module_symbol (module, "RASetPwd", &ra_set_pwd);
|
g_module_symbol (module, "RASetPwd", &ra_set_pwd);
|
||||||
|
g_module_symbol (module, "SetDLLAccessPath", &set_dll_access_path);
|
||||||
if (g_module_symbol (module, "SetDLLAccessPath", &set_dll_access_path))
|
|
||||||
funcs.SetDLLAccessPath (DEFAULT_PATH);
|
|
||||||
|
|
||||||
funcs.RACloseCodec = ra_close_codec;
|
funcs.RACloseCodec = ra_close_codec;
|
||||||
funcs.RADecode = ra_decode;
|
funcs.RADecode = ra_decode;
|
||||||
|
@ -275,6 +290,12 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
funcs.RASetPwd = ra_set_pwd;
|
funcs.RASetPwd = ra_set_pwd;
|
||||||
funcs.SetDLLAccessPath = set_dll_access_path;
|
funcs.SetDLLAccessPath = set_dll_access_path;
|
||||||
|
|
||||||
|
if (funcs.SetDLLAccessPath)
|
||||||
|
funcs.SetDLLAccessPath (split_path[i]);
|
||||||
|
|
||||||
|
/* now we are done with the split paths, so free them */
|
||||||
|
g_strfreev (split_path);
|
||||||
|
|
||||||
if ((res = funcs.RAOpenCodec2 (&context, NULL))) {
|
if ((res = funcs.RAOpenCodec2 (&context, NULL))) {
|
||||||
GST_DEBUG_OBJECT (dec, "RAOpenCodec2() failed");
|
GST_DEBUG_OBJECT (dec, "RAOpenCodec2() failed");
|
||||||
goto could_not_initialize;
|
goto could_not_initialize;
|
||||||
|
@ -306,7 +327,7 @@ gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||||
"width", G_TYPE_INT, width,
|
"width", G_TYPE_INT, width,
|
||||||
"depth", G_TYPE_INT, height,
|
"depth", G_TYPE_INT, width,
|
||||||
"rate", G_TYPE_INT, rate,
|
"rate", G_TYPE_INT, rate,
|
||||||
"channels", G_TYPE_INT, channels, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"channels", G_TYPE_INT, channels, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
bres = gst_pad_set_caps (GST_PAD (dec->src), caps);
|
bres = gst_pad_set_caps (GST_PAD (dec->src), caps);
|
||||||
|
@ -336,11 +357,12 @@ unknown_version:
|
||||||
GST_DEBUG_OBJECT (dec, "Cannot handle version %i.", version);
|
GST_DEBUG_OBJECT (dec, "Cannot handle version %i.", version);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
could_not_open:
|
could_not_open:
|
||||||
GST_DEBUG_OBJECT (dec, "Could not open library '%s': %s", path,
|
g_strfreev (split_path);
|
||||||
g_module_error ());
|
GST_DEBUG_OBJECT (dec, "Could not find library '%s' in '%s'", names, path);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
could_not_load:
|
could_not_load:
|
||||||
g_module_close (module);
|
g_module_close (module);
|
||||||
|
g_strfreev (split_path);
|
||||||
GST_DEBUG_OBJECT (dec, "Could not load all symbols: %s", g_module_error ());
|
GST_DEBUG_OBJECT (dec, "Could not load all symbols: %s", g_module_error ());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
could_not_initialize:
|
could_not_initialize:
|
||||||
|
@ -421,25 +443,29 @@ gst_real_audio_dec_finalize (GObject * object)
|
||||||
dec->module = NULL;
|
dec->module = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dec->path_racook) {
|
if (dec->real_codecs_path) {
|
||||||
g_free (dec->path_racook);
|
g_free (dec->real_codecs_path);
|
||||||
dec->path_racook = NULL;
|
dec->real_codecs_path = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_raatrk) {
|
if (dec->racook_names) {
|
||||||
g_free (dec->path_raatrk);
|
g_free (dec->racook_names);
|
||||||
dec->path_raatrk = NULL;
|
dec->racook_names = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_ra14_4) {
|
if (dec->raatrk_names) {
|
||||||
g_free (dec->path_ra14_4);
|
g_free (dec->raatrk_names);
|
||||||
dec->path_ra14_4 = NULL;
|
dec->raatrk_names = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_ra28_8) {
|
if (dec->ra14_4_names) {
|
||||||
g_free (dec->path_ra28_8);
|
g_free (dec->ra14_4_names);
|
||||||
dec->path_ra28_8 = NULL;
|
dec->ra14_4_names = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_rasipr) {
|
if (dec->ra28_8_names) {
|
||||||
g_free (dec->path_rasipr);
|
g_free (dec->ra28_8_names);
|
||||||
dec->path_rasipr = NULL;
|
dec->ra28_8_names = NULL;
|
||||||
|
}
|
||||||
|
if (dec->rasipr_names) {
|
||||||
|
g_free (dec->rasipr_names);
|
||||||
|
dec->rasipr_names = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
@ -452,30 +478,35 @@ gst_real_audio_dec_set_property (GObject * object, guint prop_id,
|
||||||
GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
|
GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PATH_RACOOK:
|
case PROP_REAL_CODECS_PATH:
|
||||||
if (dec->path_racook)
|
if (dec->real_codecs_path)
|
||||||
g_free (dec->path_racook);
|
g_free (dec->real_codecs_path);
|
||||||
dec->path_racook = g_value_dup_string (value);
|
dec->real_codecs_path = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RAATRK:
|
case PROP_RACOOK_NAMES:
|
||||||
if (dec->path_raatrk)
|
if (dec->racook_names)
|
||||||
g_free (dec->path_raatrk);
|
g_free (dec->racook_names);
|
||||||
dec->path_raatrk = g_value_dup_string (value);
|
dec->racook_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RA14_4:
|
case PROP_RAATRK_NAMES:
|
||||||
if (dec->path_ra14_4)
|
if (dec->raatrk_names)
|
||||||
g_free (dec->path_ra14_4);
|
g_free (dec->raatrk_names);
|
||||||
dec->path_ra14_4 = g_value_dup_string (value);
|
dec->raatrk_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RA28_8:
|
case PROP_RA14_4_NAMES:
|
||||||
if (dec->path_ra28_8)
|
if (dec->ra14_4_names)
|
||||||
g_free (dec->path_ra28_8);
|
g_free (dec->ra14_4_names);
|
||||||
dec->path_ra28_8 = g_value_dup_string (value);
|
dec->ra14_4_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RASIPR:
|
case PROP_RA28_8_NAMES:
|
||||||
if (dec->path_rasipr)
|
if (dec->ra28_8_names)
|
||||||
g_free (dec->path_rasipr);
|
g_free (dec->ra28_8_names);
|
||||||
dec->path_rasipr = g_value_dup_string (value);
|
dec->ra28_8_names = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
case PROP_RASIPR_NAMES:
|
||||||
|
if (dec->rasipr_names)
|
||||||
|
g_free (dec->rasipr_names);
|
||||||
|
dec->rasipr_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PASSWORD:
|
case PROP_PASSWORD:
|
||||||
if (dec->pwd)
|
if (dec->pwd)
|
||||||
|
@ -495,25 +526,29 @@ gst_real_audio_dec_get_property (GObject * object, guint prop_id,
|
||||||
GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
|
GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PATH_RACOOK:
|
case PROP_REAL_CODECS_PATH:
|
||||||
g_value_set_string (value, dec->path_racook ? dec->path_racook :
|
g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
|
||||||
DEFAULT_PATH_RACOOK);
|
: DEFAULT_REAL_CODECS_PATH);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RAATRK:
|
case PROP_RACOOK_NAMES:
|
||||||
g_value_set_string (value, dec->path_raatrk ? dec->path_raatrk :
|
g_value_set_string (value, dec->racook_names ? dec->racook_names :
|
||||||
DEFAULT_PATH_RAATRK);
|
DEFAULT_RACOOK_NAMES);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RA14_4:
|
case PROP_RAATRK_NAMES:
|
||||||
g_value_set_string (value, dec->path_ra14_4 ? dec->path_ra14_4 :
|
g_value_set_string (value, dec->raatrk_names ? dec->raatrk_names :
|
||||||
DEFAULT_PATH_RA14_4);
|
DEFAULT_RAATRK_NAMES);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RA28_8:
|
case PROP_RA14_4_NAMES:
|
||||||
g_value_set_string (value, dec->path_ra28_8 ? dec->path_ra28_8 :
|
g_value_set_string (value, dec->ra14_4_names ? dec->ra14_4_names :
|
||||||
DEFAULT_PATH_RA28_8);
|
DEFAULT_RA14_4_NAMES);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RASIPR:
|
case PROP_RA28_8_NAMES:
|
||||||
g_value_set_string (value, dec->path_rasipr ? dec->path_rasipr :
|
g_value_set_string (value, dec->ra28_8_names ? dec->ra28_8_names :
|
||||||
DEFAULT_PATH_RASIPR);
|
DEFAULT_RA28_8_NAMES);
|
||||||
|
break;
|
||||||
|
case PROP_RASIPR_NAMES:
|
||||||
|
g_value_set_string (value, dec->rasipr_names ? dec->rasipr_names :
|
||||||
|
DEFAULT_RASIPR_NAMES);
|
||||||
break;
|
break;
|
||||||
case PROP_PASSWORD:
|
case PROP_PASSWORD:
|
||||||
g_value_set_string (value, dec->pwd ? dec->pwd : DEFAULT_PWD);
|
g_value_set_string (value, dec->pwd ? dec->pwd : DEFAULT_PWD);
|
||||||
|
@ -536,21 +571,26 @@ gst_real_audio_dec_class_init (GstRealAudioDecClass * klass)
|
||||||
|
|
||||||
element_class->change_state = gst_real_audio_dec_change_state;
|
element_class->change_state = gst_real_audio_dec_change_state;
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RACOOK,
|
g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
|
||||||
g_param_spec_string ("path_racook", "Path to cook driver",
|
g_param_spec_string ("real_codecs_path",
|
||||||
"Path to cook driver", DEFAULT_PATH_RACOOK, G_PARAM_READWRITE));
|
"Path where to search for RealPlayer codecs",
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RAATRK,
|
"Path where to search for RealPlayer codecs",
|
||||||
g_param_spec_string ("path_raatrk", "Path to atrk driver",
|
DEFAULT_REAL_CODECS_PATH, G_PARAM_READWRITE));
|
||||||
"Path to atrk driver", DEFAULT_PATH_RAATRK, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RACOOK_NAMES,
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RA14_4,
|
g_param_spec_string ("racook_names", "Names of cook driver",
|
||||||
g_param_spec_string ("path_ra14_4", "Path to 14_4 driver",
|
"Names of cook driver", DEFAULT_RACOOK_NAMES, G_PARAM_READWRITE));
|
||||||
"Path to 14_4 driver", DEFAULT_PATH_RA14_4, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RAATRK_NAMES,
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RA28_8,
|
g_param_spec_string ("raatrk_names", "Names of atrk driver",
|
||||||
g_param_spec_string ("path_ra28_8", "Path to 28_8 driver",
|
"Names of atrk driver", DEFAULT_RAATRK_NAMES, G_PARAM_READWRITE));
|
||||||
"Path to 28_8 driver", DEFAULT_PATH_RA28_8, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RA14_4_NAMES,
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RASIPR,
|
g_param_spec_string ("ra14_4_names", "Names of 14_4 driver",
|
||||||
g_param_spec_string ("path_rasipr", "Path to sipr driver",
|
"Names of 14_4 driver", DEFAULT_RA14_4_NAMES, G_PARAM_READWRITE));
|
||||||
"Path to sipr driver", DEFAULT_PATH_RASIPR, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RA28_8_NAMES,
|
||||||
|
g_param_spec_string ("ra28_8_names", "Names of 28_8 driver",
|
||||||
|
"Names of 28_8 driver", DEFAULT_RA28_8_NAMES, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (object_class, PROP_RASIPR_NAMES,
|
||||||
|
g_param_spec_string ("rasipr_names", "Names of sipr driver",
|
||||||
|
"Names of sipr driver", DEFAULT_RASIPR_NAMES, G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (object_class, PROP_PASSWORD,
|
g_object_class_install_property (object_class, PROP_PASSWORD,
|
||||||
g_param_spec_string ("password", "Password",
|
g_param_spec_string ("password", "Password",
|
||||||
"Password", DEFAULT_PWD, G_PARAM_READWRITE));
|
"Password", DEFAULT_PWD, G_PARAM_READWRITE));
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstreal.h"
|
||||||
#include "gstrealvideodec.h"
|
#include "gstrealvideodec.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -45,23 +46,17 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||||
"framerate = (fraction) [0/1, MAX], "
|
"framerate = (fraction) [0/1, MAX], "
|
||||||
"width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ] "));
|
"width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ] "));
|
||||||
|
|
||||||
#ifdef HAVE_CPU_I386
|
#define DEFAULT_RV20_NAMES "drv2.so:drv2.so.6.0"
|
||||||
#define DEFAULT_PATH_RV20 "/usr/lib/win32/drv2.so.6.0"
|
#define DEFAULT_RV30_NAMES "drvc.so:drv3.so.6.0"
|
||||||
#define DEFAULT_PATH_RV30 "/usr/lib/win32/drv3.so.6.0"
|
#define DEFAULT_RV40_NAMES "drvc.so:drv4.so.6.0"
|
||||||
#define DEFAULT_PATH_RV40 "/usr/lib/win32/drv4.so.6.0"
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_CPU_X86_64
|
|
||||||
#define DEFAULT_PATH_RV20 "/usr/lib/drvc.so"
|
|
||||||
#define DEFAULT_PATH_RV30 "/usr/lib/drvc.so"
|
|
||||||
#define DEFAULT_PATH_RV40 "/usr/lib/drvc.so"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_PATH_RV20,
|
PROP_REAL_CODECS_PATH,
|
||||||
PROP_PATH_RV30,
|
PROP_RV20_NAMES,
|
||||||
PROP_PATH_RV40
|
PROP_RV30_NAMES,
|
||||||
|
PROP_RV40_NAMES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -637,66 +632,52 @@ open_library (GstRealVideoDec * dec, GstRealVideoDecHooks * hooks,
|
||||||
GstRealVideoDecVersion version)
|
GstRealVideoDecVersion version)
|
||||||
{
|
{
|
||||||
gpointer rv_custom_msg, rv_free, rv_init, rv_transform;
|
gpointer rv_custom_msg, rv_free, rv_init, rv_transform;
|
||||||
GModule *module;
|
GModule *module = NULL;
|
||||||
gchar *path = NULL;
|
gchar *path, *names;
|
||||||
|
gchar **split_names, **split_path;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dec,
|
GST_DEBUG_OBJECT (dec,
|
||||||
"Attempting to open shared library for real video version %d", version);
|
"Attempting to open shared library for real video version %d", version);
|
||||||
|
|
||||||
/* FIXME : Search for the correct library in various places if dec->path_rv20
|
path = dec->real_codecs_path ? dec->real_codecs_path :
|
||||||
* isn't set explicitely !
|
DEFAULT_REAL_CODECS_PATH;
|
||||||
* Library names can also be different (ex : drv30.so vs drvc.so)
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case GST_REAL_VIDEO_DEC_VERSION_2:
|
case GST_REAL_VIDEO_DEC_VERSION_2:
|
||||||
{
|
names = dec->rv20_names ? dec->rv20_names : DEFAULT_RV20_NAMES;
|
||||||
if (dec->path_rv20)
|
|
||||||
path = dec->path_rv20;
|
|
||||||
else if (g_file_test (DEFAULT_PATH_RV20, G_FILE_TEST_EXISTS))
|
|
||||||
path = DEFAULT_PATH_RV20;
|
|
||||||
else if (g_file_test ("/usr/lib/drv2.so.6.0", G_FILE_TEST_EXISTS))
|
|
||||||
path = "/usr/lib/drv2.so.6.0";
|
|
||||||
else
|
|
||||||
goto no_known_libraries;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GST_REAL_VIDEO_DEC_VERSION_3:
|
case GST_REAL_VIDEO_DEC_VERSION_3:
|
||||||
{
|
names = dec->rv30_names ? dec->rv30_names : DEFAULT_RV30_NAMES;
|
||||||
if (dec->path_rv30)
|
|
||||||
path = dec->path_rv30;
|
|
||||||
else if (g_file_test (DEFAULT_PATH_RV30, G_FILE_TEST_EXISTS))
|
|
||||||
path = DEFAULT_PATH_RV30;
|
|
||||||
else if (g_file_test ("/usr/lib/drv3.so.6.0", G_FILE_TEST_EXISTS))
|
|
||||||
path = "/usr/lib/drv3.so.6.0";
|
|
||||||
else
|
|
||||||
goto no_known_libraries;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GST_REAL_VIDEO_DEC_VERSION_4:
|
case GST_REAL_VIDEO_DEC_VERSION_4:
|
||||||
{
|
names = dec->rv40_names ? dec->rv40_names : DEFAULT_RV40_NAMES;
|
||||||
if (dec->path_rv40)
|
|
||||||
path = dec->path_rv40;
|
|
||||||
else if (g_file_test (DEFAULT_PATH_RV40, G_FILE_TEST_EXISTS))
|
|
||||||
path = DEFAULT_PATH_RV40;
|
|
||||||
else if (g_file_test ("/usr/lib/drv4.so.6.0", G_FILE_TEST_EXISTS))
|
|
||||||
path = "/usr/lib/drv4.so.6.0";
|
|
||||||
else
|
|
||||||
goto no_known_libraries;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
goto unknown_version;
|
goto unknown_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (dec, "Trying to open '%s'", path);
|
split_path = g_strsplit (path, ":", 0);
|
||||||
hooks->module = g_module_open (path, G_MODULE_BIND_LAZY);
|
split_names = g_strsplit (names, ":", 0);
|
||||||
|
|
||||||
if (hooks->module == NULL)
|
for (i = 0; split_path[i]; i++) {
|
||||||
|
for (j = 0; split_names[j]; j++) {
|
||||||
|
gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
|
||||||
|
|
||||||
|
module = g_module_open (codec, G_MODULE_BIND_LAZY);
|
||||||
|
g_free (codec);
|
||||||
|
if (module)
|
||||||
|
goto codec_search_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
codec_search_done:
|
||||||
|
g_strfreev (split_path);
|
||||||
|
g_strfreev (split_names);
|
||||||
|
|
||||||
|
if (module == NULL)
|
||||||
goto could_not_open;
|
goto could_not_open;
|
||||||
|
|
||||||
module = hooks->module;
|
|
||||||
|
|
||||||
/* First try opening legacy symbols, if that fails try loading new symbols */
|
/* First try opening legacy symbols, if that fails try loading new symbols */
|
||||||
if (g_module_symbol (module, "RV20toYUV420Init", &rv_init) &&
|
if (g_module_symbol (module, "RV20toYUV420Init", &rv_init) &&
|
||||||
g_module_symbol (module, "RV20toYUV420Free", &rv_free) &&
|
g_module_symbol (module, "RV20toYUV420Free", &rv_free) &&
|
||||||
|
@ -716,17 +697,10 @@ open_library (GstRealVideoDec * dec, GstRealVideoDecHooks * hooks,
|
||||||
hooks->free = rv_free;
|
hooks->free = rv_free;
|
||||||
hooks->transform = rv_transform;
|
hooks->transform = rv_transform;
|
||||||
hooks->custom_message = rv_custom_msg;
|
hooks->custom_message = rv_custom_msg;
|
||||||
|
hooks->module = module;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
no_known_libraries:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (dec, LIBRARY, INIT,
|
|
||||||
("Couldn't find a realvideo shared library for version %d",
|
|
||||||
version), (NULL));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
unknown_version:
|
unknown_version:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (dec, "Cannot handle version %i.", version);
|
GST_ERROR_OBJECT (dec, "Cannot handle version %i.", version);
|
||||||
|
@ -735,8 +709,7 @@ unknown_version:
|
||||||
|
|
||||||
could_not_open:
|
could_not_open:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (dec, "Could not open library '%s':%s", path,
|
GST_ERROR_OBJECT (dec, "Could not find library '%s' in '%s'", names, path);
|
||||||
g_module_error ());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,17 +775,21 @@ gst_real_video_dec_finalize (GObject * object)
|
||||||
close_library (dec->hooks);
|
close_library (dec->hooks);
|
||||||
memset (&dec->hooks, 0, sizeof (dec->hooks));
|
memset (&dec->hooks, 0, sizeof (dec->hooks));
|
||||||
|
|
||||||
if (dec->path_rv20) {
|
if (dec->real_codecs_path) {
|
||||||
g_free (dec->path_rv20);
|
g_free (dec->real_codecs_path);
|
||||||
dec->path_rv20 = NULL;
|
dec->real_codecs_path = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_rv30) {
|
if (dec->rv20_names) {
|
||||||
g_free (dec->path_rv30);
|
g_free (dec->rv20_names);
|
||||||
dec->path_rv30 = NULL;
|
dec->rv20_names = NULL;
|
||||||
}
|
}
|
||||||
if (dec->path_rv40) {
|
if (dec->rv30_names) {
|
||||||
g_free (dec->path_rv40);
|
g_free (dec->rv30_names);
|
||||||
dec->path_rv40 = NULL;
|
dec->rv30_names = NULL;
|
||||||
|
}
|
||||||
|
if (dec->rv40_names) {
|
||||||
|
g_free (dec->rv40_names);
|
||||||
|
dec->rv40_names = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
@ -829,20 +806,25 @@ gst_real_video_dec_set_property (GObject * object, guint prop_id,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PATH_RV20:
|
case PROP_REAL_CODECS_PATH:
|
||||||
if (dec->path_rv20)
|
if (dec->real_codecs_path)
|
||||||
g_free (dec->path_rv20);
|
g_free (dec->real_codecs_path);
|
||||||
dec->path_rv20 = g_value_dup_string (value);
|
dec->real_codecs_path = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RV30:
|
case PROP_RV20_NAMES:
|
||||||
if (dec->path_rv30)
|
if (dec->rv20_names)
|
||||||
g_free (dec->path_rv30);
|
g_free (dec->rv20_names);
|
||||||
dec->path_rv30 = g_value_dup_string (value);
|
dec->rv20_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RV40:
|
case PROP_RV30_NAMES:
|
||||||
if (dec->path_rv40)
|
if (dec->rv30_names)
|
||||||
g_free (dec->path_rv40);
|
g_free (dec->rv30_names);
|
||||||
dec->path_rv40 = g_value_dup_string (value);
|
dec->rv30_names = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
case PROP_RV40_NAMES:
|
||||||
|
if (dec->rv40_names)
|
||||||
|
g_free (dec->rv40_names);
|
||||||
|
dec->rv40_names = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -857,17 +839,21 @@ gst_real_video_dec_get_property (GObject * object, guint prop_id,
|
||||||
GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
|
GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PATH_RV20:
|
case PROP_REAL_CODECS_PATH:
|
||||||
g_value_set_string (value, dec->path_rv20 ? dec->path_rv20 :
|
g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
|
||||||
DEFAULT_PATH_RV20);
|
: DEFAULT_REAL_CODECS_PATH);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RV30:
|
case PROP_RV20_NAMES:
|
||||||
g_value_set_string (value, dec->path_rv30 ? dec->path_rv30 :
|
g_value_set_string (value, dec->rv20_names ? dec->rv20_names :
|
||||||
DEFAULT_PATH_RV30);
|
DEFAULT_RV20_NAMES);
|
||||||
break;
|
break;
|
||||||
case PROP_PATH_RV40:
|
case PROP_RV30_NAMES:
|
||||||
g_value_set_string (value, dec->path_rv40 ? dec->path_rv40 :
|
g_value_set_string (value, dec->rv30_names ? dec->rv30_names :
|
||||||
DEFAULT_PATH_RV40);
|
DEFAULT_RV30_NAMES);
|
||||||
|
break;
|
||||||
|
case PROP_RV40_NAMES:
|
||||||
|
g_value_set_string (value, dec->rv40_names ? dec->rv40_names :
|
||||||
|
DEFAULT_RV40_NAMES);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -884,15 +870,20 @@ gst_real_video_dec_class_init (GstRealVideoDecClass * klass)
|
||||||
object_class->get_property = gst_real_video_dec_get_property;
|
object_class->get_property = gst_real_video_dec_get_property;
|
||||||
object_class->finalize = gst_real_video_dec_finalize;
|
object_class->finalize = gst_real_video_dec_finalize;
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RV20,
|
g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
|
||||||
g_param_spec_string ("path_rv20", "Path to rv20 driver",
|
g_param_spec_string ("real_codecs_path",
|
||||||
"Path to rv20 driver", DEFAULT_PATH_RV20, G_PARAM_READWRITE));
|
"Path where to search for RealPlayer codecs",
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RV30,
|
"Path where to search for RealPlayer codecs",
|
||||||
g_param_spec_string ("path_rv30", "Path to rv30 driver",
|
DEFAULT_REAL_CODECS_PATH, G_PARAM_READWRITE));
|
||||||
"Path to rv30 driver", DEFAULT_PATH_RV30, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RV20_NAMES,
|
||||||
g_object_class_install_property (object_class, PROP_PATH_RV40,
|
g_param_spec_string ("rv20_names", "Names of rv20 driver",
|
||||||
g_param_spec_string ("path_rv40", "Path to rv40 driver",
|
"Names of rv20 driver", DEFAULT_RV20_NAMES, G_PARAM_READWRITE));
|
||||||
"Path to rv40 driver", DEFAULT_PATH_RV40, G_PARAM_READWRITE));
|
g_object_class_install_property (object_class, PROP_RV30_NAMES,
|
||||||
|
g_param_spec_string ("rv30_names", "Names of rv30 driver",
|
||||||
|
"Names of rv30 driver", DEFAULT_RV30_NAMES, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (object_class, PROP_RV40_NAMES,
|
||||||
|
g_param_spec_string ("rv40_names", "Names of rv40 driver",
|
||||||
|
"Names of rv40 driver", DEFAULT_RV40_NAMES, G_PARAM_READWRITE));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (realvideode_debug, "realvideodec", 0,
|
GST_DEBUG_CATEGORY_INIT (realvideode_debug, "realvideodec", 0,
|
||||||
"RealVideo decoder");
|
"RealVideo decoder");
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct _GstRealVideoDec
|
||||||
guint32 fragments[256];
|
guint32 fragments[256];
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
gchar *path_rv20, *path_rv30, *path_rv40;
|
gchar *real_codecs_path, *rv20_names, *rv30_names, *rv40_names;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRealVideoDecClass
|
struct _GstRealVideoDecClass
|
||||||
|
|
Loading…
Reference in a new issue