mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
Add an AVClass to the HTTPContext
Originally committed as revision 23709 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
a9a3364c31
commit
4167ba0bc8
@ -28,6 +28,7 @@
|
|||||||
#include "http.h"
|
#include "http.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "httpauth.h"
|
#include "httpauth.h"
|
||||||
|
#include "libavcodec/opt.h"
|
||||||
|
|
||||||
/* XXX: POST protocol is not completely implemented because ffmpeg uses
|
/* XXX: POST protocol is not completely implemented because ffmpeg uses
|
||||||
only a subset of it. */
|
only a subset of it. */
|
||||||
@ -38,6 +39,7 @@
|
|||||||
#define MAX_REDIRECTS 8
|
#define MAX_REDIRECTS 8
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
const AVClass *class;
|
||||||
URLContext *hd;
|
URLContext *hd;
|
||||||
unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
|
unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
|
||||||
int line_count;
|
int line_count;
|
||||||
@ -50,6 +52,15 @@ typedef struct {
|
|||||||
unsigned char headers[BUFFER_SIZE];
|
unsigned char headers[BUFFER_SIZE];
|
||||||
} HTTPContext;
|
} HTTPContext;
|
||||||
|
|
||||||
|
#define OFFSET(x) offsetof(HTTPContext, x)
|
||||||
|
static const AVOption options[] = {
|
||||||
|
{"chunksize", "use chunked transfer-encoding for posts, -1 disables it, 0 enables it", OFFSET(chunksize), FF_OPT_TYPE_INT64, 0, -1, 0 }, /* Default to 0, for chunked POSTs */
|
||||||
|
{NULL}
|
||||||
|
};
|
||||||
|
static const AVClass httpcontext_class = {
|
||||||
|
"HTTP", av_default_item_name, options, LIBAVUTIL_VERSION_INT
|
||||||
|
};
|
||||||
|
|
||||||
static int http_connect(URLContext *h, const char *path, const char *hoststr,
|
static int http_connect(URLContext *h, const char *path, const char *hoststr,
|
||||||
const char *auth, int *new_location);
|
const char *auth, int *new_location);
|
||||||
|
|
||||||
@ -152,7 +163,6 @@ static int http_open(URLContext *h, const char *uri, int flags)
|
|||||||
h->is_streamed = 1;
|
h->is_streamed = 1;
|
||||||
|
|
||||||
s->filesize = -1;
|
s->filesize = -1;
|
||||||
s->chunksize = 0; /* Default to chunked POSTs */
|
|
||||||
av_strlcpy(s->location, uri, URL_SIZE);
|
av_strlcpy(s->location, uri, URL_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -522,4 +532,5 @@ URLProtocol http_protocol = {
|
|||||||
http_close,
|
http_close,
|
||||||
.url_get_file_handle = http_get_file_handle,
|
.url_get_file_handle = http_get_file_handle,
|
||||||
.priv_data_size = sizeof(HTTPContext),
|
.priv_data_size = sizeof(HTTPContext),
|
||||||
|
.priv_data_class = &httpcontext_class,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user