-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpStream.h
More file actions
68 lines (50 loc) · 1.37 KB
/
HttpStream.h
File metadata and controls
68 lines (50 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef __SLSERVER_HTTPSTREAM_
#define __SLSERVER_HTTPSTREAM_
/***************************************************************************
*
* Project libmjpeg
*
* Copyright (C) 2014-2015, Changer, <dingjinchengyx@163.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "slconfig.h"
#include "list.h"
class HttpStream {
public:
HttpStream(int size_count,int cnt = 16);
virtual ~HttpStream();
public:
void lock();
void unlock();
int read(u8* buf,int len);
int readline(u8* buf,int len);
int skip(int len);
int write(const u8* wbuf,int len,bool blocked = false);
int left();
void alloc_new_page(int cnt);
void setEOF(bool v);
bool isEOF();
int size();
void clear();
private:
int _page_size;
list<u8*>* _free_page;
list<u8*>* _p_arr;
int _read_pos;
int _write_pos;
u8* _readpage_addr;
u8* _writepage_addr;
CRITICAL_SECTION _write_mutex;
bool _isEOF;
};
#endif