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
0589da0a
Commit
0589da0a
authored
Mar 31, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: make url_open() internal.
parent
62eaaeac
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
51 additions
and
35 deletions
+51
-35
applehttpproto.c
libavformat/applehttpproto.c
+2
-1
avio.c
libavformat/avio.c
+7
-3
avio.h
libavformat/avio.h
+1
-13
aviobuf.c
libavformat/aviobuf.c
+2
-1
concat.c
libavformat/concat.c
+2
-1
gopher.c
libavformat/gopher.c
+2
-1
http.c
libavformat/http.c
+2
-1
md5proto.c
libavformat/md5proto.c
+2
-1
mmst.c
libavformat/mmst.c
+2
-1
rtmpproto.c
libavformat/rtmpproto.c
+2
-1
rtpproto.c
libavformat/rtpproto.c
+3
-2
rtsp.c
libavformat/rtsp.c
+6
-6
sapdec.c
libavformat/sapdec.c
+2
-1
sapenc.c
libavformat/sapenc.c
+3
-2
url.h
libavformat/url.h
+13
-0
No files found.
libavformat/applehttpproto.c
View file @
0589da0a
...
...
@@ -29,6 +29,7 @@
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "url.h"
#include <unistd.h>
/*
...
...
@@ -274,7 +275,7 @@ retry:
}
url
=
s
->
segments
[
s
->
cur_seq_no
-
s
->
start_seq_no
]
->
url
,
av_log
(
NULL
,
AV_LOG_DEBUG
,
"opening %s
\n
"
,
url
);
ret
=
url_open
(
&
s
->
seg_hd
,
url
,
URL_RDONLY
);
ret
=
ff
url_open
(
&
s
->
seg_hd
,
url
,
URL_RDONLY
);
if
(
ret
<
0
)
{
if
(
url_interrupt_cb
())
return
AVERROR_EXIT
;
...
...
libavformat/avio.c
View file @
0589da0a
...
...
@@ -176,6 +176,10 @@ int url_connect(URLContext* uc)
{
return
ffurl_connect
(
uc
);
}
int
url_open
(
URLContext
**
puc
,
const
char
*
filename
,
int
flags
)
{
return
ffurl_open
(
puc
,
filename
,
flags
);
}
#endif
#define URL_SCHEME_CHARS \
...
...
@@ -211,7 +215,7 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags)
return
AVERROR
(
ENOENT
);
}
int
url_open
(
URLContext
**
puc
,
const
char
*
filename
,
int
flags
)
int
ff
url_open
(
URLContext
**
puc
,
const
char
*
filename
,
int
flags
)
{
int
ret
=
ffurl_alloc
(
puc
,
filename
,
flags
);
if
(
ret
)
...
...
@@ -292,7 +296,7 @@ int64_t url_seek(URLContext *h, int64_t pos, int whence)
int
url_close
(
URLContext
*
h
)
{
int
ret
=
0
;
if
(
!
h
)
return
0
;
/* can happen when url_open fails */
if
(
!
h
)
return
0
;
/* can happen when
ff
url_open fails */
if
(
h
->
is_connected
&&
h
->
prot
->
url_close
)
ret
=
h
->
prot
->
url_close
(
h
);
...
...
@@ -308,7 +312,7 @@ int url_close(URLContext *h)
int
url_exist
(
const
char
*
filename
)
{
URLContext
*
h
;
if
(
url_open
(
&
h
,
filename
,
URL_RDONLY
)
<
0
)
if
(
ff
url_open
(
&
h
,
filename
,
URL_RDONLY
)
<
0
)
return
0
;
url_close
(
h
);
return
1
;
...
...
libavformat/avio.h
View file @
0589da0a
...
...
@@ -104,21 +104,9 @@ attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol
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_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
#endif
/**
* Create an URLContext for accessing to the resource indicated by
* url, and open it.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int
url_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.
...
...
libavformat/aviobuf.c
View file @
0589da0a
...
...
@@ -25,6 +25,7 @@
#include "avio.h"
#include "avio_internal.h"
#include "internal.h"
#include "url.h"
#include <stdarg.h>
#define IO_BUFFER_SIZE 32768
...
...
@@ -944,7 +945,7 @@ int avio_open(AVIOContext **s, const char *filename, int flags)
URLContext
*
h
;
int
err
;
err
=
url_open
(
&
h
,
filename
,
flags
);
err
=
ff
url_open
(
&
h
,
filename
,
flags
);
if
(
err
<
0
)
return
err
;
err
=
ffio_fdopen
(
s
,
h
);
...
...
libavformat/concat.c
View file @
0589da0a
...
...
@@ -24,6 +24,7 @@
#include "avformat.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "url.h"
#define AV_CAT_SEPARATOR "|"
...
...
@@ -100,7 +101,7 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
uri
+=
len
+
strspn
(
uri
+
len
,
AV_CAT_SEPARATOR
);
/* creating URLContext */
if
((
err
=
url_open
(
&
uc
,
node_uri
,
flags
))
<
0
)
if
((
err
=
ff
url_open
(
&
uc
,
node_uri
,
flags
))
<
0
)
break
;
/* creating size */
...
...
libavformat/gopher.c
View file @
0589da0a
...
...
@@ -26,6 +26,7 @@
#include "avformat.h"
#include "internal.h"
#include "network.h"
#include "url.h"
typedef
struct
{
URLContext
*
hd
;
...
...
@@ -99,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
ff_url_join
(
buf
,
sizeof
(
buf
),
"tcp"
,
NULL
,
hostname
,
port
,
NULL
);
s
->
hd
=
NULL
;
err
=
url_open
(
&
s
->
hd
,
buf
,
URL_RDWR
);
err
=
ff
url_open
(
&
s
->
hd
,
buf
,
URL_RDWR
);
if
(
err
<
0
)
goto
fail
;
...
...
libavformat/http.c
View file @
0589da0a
...
...
@@ -28,6 +28,7 @@
#include "http.h"
#include "os_support.h"
#include "httpauth.h"
#include "url.h"
#include "libavutil/opt.h"
/* XXX: POST protocol is not completely implemented because ffmpeg uses
...
...
@@ -123,7 +124,7 @@ static int http_open_cnx(URLContext *h)
port
=
80
;
ff_url_join
(
buf
,
sizeof
(
buf
),
"tcp"
,
NULL
,
hostname
,
port
,
NULL
);
err
=
url_open
(
&
hd
,
buf
,
URL_RDWR
);
err
=
ff
url_open
(
&
hd
,
buf
,
URL_RDWR
);
if
(
err
<
0
)
goto
fail
;
...
...
libavformat/md5proto.c
View file @
0589da0a
...
...
@@ -25,6 +25,7 @@
#include "libavutil/error.h"
#include "avformat.h"
#include "avio.h"
#include "url.h"
#define PRIV_SIZE 128
...
...
@@ -64,7 +65,7 @@ static int md5_close(URLContext *h)
av_strstart
(
filename
,
"md5:"
,
&
filename
);
if
(
*
filename
)
{
err
=
url_open
(
&
out
,
filename
,
URL_WRONLY
);
err
=
ff
url_open
(
&
out
,
filename
,
URL_WRONLY
);
if
(
err
)
return
err
;
err
=
url_write
(
out
,
buf
,
i
*
2
+
1
);
...
...
libavformat/mmst.c
View file @
0589da0a
...
...
@@ -35,6 +35,7 @@
#include "libavutil/intreadwrite.h"
#include "libavcodec/bytestream.h"
#include "network.h"
#include "url.h"
#define LOCAL_ADDRESS 0xc0a80081 // FIXME get and use correct local ip address.
#define LOCAL_PORT 1037 // as above.
...
...
@@ -522,7 +523,7 @@ static int mms_open(URLContext *h, const char *uri, int flags)
// establish tcp connection.
ff_url_join
(
tcpname
,
sizeof
(
tcpname
),
"tcp"
,
NULL
,
mmst
->
host
,
port
,
NULL
);
err
=
url_open
(
&
mms
->
mms_hd
,
tcpname
,
URL_RDWR
);
err
=
ff
url_open
(
&
mms
->
mms_hd
,
tcpname
,
URL_RDWR
);
if
(
err
)
goto
fail
;
...
...
libavformat/rtmpproto.c
View file @
0589da0a
...
...
@@ -36,6 +36,7 @@
#include "flv.h"
#include "rtmp.h"
#include "rtmppkt.h"
#include "url.h"
/* we can't use av_log() with URLContext yet... */
#if FF_API_URL_CLASS
...
...
@@ -820,7 +821,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
port
=
RTMP_DEFAULT_PORT
;
ff_url_join
(
buf
,
sizeof
(
buf
),
"tcp"
,
NULL
,
hostname
,
port
,
NULL
);
if
(
url_open
(
&
rt
->
stream
,
buf
,
URL_RDWR
)
<
0
)
{
if
(
ff
url_open
(
&
rt
->
stream
,
buf
,
URL_RDWR
)
<
0
)
{
av_log
(
LOG_CONTEXT
,
AV_LOG_ERROR
,
"Cannot open connection %s
\n
"
,
buf
);
goto
fail
;
}
...
...
libavformat/rtpproto.c
View file @
0589da0a
...
...
@@ -29,6 +29,7 @@
#include "avformat.h"
#include "avio_internal.h"
#include "rtpdec.h"
#include "url.h"
#include <unistd.h>
#include <stdarg.h>
...
...
@@ -189,7 +190,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url
(
buf
,
sizeof
(
buf
),
hostname
,
rtp_port
,
local_rtp_port
,
ttl
,
max_packet_size
,
connect
);
if
(
url_open
(
&
s
->
rtp_hd
,
buf
,
flags
)
<
0
)
if
(
ff
url_open
(
&
s
->
rtp_hd
,
buf
,
flags
)
<
0
)
goto
fail
;
if
(
local_rtp_port
>=
0
&&
local_rtcp_port
<
0
)
local_rtcp_port
=
ff_udp_get_local_port
(
s
->
rtp_hd
)
+
1
;
...
...
@@ -197,7 +198,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url
(
buf
,
sizeof
(
buf
),
hostname
,
rtcp_port
,
local_rtcp_port
,
ttl
,
max_packet_size
,
connect
);
if
(
url_open
(
&
s
->
rtcp_hd
,
buf
,
flags
)
<
0
)
if
(
ff
url_open
(
&
s
->
rtcp_hd
,
buf
,
flags
)
<
0
)
goto
fail
;
/* just to ease handle access. XXX: need to suppress direct handle
...
...
libavformat/rtsp.c
View file @
0589da0a
...
...
@@ -1116,14 +1116,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
"?localport=%d"
,
j
);
/* we will use two ports per rtp stream (rtp and rtcp) */
j
+=
2
;
if
(
url_open
(
&
rtsp_st
->
rtp_handle
,
buf
,
URL_RDWR
)
==
0
)
if
(
ff
url_open
(
&
rtsp_st
->
rtp_handle
,
buf
,
URL_RDWR
)
==
0
)
goto
rtp_opened
;
}
}
#if 0
/* then try on any port */
if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
if (
ff
url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
...
...
@@ -1269,7 +1269,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
namebuf
,
sizeof
(
namebuf
),
NULL
,
0
,
NI_NUMERICHOST
);
ff_url_join
(
url
,
sizeof
(
url
),
"rtp"
,
NULL
,
namebuf
,
port
,
"?ttl=%d"
,
ttl
);
if
(
url_open
(
&
rtsp_st
->
rtp_handle
,
url
,
URL_RDWR
)
<
0
)
{
if
(
ff
url_open
(
&
rtsp_st
->
rtp_handle
,
url
,
URL_RDWR
)
<
0
)
{
err
=
AVERROR_INVALIDDATA
;
goto
fail
;
}
...
...
@@ -1460,7 +1460,7 @@ redirect:
}
else
{
/* open the tcp connection */
ff_url_join
(
tcpname
,
sizeof
(
tcpname
),
"tcp"
,
NULL
,
host
,
port
,
NULL
);
if
(
url_open
(
&
rt
->
rtsp_hd
,
tcpname
,
URL_RDWR
)
<
0
)
{
if
(
ff
url_open
(
&
rt
->
rtsp_hd
,
tcpname
,
URL_RDWR
)
<
0
)
{
err
=
AVERROR
(
EIO
);
goto
fail
;
}
...
...
@@ -1807,7 +1807,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
namebuf
,
rtsp_st
->
sdp_port
,
"?localport=%d&ttl=%d"
,
rtsp_st
->
sdp_port
,
rtsp_st
->
sdp_ttl
);
if
(
url_open
(
&
rtsp_st
->
rtp_handle
,
url
,
URL_RDWR
)
<
0
)
{
if
(
ff
url_open
(
&
rtsp_st
->
rtp_handle
,
url
,
URL_RDWR
)
<
0
)
{
err
=
AVERROR_INVALIDDATA
;
goto
fail
;
}
...
...
@@ -1863,7 +1863,7 @@ static int rtp_read_header(AVFormatContext *s,
if
(
!
ff_network_init
())
return
AVERROR
(
EIO
);
ret
=
url_open
(
&
in
,
s
->
filename
,
URL_RDONLY
);
ret
=
ff
url_open
(
&
in
,
s
->
filename
,
URL_RDONLY
);
if
(
ret
)
goto
fail
;
...
...
libavformat/sapdec.c
View file @
0589da0a
...
...
@@ -26,6 +26,7 @@
#include "os_support.h"
#include "internal.h"
#include "avio_internal.h"
#include "url.h"
#if HAVE_POLL_H
#include <poll.h>
#endif
...
...
@@ -84,7 +85,7 @@ static int sap_read_header(AVFormatContext *s,
ff_url_join
(
url
,
sizeof
(
url
),
"udp"
,
NULL
,
host
,
port
,
"?localport=%d"
,
port
);
ret
=
url_open
(
&
sap
->
ann_fd
,
url
,
URL_RDONLY
);
ret
=
ff
url_open
(
&
sap
->
ann_fd
,
url
,
URL_RDONLY
);
if
(
ret
)
goto
fail
;
...
...
libavformat/sapenc.c
View file @
0589da0a
...
...
@@ -28,6 +28,7 @@
#include "network.h"
#include "os_support.h"
#include "rtpenc_chain.h"
#include "url.h"
struct
SAPState
{
uint8_t
*
ann
;
...
...
@@ -145,7 +146,7 @@ static int sap_write_header(AVFormatContext *s)
"?ttl=%d"
,
ttl
);
if
(
!
same_port
)
base_port
+=
2
;
ret
=
url_open
(
&
fd
,
url
,
URL_WRONLY
);
ret
=
ff
url_open
(
&
fd
,
url
,
URL_WRONLY
);
if
(
ret
)
{
ret
=
AVERROR
(
EIO
);
goto
fail
;
...
...
@@ -157,7 +158,7 @@ static int sap_write_header(AVFormatContext *s)
ff_url_join
(
url
,
sizeof
(
url
),
"udp"
,
NULL
,
announce_addr
,
port
,
"?ttl=%d&connect=1"
,
ttl
);
ret
=
url_open
(
&
sap
->
ann_fd
,
url
,
URL_WRONLY
);
ret
=
ff
url_open
(
&
sap
->
ann_fd
,
url
,
URL_WRONLY
);
if
(
ret
)
{
ret
=
AVERROR
(
EIO
);
goto
fail
;
...
...
libavformat/url.h
View file @
0589da0a
...
...
@@ -45,4 +45,17 @@ int ffurl_alloc(URLContext **h, const char *url, int flags);
*/
int
ffurl_connect
(
URLContext
*
h
);
/**
* Create an URLContext for accessing to the resource indicated by
* url, and open it.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int
ffurl_open
(
URLContext
**
h
,
const
char
*
url
,
int
flags
);
#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