Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
bc371aca
Commit
bc371aca
authored
Mar 31, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: make url_read() internal.
parent
0589da0a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
29 additions
and
23 deletions
+29
-23
applehttpproto.c
libavformat/applehttpproto.c
+1
-1
avio.c
libavformat/avio.c
+5
-1
avio.h
libavformat/avio.h
+1
-11
aviobuf.c
libavformat/aviobuf.c
+1
-1
concat.c
libavformat/concat.c
+1
-1
gopher.c
libavformat/gopher.c
+1
-1
http.c
libavformat/http.c
+2
-2
rtmppkt.c
libavformat/rtmppkt.c
+2
-1
rtsp.c
libavformat/rtsp.c
+2
-2
sapdec.c
libavformat/sapdec.c
+2
-2
url.h
libavformat/url.h
+11
-0
No files found.
libavformat/applehttpproto.c
View file @
bc371aca
...
@@ -241,7 +241,7 @@ static int applehttp_read(URLContext *h, uint8_t *buf, int size)
...
@@ -241,7 +241,7 @@ static int applehttp_read(URLContext *h, uint8_t *buf, int size)
start:
start:
if
(
s
->
seg_hd
)
{
if
(
s
->
seg_hd
)
{
ret
=
url_read
(
s
->
seg_hd
,
buf
,
size
);
ret
=
ff
url_read
(
s
->
seg_hd
,
buf
,
size
);
if
(
ret
>
0
)
if
(
ret
>
0
)
return
ret
;
return
ret
;
}
}
...
...
libavformat/avio.c
View file @
bc371aca
...
@@ -180,6 +180,10 @@ int url_open(URLContext **puc, const char *filename, int flags)
...
@@ -180,6 +180,10 @@ int url_open(URLContext **puc, const char *filename, int flags)
{
{
return
ffurl_open
(
puc
,
filename
,
flags
);
return
ffurl_open
(
puc
,
filename
,
flags
);
}
}
int
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
)
{
return
ffurl_read
(
h
,
buf
,
size
);
}
#endif
#endif
#define URL_SCHEME_CHARS \
#define URL_SCHEME_CHARS \
...
@@ -258,7 +262,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
...
@@ -258,7 +262,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
return
len
;
return
len
;
}
}
int
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
)
int
ff
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
)
{
{
if
(
h
->
flags
&
URL_WRONLY
)
if
(
h
->
flags
&
URL_WRONLY
)
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
...
...
libavformat/avio.h
View file @
bc371aca
...
@@ -105,19 +105,9 @@ attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol
...
@@ -105,19 +105,9 @@ attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol
attribute_deprecated
int
url_alloc
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
attribute_deprecated
int
url_alloc
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
attribute_deprecated
int
url_connect
(
URLContext
*
h
);
attribute_deprecated
int
url_connect
(
URLContext
*
h
);
attribute_deprecated
int
url_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
attribute_deprecated
int
url_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
attribute_deprecated
int
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
#endif
#endif
/**
* Read up to size bytes from the resource accessed by h, and store
* the read bytes in buf.
*
* @return The number of bytes actually read, or a negative value
* corresponding to an AVERROR code in case of error. A value of zero
* indicates that it is not possible to read more from the accessed
* resource (except if the value of the size argument is also zero).
*/
int
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
/**
/**
* Read as many bytes as possible (up to size), calling the
* Read as many bytes as possible (up to size), calling the
* read function multiple times if necessary.
* read function multiple times if necessary.
...
...
libavformat/aviobuf.c
View file @
bc371aca
...
@@ -846,7 +846,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
...
@@ -846,7 +846,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
if
(
ffio_init_context
(
*
s
,
buffer
,
buffer_size
,
if
(
ffio_init_context
(
*
s
,
buffer
,
buffer_size
,
(
h
->
flags
&
URL_WRONLY
||
h
->
flags
&
URL_RDWR
),
h
,
(
h
->
flags
&
URL_WRONLY
||
h
->
flags
&
URL_RDWR
),
h
,
url_read
,
url_write
,
url_seek
)
<
0
)
{
ff
url_read
,
url_write
,
url_seek
)
<
0
)
{
av_free
(
buffer
);
av_free
(
buffer
);
av_freep
(
s
);
av_freep
(
s
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
...
...
libavformat/concat.c
View file @
bc371aca
...
@@ -136,7 +136,7 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
...
@@ -136,7 +136,7 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
size_t
i
=
data
->
current
;
size_t
i
=
data
->
current
;
while
(
size
>
0
)
{
while
(
size
>
0
)
{
result
=
url_read
(
nodes
[
i
].
uc
,
buf
,
size
);
result
=
ff
url_read
(
nodes
[
i
].
uc
,
buf
,
size
);
if
(
result
<
0
)
if
(
result
<
0
)
return
total
?
total
:
result
;
return
total
?
total
:
result
;
if
(
!
result
)
if
(
!
result
)
...
...
libavformat/gopher.c
View file @
bc371aca
...
@@ -115,7 +115,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
...
@@ -115,7 +115,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
static
int
gopher_read
(
URLContext
*
h
,
uint8_t
*
buf
,
int
size
)
static
int
gopher_read
(
URLContext
*
h
,
uint8_t
*
buf
,
int
size
)
{
{
GopherContext
*
s
=
h
->
priv_data
;
GopherContext
*
s
=
h
->
priv_data
;
int
len
=
url_read
(
s
->
hd
,
buf
,
size
);
int
len
=
ff
url_read
(
s
->
hd
,
buf
,
size
);
return
len
;
return
len
;
}
}
...
...
libavformat/http.c
View file @
bc371aca
...
@@ -171,7 +171,7 @@ static int http_getc(HTTPContext *s)
...
@@ -171,7 +171,7 @@ static int http_getc(HTTPContext *s)
{
{
int
len
;
int
len
;
if
(
s
->
buf_ptr
>=
s
->
buf_end
)
{
if
(
s
->
buf_ptr
>=
s
->
buf_end
)
{
len
=
url_read
(
s
->
hd
,
s
->
buffer
,
BUFFER_SIZE
);
len
=
ff
url_read
(
s
->
hd
,
s
->
buffer
,
BUFFER_SIZE
);
if
(
len
<
0
)
{
if
(
len
<
0
)
{
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
else
if
(
len
==
0
)
{
}
else
if
(
len
==
0
)
{
...
@@ -407,7 +407,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
...
@@ -407,7 +407,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
}
else
{
}
else
{
if
(
!
s
->
willclose
&&
s
->
filesize
>=
0
&&
s
->
off
>=
s
->
filesize
)
if
(
!
s
->
willclose
&&
s
->
filesize
>=
0
&&
s
->
off
>=
s
->
filesize
)
return
AVERROR_EOF
;
return
AVERROR_EOF
;
len
=
url_read
(
s
->
hd
,
buf
,
size
);
len
=
ff
url_read
(
s
->
hd
,
buf
,
size
);
}
}
if
(
len
>
0
)
{
if
(
len
>
0
)
{
s
->
off
+=
len
;
s
->
off
+=
len
;
...
...
libavformat/rtmppkt.c
View file @
bc371aca
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "rtmppkt.h"
#include "rtmppkt.h"
#include "flv.h"
#include "flv.h"
#include "url.h"
void
ff_amf_write_bool
(
uint8_t
**
dst
,
int
val
)
void
ff_amf_write_bool
(
uint8_t
**
dst
,
int
val
)
{
{
...
@@ -78,7 +79,7 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
...
@@ -78,7 +79,7 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
enum
RTMPPacketType
type
;
enum
RTMPPacketType
type
;
int
size
=
0
;
int
size
=
0
;
if
(
url_read
(
h
,
&
hdr
,
1
)
!=
1
)
if
(
ff
url_read
(
h
,
&
hdr
,
1
)
!=
1
)
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
size
++
;
size
++
;
channel_id
=
hdr
&
0x3F
;
channel_id
=
hdr
&
0x3F
;
...
...
libavformat/rtsp.c
View file @
bc371aca
...
@@ -1594,7 +1594,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
...
@@ -1594,7 +1594,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
rtsp_st
=
rt
->
rtsp_streams
[
i
];
rtsp_st
=
rt
->
rtsp_streams
[
i
];
if
(
rtsp_st
->
rtp_handle
)
{
if
(
rtsp_st
->
rtp_handle
)
{
if
(
p
[
j
].
revents
&
POLLIN
||
p
[
j
+
1
].
revents
&
POLLIN
)
{
if
(
p
[
j
].
revents
&
POLLIN
||
p
[
j
+
1
].
revents
&
POLLIN
)
{
ret
=
url_read
(
rtsp_st
->
rtp_handle
,
buf
,
buf_size
);
ret
=
ff
url_read
(
rtsp_st
->
rtp_handle
,
buf
,
buf_size
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
*
prtsp_st
=
rtsp_st
;
*
prtsp_st
=
rtsp_st
;
return
ret
;
return
ret
;
...
@@ -1868,7 +1868,7 @@ static int rtp_read_header(AVFormatContext *s,
...
@@ -1868,7 +1868,7 @@ static int rtp_read_header(AVFormatContext *s,
goto
fail
;
goto
fail
;
while
(
1
)
{
while
(
1
)
{
ret
=
url_read
(
in
,
recvbuf
,
sizeof
(
recvbuf
));
ret
=
ff
url_read
(
in
,
recvbuf
,
sizeof
(
recvbuf
));
if
(
ret
==
AVERROR
(
EAGAIN
))
if
(
ret
==
AVERROR
(
EAGAIN
))
continue
;
continue
;
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
libavformat/sapdec.c
View file @
bc371aca
...
@@ -93,7 +93,7 @@ static int sap_read_header(AVFormatContext *s,
...
@@ -93,7 +93,7 @@ static int sap_read_header(AVFormatContext *s,
int
addr_type
,
auth_len
;
int
addr_type
,
auth_len
;
int
pos
;
int
pos
;
ret
=
url_read
(
sap
->
ann_fd
,
recvbuf
,
sizeof
(
recvbuf
)
-
1
);
ret
=
ff
url_read
(
sap
->
ann_fd
,
recvbuf
,
sizeof
(
recvbuf
)
-
1
);
if
(
ret
==
AVERROR
(
EAGAIN
))
if
(
ret
==
AVERROR
(
EAGAIN
))
continue
;
continue
;
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -195,7 +195,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -195,7 +195,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
n
=
poll
(
&
p
,
1
,
0
);
n
=
poll
(
&
p
,
1
,
0
);
if
(
n
<=
0
||
!
(
p
.
revents
&
POLLIN
))
if
(
n
<=
0
||
!
(
p
.
revents
&
POLLIN
))
break
;
break
;
ret
=
url_read
(
sap
->
ann_fd
,
recvbuf
,
sizeof
(
recvbuf
));
ret
=
ff
url_read
(
sap
->
ann_fd
,
recvbuf
,
sizeof
(
recvbuf
));
if
(
ret
>=
8
)
{
if
(
ret
>=
8
)
{
uint16_t
hash
=
AV_RB16
(
&
recvbuf
[
2
]);
uint16_t
hash
=
AV_RB16
(
&
recvbuf
[
2
]);
/* Should ideally check the source IP address, too */
/* Should ideally check the source IP address, too */
...
...
libavformat/url.h
View file @
bc371aca
...
@@ -58,4 +58,15 @@ int ffurl_connect(URLContext *h);
...
@@ -58,4 +58,15 @@ int ffurl_connect(URLContext *h);
*/
*/
int
ffurl_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
int
ffurl_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
/**
* Read up to size bytes from the resource accessed by h, and store
* the read bytes in buf.
*
* @return The number of bytes actually read, or a negative value
* corresponding to an AVERROR code in case of error. A value of zero
* indicates that it is not possible to read more from the accessed
* resource (except if the value of the size argument is also zero).
*/
int
ffurl_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
#endif //AVFORMAT_URL_H
#endif //AVFORMAT_URL_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment