aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/parseutils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-05 12:39:51 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-05 13:02:20 +0200
commit22d841becd89f21fcd88a76bcafb675fd051ce86 (patch)
tree04f910119420fabb5557217eb8c7cd6c1a0d24ea /libavutil/parseutils.c
parent25c2f13d00fcfdb81c33a459795c33d29f8690e8 (diff)
parent6e19cfb083eda83aaf4b49ae765ab2b3e578d32d (diff)
downloadffmpeg-22d841becd89f21fcd88a76bcafb675fd051ce86.tar.gz
Merge branch 'master' into oldabi
* master: (780 commits) ffmpeg: Fix doxygen comments for MetadataMap filters.texi: fix wrong references in the "Filtergraph syntax" section yadif: correct documentation on the parity parameter mpegvideo.h: remove the 1 line difference to qatar applehttp: fix variant discard logic Fix possible crash when decoding mpeg streams. h263dec: Fix asserts broken by the elimination of FF_COMMON_FRAME. avidec: skip seek pos adjustment for non interleaved files. Fixes Ticket327 lsws: remove deprecated and unused stuff after the 0->1 major bump cosmetics: remove some stray comments from AVCodec declarations cosmetics: fix indentation/alignment in AVCodec declarations Abort if command offset decreases, avoids potential endless loop. Warn when falling back to unreliable UMF fps tag. Detect NI-avi at playtime like mplayer. Fixes Ticket333 avidec: Fix XAN DPCM demuxing. Fix a possible miscompilation of cabac with old (broken) compilers. Fix -loop_input. Set bits_per_coded_sample when encoding ADPCM. vf_boxblur: call avfilter_draw_slice() at the end of draw_slice() vf_boxblur: fix out-of-buffer access when h > w ... Conflicts: ffmpeg.c libavcodec/avcodec.h libavcodec/opt.h libavcodec/version.h libavdevice/avdevice.h libavfilter/avfilter.h libavformat/avformat.h libavformat/aviobuf.c libavformat/rtsp.c libavformat/udp.c libavformat/utils.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/parseutils.c')
-rw-r--r--libavutil/parseutils.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index b2404b5c0f..2000778a32 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -28,6 +28,7 @@
#include "avstring.h"
#include "avutil.h"
#include "eval.h"
+#include "log.h"
#include "random_seed.h"
#include "parseutils.h"
@@ -400,7 +401,16 @@ static int date_get_num(const char **pp,
return val;
}
-/* small strptime for ffmpeg */
+/**
+ * Parse the input string p according to the format string fmt and
+ * store its results in the structure dt.
+ * This implementation supports only a subset of the formats supported
+ * by the standard strptime().
+ *
+ * @return a pointer to the first character not processed in this
+ * function call, or NULL in case the function fails to match all of
+ * the fmt string and therefore an error occurred
+ */
static
const char *small_strptime(const char *p, const char *fmt,
struct tm *dt)
@@ -462,7 +472,6 @@ const char *small_strptime(const char *p, const char *fmt,
p++;
}
}
- return p;
}
static time_t mktimegm(struct tm *tm)
@@ -484,7 +493,7 @@ static time_t mktimegm(struct tm *tm)
return t;
}
-int av_parse_time(int64_t *timeval, const char *datestr, int duration)
+int av_parse_time(int64_t *timeval, const char *timestr, int duration)
{
const char *p;
int64_t t;
@@ -506,19 +515,19 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration)
#undef time
time_t now = time(0);
- len = strlen(datestr);
+ len = strlen(timestr);
if (len > 0)
- lastch = datestr[len - 1];
+ lastch = timestr[len - 1];
else
lastch = '\0';
is_utc = (lastch == 'z' || lastch == 'Z');
memset(&dt, 0, sizeof(dt));
- p = datestr;
+ p = timestr;
q = NULL;
if (!duration) {
- if (!strncasecmp(datestr, "now", len)) {
+ if (!strncasecmp(timestr, "now", len)) {
*timeval = (int64_t) now * 1000000;
return 0;
}
@@ -555,15 +564,15 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration)
}
}
} else {
- /* parse datestr as a duration */
+ /* parse timestr as a duration */
if (p[0] == '-') {
negative = 1;
++p;
}
- /* parse datestr as HH:MM:SS */
+ /* parse timestr as HH:MM:SS */
q = small_strptime(p, time_fmt[0], &dt);
if (!q) {
- /* parse datestr as S+ */
+ /* parse timestr as S+ */
dt.tm_sec = strtol(p, (char **)&q, 10);
if (q == p) {
/* the parsing didn't succeed */