You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.3KB

  1. #ifndef _amf0_h_
  2. #define _amf0_h_
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. enum AMFDataType
  9. {
  10. AMF_NUMBER = 0x00,
  11. AMF_BOOLEAN,
  12. AMF_STRING,
  13. AMF_OBJECT,
  14. AMF_MOVIECLIP,
  15. AMF_NULL,
  16. AMF_UNDEFINED,
  17. AMF_REFERENCE,
  18. AMF_ECMA_ARRAY,
  19. AMF_OBJECT_END,
  20. AMF_STRICT_ARRAY,
  21. AMF_DATE,
  22. AMF_LONG_STRING,
  23. AMF_UNSUPPORTED,
  24. AMF_RECORDSET,
  25. AMF_XML_DOCUMENT,
  26. AMF_TYPED_OBJECT,
  27. AMF_AVMPLUS_OBJECT,
  28. };
  29. uint8_t* AMFWriteNull(uint8_t* ptr, const uint8_t* end);
  30. uint8_t* AMFWriteUndefined(uint8_t* ptr, const uint8_t* end);
  31. uint8_t* AMFWriteObject(uint8_t* ptr, const uint8_t* end);
  32. uint8_t* AMFWriteObjectEnd(uint8_t* ptr, const uint8_t* end);
  33. uint8_t* AMFWriteTypedObject(uint8_t* ptr, const uint8_t* end);
  34. uint8_t* AMFWriteECMAArarry(uint8_t* ptr, const uint8_t* end);
  35. uint8_t* AMFWriteBoolean(uint8_t* ptr, const uint8_t* end, uint8_t value);
  36. uint8_t* AMFWriteDouble(uint8_t* ptr, const uint8_t* end, double value);
  37. uint8_t* AMFWriteString(uint8_t* ptr, const uint8_t* end, const char* string, size_t length);
  38. uint8_t* AMFWriteDate(uint8_t* ptr, const uint8_t* end, double milliseconds, int16_t timezone);
  39. uint8_t* AMFWriteNamedString(uint8_t* ptr, const uint8_t* end, const char* name, size_t length, const char* value, size_t length2);
  40. uint8_t* AMFWriteNamedDouble(uint8_t* ptr, const uint8_t* end, const char* name, size_t length, double value);
  41. uint8_t* AMFWriteNamedBoolean(uint8_t* ptr, const uint8_t* end, const char* name, size_t length, uint8_t value);
  42. const uint8_t* AMFReadNull(const uint8_t* ptr, const uint8_t* end);
  43. const uint8_t* AMFReadUndefined(const uint8_t* ptr, const uint8_t* end);
  44. const uint8_t* AMFReadBoolean(const uint8_t* ptr, const uint8_t* end, uint8_t* value);
  45. const uint8_t* AMFReadDouble(const uint8_t* ptr, const uint8_t* end, double* value);
  46. const uint8_t* AMFReadString(const uint8_t* ptr, const uint8_t* end, int isLongString, char* string, size_t length);
  47. const uint8_t* AMFReadDate(const uint8_t* ptr, const uint8_t* end, double *milliseconds, int16_t *timezone);
  48. struct amf_object_item_t
  49. {
  50. enum AMFDataType type;
  51. const char* name;
  52. void* value;
  53. size_t size;
  54. };
  55. const uint8_t* amf_read_items(const uint8_t* data, const uint8_t* end, struct amf_object_item_t* items, size_t count);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* !_amf0_h_ */