Fix oggplay-dump-first-frame
[liboggplay.git] / src / liboggplay / oggplay_tcp_reader.h
blob8290ee4d66bcd552c7834d44d95bd193c1d6e70b
1 /*
2 Copyright (C) 2003 Commonwealth Scientific and Industrial Research
3 Organisation (CSIRO) Australia
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
9 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 - Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 - Neither the name of CSIRO Australia nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * oggplay_tcp_reader.h
36 * Shane Stephens <shane.stephens@annodex.net>
37 * Michael Martin
40 #ifndef __OGGPLAY_FILE_READER_H__
41 #define __OGGPLAY_FILE_READER_H__
43 #include <stdio.h>
45 /* we'll fill to the MAX_IN_MEMORY line, then write out to the
46 * WRITE_THRESHOLD line
48 #define TCP_READER_MAX_IN_MEMORY 128*1024
49 #define TCP_READER_WRITE_THRESHOLD 64*1024
51 typedef enum {
52 TCP_READER_FROM_MEMORY,
53 TCP_READER_FROM_FILE
54 } dataLocation;
56 typedef enum {
57 OTRS_UNINITIALISED,
58 OTRS_SOCKET_CREATED,
59 OTRS_CONNECTED,
60 OTRS_SENT_HEADER,
61 OTRS_HTTP_RESPONDED,
62 OTRS_INIT_COMPLETE
63 } OPTCPReaderState;
65 typedef struct {
66 OggPlayReader functions;
67 OPTCPReaderState state;
68 #ifdef _WIN32
69 SOCKET socket;
70 #else
71 int socket;
72 #endif
73 unsigned char * buffer;
74 int buffer_size;
75 int current_position;
76 char * location;
77 const char * proxy;
78 int proxy_port;
79 int amount_in_memory;
80 FILE * backing_store;
81 int stored_offset;
82 dataLocation mode;
83 int duration;
84 } OggPlayTCPReader;
86 #endif