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
bf5b2f9d
Commit
bf5b2f9d
authored
Aug 19, 2015
by
Mariusz Szczepańczyk
Committed by
Michael Niedermayer
Aug 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/ftp: implement move and delete callbacks
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
034e6fbd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
ftp.c
libavformat/ftp.c
+61
-0
No files found.
libavformat/ftp.c
View file @
bf5b2f9d
...
...
@@ -1038,6 +1038,65 @@ static int ftp_close_dir(URLContext *h)
return
0
;
}
static
int
ftp_delete
(
URLContext
*
h
)
{
FTPContext
*
s
=
h
->
priv_data
;
char
command
[
MAX_URL_SIZE
];
static
const
int
del_codes
[]
=
{
250
,
421
,
450
,
500
,
501
,
502
,
530
,
550
,
0
};
static
const
int
rmd_codes
[]
=
{
250
,
421
,
500
,
501
,
502
,
530
,
550
,
0
};
int
ret
;
if
((
ret
=
ftp_connect
(
h
,
h
->
filename
))
<
0
)
goto
cleanup
;
snprintf
(
command
,
sizeof
(
command
),
"DELE %s
\r\n
"
,
s
->
path
);
if
(
ftp_send_command
(
s
,
command
,
del_codes
,
NULL
)
==
250
)
{
ret
=
0
;
goto
cleanup
;
}
snprintf
(
command
,
sizeof
(
command
),
"RMD %s
\r\n
"
,
s
->
path
);
if
(
ftp_send_command
(
s
,
command
,
rmd_codes
,
NULL
)
==
250
)
ret
=
0
;
else
ret
=
AVERROR
(
EIO
);
cleanup:
ftp_close
(
h
);
return
ret
;
}
static
int
ftp_move
(
URLContext
*
h_src
,
URLContext
*
h_dst
)
{
FTPContext
*
s
=
h_src
->
priv_data
;
char
command
[
MAX_URL_SIZE
],
path
[
MAX_URL_SIZE
];
static
const
int
rnfr_codes
[]
=
{
350
,
421
,
450
,
500
,
501
,
502
,
503
,
530
,
0
};
static
const
int
rnto_codes
[]
=
{
250
,
421
,
500
,
501
,
502
,
503
,
530
,
532
,
553
,
0
};
int
ret
;
if
((
ret
=
ftp_connect
(
h_src
,
h_src
->
filename
))
<
0
)
goto
cleanup
;
snprintf
(
command
,
sizeof
(
command
),
"RNFR %s
\r\n
"
,
s
->
path
);
if
(
ftp_send_command
(
s
,
command
,
rnfr_codes
,
NULL
)
!=
350
)
{
ret
=
AVERROR
(
EIO
);
goto
cleanup
;
}
av_url_split
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
path
,
sizeof
(
path
),
h_dst
->
filename
);
snprintf
(
command
,
sizeof
(
command
),
"RNTO %s
\r\n
"
,
path
);
if
(
ftp_send_command
(
s
,
command
,
rnto_codes
,
NULL
)
==
250
)
ret
=
0
;
else
ret
=
AVERROR
(
EIO
);
cleanup:
ftp_close
(
h_src
);
return
ret
;
}
URLProtocol
ff_ftp_protocol
=
{
.
name
=
"ftp"
,
.
url_open
=
ftp_open
,
...
...
@@ -1052,5 +1111,7 @@ URLProtocol ff_ftp_protocol = {
.
url_open_dir
=
ftp_open_dir
,
.
url_read_dir
=
ftp_read_dir
,
.
url_close_dir
=
ftp_close_dir
,
.
url_delete
=
ftp_delete
,
.
url_move
=
ftp_move
,
.
flags
=
URL_PROTOCOL_FLAG_NETWORK
,
};
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