From 502d92895923310758b837619635bfe51e153b1b Mon Sep 17 00:00:00 2001 From: arpi Date: Thu, 13 Jun 2002 13:32:10 +0000 Subject: merged with patch by Florian Schneider git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6416 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/realcodecs/TODO | 28 ++++---- DOCS/tech/realcodecs/audio-codecs.txt | 118 +++++++++++++++++++++++++++++----- 2 files changed, 120 insertions(+), 26 deletions(-) (limited to 'DOCS/tech/realcodecs') diff --git a/DOCS/tech/realcodecs/TODO b/DOCS/tech/realcodecs/TODO index 37450eadf1..504f844d42 100644 --- a/DOCS/tech/realcodecs/TODO +++ b/DOCS/tech/realcodecs/TODO @@ -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 + diff --git a/DOCS/tech/realcodecs/audio-codecs.txt b/DOCS/tech/realcodecs/audio-codecs.txt index a2e8f02d22..04ed152912 100644 --- a/DOCS/tech/realcodecs/audio-codecs.txt +++ b/DOCS/tech/realcodecs/audio-codecs.txt @@ -2,7 +2,7 @@ all audio codecs (cook,atrk,14_4,28_8,dnet,sipr) have the same interface, 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 @@ audio properties 0B n/a 0C n/a 0D ? -0E ? +0E ? leaf size 0F ? 10 ? 11 ? @@ -36,26 +36,38 @@ functions: ulong result=RAOpenCodec2(ra_main_t *raMain); -ulong result=RAInitDecoder(ra_main_t *raMain, p2); -p2 points to an array of 7 longs: +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 +}; + +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: -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..|... - -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 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 @@ RACloseCodec(ra_main_t *); 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 + + + -- cgit v1.2.3