mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-20 07:12:21 +08:00
新增mk_http_body无拷贝创建api
This commit is contained in:
@@ -253,6 +253,7 @@ API_EXPORT void API_CALL mk_media_source_for_each(void *user_data, on_mk_media_s
|
||||
}
|
||||
|
||||
///////////////////////////////////////////HttpBody/////////////////////////////////////////////
|
||||
|
||||
API_EXPORT mk_http_body API_CALL mk_http_body_from_string(const char *str, size_t len){
|
||||
assert(str);
|
||||
if(!len){
|
||||
@@ -261,6 +262,11 @@ API_EXPORT mk_http_body API_CALL mk_http_body_from_string(const char *str, size_
|
||||
return new HttpBody::Ptr(new HttpStringBody(std::string(str, len)));
|
||||
}
|
||||
|
||||
API_EXPORT mk_http_body API_CALL mk_http_body_from_buffer(mk_buffer buffer) {
|
||||
assert(buffer);
|
||||
return new HttpBody::Ptr(new HttpBufferBody(*((Buffer::Ptr *) buffer)));
|
||||
}
|
||||
|
||||
API_EXPORT mk_http_body API_CALL mk_http_body_from_file(const char *file_path){
|
||||
assert(file_path);
|
||||
return new HttpBody::Ptr(new HttpFileBody(file_path));
|
||||
|
||||
Reference in New Issue
Block a user