Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
925e908b
Commit
925e908b
authored
Mar 31, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: make url_write() internal.
parent
dce37564
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
42 additions
and
35 deletions
+42
-35
avio.c
libavformat/avio.c
+5
-1
avio.h
libavformat/avio.h
+1
-8
aviobuf.c
libavformat/aviobuf.c
+1
-1
gopher.c
libavformat/gopher.c
+1
-1
http.c
libavformat/http.c
+6
-6
md5proto.c
libavformat/md5proto.c
+1
-1
mmst.c
libavformat/mmst.c
+1
-1
rtmppkt.c
libavformat/rtmppkt.c
+3
-3
rtmpproto.c
libavformat/rtmpproto.c
+3
-3
rtpdec.c
libavformat/rtpdec.c
+5
-4
rtpproto.c
libavformat/rtpproto.c
+1
-1
rtsp.c
libavformat/rtsp.c
+2
-2
rtspenc.c
libavformat/rtspenc.c
+2
-1
sapenc.c
libavformat/sapenc.c
+2
-2
url.h
libavformat/url.h
+8
-0
No files found.
libavformat/avio.c
View file @
925e908b
...
...
@@ -188,6 +188,10 @@ int url_read_complete(URLContext *h, unsigned char *buf, int size)
{
return
ffurl_read_complete
(
h
,
buf
,
size
);
}
int
url_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
)
{
return
ffurl_write
(
h
,
buf
,
size
);
}
#endif
#define URL_SCHEME_CHARS \
...
...
@@ -280,7 +284,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
return
retry_transfer_wrapper
(
h
,
buf
,
size
,
size
,
h
->
prot
->
url_read
);
}
int
url_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
)
int
ff
url_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
)
{
if
(
!
(
h
->
flags
&
(
URL_WRONLY
|
URL_RDWR
)))
return
AVERROR
(
EIO
);
...
...
libavformat/avio.h
View file @
925e908b
...
...
@@ -107,16 +107,9 @@ attribute_deprecated int url_connect(URLContext *h);
attribute_deprecated
int
url_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
attribute_deprecated
int
url_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
attribute_deprecated
int
url_read_complete
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
attribute_deprecated
int
url_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
);
#endif
/**
* Write size bytes from buf to the resource accessed by h.
*
* @return the number of bytes actually written, or a negative value
* corresponding to an AVERROR code in case of failure
*/
int
url_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
);
/**
* Passing this as the "whence" parameter to a seek function causes it to
* return the filesize without seeking anywhere. Supporting this is optional.
...
...
libavformat/aviobuf.c
View file @
925e908b
...
...
@@ -846,7 +846,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
if
(
ffio_init_context
(
*
s
,
buffer
,
buffer_size
,
(
h
->
flags
&
URL_WRONLY
||
h
->
flags
&
URL_RDWR
),
h
,
ffurl_read
,
url_write
,
url_seek
)
<
0
)
{
ffurl_read
,
ff
url_write
,
url_seek
)
<
0
)
{
av_free
(
buffer
);
av_freep
(
s
);
return
AVERROR
(
EIO
);
...
...
libavformat/gopher.c
View file @
925e908b
...
...
@@ -35,7 +35,7 @@ typedef struct {
static
int
gopher_write
(
URLContext
*
h
,
const
uint8_t
*
buf
,
int
size
)
{
GopherContext
*
s
=
h
->
priv_data
;
return
url_write
(
s
->
hd
,
buf
,
size
);
return
ff
url_write
(
s
->
hd
,
buf
,
size
);
}
static
int
gopher_connect
(
URLContext
*
h
,
const
char
*
path
)
...
...
libavformat/http.c
View file @
925e908b
...
...
@@ -333,7 +333,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
authstr
?
authstr
:
""
);
av_freep
(
&
authstr
);
if
(
url_write
(
s
->
hd
,
s
->
buffer
,
strlen
(
s
->
buffer
))
<
0
)
if
(
ff
url_write
(
s
->
hd
,
s
->
buffer
,
strlen
(
s
->
buffer
))
<
0
)
return
AVERROR
(
EIO
);
/* init input buffer */
...
...
@@ -427,7 +427,7 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
if
(
s
->
chunksize
==
-
1
)
{
/* non-chunked data is sent without any special encoding */
return
url_write
(
s
->
hd
,
buf
,
size
);
return
ff
url_write
(
s
->
hd
,
buf
,
size
);
}
/* silently ignore zero-size data since chunk encoding that would
...
...
@@ -436,9 +436,9 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
/* upload data using chunked encoding */
snprintf
(
temp
,
sizeof
(
temp
),
"%x
\r\n
"
,
size
);
if
((
ret
=
url_write
(
s
->
hd
,
temp
,
strlen
(
temp
)))
<
0
||
(
ret
=
url_write
(
s
->
hd
,
buf
,
size
))
<
0
||
(
ret
=
url_write
(
s
->
hd
,
crlf
,
sizeof
(
crlf
)
-
1
))
<
0
)
if
((
ret
=
ff
url_write
(
s
->
hd
,
temp
,
strlen
(
temp
)))
<
0
||
(
ret
=
ff
url_write
(
s
->
hd
,
buf
,
size
))
<
0
||
(
ret
=
ff
url_write
(
s
->
hd
,
crlf
,
sizeof
(
crlf
)
-
1
))
<
0
)
return
ret
;
}
return
size
;
...
...
@@ -452,7 +452,7 @@ static int http_close(URLContext *h)
/* signal end of chunked encoding if used */
if
((
h
->
flags
&
URL_WRONLY
)
&&
s
->
chunksize
!=
-
1
)
{
ret
=
url_write
(
s
->
hd
,
footer
,
sizeof
(
footer
)
-
1
);
ret
=
ff
url_write
(
s
->
hd
,
footer
,
sizeof
(
footer
)
-
1
);
ret
=
ret
>
0
?
0
:
ret
;
}
...
...
libavformat/md5proto.c
View file @
925e908b
...
...
@@ -68,7 +68,7 @@ static int md5_close(URLContext *h)
err
=
ffurl_open
(
&
out
,
filename
,
URL_WRONLY
);
if
(
err
)
return
err
;
err
=
url_write
(
out
,
buf
,
i
*
2
+
1
);
err
=
ff
url_write
(
out
,
buf
,
i
*
2
+
1
);
url_close
(
out
);
}
else
{
if
(
fwrite
(
buf
,
1
,
i
*
2
+
1
,
stdout
)
<
i
*
2
+
1
)
...
...
libavformat/mmst.c
View file @
925e908b
...
...
@@ -139,7 +139,7 @@ static int send_command_packet(MMSTContext *mmst)
memset
(
mms
->
write_out_ptr
,
0
,
exact_length
-
len
);
// write it out.
write_result
=
url_write
(
mms
->
mms_hd
,
mms
->
out_buffer
,
exact_length
);
write_result
=
ff
url_write
(
mms
->
mms_hd
,
mms
->
out_buffer
,
exact_length
);
if
(
write_result
!=
exact_length
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Failed to write data of length %d: %d (%s)
\n
"
,
...
...
libavformat/rtmppkt.c
View file @
925e908b
...
...
@@ -215,15 +215,15 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
}
prev_pkt
[
pkt
->
channel_id
].
extra
=
pkt
->
extra
;
url_write
(
h
,
pkt_hdr
,
p
-
pkt_hdr
);
ff
url_write
(
h
,
pkt_hdr
,
p
-
pkt_hdr
);
size
=
p
-
pkt_hdr
+
pkt
->
data_size
;
while
(
off
<
pkt
->
data_size
)
{
int
towrite
=
FFMIN
(
chunk_size
,
pkt
->
data_size
-
off
);
url_write
(
h
,
pkt
->
data
+
off
,
towrite
);
ff
url_write
(
h
,
pkt
->
data
+
off
,
towrite
);
off
+=
towrite
;
if
(
off
<
pkt
->
data_size
)
{
uint8_t
marker
=
0xC0
|
pkt
->
channel_id
;
url_write
(
h
,
&
marker
,
1
);
ff
url_write
(
h
,
&
marker
,
1
);
size
++
;
}
}
...
...
libavformat/rtmpproto.c
View file @
925e908b
...
...
@@ -486,7 +486,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
tosend
[
i
]
=
av_lfg_get
(
&
rnd
)
>>
24
;
client_pos
=
rtmp_handshake_imprint_with_digest
(
tosend
+
1
);
url_write
(
rt
->
stream
,
tosend
,
RTMP_HANDSHAKE_PACKET_SIZE
+
1
);
ff
url_write
(
rt
->
stream
,
tosend
,
RTMP_HANDSHAKE_PACKET_SIZE
+
1
);
i
=
ffurl_read_complete
(
rt
->
stream
,
serverdata
,
RTMP_HANDSHAKE_PACKET_SIZE
+
1
);
if
(
i
!=
RTMP_HANDSHAKE_PACKET_SIZE
+
1
)
{
av_log
(
LOG_CONTEXT
,
AV_LOG_ERROR
,
"Cannot read RTMP handshake response
\n
"
);
...
...
@@ -532,9 +532,9 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
tosend
+
RTMP_HANDSHAKE_PACKET_SIZE
-
32
);
// write reply back to the server
url_write
(
rt
->
stream
,
tosend
,
RTMP_HANDSHAKE_PACKET_SIZE
);
ff
url_write
(
rt
->
stream
,
tosend
,
RTMP_HANDSHAKE_PACKET_SIZE
);
}
else
{
url_write
(
rt
->
stream
,
serverdata
+
1
,
RTMP_HANDSHAKE_PACKET_SIZE
);
ff
url_write
(
rt
->
stream
,
serverdata
+
1
,
RTMP_HANDSHAKE_PACKET_SIZE
);
}
return
0
;
...
...
libavformat/rtpdec.c
View file @
925e908b
...
...
@@ -25,6 +25,7 @@
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
#include "url.h"
#include <unistd.h>
#include <strings.h>
...
...
@@ -325,8 +326,8 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
if
((
len
>
0
)
&&
buf
)
{
int
result
;
av_dlog
(
s
->
ic
,
"sending %d bytes of RR
\n
"
,
len
);
result
=
url_write
(
s
->
rtp_ctx
,
buf
,
len
);
av_dlog
(
s
->
ic
,
"result from url_write: %d
\n
"
,
result
);
result
=
ff
url_write
(
s
->
rtp_ctx
,
buf
,
len
);
av_dlog
(
s
->
ic
,
"result from
ff
url_write: %d
\n
"
,
result
);
av_free
(
buf
);
}
return
0
;
...
...
@@ -351,7 +352,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_flush
(
pb
);
len
=
avio_close_dyn_buf
(
pb
,
&
buf
);
if
((
len
>
0
)
&&
buf
)
url_write
(
rtp_handle
,
buf
,
len
);
ff
url_write
(
rtp_handle
,
buf
,
len
);
av_free
(
buf
);
/* Send a minimal RTCP RR */
...
...
@@ -366,7 +367,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_flush
(
pb
);
len
=
avio_close_dyn_buf
(
pb
,
&
buf
);
if
((
len
>
0
)
&&
buf
)
url_write
(
rtp_handle
,
buf
,
len
);
ff
url_write
(
rtp_handle
,
buf
,
len
);
av_free
(
buf
);
}
...
...
libavformat/rtpproto.c
View file @
925e908b
...
...
@@ -297,7 +297,7 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size)
hd
=
s
->
rtp_hd
;
}
ret
=
url_write
(
hd
,
buf
,
size
);
ret
=
ff
url_write
(
hd
,
buf
,
size
);
#if 0
{
struct timespec ts;
...
...
libavformat/rtsp.c
View file @
925e908b
...
...
@@ -983,14 +983,14 @@ static int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
av_dlog
(
s
,
"Sending:
\n
%s--
\n
"
,
buf
);
url_write
(
rt
->
rtsp_hd_out
,
out_buf
,
strlen
(
out_buf
));
ff
url_write
(
rt
->
rtsp_hd_out
,
out_buf
,
strlen
(
out_buf
));
if
(
send_content_length
>
0
&&
send_content
)
{
if
(
rt
->
control_transport
==
RTSP_MODE_TUNNEL
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"tunneling of RTSP requests "
"with content data not supported
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
url_write
(
rt
->
rtsp_hd_out
,
send_content
,
send_content_length
);
ff
url_write
(
rt
->
rtsp_hd_out
,
send_content
,
send_content_length
);
}
rt
->
last_cmd_time
=
av_gettime
();
...
...
libavformat/rtspenc.c
View file @
925e908b
...
...
@@ -32,6 +32,7 @@
#include "avio_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
#include "url.h"
#define SDP_MAX_SIZE 16384
...
...
@@ -158,7 +159,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
interleave_header
[
0
]
=
'$'
;
interleave_header
[
1
]
=
id
;
AV_WB16
(
interleave_header
+
2
,
packet_len
);
url_write
(
rt
->
rtsp_hd_out
,
interleaved_packet
,
4
+
packet_len
);
ff
url_write
(
rt
->
rtsp_hd_out
,
interleaved_packet
,
4
+
packet_len
);
ptr
+=
packet_len
;
size
-=
packet_len
;
}
...
...
libavformat/sapenc.c
View file @
925e908b
...
...
@@ -54,7 +54,7 @@ static int sap_write_close(AVFormatContext *s)
if
(
sap
->
last_time
&&
sap
->
ann
&&
sap
->
ann_fd
)
{
sap
->
ann
[
0
]
|=
4
;
/* Session deletion*/
url_write
(
sap
->
ann_fd
,
sap
->
ann
,
sap
->
ann_size
);
ff
url_write
(
sap
->
ann_fd
,
sap
->
ann
,
sap
->
ann_size
);
}
av_freep
(
&
sap
->
ann
);
...
...
@@ -239,7 +239,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t
now
=
av_gettime
();
if
(
!
sap
->
last_time
||
now
-
sap
->
last_time
>
5000000
)
{
int
ret
=
url_write
(
sap
->
ann_fd
,
sap
->
ann
,
sap
->
ann_size
);
int
ret
=
ff
url_write
(
sap
->
ann_fd
,
sap
->
ann
,
sap
->
ann_size
);
/* Don't abort even if we get "Destination unreachable" */
if
(
ret
<
0
&&
ret
!=
AVERROR
(
ECONNREFUSED
))
return
ret
;
...
...
libavformat/url.h
View file @
925e908b
...
...
@@ -78,4 +78,12 @@ int ffurl_read(URLContext *h, unsigned char *buf, int size);
*/
int
ffurl_read_complete
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
);
/**
* Write size bytes from buf to the resource accessed by h.
*
* @return the number of bytes actually written, or a negative value
* corresponding to an AVERROR code in case of failure
*/
int
ffurl_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
);
#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