diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-25 14:36:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-25 14:36:45 +0100 |
commit | 25be63005f0ba0b4cb8bf2569202ad0e89b4dae3 (patch) | |
tree | 43bf6b49aa89942207f0937cfcab374524795a8f /libavutil | |
parent | b2d0c5bd13ab100a3acb18e9c869d73904e6e764 (diff) | |
parent | b85a5e87af4254b80913fe33591d96361f30832b (diff) | |
download | ffmpeg-25be63005f0ba0b4cb8bf2569202ad0e89b4dae3.tar.gz |
Merge commit 'b85a5e87af4254b80913fe33591d96361f30832b'
* commit 'b85a5e87af4254b80913fe33591d96361f30832b':
lavu: Add av_strnstr()
h264: Allow discarding the cropping information from SPS
Conflicts:
Changelog
doc/APIchanges
libavcodec/avcodec.h
libavcodec/version.h
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avstring.c | 14 | ||||
-rw-r--r-- | libavutil/avstring.h | 15 | ||||
-rw-r--r-- | libavutil/version.h | 4 |
3 files changed, 31 insertions, 2 deletions
diff --git a/libavutil/avstring.c b/libavutil/avstring.c index b47fe535ce..2f00374176 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -65,6 +65,20 @@ char *av_stristr(const char *s1, const char *s2) return NULL; } +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length) +{ + size_t needle_len = strlen(needle); + if (!needle_len) + return haystack; + while (hay_length >= needle_len) { + hay_length--; + if (!memcmp(haystack, needle, needle_len)) + return haystack; + haystack++; + } + return NULL; +} + size_t av_strlcpy(char *dst, const char *src, size_t size) { size_t len = 0; diff --git a/libavutil/avstring.h b/libavutil/avstring.h index d7af9ec7c3..b08d78ee8c 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -67,6 +67,21 @@ int av_stristart(const char *str, const char *pfx, const char **ptr); char *av_stristr(const char *haystack, const char *needle); /** + * Locate the first occurrence of the string needle in the string haystack + * where not more than hay_length characters are searched. A zero-length + * string needle is considered to match at the start of haystack. + * + * This function is a length-limited version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @param hay_length length of string to search in + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); + +/** * Copy the string src to dst, but no more than size - 1 bytes, and * null-terminate dst. * diff --git a/libavutil/version.h b/libavutil/version.h index 6e81f48e65..ee3fd2d6a7 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -75,8 +75,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 15 -#define LIBAVUTIL_VERSION_MICRO 103 +#define LIBAVUTIL_VERSION_MINOR 16 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ |