[FFmpeg-devel] [PATCH 2/5] lavf: add av_ prefix to parse_date
Anton Khirnov
anton
Sun Feb 6 15:46:47 CET 2011
---
cmdutils.c | 2 +-
cmdutils.h | 2 +-
ffserver.c | 4 ++--
libavformat/avformat.h | 6 +++++-
libavformat/rtsp.c | 4 ++--
libavformat/utils.c | 7 +++++++
libavformat/version.h | 3 +++
7 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/cmdutils.c b/cmdutils.c
index c68f37f..0abfe1e 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -114,7 +114,7 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
{
- int64_t us = parse_date(timestr, is_duration);
+ int64_t us = av_parse_date(timestr, is_duration);
if (us == INT64_MIN) {
fprintf(stderr, "Invalid %s specification for %s: %s\n",
is_duration ? "duration" : "date", context, timestr);
diff --git a/cmdutils.h b/cmdutils.h
index c3d8a42..faa3c7c 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -102,7 +102,7 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
* not zero timestr is interpreted as a duration, otherwise as a
* date
*
- * @see parse_date()
+ * @see av_parse_date()
*/
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
diff --git a/ffserver.c b/ffserver.c
index 9a32408..0b3e051 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2136,7 +2136,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
buf_size = FFM_PACKET_SIZE;
/* compute position (absolute time) */
if (find_info_tag(buf, sizeof(buf), "date", info)) {
- stream_pos = parse_date(buf, 0);
+ stream_pos = av_parse_date(buf, 0);
if (stream_pos == INT64_MIN)
return -1;
} else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
@@ -2149,7 +2149,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
buf_size = 0;
/* compute position (relative time) */
if (find_info_tag(buf, sizeof(buf), "date", info)) {
- stream_pos = parse_date(buf, 1);
+ stream_pos = av_parse_date(buf, 1);
if (stream_pos == INT64_MIN)
return -1;
} else
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f354539..4027990 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1474,6 +1474,10 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
const char *arg);
#endif
+#if FF_API_PARSE_DATE
+attribute_deprecated int64_t parse_date(const char *datestr, int duration);
+#endif
+
/**
* Parse datestr and return a corresponding number of microseconds.
* @param datestr String representing a date or a duration.
@@ -1501,7 +1505,7 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
* not zero datestr is interpreted as a duration, otherwise as a
* date.
*/
-int64_t parse_date(const char *datestr, int duration);
+int64_t av_parse_date(const char *datestr, int duration);
/**
* Get the current time in microseconds.
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index d3e88e9..f6a4eab 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -99,11 +99,11 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
*end = AV_NOPTS_VALUE;
get_word_sep(buf, sizeof(buf), "-", &p);
- *start = parse_date(buf, 1);
+ *start = av_parse_date(buf, 1);
if (*p == '-') {
p++;
get_word_sep(buf, sizeof(buf), "-", &p);
- *end = parse_date(buf, 1);
+ *end = av_parse_date(buf, 1);
}
// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start);
// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b5e2322..2abcc1e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3352,8 +3352,15 @@ uint64_t ff_ntp_time(void)
return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
}
+#if FF_API_PARSE_DATE
int64_t parse_date(const char *datestr, int duration)
{
+ return av_parse_date(datestr, duration);
+}
+#endif
+
+int64_t av_parse_date(const char *datestr, int duration)
+{
const char *p;
int64_t t;
struct tm dt;
diff --git a/libavformat/version.h b/libavformat/version.h
index ff5f9be..38ff76e 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -92,5 +92,8 @@
#ifndef FF_API_DUMP_FORMAT
#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_PARSE_DATE
+#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif //AVFORMAT_VERSION_H
--
1.7.2.3
More information about the ffmpeg-devel
mailing list