Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

10 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef _rtsp_client_internal_h_
  2. #define _rtsp_client_internal_h_
  3. #include "rtsp-media.h"
  4. #include "rtsp-client.h"
  5. #include "rtp-over-rtsp.h"
  6. #include "http-header-auth.h"
  7. #include "rtsp-header-session.h"
  8. #include "rtsp-header-transport.h"
  9. #include "http-parser.h"
  10. #include "sdp-options.h"
  11. #include "sdp.h"
  12. #include <errno.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <assert.h>
  17. #include <inttypes.h>
  18. #if defined(OS_WINDOWS)
  19. #define strcasecmp _stricmp
  20. #endif
  21. #define USER_AGENT "ireader/media-server"
  22. #define N_MEDIA 8
  23. enum rtsp_state_t
  24. {
  25. RTSP_INIT,
  26. RTSP_ANNOUNCE,
  27. RTSP_RECORD,
  28. RTSP_DESCRIBE,
  29. RTSP_SETUP,
  30. RTSP_PLAY,
  31. RTSP_PAUSE,
  32. RTSP_TEARDWON,
  33. RTSP_OPTIONS,
  34. RTSP_GET_PARAMETER,
  35. RTSP_SET_PARAMETER,
  36. };
  37. struct rtsp_client_t
  38. {
  39. struct rtsp_client_handler_t handler;
  40. void* param;
  41. const char* announce; // announce sdp
  42. http_parser_t* parser;
  43. enum rtsp_state_t state;
  44. int parser_need_more_data;
  45. int progress;
  46. unsigned int cseq; // rtsp sequence
  47. struct rtp_over_rtsp_t rtp;
  48. sdp_t* sdp;
  49. int media_count;
  50. struct rtsp_media_t media[N_MEDIA];
  51. struct rtsp_header_session_t session[N_MEDIA];
  52. struct rtsp_header_transport_t transport[N_MEDIA];
  53. // media
  54. char range[64]; // rtsp header Range
  55. char speed[16]; // rtsp header speed
  56. char scale[16]; // rtsp header scale
  57. char req[2048];
  58. char uri[256];
  59. char baseuri[256]; // Content-Base
  60. char location[256]; // Content-Location
  61. int aggregate; // 1-aggregate control available
  62. char aggregate_uri[256]; // aggregate control uri, valid if 1==aggregate
  63. int auth_failed;
  64. char usr[128];
  65. char pwd[256];
  66. char authenrization[1024];
  67. struct http_header_www_authenticate_t auth;
  68. };
  69. //int rtsp_client_describe(struct rtsp_client_t* rtsp);
  70. //int rtsp_client_announce(struct rtsp_client_t* rtsp, const char* sdp);
  71. //int rtsp_client_setup(struct rtsp_client_t* rtsp, const char* sdp);
  72. //int rtsp_client_teardown(struct rtsp_client_t* rtsp);
  73. int rtsp_client_sdp(struct rtsp_client_t* rtsp, const char* sdp);
  74. int rtsp_client_get_parameter(struct rtsp_client_t *rtsp, int media, const char* parameter);
  75. int rtsp_client_set_parameter(struct rtsp_client_t *rtsp, int media, const char* parameter);
  76. int rtsp_client_announce_onreply(struct rtsp_client_t* rtsp, void* parser);
  77. int rtsp_client_describe_onreply(struct rtsp_client_t* rtsp, void* parser);
  78. int rtsp_client_setup_onreply(struct rtsp_client_t* rtsp, void* parser);
  79. int rtsp_client_play_onreply(struct rtsp_client_t* rtsp, void* parser);
  80. int rtsp_client_pause_onreply(struct rtsp_client_t* rtsp, void* parser);
  81. int rtsp_client_teardown_onreply(struct rtsp_client_t* rtsp, void* parser);
  82. int rtsp_client_options_onreply(struct rtsp_client_t* rtsp, void* parser);
  83. int rtsp_client_record_onreply(struct rtsp_client_t* rtsp, void* parser);
  84. int rtsp_client_get_parameter_onreply(struct rtsp_client_t* rtsp, void* parser);
  85. int rtsp_client_set_parameter_onreply(struct rtsp_client_t* rtsp, void* parser);
  86. int rtsp_client_www_authenticate(struct rtsp_client_t* rtsp, const char* filed);
  87. int rtsp_client_authenrization(struct rtsp_client_t* rtsp, const char* method, const char* uri, const char* content, int length, char* authenrization, int bytes);
  88. #endif /* !_rtsp_client_internal_h_ */