changeset 6415:737a277b690c

merged with patch by Florian Schneider <flo-mplayer-dev@gmx.net>
author arpi
date Thu, 13 Jun 2002 13:32:10 +0000
parents 67c1050a8718
children 2e323cde8ad1
files DOCS/tech/realcodecs/TODO DOCS/tech/realcodecs/audio-codecs.txt
diffstat 2 files changed, 120 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/tech/realcodecs/TODO	Thu Jun 13 13:31:45 2002 +0000
+++ b/DOCS/tech/realcodecs/TODO	Thu Jun 13 13:32:10 2002 +0000
@@ -1,18 +1,24 @@
 TODO:
 
 - more docs are coming as I find the time to write them down
-- USE_REALCODECS is needed in config.h -> configure - DONE
-- the original player is doing something I don't know of:
-  I compare the input and output data of the original and mplayer.
-  While the input is the same, the ouput differs. - DONE
 - the frame rate is incorrect - WHY?? need sample, can't reproduce
+  -> see still_stil_still.ram. it needs the value six bytes
+  behind the frame rate. I have activated this for RV[23]0.
+  The sample plays at 12fps (without this patch), realplay
+  play it correctly with 15fps. - possibly DONE
 - use RV20toYUV420Free()
-- rvyuvMain and the two format dwords should be stored inside
-  st_context, so we don't use constants in the demuxer and the
-  wrapper - DONE
-- audio support (mainly for COOK)
-- RV20 support - DONE
+- audio support - nearly DONE (look below)
 - internet streaming support
-- searching
-- get it to work before (they stream) the Bizarre festival :)
+- searching - we need to take care of the audio interleaving -
+  haven't taken steps to locate audio key frames (does such thing
+  exist?)
+- some media files can't be played (mplayer crashes/fails) because
+  it asks for decoded audio data, but the buffer in the audio
+  demuxer packets are empty/missing. It seems that the necessary
+  audio packets haven't been decoded completely (incomplete interleaving)
+  the audio stream packets may get mixed with video stream packet
+- put variables for audio streaming inside real_priv_t
+- audio support for other formats than COOK - use a switch
+  (like -forcereal) to activate it
 
+
--- a/DOCS/tech/realcodecs/audio-codecs.txt	Thu Jun 13 13:31:45 2002 +0000
+++ b/DOCS/tech/realcodecs/audio-codecs.txt	Thu Jun 13 13:32:10 2002 +0000
@@ -2,7 +2,7 @@
 but i have only analyzed the cook codec
 
 
-audio properties
+audio properties (hex)
 
 00 short text/description of the format (bitrate, when to use)
 01 bitrate (bits/s) //avg. bytes/sec output
@@ -21,7 +21,7 @@
 0B n/a
 0C n/a
 0D ?
-0E ?
+0E ? leaf size
 0F ?
 10 ?
 11 ?
@@ -36,26 +36,38 @@
 
 ulong result=RAOpenCodec2(ra_main_t *raMain);
 
-ulong result=RAInitDecoder(ra_main_t *raMain, p2);
-p2 points to an array of 7 longs:
-
-bfffefe0  22 56 00 00 10 00 02 00 64 00 00 00 3c 00 00 00   "V......d...<...
-bfffeff0  58 02 00 00 10 00 00 00 f0 73 1c 08 7c f0 ff bf   X........s..|...
+ulong result=RAInitDecoder(ra_main_t *raMain, ra_init_struct *raInit);
+struct ra_init_struct {
+	ulong sample_rate;
+	ushort bits_per_sample;	// unused by RAInitDecoder
+	ushort number_of_channels;
+	ushort unknown1;	// 0
+	ushort unknown2;	// also unused (100)
+	ulong leaf_size;	// leaf size (used for interleaving, but
+				// exists in audio stream description header (ASDH))
+	ulong block_align;	// packet size
+	ulong bits_per_sample;	// unused (always 16)
+	char *ext_data;		// 16 bytes located at the end of the
+				// ASDH
+};
 
-long  00005622=22050 (Hz)
-short     0010=16 (bit)
-short     0002=2  (channels)
-long  00000064=100 ???
-long  0000003c=60  ???
-long  00000258=600 packet size (used for 'p3' of RADecode)
-long  00000010=16  ???
-long  081c73f0= looks like a pointer
+There are some information missing that you usually need for playback,
+like bits per sample (the fileds aren't read by RAInitDecoder()). These
+are hard coded in the "flavors", i.e. the sub formats. A flavor is an entry
+in the list of available format variations like bitrate, number of channels,
+decoding algorithm, and so on.We can get those information with the
+following command:
+
 
 
 void *GetRAFlavorProperty(ra_main_t *raMain, ulong flavor, ulong property,
 	short *property_length_in_bytes);
 returns property data for a specific data
 
+This is not important, because it's just a read only function.
+These flavor properties don't seem to exist in 
+
+
 ulong RADecode(ra_main_t *raMain, char *input_buffer,
 	ulong input_buffer_size, char *output_buffer,
 	ulong *decoded_bytes, ulong p6=-1);
@@ -66,5 +78,81 @@
 
 
 ulong RASetFlavor(ra_main_t *ra_main, ulong flavor);
+
+Set the flavor of the stream.
+
 a flavor is an entry in the list of available format variations like
 bitrate, number of channels, decoding algorithm, and so on
+
+
+audio data storage:
+-------------------
+
+With Real Audio V5 (or earlier?), the audio streams can be interleaved,
+i.e. the stream is striped amongst several data packets. The packets
+(which have a fixed size packet_len) are split up into a fixed number
+of num_parts equally sized parts - I call them leaves in lack of 
+better name. The leaves have the size leaf_size = packet_len / num_parts.
+
+To create a bunch of packets, you need 2*num_parts stream packets.
+The first part of the first stream packet is stored in leaf number 0,
+the first part of the second into leaf number num_parts, the one of the
+next one into leaf number 1 etc. The following part of a stream packet
+is stored 2*num_packets behind the current part of the same stream packet.
+
+In short words: when you have a matrix with the leaves as the values,
+it's a transposition in conjunction with a permutation.
+
+packet | leaf          | stream packet, part no.
+-------+---------------+------------------------
+0      | 0             | (0,0)
+0      | 1             | (2,0)
+.      | .             | .
+.      | .             | .
+0      | num_parts-1   | (2*num_parts-2,0)
+0      | num_parts     | (1,0)
+0      | num_parts+1   | (3,0)
+.      | .             | .
+.      | .             | .
+0      | 2*num_parts-1 | (2*num_parts-1,0)
+1      | 0             | (0,1)
+.      | .             | .
+.      | .             | .
+
+
+sequence of calls:
+------------------
+
+RAOpenCodec2()
+
+RAInitDecoder()
+
+RASetFlavor()
+
+RAGetFlavorProperty(0xE)
+
+sequence of RADecode()s
+
+once a RAGetFlavorProperty(0xE) after some RADecode()s
+
+and occasionally the following sequence:
+RAGetFlavorProperty(0)
+RAGetFlavorProperty(7)
+which is rather pointless because they only return
+cleartext audio descriptions
+
+RAFreeDecoder()
+
+RACloseCodec()
+
+
+
+RAFlush(ra_main_t *raMain, char *output_buffer, ulong *retval)
+will be called when seeking
+output_buffer points to the output buffer from the last
+decode operation.
+retval is unknow, returning always 0x18 in a specific sample
+-> further investigation needed
+
+
+