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
d8fd06c3
Commit
d8fd06c3
authored
Dec 23, 2012
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avstring: add av_basename and av_dirname
Thread safe version of the common basename and dirname.
parent
c73c87b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
1 deletion
+64
-1
Changelog
Changelog
+3
-0
APIchanges
doc/APIchanges
+3
-0
avstring.c
libavutil/avstring.c
+41
-0
avstring.h
libavutil/avstring.h
+16
-0
version.h
libavutil/version.h
+1
-1
No files found.
Changelog
View file @
d8fd06c3
...
...
@@ -2,6 +2,9 @@ Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
- av_basename and av_dirname
version 9_beta3:
- ashowinfo audio filter
- 24-bit FLAC encoding
- audio volume filter
...
...
doc/APIchanges
View file @
d8fd06c3
...
...
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
2012-xx-xx - xxxxxxx - lavu 52.2.1 - avstring.h
Add av_basename() and av_dirname().
2012-xx-xx - xxxxxxx - lavu 52.2.0 - audioconvert.h
Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
...
...
libavutil/avstring.c
View file @
d8fd06c3
...
...
@@ -25,6 +25,8 @@
#include <string.h>
#include <ctype.h>
#include "avstring.h"
#include "config.h"
#include "common.h"
#include "mem.h"
int
av_strstart
(
const
char
*
str
,
const
char
*
pfx
,
const
char
**
ptr
)
...
...
@@ -156,6 +158,45 @@ int av_strncasecmp(const char *a, const char *b, size_t n)
return
c1
-
c2
;
}
const
char
*
av_basename
(
const
char
*
path
)
{
char
*
p
=
strrchr
(
path
,
'/'
);
#if HAVE_DOS_PATHS
char
*
q
=
strrchr
(
path
,
'\\'
);
char
*
d
=
strchr
(
path
,
':'
);
p
=
FFMAX3
(
p
,
q
,
d
);
#endif
if
(
!
p
)
return
path
;
return
p
+
1
;
}
const
char
*
av_dirname
(
char
*
path
)
{
char
*
p
=
strrchr
(
path
,
'/'
);
#if HAVE_DOS_PATHS
char
*
q
=
strrchr
(
path
,
'\\'
);
char
*
d
=
strchr
(
path
,
':'
);
d
=
d
?
d
+
1
:
d
;
p
=
FFMAX3
(
p
,
q
,
d
);
#endif
if
(
!
p
)
return
"."
;
*
p
=
'\0'
;
return
path
;
}
#ifdef TEST
#include "common.h"
...
...
libavutil/avstring.h
View file @
d8fd06c3
...
...
@@ -168,6 +168,22 @@ int av_strcasecmp(const char *a, const char *b);
*/
int
av_strncasecmp
(
const
char
*
a
,
const
char
*
b
,
size_t
n
);
/**
* Thread safe basename.
* @param path the path, on DOS both \ and / are considered separators.
* @return pointer to the basename substring.
*/
const
char
*
av_basename
(
const
char
*
path
);
/**
* Thread safe dirname.
* @param path the path, on DOS both \ and / are considered separators.
* @return the path with the separator replaced by the string terminator or ".".
* @note the function may change the input string.
*/
const
char
*
av_dirname
(
char
*
path
);
/**
* @}
*/
...
...
libavutil/version.h
View file @
d8fd06c3
...
...
@@ -37,7 +37,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR
2
#define LIBAVUTIL_VERSION_MINOR
3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
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