You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avio: K&R formatting cosmetics
This commit is contained in:
@@ -42,8 +42,10 @@ URLProtocol *ffurl_protocol_next(URLProtocol *prev)
|
||||
static const char *urlcontext_to_name(void *ptr)
|
||||
{
|
||||
URLContext *h = (URLContext *)ptr;
|
||||
if(h->prot) return h->prot->name;
|
||||
else return "NULL";
|
||||
if (h->prot)
|
||||
return h->prot->name;
|
||||
else
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
static void *urlcontext_child_next(void *obj, void *prev)
|
||||
@@ -68,7 +70,6 @@ static const AVClass *urlcontext_child_class_next(const AVClass *prev)
|
||||
if (p->priv_data_class)
|
||||
return p->priv_data_class;
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
static const AVOption options[] = { { NULL } };
|
||||
@@ -82,12 +83,12 @@ const AVClass ffurl_context_class = {
|
||||
};
|
||||
/*@}*/
|
||||
|
||||
|
||||
const char *avio_enum_protocols(void **opaque, int output)
|
||||
{
|
||||
URLProtocol *p;
|
||||
*opaque = ffurl_protocol_next(*opaque);
|
||||
if (!(p = *opaque)) return NULL;
|
||||
if (!(p = *opaque))
|
||||
return NULL;
|
||||
if ((output && p->url_write) || (!output && p->url_read))
|
||||
return p->name;
|
||||
return avio_enum_protocols(opaque, output);
|
||||
@@ -102,7 +103,8 @@ int ffurl_register_protocol(URLProtocol *protocol, int size)
|
||||
protocol = temp;
|
||||
}
|
||||
p = &first_protocol;
|
||||
while (*p != NULL) p = &(*p)->next;
|
||||
while (*p != NULL)
|
||||
p = &(*p)->next;
|
||||
*p = protocol;
|
||||
protocol->next = NULL;
|
||||
return 0;
|
||||
@@ -155,14 +157,17 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||
int ffurl_connect(URLContext *uc, AVDictionary **options)
|
||||
{
|
||||
int err =
|
||||
uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, uc->flags, options) :
|
||||
uc->prot->url_open2 ? uc->prot->url_open2(uc,
|
||||
uc->filename,
|
||||
uc->flags,
|
||||
options) :
|
||||
uc->prot->url_open(uc, uc->filename, uc->flags);
|
||||
if (err)
|
||||
return err;
|
||||
uc->is_connected = 1;
|
||||
//We must be careful here as ffurl_seek() could be slow, for example for http
|
||||
if( (uc->flags & AVIO_FLAG_WRITE)
|
||||
|| !strcmp(uc->prot->name, "file"))
|
||||
/* We must be careful here as ffurl_seek() could be slow,
|
||||
* for example for http */
|
||||
if ((uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file"))
|
||||
if (!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
||||
uc->is_streamed = 1;
|
||||
return 0;
|
||||
@@ -183,7 +188,8 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
|
||||
if (filename[proto_len] != ':' || is_dos_path(filename))
|
||||
strcpy(proto_str, "file");
|
||||
else
|
||||
av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
|
||||
av_strlcpy(proto_str, filename,
|
||||
FFMIN(proto_len + 1, sizeof(proto_str)));
|
||||
|
||||
av_strlcpy(proto_nested, proto_str, sizeof(proto_nested));
|
||||
if ((ptr = strchr(proto_nested, '+')))
|
||||
@@ -218,8 +224,11 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min,
|
||||
int (*transfer_func)(URLContext *h, unsigned char *buf, int size))
|
||||
static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
|
||||
int size, int size_min,
|
||||
int (*transfer_func)(URLContext *h,
|
||||
uint8_t *buf,
|
||||
int size))
|
||||
{
|
||||
int ret, len;
|
||||
int fast_retries = 5;
|
||||
@@ -286,7 +295,8 @@ int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
|
||||
int ffurl_close(URLContext *h)
|
||||
{
|
||||
int ret = 0;
|
||||
if (!h) return 0; /* can happen when ffurl_open fails */
|
||||
if (!h)
|
||||
return 0; /* can happen when ffurl_open fails */
|
||||
|
||||
if (h->is_connected && h->prot->url_close)
|
||||
ret = h->prot->url_close(h);
|
||||
|
Reference in New Issue
Block a user