summaryrefslogtreecommitdiff
path: root/src/libreal
diff options
context:
space:
mode:
Diffstat (limited to 'src/libreal')
-rw-r--r--src/libreal/Makefile.am11
-rw-r--r--src/libreal/real_common.c90
-rw-r--r--src/libreal/real_common.h6
-rw-r--r--src/libreal/xine_real_audio_decoder.c63
-rw-r--r--src/libreal/xine_real_video_decoder.c47
5 files changed, 109 insertions, 108 deletions
diff --git a/src/libreal/Makefile.am b/src/libreal/Makefile.am
index c9cf62984..7072039dd 100644
--- a/src/libreal/Makefile.am
+++ b/src/libreal/Makefile.am
@@ -1,12 +1,13 @@
include $(top_srcdir)/misc/Makefile.common
+AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG)
+AM_LDFLAGS = $(xineplug_ldflags)
+
+noinst_HEADERS = real_common.h
+
if ENABLE_REAL
xineplug_LTLIBRARIES = xineplug_decode_real.la
endif
xineplug_decode_real_la_SOURCES = xine_real_video_decoder.c real_common.c xine_real_audio_decoder.c
-xineplug_decode_real_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS)
-xineplug_decode_real_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_decode_real_la_LDFLAGS = $(xineplug_ldflags)
-
-noinst_HEADERS = real_common.h
+xineplug_decode_real_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) $(LTLIBINTL)
diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c
index 925a5cc71..531fb780e 100644
--- a/src/libreal/real_common.c
+++ b/src/libreal/real_common.c
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: real_common.c,v 1.12 2007/03/17 15:45:41 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Common function for the thin layer to use Real binary-only codecs in xine
*/
@@ -75,29 +73,63 @@ void _x_real_codecs_init(xine_t *const xine) {
#ifdef REAL_CODEC_PATH
const char *const default_real_codecs_path = REAL_CODEC_PATH;
#else
- const char *default_real_codecs_path = "";
- struct stat s;
-
-#define try_real_path(path) \
- if (!stat (path "/dvrc.so", &s)) \
- default_real_codecs_path = path;
-#define try_real_subpath(path) \
- try_real_path("/usr/" path) \
- else try_real_path("/usr/local" path) \
- else try_real_path("/opt" path)
-
- /* The priority is for the first found */
- try_real_subpath("lib/win32")
- else try_real_subpath("lib/codecs")
- else try_real_subpath("lib64/RealPlayer10/codecs")
- else try_real_subpath("lib/RealPlayer10/codecs")
- else try_real_subpath("lib64/RealPlayer9/users/Real/Codecs")
- else try_real_subpath("lib/RealPlayer9/users/Real/Codecs")
- else try_real_subpath("lib/RealPlayer8/Codecs")
- else try_real_subpath("RealPlayer8/Codecs");
-
-#undef try_real_path
-#undef try_real_subpath
+ char default_real_codecs_path[256];
+
+ default_real_codecs_path[0] = 0;
+
+#define UL64 0x05 /* /usr/{,local/}lib64 */
+#define UL 0x0A /* /usr/{,local/}lib */
+#define O 0x10 /* /opt */
+#define OL64 0x20 /* /opt/lib64 */
+#define OL 0x40 /* /opt/lib */
+
+ static const char *const prefix[] = {
+ "/usr/lib64", "/usr/local/lib64",
+ "/usr/lib", "/usr/local/lib",
+ "/opt", "/opt/lib64", "/opt/lib",
+ };
+
+ static const struct {
+ int prefix;
+ const char *path;
+ } paths[] = {
+ { O | UL, "win32" },
+ { O | UL, "codecs" },
+ { O | UL | UL64, "real" },
+ { O, "real/RealPlayer/codecs" },
+ { OL | OL64 | UL | UL64, "RealPlayer10GOLD/codecs" },
+ { OL | OL64 | UL | UL64, "RealPlayer10/codecs" },
+ { OL | OL64 | UL | UL64, "RealPlayer9/users/Real/Codecs" },
+ { O | OL | UL, "RealPlayer8/Codecs" },
+ {}
+ };
+
+ int i;
+ for (i = 0; paths[i].prefix; ++i)
+ {
+ int p;
+ for (p = 0; p < sizeof (prefix) / sizeof (prefix[0]); ++p)
+ {
+ if (paths[i].prefix & (1 << p))
+ {
+ void *handle;
+ snprintf (default_real_codecs_path, sizeof (default_real_codecs_path), "%s/%s/drvc.so", prefix[p], paths[i].path);
+ handle = dlopen (default_real_codecs_path, RTLD_NOW);
+ if (handle)
+ {
+ dlclose (handle);
+ snprintf (default_real_codecs_path, sizeof (default_real_codecs_path), "%s/%s", prefix[p], paths[i].path);
+ goto found;
+ }
+ }
+ }
+ }
+
+ /* if this is reached, no valid path was found */
+ default_real_codecs_path[0] = 0;
+
+ found:;
+
#endif
real_codecs_path =
@@ -114,7 +146,7 @@ void _x_real_codecs_init(xine_t *const xine) {
"how to install the codecs."),
10, NULL, NULL);
- lprintf ("real codecs path : %s\n", real_codec_path);
+ lprintf ("real codecs path : %s\n", real_codecs_path);
}
void *_x_real_codec_open(xine_stream_t *const stream, const char *const path,
@@ -152,7 +184,7 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path,
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "realvdec", XINE_VERSION_CODE, &dec_info_realvideo, init_realvdec },
- { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "realadec", XINE_VERSION_CODE, &dec_info_realaudio, init_realadec },
+ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 19, "realvdec", XINE_VERSION_CODE, &dec_info_realvideo, init_realvdec },
+ { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 16, "realadec", XINE_VERSION_CODE, &dec_info_realaudio, init_realadec },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h
index 232bf2a4d..74dc5e6e2 100644
--- a/src/libreal/real_common.h
+++ b/src/libreal/real_common.h
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: real_common.h,v 1.7 2007/03/17 15:45:41 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Common function for the thin layer to use Real binary-only codecs in xine
*/
@@ -25,7 +23,7 @@
#ifndef __REAL_COMMON_H__
#define __REAL_COMMON_H__
-#include "xine_internal.h"
+#include <xine/xine_internal.h>
/*
* some fake functions to make real codecs happy
diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c
index d1bb94230..b9231a2b7 100644
--- a/src/libreal/xine_real_audio_decoder.c
+++ b/src/libreal/xine_real_audio_decoder.c
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_decoder.c,v 1.59 2007/03/17 15:45:41 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* thin layer to use real binary-only codecs in xine
*
@@ -40,10 +38,10 @@
*/
#include "bswap.h"
-#include "xine_internal.h"
-#include "video_out.h"
-#include "buffer.h"
-#include "xineutils.h"
+#include <xine/xine_internal.h>
+#include <xine/video_out.h>
+#include <xine/buffer.h>
+#include <xine/xineutils.h>
#include "real_common.h"
@@ -163,27 +161,27 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
* extract header data
*/
- version = BE_16 (buf->content+4);
+ version = _X_BE_16 (buf->content+4);
lprintf ("header buffer detected, header version %d\n", version);
#ifdef LOG
xine_hexdump (buf->content, buf->size);
#endif
- flavor = BE_16 (buf->content+22);
- coded_frame_size = BE_32 (buf->content+24);
- codec_data_length= BE_16 (buf->content+40);
- coded_frame_size2= BE_16 (buf->content+42);
- subpacket_size = BE_16 (buf->content+44);
+ flavor = _X_BE_16 (buf->content+22);
+ coded_frame_size = _X_BE_32 (buf->content+24);
+ codec_data_length= _X_BE_16 (buf->content+40);
+ coded_frame_size2= _X_BE_16 (buf->content+42);
+ subpacket_size = _X_BE_16 (buf->content+44);
this->sps = subpacket_size;
this->w = coded_frame_size2;
this->h = codec_data_length;
if (version == 4) {
- samples_per_sec = BE_16 (buf->content+48);
- bits_per_sample = BE_16 (buf->content+52);
- num_channels = BE_16 (buf->content+54);
+ samples_per_sec = _X_BE_16 (buf->content+48);
+ bits_per_sample = _X_BE_16 (buf->content+52);
+ num_channels = _X_BE_16 (buf->content+54);
/* FIXME: */
if (buf->type==BUF_AUDIO_COOK) {
@@ -196,10 +194,10 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
extras = buf->content+71;
} else {
- samples_per_sec = BE_16 (buf->content+54);
- bits_per_sample = BE_16 (buf->content+58);
- num_channels = BE_16 (buf->content+60);
- data_len = BE_32 (buf->content+74);
+ samples_per_sec = _X_BE_16 (buf->content+54);
+ bits_per_sample = _X_BE_16 (buf->content+58);
+ num_channels = _X_BE_16 (buf->content+60);
+ data_len = _X_BE_32 (buf->content+74);
extras = buf->content+78;
}
@@ -339,7 +337,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
return 0;
}
- this->stream->audio_out->open(this->stream->audio_out,
+ (this->stream->audio_out->open) (this->stream->audio_out,
this->stream,
bits_per_sample,
samples_per_sec,
@@ -352,7 +350,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
return 1;
}
-static unsigned char sipr_swaps[38][2]={
+static const unsigned char sipr_swaps[38][2]={
{0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68},
{13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46},
{25,94},{26,54},{28,75},{29,50},{32,70},{33,92},{35,74},{38,85},{40,56},
@@ -584,19 +582,6 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
/*
* real plugin class
*/
-
-static char *get_identifier (audio_decoder_class_t *this) {
- return "realadec";
-}
-
-static char *get_description (audio_decoder_class_t *this) {
- return "real binary-only codec based audio decoder plugin";
-}
-
-static void dispose_class (audio_decoder_class_t *this) {
- free (this);
-}
-
void *init_realadec (xine_t *xine, void *data) {
real_class_t *this;
@@ -605,9 +590,9 @@ void *init_realadec (xine_t *xine, void *data) {
this = (real_class_t *) xine_xmalloc (sizeof (real_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;
+ this->decoder_class.identifier = "realadec";
+ this->decoder_class.description = N_("real binary-only codec based audio decoder plugin");
+ this->decoder_class.dispose = default_audio_decoder_class_dispose;
_x_real_codecs_init(xine);
@@ -618,7 +603,7 @@ void *init_realadec (xine_t *xine, void *data) {
* exported plugin catalog entry
*/
-static uint32_t audio_types[] = {
+static const uint32_t audio_types[] = {
BUF_AUDIO_COOK, BUF_AUDIO_ATRK, /* BUF_AUDIO_14_4, BUF_AUDIO_28_8, */ BUF_AUDIO_SIPRO, 0
};
diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c
index ea1fc8c54..28fddafda 100644
--- a/src/libreal/xine_real_video_decoder.c
+++ b/src/libreal/xine_real_video_decoder.c
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine_decoder.c,v 1.93 2007/03/17 15:45:41 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* thin layer to use real binary-only codecs in xine
*
@@ -39,10 +37,10 @@
#define LOG
*/
#include "bswap.h"
-#include "xine_internal.h"
-#include "video_out.h"
-#include "buffer.h"
-#include "xineutils.h"
+#include <xine/xine_internal.h>
+#include <xine/video_out.h>
+#include <xine/buffer.h>
+#include <xine/xineutils.h>
#include "real_common.h"
@@ -194,8 +192,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
_x_abort();
}
- init_data.w = BE_16(&buf->content[12]);
- init_data.h = BE_16(&buf->content[14]);
+ init_data.w = _X_BE_16(&buf->content[12]);
+ init_data.h = _X_BE_16(&buf->content[14]);
this->width = (init_data.w + 1) & (~1);
this->height = (init_data.h + 1) & (~1);
@@ -209,8 +207,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
* much resemblence to the actual frequency of frames in the file. Hence
* it's better to just let the engine estimate the frame duration for us */
#if 0
- this->fps = (double) BE_16(&buf->content[22]) +
- ((double) BE_16(&buf->content[24]) / 65536.0);
+ this->fps = (double) _X_BE_16(&buf->content[22]) +
+ ((double) _X_BE_16(&buf->content[24]) / 65536.0);
this->duration = 90000.0 / this->fps;
#endif
@@ -227,8 +225,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->ratio*10000);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->duration);
- init_data.subformat = BE_32(&buf->content[26]);
- init_data.format = BE_32(&buf->content[30]);
+ init_data.subformat = _X_BE_32(&buf->content[26]);
+ init_data.format = _X_BE_32(&buf->content[30]);
#ifdef LOG
printf ("libreal: init_data for rvyuv_init:\n");
@@ -268,7 +266,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
this->rvyuv_custom_message (&cmsg_data, this->context);
}
- this->stream->video_out->open(this->stream->video_out, this->stream);
+ (this->stream->video_out->open) (this->stream->video_out, this->stream);
this->frame_size = this->width * this->height;
this->frame_buffer = xine_xmalloc (this->width * this->height * 3 / 2);
@@ -512,19 +510,6 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen,
/*
* real plugin class
*/
-
-static char *get_identifier (video_decoder_class_t *this) {
- return "realvdec";
-}
-
-static char *get_description (video_decoder_class_t *this) {
- return "real binary-only codec based video decoder plugin";
-}
-
-static void dispose_class (video_decoder_class_t *this) {
- free (this);
-}
-
void *init_realvdec (xine_t *xine, void *data) {
real_class_t *this;
@@ -533,9 +518,9 @@ void *init_realvdec (xine_t *xine, void *data) {
this = (real_class_t *) xine_xmalloc (sizeof (real_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;
+ this->decoder_class.identifier = "realvdec";
+ this->decoder_class.description = N_("real binary-only codec based video decoder plugin");
+ this->decoder_class.dispose = default_video_decoder_class_dispose;
_x_real_codecs_init(xine);
@@ -546,7 +531,7 @@ void *init_realvdec (xine_t *xine, void *data) {
* exported plugin catalog entry
*/
-static uint32_t supported_types[] = { BUF_VIDEO_RV20,
+static const uint32_t supported_types[] = { BUF_VIDEO_RV20,
BUF_VIDEO_RV30,
BUF_VIDEO_RV40,
0 };