summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/demuxers/demux_real.c111
-rw-r--r--src/libreal/audio_decoder.c76
-rw-r--r--src/libreal/xine_decoder.c43
3 files changed, 133 insertions, 97 deletions
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 9353c70a6..934c092ce 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -21,7 +21,7 @@
* For more information regarding the Real file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_real.c,v 1.16 2002/11/25 02:32:48 guenter Exp $
+ * $Id: demux_real.c,v 1.17 2002/11/26 00:37:28 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -40,7 +40,9 @@
#include "demux.h"
#include "bswap.h"
+/*
#define LOG
+*/
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | \
@@ -136,6 +138,7 @@ typedef struct {
} pnm_mdpr_t;
+#ifdef LOG
static void hexdump (char *buf, int length) {
int i;
@@ -166,6 +169,7 @@ static void hexdump (char *buf, int length) {
}
printf ("\n");
}
+#endif
static pnm_mdpr_t *pnm_parse_mdpr(const char *data) {
@@ -202,6 +206,7 @@ static pnm_mdpr_t *pnm_parse_mdpr(const char *data) {
memcpy(mdpr->type_specific_data,
&data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
+#ifdef LOG
printf("demux_real: MDPR: stream number: %i\n", mdpr->stream_number);
printf("demux_real: MDPR: maximal bit rate: %i\n", mdpr->max_bit_rate);
printf("demux_real: MDPR: average bit rate: %i\n", mdpr->avg_bit_rate);
@@ -215,6 +220,7 @@ static pnm_mdpr_t *pnm_parse_mdpr(const char *data) {
printf("demux_real: MDPR: type specific data:\n");
hexdump(mdpr->type_specific_data, mdpr->type_specific_len);
printf("\n");
+#endif
return mdpr;
}
@@ -226,42 +232,6 @@ typedef struct dp_hdr_s {
uint32_t chunktab; /* offset to chunk offset array */
} dp_hdr_t;
-#if 0
-static void send_real_buf (demux_real_t *this, uint32_t timestamp, int len,
- fifo_buffer_t *fifo,
- uint32_t buf_type, uint32_t decoder_flags) {
-
- dp_hdr_t *hdr;
- buf_element_t *buf;
-
- if (!fifo) {
- this->input->seek (this->input, len, SEEK_CUR);
- return;
- }
-
- buf = fifo->buffer_pool_alloc (fifo);
-
- buf->content = buf->mem;
-
- hdr = (dp_hdr_t *) buf->content;
- hdr->chunks = 1;
- hdr->timestamp = timestamp;
- hdr->len = len;
- hdr->chunktab = 0;
-
- this->input->read (this->input, buf->content+16, len);
-
- buf->size = len+16;
-
- buf->input_pos = 0 ; /* FIXME */
- buf->input_time = 0 ; /* FIXME */
- buf->type = buf_type;
- buf->decoder_flags = decoder_flags;
-
- fifo->put (fifo, buf);
-
-}
-#endif
static void real_parse_headers (demux_real_t *this) {
@@ -339,7 +309,9 @@ static void real_parse_headers (demux_real_t *this) {
this->bitrate = mdpr->avg_bit_rate;
this->stream->stream_info[XINE_STREAM_INFO_BITRATE] = mdpr->avg_bit_rate;
+#ifdef LOG
printf ("demux_real: parsing type specific data...\n");
+#endif
/* skip unknown stuff - FIXME: find a better/cleaner way */
{
@@ -349,7 +321,9 @@ static void real_parse_headers (demux_real_t *this) {
while (off<=(mdpr->type_specific_len-8)) {
+#ifdef LOG
printf ("demux_real: got %.4s\n", mdpr->type_specific_data+off);
+#endif
if (!strncmp (mdpr->type_specific_data+off, ".ra", 3)) {
int version;
@@ -357,12 +331,16 @@ static void real_parse_headers (demux_real_t *this) {
off += 4;
+#ifdef LOG
printf ("demux_real: audio detected %.3s\n",
mdpr->type_specific_data+off+4);
+#endif
version = BE_16 (mdpr->type_specific_data+off);
+#ifdef LOG
printf ("demux_real: audio version %d\n", version);
+#endif
if (version==4) {
int str_len;
@@ -370,23 +348,31 @@ static void real_parse_headers (demux_real_t *this) {
sample_rate = BE_16(mdpr->type_specific_data+off+44);
+#ifdef LOG
printf ("demux_real: sample_rate %d\n", sample_rate);
+#endif
str_len = *(mdpr->type_specific_data+off+50);
+#ifdef LOG
printf ("demux_real: str_len = %d\n", str_len);
+#endif
memcpy (fourcc, mdpr->type_specific_data+off+53+str_len, 4);
fourcc[4]=0;
+#ifdef LOG
printf ("demux_real: fourcc == %s\n", fourcc);
+#endif
} else if (version == 5) {
memcpy (fourcc, mdpr->type_specific_data+off+62, 4);
fourcc[4]=0;
+#ifdef LOG
printf ("demux_real: fourcc == %s\n", fourcc);
+#endif
} else {
printf ("demux_real: error, unknown audio data header version %d\n",
@@ -405,8 +391,10 @@ static void real_parse_headers (demux_real_t *this) {
else
this->audio_buf_type = 0;
+#ifdef LOG
printf ("demux_real: audio codec, buf type %08x\n",
this->audio_buf_type);
+#endif
this->audio_stream_num = mdpr->stream_number;
@@ -438,7 +426,11 @@ static void real_parse_headers (demux_real_t *this) {
break; /* audio */
}
if (!strncmp (mdpr->type_specific_data+off, "VIDO", 4)) {
+#ifdef LOG
printf ("demux_real: video detected\n");
+#endif
+ /* FIXME: insert video codec detection code here */
+
break; /* video */
}
off++;
@@ -456,7 +448,9 @@ static void real_parse_headers (demux_real_t *this) {
this->video_stream_num = mdpr->stream_number;
this->video_buf_type = BUF_VIDEO_RV20;
+#ifdef LOG
printf ("demux_real: RV20 video detected\n");
+#endif
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
@@ -483,7 +477,9 @@ static void real_parse_headers (demux_real_t *this) {
this->video_stream_num = mdpr->stream_number;
this->video_buf_type = BUF_VIDEO_RV30;
+#ifdef LOG
printf ("demux_real: RV30 video detected\n");
+#endif
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
@@ -505,7 +501,9 @@ static void real_parse_headers (demux_real_t *this) {
} else {
+#ifdef LOG
printf ("demux_real: codec not recognized as video\n");
+#endif
}
@@ -634,7 +632,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
buf_element_t *buf;
int n;
+#ifdef LOG
printf ("demux_real: video chunk detected.\n");
+#endif
/* sub-demuxer */
@@ -647,7 +647,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
*/
vpkg_header = stream_read_char (this); size--;
+#ifdef LOG
printf ("demux_real: hdr: %02x (size=%d)\n", vpkg_header, size);
+#endif
if (0x40==(vpkg_header&0xc0)) {
/*
@@ -657,7 +659,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
int bummer;
bummer = stream_read_char (this); size--;
+#ifdef LOG
printf ("demux_real: bummer == %02X\n",bummer);
+#endif
vpkg_offset = 0;
vpkg_length = size;
@@ -668,7 +672,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
/* sub-seqnum (bits 0-6: number of fragment. bit 7: ???) */
vpkg_subseq = stream_read_char (this); size--;
+#ifdef LOG
printf ("demux_real: subseq: %02X ", vpkg_subseq);
+#endif
vpkg_subseq &= 0x7f;
}
@@ -677,12 +683,16 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
* bit 14 is always one (same applies to the offset)
*/
vpkg_length = stream_read_word (this); size -= 2;
+#ifdef LOG
printf ("demux_real: l: %02X %02X ", vpkg_length>>8, vpkg_length&0xff);
+#endif
if (!(vpkg_length&0xC000)) {
vpkg_length <<= 16;
vpkg_length |= stream_read_word (this);
+#ifdef LOG
printf ("demux_real: l+: %02X %02X ",
(vpkg_length>>8)&0xff,vpkg_length&0xff);
+#endif
size-=2;
} else
vpkg_length &= 0x3fff;
@@ -694,24 +704,32 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
*/
vpkg_offset = stream_read_word (this); size -= 2;
+#ifdef LOG
printf ("demux_real: o: %02X %02X ",
vpkg_offset>>8,vpkg_offset&0xff);
+#endif
if (!(vpkg_offset&0xC000)) {
vpkg_offset <<= 16;
vpkg_offset |= stream_read_word (this);
+#ifdef LOG
printf ("demux_real: o+: %02X %02X ",
(vpkg_offset>>8)&0xff,vpkg_offset&0xff);
+#endif
size -= 2;
} else
vpkg_offset &= 0x3fff;
vpkg_seqnum = stream_read_char (this); size--;
+#ifdef LOG
printf ("demux_real: seq: %02X ", vpkg_seqnum);
+#endif
}
+#ifdef LOG
printf ("demux_real: vpkg seqnum=%d, offset=%d, length=%d\n",
vpkg_seqnum, vpkg_offset, vpkg_length);
+#endif
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
@@ -726,14 +744,18 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
if (this->old_seqnum>=0) {
+#ifdef LOG
printf ("demux_real: we have an incomplete packet (oldseq=%d new=%d)\n",
this->old_seqnum, vpkg_seqnum);
+#endif
/* we have an incomplete packet: */
if (this->old_seqnum != vpkg_seqnum) {
/* this fragment is for new packet, close the old one */
+#ifdef LOG
printf ("demux_real: closing probably incomplete packet\n");
+#endif
/* ds_add_packet(ds,dp); */
this->old_seqnum = -1;
@@ -793,7 +815,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
if (0x00 == (vpkg_header&0xc0)) {
+#ifdef LOG
printf ("demux_real: first fragment, %d bytes\n", size);
+#endif
/* first fragment: */
/* this->input->seek (this->input, size, SEEK_CUR); */
@@ -820,7 +844,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
break;
}
+#ifdef LOG
printf ("demux_real: whole packet, %d bytes\n", vpkg_length);
+#endif
/* whole packet (not fragmented): */
size -= vpkg_length;
@@ -868,7 +894,6 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
n = this->input->read (this->input, buf->content, size);
if (n<size) {
-
printf ("demux_real: read error\n");
buf->free_buffer(buf);
@@ -1016,8 +1041,10 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
if (input->read(input, buf, 4)) {
+#ifdef LOG
printf ("demux_real: input seekable, read 4 bytes: %02x %02x %02x %02x\n",
buf[0], buf[1], buf[2], buf[3]);
+#endif
if ((buf[0] != 0x2e)
|| (buf[1] != 'R')
@@ -1029,8 +1056,10 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
} else if (input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW)) {
+#ifdef LOG
printf ("demux_real: input provides preview, read 4 bytes: %02x %02x %02x %02x\n",
buf[0], buf[1], buf[2], buf[3]);
+#endif
if ((buf[0] != 0x2e)
|| (buf[1] != 'R')
@@ -1051,11 +1080,15 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
mrl = input->get_mrl (input);
+#ifdef LOG
printf ("demux_real: by extension '%s'\n", mrl);
+#endif
ending = strrchr(mrl, '.');
+#ifdef LOG
printf ("demux_real: ending %s\n", ending);
+#endif
if (!ending)
return NULL;
@@ -1065,7 +1098,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
&& strncasecmp (ending, ".ram", 4))
return NULL;
+#ifdef LOG
printf ("demux_real: by extension accepted.\n");
+#endif
}
diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c
index c0df8c72f..8bf3afaaa 100644
--- a/src/libreal/audio_decoder.c
+++ b/src/libreal/audio_decoder.c
@@ -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: audio_decoder.c,v 1.4 2002/11/25 02:06:28 guenter Exp $
+ * $Id: audio_decoder.c,v 1.5 2002/11/26 00:37:29 guenter Exp $
*
* thin layer to use real binary-only codecs in xine
*
@@ -38,10 +38,9 @@
#include "video_out.h"
#include "buffer.h"
-
+/*
#define LOG
-
-
+*/
typedef struct {
video_decoder_class_t decoder_class;
@@ -95,6 +94,7 @@ typedef struct {
void *extras;
} ra_init_t;
+#ifdef LOG
static void hexdump (char *buf, int length) {
int i;
@@ -125,6 +125,7 @@ static void hexdump (char *buf, int length) {
}
printf ("\n");
}
+#endif
void *__builtin_new(unsigned long size) {
return malloc(size);
@@ -136,7 +137,11 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
sprintf (path, "%s/%s", this->cls->real_codec_path, codec_name);
+#ifdef LOG
printf ("libareal: (audio) opening shared obj '%s'\n", path);
+
+#endif
+
this->ra_handle = dlopen (path, RTLD_LAZY);
if (!this->ra_handle) {
@@ -155,8 +160,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
this->raSetDLLAccessPath = dlsym (this->ra_handle, "SetDLLAccessPath");
this->raSetPwd = dlsym (this->ra_handle, "RASetPwd"); /* optional, used by SIPR */
- printf ("libareal: codec loaded, symbols resolved\n");
-
if (!this->raCloseCodec || !this->raDecode || !this->raFlush || !this->raFreeDecoder ||
!this->raGetFlavorProperty || !this->raOpenCodec2 || !this->raSetFlavor ||
/*!raSetDLLAccessPath ||*/ !this->raInitDecoder){
@@ -165,8 +168,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
return 0;
}
- printf ("libareal: raSetDLLAccessPath\n");
-
if (this->raSetDLLAccessPath){
char path[1024];
@@ -178,12 +179,12 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
}
path[strlen(path)+1]=0;
- printf ("libareal: path=%s\n", path);
-
this->raSetDLLAccessPath(path);
}
+#ifdef LOG
printf ("libareal: audio decoder loaded successfully\n");
+#endif
return 1;
}
@@ -203,9 +204,10 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
version = BE_16 (buf->content);
+#ifdef LOG
printf ("libareal: header buffer detected, header version %d\n", version);
-
hexdump (buf->content, buf->size);
+#endif
flavor = BE_16 (buf->content+18);
coded_frame_size = BE_32 (buf->content+20);
@@ -241,18 +243,16 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
this->block_align= coded_frame_size2;
+#ifdef LOG
printf ("libareal: 0x%04x 0x%04x 0x%04x 0x%04x data_len 0x%04x\n",
subpacket_size, coded_frame_size, codec_data_length,
coded_frame_size2, data_len);
-
-
printf ("libareal: %d samples/sec, %d bits/sample, %d channels\n",
samples_per_sec, bits_per_sample, num_channels);
+#endif
/* load codec, resolv symbols */
- printf ("libareal: loading codec...\n");
-
switch (buf->type) {
case BUF_AUDIO_COOK:
if (!load_syms_linux (this, "cook.so.6.0"))
@@ -311,11 +311,12 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
};
+#ifdef LOG
printf ("libareal: init_data:\n");
hexdump (&init_data, sizeof (ra_init_t));
printf ("libareal: extras :\n");
hexdump (init_data.extras, data_len);
-
+#endif
result = this->raInitDecoder (this->context, &init_data);
if(result){
@@ -325,16 +326,12 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
}
}
- printf ("libareal: raInitDecoder done.\n");
-
if (this->raSetPwd){
/* used by 'SIPR' */
this->raSetPwd (this->context, "Ardubancel Quazanga"); /* set password... lol. */
printf ("libareal: password set\n");
}
- printf ("libareal: set flavor %d\n", flavor);
-
result = this->raSetFlavor (this->context, flavor);
if (result){
printf ("libareal: decoder flavor setup failed, error code: 0x%x\n",
@@ -342,26 +339,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
return 0;
}
- printf ("libareal: set flavor %d done\n", flavor);
-
-
-#if 0
-
- prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0,&len);
- mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio codec: [%d] %s\n",((short*)(sh->wf+1))[2],prop);
-
- prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],1,&len);
- sh->i_bps=((*((int*)prop))+4)/8;
- mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio bitrate: %5.3f kbit/s (%d bps) \n",(*((int*)prop))*0.001f,sh->i_bps);
-
-// prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0x13,&len);
-// mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Samples/block?: %d \n",(*((int*)prop)));
-
- sh->audio_out_minsize=128000; // no idea how to get... :(
- sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign;
-
-#endif
-
/*
* alloc buffers for data reordering
*/
@@ -380,7 +357,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
this->frame_reordered = this->frame_buffer;
this->frame_num_bytes = 0;
- printf ("libareal: frame size is %d\n", this->frame_size);
}
/*
@@ -406,7 +382,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
mode) ;
this->sample_size = num_channels * (bits_per_sample>>3);
- printf ("libareal: 1 sample is %d bytes\n", this->sample_size);
return 1;
}
@@ -437,7 +412,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
int size;
+#ifdef LOG
printf ("libareal: content buffer detected, %d bytes\n", buf->size);
+#endif
size = buf->size;
@@ -452,7 +429,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, size);
this->frame_num_bytes += size;
+#ifdef LOG
printf ("libareal: buffering %d/%d bytes\n", this->frame_num_bytes, this->frame_size);
+#endif
size = 0;
@@ -466,16 +445,19 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
int h = this->h;
audio_buffer_t *audio_buffer;
+#ifdef LOG
printf ("libareal: buffering %d bytes\n", needed);
+#endif
memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, needed);
size -= needed;
this->frame_num_bytes = 0;
+#ifdef LOG
printf ("libareal: frame completed. reordering...\n");
-
printf ("libareal: bs=%d sps=%d w=%d h=%d \n",/*sh->wf->nBlockAlign*/-1,sps,w,h);
+#endif
if (!sps) {
@@ -523,8 +505,10 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
for (x=0; x<w; x++) {
+#ifdef LOG
printf ("libareal: x=%d, y=%d, off %d\n",
x, y, sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
+#endif
memcpy (this->frame_reordered+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)),
s, sps);
@@ -540,7 +524,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
*/
}
+#ifdef LOG
hexdump (this->frame_reordered, buf->size);
+#endif
n = 0;
while (n<this->frame_size) {
@@ -552,7 +538,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
this->block_align,
audio_buffer->mem, &len, -1);
+#ifdef LOG
printf ("libareal: raDecode result %d, len=%d\n", result, len);
+#endif
audio_buffer->vpts = 0; /* FIXME */
audio_buffer->num_frames = len/this->sample_size;;
@@ -698,7 +686,9 @@ static void *init_class (xine_t *xine, void *data) {
"/opt/RealPlayer8/Codecs");
}
+#ifdef LOG
printf ("libareal: real codec path : %s\n", this->real_codec_path);
+#endif
return this;
}
diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c
index 935492c7a..49b86600b 100644
--- a/src/libreal/xine_decoder.c
+++ b/src/libreal/xine_decoder.c
@@ -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: xine_decoder.c,v 1.7 2002/11/25 02:26:51 guenter Exp $
+ * $Id: xine_decoder.c,v 1.8 2002/11/26 00:37:29 guenter Exp $
*
* thin layer to use real binary-only codecs in xine
*
@@ -38,9 +38,9 @@
#include "video_out.h"
#include "buffer.h"
-
+/*
#define LOG
-
+*/
typedef struct {
@@ -101,6 +101,7 @@ typedef struct {
int format;
} rv_init_t;
+#ifdef LOG
static void hexdump (char *buf, int length) {
int i;
@@ -131,7 +132,7 @@ static void hexdump (char *buf, int length) {
}
printf ("\n");
}
-
+#endif
/*
* real codec loader
@@ -143,7 +144,9 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
sprintf (path, "%s/%s", this->cls->real_codec_path, codec_name);
+#ifdef LOG
printf ("libreal: opening shared obj '%s'\n", path);
+#endif
this->rv_handle = dlopen (path, RTLD_LAZY);
if (!this->rv_handle) {
@@ -176,8 +179,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
0, 1, 0}; /* rv30 */
- printf ("libareal: loading codec...\n");
-
switch (buf->type) {
case BUF_VIDEO_RV20:
if (!load_syms_linux (this, "drv2.so.6.0"))
@@ -202,21 +203,21 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
init_data.subformat = BE_32(&buf->content[26]);
init_data.format = BE_32(&buf->content[30]);
+#ifdef LOG
hexdump (&init_data, sizeof (init_data));
hexdump (buf->content, 32);
hexdump (extrahdr, 10);
-
+
printf ("libreal: init codec %dx%d... %x %x\n",
init_data.w, init_data.h,
init_data.subformat, init_data.format );
-
+#endif
+
this->context = NULL;
result = this->rvyuv_init (&init_data, &this->context);
- printf ("libreal: ... done %d\n", result);
-
/* setup rv30 codec (codec sub-type and image dimensions): */
if (init_data.format>=0x20200002){
unsigned long cmsg24[4]={this->width,this->height,
@@ -224,15 +225,14 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) {
unsigned long cmsg_data[3]={0x24,1+((init_data.subformat>>16)&7),
(unsigned long) &cmsg24};
+#ifdef LOG
printf ("libreal: cmsg24:\n");
hexdump (cmsg24, sizeof (cmsg24));
printf ("libreal: cmsg_data:\n");
hexdump (cmsg_data, sizeof (cmsg_data));
+#endif
this->rvyuv_custom_message (cmsg_data, this->context);
-
- printf ("libreal: special setup for rv30 done\n");
-
}
this->stream->video_out->open(this->stream->video_out, this->stream);
@@ -247,7 +247,8 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
realdec_decoder_t *this = (realdec_decoder_t *) this_gen;
#ifdef LOG
- printf ("libreal: decode_data, flags=0x%08x ...\n", buf->decoder_flags);
+ printf ("libreal: decode_data, flags=0x%08x, len=%d ...\n",
+ buf->decoder_flags, buf->size);
#endif
if (buf->decoder_flags & BUF_FLAG_PREVIEW) {
@@ -275,8 +276,10 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
this->pts /* timestamp (the integer value from the stream) */
};
+#ifdef LOG
printf ("libreal: got %d chunks in buffer and new frame is starting\n",
this->num_chunks);
+#endif
img = this->stream->video_out->get_frame (this->stream->video_out,
/* this->av_picture.linesize[0], */
@@ -301,6 +304,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
img->duration = this->duration;
img->bad_frame = 0;
+#ifdef LOG
printf ("libreal: pts %lld %lld diff %lld # %d est. duration %lld\n",
this->pts*90,
buf->pts*90,
@@ -316,6 +320,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
printf ("libreal: chunk_table:\n");
hexdump (this->chunk_tab, this->num_chunks*8+8);
+#endif
result = this->rvyuv_transform (this->chunk_buffer,
this->frame_buffer,
@@ -323,14 +328,14 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
transform_out,
this->context);
- printf ("libreal: decoding result: %d\n", result);
-
xine_fast_memcpy (img->base[0], this->frame_buffer, this->frame_size);
xine_fast_memcpy (img->base[1], this->frame_buffer+this->frame_size,
this->frame_size/4);
xine_fast_memcpy (img->base[2], this->frame_buffer+this->frame_size*5/4,
this->frame_size/4);
+ /* FIXME: call copy on slices */
+
img->draw(img, this->stream);
img->free(img);
@@ -338,7 +343,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
/* new frame starting */
+#ifdef LOG
printf ("libreal: new frame starting (%d bytes)\n", buf->size);
+#endif
memcpy (this->chunk_buffer, buf->content, buf->size);
@@ -355,8 +362,10 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
/* buffer another fragment */
+#ifdef LOG
printf ("libreal: another fragment (%d chunks in buffer)\n",
this->num_chunks);
+#endif
memcpy (this->chunk_buffer+this->chunk_buffer_size, buf->content, buf->size);
@@ -503,7 +512,9 @@ static void *init_class (xine_t *xine, void *data) {
"/opt/RealPlayer8/Codecs");
}
+#ifdef LOG
printf ("libareal: real codec path : %s\n", this->real_codec_path);
+#endif
return this;
}