X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frtmp.h;h=bdac6fd31d9808311a40dd5c9743476b17e4690e;hb=11a1033c9fcae380f4da06b2b0253ab0eb82b026;hp=b0436c0391bb5ae1348955b8ce2575c2dc42d28d;hpb=5c14b282d1cc407f6b9efb03564ecac75fb59471;p=ffmpeg diff --git a/libavformat/rtmp.h b/libavformat/rtmp.h index b0436c0391b..bdac6fd31d9 100644 --- a/libavformat/rtmp.h +++ b/libavformat/rtmp.h @@ -25,9 +25,22 @@ #include "avformat.h" #define RTMP_DEFAULT_PORT 1935 +#define RTMPS_DEFAULT_PORT 443 #define RTMP_HANDSHAKE_PACKET_SIZE 1536 +#define HMAC_IPAD_VAL 0x36 +#define HMAC_OPAD_VAL 0x5C + +/** + * A non-zero transaction id requires the server to send back + * a _result or _error response. + * Setting it to 0 marks the message as a notification not + * requiring feedback. + */ + +#define RTMP_NOTIFICATION 0 + /** * emulated Flash client version - 9.0.124.2 on Linux * @{ @@ -39,4 +52,29 @@ #define RTMP_CLIENT_VER4 2 /** @} */ //version defines +/** + * Calculate HMAC-SHA2 digest for RTMP handshake packets. + * + * @param src input buffer + * @param len input buffer length (should be 1536) + * @param gap offset in buffer where 32 bytes should not be taken into account + * when calculating digest (since it will be used to store that digest) + * @param key digest key + * @param keylen digest key length + * @param dst buffer where calculated digest will be stored (32 bytes) + */ +int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap, + const uint8_t *key, int keylen, uint8_t *dst); + +/** + * Calculate digest position for RTMP handshake packets. + * + * @param buf input buffer (should be 1536 bytes) + * @param off offset in buffer where to start calculating digest position + * @param mod_val value used for computing modulo + * @param add_val value added at the end (after computing modulo) + */ +int ff_rtmp_calc_digest_pos(const uint8_t *buf, int off, int mod_val, + int add_val); + #endif /* AVFORMAT_RTMP_H */