[Red5devs] Datatype conversion example

Dominick Accattato daccattato at gmail.com
Mon Mar 20 08:07:30 EST 2006


As promised, heres an example of my Datatype woes.

Type
Size
String
 Number

Correct Meta Data inserted with Flash Video Exporter
02 00 0A 6F 6E 43 75 65 50 6F 69 6E 74 08 00 00 00 03 00
04 6E 61 6D 65 *02 00 03 6F 6E 65* 00 *04 74 69 6D 65* *00 3F
EB A5 E3 53 F7 CE D9* 00 04 74 79 70 65 *02 00 05 * *65 76 65
6E 74* 00 00 09

Ok, now to explain the above colored metadata.  We start off with 02 which
tells us that we have a string coming with a length of 10 ( 00 0A) that
string is "onCuePoint" in green.  Next we get to datatype 08 which is a
MixedArray. The MixedArray datatype is followed by a Long which states that
their are three items in the MixedArray (00 00 00 03). The MixedArray (Map)
is followed by a number of Key/Value pairs.  The key is not prefixed with a
datatype because it is always a String, so the only information needed is
the length which is 4 bytes (00 04) followed by a UTF8 String "name" which
represents the key.  Then we have a value which has a datatype of 02 which
is a String. So I can go on and on, but the point is that the MixedArray is
surely a Map and not a List.

Incorrect Meta Data inserted with Red5
20 00 0A 6F 6E 43 75 65 50 6F 69 6E 74 08 00 00 00 03 00
01 30 03 00 04 74 79 70 65 *02 00 05 65 76 65 6E 74* 00 00
09 00 01 31 03 00 04 74 69 6D 65 *02 00 02 61 61 * 00 00 09
00 01 32 03 00 04 6E 61 6D 65 *02 00 08 **6E 61 6D 65 54 65
73 74* 00 00 09 00 00 09

Okay, so what I have above is metadata that has a MixedArray (List) which
holds three items (Maps).  The important thing to notice above is the bytes
highlighted in yellow .  Lets examine the first one:  00 01 30  .  This says
that there is a length of (00 01), and that the value is a String "0" (30).
The next one says that there is a length of 1 (00 01)with a value of "1" (31).
The last one says that there is a length of 1 (00 01)with a value of "2" (32
).

What those represent are the indexes of the List, 1,2,3.  A MixedArray
doesn't use numbers as indexes, only key/value pairs.


So currently I can only inject metadata with a hack.  However, we should
take a look at datatype coversion for a better serialization.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5devs_osflash.org/attachments/20060320/923310f4/attachment.htm


More information about the Red5devs mailing list