summaryrefslogtreecommitdiff
path: root/src/libreal
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-08 01:00:10 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-08 01:00:10 +0100
commit628c4cbd9d023e74a7c6805d7ec0f163f2c172d1 (patch)
treeb74ddd76dc7fb3080ea269c6d3776f84aca36837 /src/libreal
parent3f255412a55880c7323debef2bff0fc2dd5ed554 (diff)
parent964f55aef546a1f1574c9f6ec10b3410fe390c34 (diff)
downloadxine-lib-628c4cbd9d023e74a7c6805d7ec0f163f2c172d1.tar.gz
xine-lib-628c4cbd9d023e74a7c6805d7ec0f163f2c172d1.tar.bz2
Merge from 1.1.
--HG-- rename : src/xine-engine/buffer.h => include/xine/buffer.h rename : src/libmad/xine_mad_decoder.c => src/audio_dec/xine_mad_decoder.c rename : src/combined/combined_wavpack.c => src/combined/wavpack_combined.c
Diffstat (limited to 'src/libreal')
-rw-r--r--src/libreal/xine_real_audio_decoder.c166
-rw-r--r--src/libreal/xine_real_video_decoder.c46
2 files changed, 65 insertions, 147 deletions
diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c
index b9231a2b7..a12518c1e 100644
--- a/src/libreal/xine_real_audio_decoder.c
+++ b/src/libreal/xine_real_audio_decoder.c
@@ -51,6 +51,8 @@ typedef struct {
/* empty so far */
} real_class_t;
+typedef void * ra_codec_t;
+
typedef struct realdec_decoder_s {
audio_decoder_t audio_decoder;
@@ -60,18 +62,18 @@ typedef struct realdec_decoder_s {
void *ra_handle;
- unsigned long (*raCloseCodec)(void*);
- unsigned long (*raDecode)(void*, char*,unsigned long,char*,unsigned int*,long);
- unsigned long (*raFlush)(unsigned long,unsigned long,unsigned long);
- unsigned long (*raFreeDecoder)(void*);
- void* (*raGetFlavorProperty)(void*,unsigned long,unsigned long,int*);
- unsigned long (*raInitDecoder)(void*, void*);
- unsigned long (*raOpenCodec2)(void*);
- unsigned long (*raSetFlavor)(void*,unsigned long);
- void (*raSetDLLAccessPath)(char*);
- void (*raSetPwd)(char*,char*);
+ uint32_t (*raCloseCodec)(ra_codec_t);
+ uint32_t (*raDecode)(ra_codec_t, char *, uint32_t, char *, uint32_t *, uint32_t);
+ uint32_t (*raFlush)(ra_codec_t, char *, uint32_t *);
+ uint32_t (*raFreeDecoder)(ra_codec_t);
+ void * (*raGetFlavorProperty)(ra_codec_t, uint16_t, uint16_t, uint16_t *);
+ uint32_t (*raInitDecoder)(ra_codec_t, void *);
+ uint32_t (*raOpenCodec2)(ra_codec_t *, const char *);
+ uint32_t (*raSetFlavor)(ra_codec_t, uint16_t);
+ void (*raSetDLLAccessPath)(char *);
+ void (*raSetPwd)(ra_codec_t, char *);
- void *context;
+ ra_codec_t context;
int sps, w, h;
int block_align;
@@ -92,14 +94,14 @@ typedef struct realdec_decoder_s {
} realdec_decoder_t;
typedef struct {
- int samplerate;
- short bits;
- short channels;
- int unk1;
- int subpacket_size;
- int coded_frame_size;
- int codec_data_length;
- void *extras;
+ uint32_t samplerate;
+ uint16_t bits;
+ uint16_t channels;
+ uint16_t quality;
+ uint32_t subpacket_size;
+ uint32_t coded_frame_size;
+ uint32_t codec_data_length;
+ void *extras;
} ra_init_t;
static int load_syms_linux (realdec_decoder_t *this, const char *const codec_name, const char *const codec_alternate) {
@@ -216,13 +218,14 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Cook");
if (!load_syms_linux (this, "cook.so", "cook.so.6.0"))
return 0;
+ this->block_align = subpacket_size;
break;
case BUF_AUDIO_ATRK:
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Atrac");
if (!load_syms_linux (this, "atrc.so", "atrc.so.6.0"))
return 0;
- this->block_align = 384;
+ this->block_align = subpacket_size;
break;
case BUF_AUDIO_14_4:
@@ -254,7 +257,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
* init codec
*/
- result = this->raOpenCodec2 (&this->context);
+ result = this->raOpenCodec2 (&this->context, NULL);
if (result) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: error in raOpenCodec2: %d\n", result);
return 0;
@@ -266,7 +269,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
init_data.samplerate = samples_per_sec;
init_data.bits = bits_per_sample;
init_data.channels = num_channels;
- init_data.unk1 = 100; /* ??? */
+ init_data.quality = 100; /* ??? */
init_data.subpacket_size = subpacket_size; /* subpacket size */
init_data.coded_frame_size = coded_frame_size; /* coded frame size */
init_data.codec_data_length = data_len; /* codec data length */
@@ -350,13 +353,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
return 1;
}
-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},
- {42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83},
- {77,80} };
-
static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
realdec_decoder_t *this = (realdec_decoder_t *) this_gen;
@@ -383,116 +379,32 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->pts = buf->pts;
size = buf->size;
-
while (size) {
+ int need;
- int needed;
-
- needed = this->frame_size - this->frame_num_bytes;
-
- if (needed>size) {
-
- memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, size);
+ need = this->frame_size - this->frame_num_bytes;
+ if (size < need) {
+ memcpy (this->frame_buffer + this->frame_num_bytes,
+ buf->content + buf->size - size, size);
this->frame_num_bytes += size;
-
- lprintf ("buffering %d/%d bytes\n", this->frame_num_bytes, this->frame_size);
-
size = 0;
-
} else {
-
- int result;
- int len =-1;
- int n;
- int sps = this->sps;
- int w = this->w;
- int h = this->h;
audio_buffer_t *audio_buffer;
+ int n, len;
+ int result;
- lprintf ("buffering %d bytes\n", needed);
-
- memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, needed);
-
- size -= needed;
+ memcpy (this->frame_buffer + this->frame_num_bytes,
+ buf->content + buf->size - size, need);
+ size -= need;
this->frame_num_bytes = 0;
- lprintf ("frame completed. reordering...\n");
- lprintf ("bs=%d sps=%d w=%d h=%d \n",/*sh->wf->nBlockAlign*/-1,sps,w,h);
-
- if (!sps) {
-
- int j,n;
- int bs=h*w*2/96; /* nibbles per subpacket */
- unsigned char *p=this->frame_buffer;
-
- /* 'sipr' way */
- /* demux_read_data(sh->ds, p, h*w); */
- for (n=0;n<38;n++){
- int i=bs*sipr_swaps[n][0];
- int o=bs*sipr_swaps[n][1];
- /* swap nibbles of block 'i' with 'o' TODO: optimize */
- for (j=0;j<bs;j++) {
- int x=(i&1) ? (p[(i>>1)]>>4) : (p[(i>>1)]&15);
- int y=(o&1) ? (p[(o>>1)]>>4) : (p[(o>>1)]&15);
- if (o&1)
- p[(o>>1)]=(p[(o>>1)]&0x0F)|(x<<4);
- else
- p[(o>>1)]=(p[(o>>1)]&0xF0)|x;
-
- if (i&1)
- p[(i>>1)]=(p[(i>>1)]&0x0F)|(y<<4);
- else
- p[(i>>1)]=(p[(i>>1)]&0xF0)|y;
-
- ++i;
- ++o;
- }
- }
- /*
- sh->a_in_buffer_size=
- sh->a_in_buffer_len=w*h;
- */
-
- } else {
- int x, y;
- uint8_t *s;
-
- /* 'cook' way */
-
- w /= sps; s = this->frame_buffer;
-
- for (y=0; y<h; y++)
-
- for (x=0; x<w; x++) {
-
- lprintf ("x=%d, y=%d, off %d\n",
- x, y, sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
-
- memcpy (this->frame_reordered+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)),
- s, sps);
- s+=sps;
-
- /* demux_read_data(sh->ds, sh->a_in_buffer+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)),
- sps); */
-
- }
- /*
- sh->a_in_buffer_size=
- sh->a_in_buffer_len=w*h*sps;
- */
- }
-
-#ifdef LOG
- xine_hexdump (this->frame_reordered, buf->size);
-#endif
-
n = 0;
- while (n<this->frame_size) {
+ while (n < this->frame_size) {
audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
result = this->raDecode (this->context,
- this->frame_reordered+n,
+ this->frame_buffer + n,
this->block_align,
(char *) audio_buffer->mem, &len, -1);
@@ -506,7 +418,7 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->stream->audio_out->put_buffer (this->stream->audio_out,
audio_buffer, this->stream);
- n+=this->block_align;
+ n += this->block_align;
}
}
}
@@ -609,5 +521,5 @@ static const uint32_t audio_types[] = {
const decoder_info_t dec_info_realaudio = {
audio_types, /* supported types */
- 7 /* priority */
+ 6 /* priority */
};
diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c
index 28fddafda..2b5eafa16 100644
--- a/src/libreal/xine_real_video_decoder.c
+++ b/src/libreal/xine_real_video_decoder.c
@@ -63,9 +63,9 @@ typedef struct realdec_decoder_s {
uint32_t (*rvyuv_custom_message)(void*, void*);
uint32_t (*rvyuv_free)(void*);
- uint32_t (*rvyuv_hive_message)(uint32_t, uint32_t);
+ uint32_t (*rvyuv_hive_message)(uint32_t, void*);
uint32_t (*rvyuv_init)(void*, void*); /* initdata,context */
- uint32_t (*rvyuv_transform)(char*, char*, void*, uint32_t*,void*);
+ uint32_t (*rvyuv_transform)(char*, char*, void*, void*, void*);
void *context;
@@ -113,13 +113,21 @@ typedef struct cmsg_data_s {
typedef struct transform_in_s {
uint32_t len;
- uint32_t unknown1;
- uint32_t chunks;
- uint32_t* extra;
- uint32_t unknown2;
+ uint32_t interpolate;
+ uint32_t nsegments;
+ void *segments;
+ uint32_t flags;
uint32_t timestamp;
} transform_in_t;
+typedef struct {
+ uint32_t frames;
+ uint32_t notes;
+ uint32_t timestamp;
+ uint32_t width;
+ uint32_t height;
+} transform_out_t;
+
/*
* real codec loader
*/
@@ -169,7 +177,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
int result;
rv_init_t init_data = {11, 0, 0, 0, 0, 0, 1, 0}; /* rv30 */
-
switch (buf->type) {
case BUF_VIDEO_RV20:
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 2.0");
@@ -258,7 +265,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
#ifdef LOG
printf ("libreal: CustomMessage cmsg_data:\n");
- xine_hexdump ((uint8_t *) cmsg_data, sizeof (cmsg_data));
+ xine_hexdump ((uint8_t *) &cmsg_data, sizeof (cmsg_data));
printf ("libreal: cmsg24:\n");
xine_hexdump ((uint8_t *) cmsg24, (buf->size - 34 + 2) * sizeof(uint32_t));
#endif
@@ -342,7 +349,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
int result;
vo_frame_t *img;
- uint32_t transform_out[5];
+ transform_out_t transform_out;
transform_in_t transform_in = {
this->chunk_buffer_size,
/* length of the packet (sub-packets appended) */
@@ -369,7 +376,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
xine_hexdump (this->chunk_buffer, this->chunk_buffer_size);
printf ("libreal: transform_in:\n");
- xine_hexdump ((uint8_t *) transform_in, 6 * 4);
+ xine_hexdump ((uint8_t *) &transform_in, sizeof(rv_xform_in_t));
printf ("libreal: chunk_table:\n");
xine_hexdump ((uint8_t *) buf->decoder_info_ptr[2],
@@ -379,21 +386,21 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
result = this->rvyuv_transform (this->chunk_buffer,
this->frame_buffer,
&transform_in,
- transform_out,
+ &transform_out,
this->context);
lprintf ("transform result: %08x\n", result);
lprintf ("transform_out:\n");
- #ifdef LOG
- xine_hexdump ((uint8_t *) transform_out, 5 * 4);
- #endif
+#ifdef LOG
+ xine_hexdump ((uint8_t *) &transform_out, 5 * 4);
+#endif
/* Sometimes the stream contains video of a different size
* to that specified in the realmedia header */
- if(transform_out[0] && ((transform_out[3] != this->width) ||
- (transform_out[4] != this->height))) {
- this->width = transform_out[3];
- this->height = transform_out[4];
+ if(transform_out.frames && ((transform_out.width != this->width) ||
+ (transform_out.height != this->height))) {
+ this->width = transform_out.width;
+ this->height = transform_out.height;
this->frame_size = this->width * this->height;
@@ -531,8 +538,7 @@ void *init_realvdec (xine_t *xine, void *data) {
* exported plugin catalog entry
*/
-static const uint32_t supported_types[] = { BUF_VIDEO_RV20,
- BUF_VIDEO_RV30,
+static const uint32_t supported_types[] = { BUF_VIDEO_RV30,
BUF_VIDEO_RV40,
0 };