Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
824a82d1
Commit
824a82d1
authored
9 years ago
by
Mariusz Szczepańczyk
Committed by
Michael Niedermayer
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
lavf/file: implement move and delete callbacks
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
80e18bb4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/file.c
+38
-0
38 additions, 0 deletions
libavformat/file.c
with
38 additions
and
0 deletions
libavformat/file.c
+
38
−
0
View file @
824a82d1
...
@@ -131,6 +131,42 @@ static int file_check(URLContext *h, int mask)
...
@@ -131,6 +131,42 @@ static int file_check(URLContext *h, int mask)
return
ret
;
return
ret
;
}
}
static
int
file_delete
(
URLContext
*
h
)
{
#if HAVE_UNISTD_H
int
ret
;
const
char
*
filename
=
h
->
filename
;
av_strstart
(
filename
,
"file:"
,
&
filename
);
ret
=
rmdir
(
filename
);
if
(
ret
<
0
&&
errno
==
ENOTDIR
)
ret
=
unlink
(
filename
);
if
(
ret
<
0
)
return
AVERROR
(
errno
);
return
ret
;
#else
return
AVERROR
(
ENOSYS
);
#endif
/* HAVE_UNISTD_H */
}
static
int
file_move
(
URLContext
*
h_src
,
URLContext
*
h_dst
)
{
#if HAVE_UNISTD_H
const
char
*
filename_src
=
h_src
->
filename
;
const
char
*
filename_dst
=
h_dst
->
filename
;
av_strstart
(
filename_src
,
"file:"
,
&
filename_src
);
av_strstart
(
filename_dst
,
"file:"
,
&
filename_src
);
if
(
rename
(
filename_src
,
filename_dst
)
<
0
)
return
AVERROR
(
errno
);
return
0
;
#else
return
AVERROR
(
ENOSYS
);
#endif
/* HAVE_UNISTD_H */
}
#if CONFIG_FILE_PROTOCOL
#if CONFIG_FILE_PROTOCOL
static
int
file_open
(
URLContext
*
h
,
const
char
*
filename
,
int
flags
)
static
int
file_open
(
URLContext
*
h
,
const
char
*
filename
,
int
flags
)
...
@@ -198,6 +234,8 @@ URLProtocol ff_file_protocol = {
...
@@ -198,6 +234,8 @@ URLProtocol ff_file_protocol = {
.
url_close
=
file_close
,
.
url_close
=
file_close
,
.
url_get_file_handle
=
file_get_handle
,
.
url_get_file_handle
=
file_get_handle
,
.
url_check
=
file_check
,
.
url_check
=
file_check
,
.
url_delete
=
file_delete
,
.
url_move
=
file_move
,
.
priv_data_size
=
sizeof
(
FileContext
),
.
priv_data_size
=
sizeof
(
FileContext
),
.
priv_data_class
=
&
file_class
,
.
priv_data_class
=
&
file_class
,
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment