comparison src/neon/neon.h @ 1719:29c35cb8873e

- Add neon HTTP transport plugin sources (for real)
author Ralf Ertzinger <ralf@skytale.net>
date Mon, 17 Sep 2007 21:46:53 +0200
parents
children 50d151b259bb
comparison
equal deleted inserted replaced
1718:892deefba58d 1719:29c35cb8873e
1 #ifndef _NEON_PLUGIN_H
2 #define _NEON_PLUGIN_H
3
4 #include <glib.h>
5 #include <audacious/vfs.h>
6 #include <ne_session.h>
7 #include <ne_request.h>
8 #include <ne_uri.h>
9 #include "rb.h"
10
11
12 static void init(void);
13 static void fini(void);
14
15 VFSFile *neon_vfs_fopen_impl(const gchar* path, const gchar* mode);
16 gint neon_vfs_fclose_impl(VFSFile* file);
17 size_t neon_vfs_fread_impl(gpointer ptr_, size_t size, size_t nmemb, VFSFile* file);
18 size_t neon_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile* file);
19 gint neon_vfs_getc_impl(VFSFile* file);
20 gint neon_vfs_ungetc_impl(gint c, VFSFile* file);
21 void neon_vfs_rewind_impl(VFSFile* file);
22 glong neon_vfs_ftell_impl(VFSFile* file);
23 gboolean neon_vfs_feof_impl(VFSFile* file);
24 gint neon_vfs_truncate_impl(VFSFile* file, glong size);
25 gint neon_vfs_fseek_impl(VFSFile* file, glong offset, gint whence);
26 gchar *neon_vfs_metadata_impl(VFSFile* file, const gchar * field);
27 off_t neon_vfs_fsize_impl(VFSFile* file);
28
29 ne_uri purl;
30
31 typedef enum {
32 NEON_READER_INIT=0,
33 NEON_READER_RUN=1,
34 NEON_READER_ERROR,
35 NEON_READER_EOF,
36 NEON_READER_TERM
37 } neon_reader_t;
38
39 struct reader_status {
40 GMutex* mutex;
41 GCond* cond;
42 gboolean reading;
43 neon_reader_t status;
44 };
45
46 struct neon_handle {
47 gchar* url; /* The URL, as passed to us */
48 ne_uri* purl; /* The URL, parsed into a structure */
49 struct ringbuf rb; /* Ringbuffer for our data */
50 unsigned char redircount; /* Redirect count for the opened URL */
51 long pos; /* Current position in the stream (number of last byte delivered to the player) */
52 unsigned long content_start; /* Start position in the stream */
53 long content_length; /* Total content length, counting from content_start, if known. -1 if unknown */
54 gboolean can_ranges; /* TRUE if the webserver advertised accept-range: bytes */
55 ne_session* session;
56 ne_request* request;
57 GThread* reader;
58 struct reader_status reader_status;
59 gboolean eof;
60 };
61
62
63 #endif