Unified · Split
| @@ -1635,10 +1635,9 @@ void av_dump_format(AVFormatContext *ic, · 1634 unmodified lines | |||
| 1635 | const char *url, | 1635 | const char *url, |
| 1636 | int is_output); | 1636 | int is_output); |
| 1637 | 1637 | ||
| 1638 | /** | 1638 | #if FF_API_AV_GETTIME |
| 1639 | * Get the current time in microseconds. | ||
| 1640 | */ | ||
| 1641 | int64_t av_gettime(void); | 1639 | int64_t av_gettime(void); |
| 1640 | #endif | ||
| 1642 | 1641 | ||
| 1643 | /** | 1642 | /** |
| 1644 | * Return in 'buf' the path with '%d' replaced by a number. | 1643 | * Return in 'buf' the path with '%d' replaced by a number. |
| @@ -38,8 +38,6 @@ · 37 unmodified lines | |||
| 38 | #include "riff.h" | 38 | #include "riff.h" |
| 39 | #include "audiointerleave.h" | 39 | #include "audiointerleave.h" |
| 40 | #include "url.h" | 40 | #include "url.h" |
| 41 | #include <sys/time.h> | ||
| 42 | #include <time.h> | ||
| 43 | #include <stdarg.h> | 41 | #include <stdarg.h> |
| 44 | #if CONFIG_NETWORK | 42 | #if CONFIG_NETWORK |
| 45 | #include "network.h" | 43 | #include "network.h" |
| @@ -3411,12 +3409,12 @@ void av_dump_format(AVFormatContext *ic, · 3365 unmodified lines | |||
| 3411 | av_free(printed); | 3409 | av_free(printed); |
| 3412 | } | 3410 | } |
| 3413 | 3411 | ||
| 3414 | int64_t av_gettime(void) | 3412 | #if FF_API_AV_GETTIME && CONFIG_SHARED && HAVE_SYMVER |
| 3413 | FF_SYMVER(int64_t, av_gettime, (void), "LIBAVFORMAT_54") | ||
| 3415 | { | 3414 | { |
| 3416 | struct timeval tv; | 3415 | return av_gettime(); |
| 3417 | gettimeofday(&tv,NULL); | ||
| 3418 | return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; | ||
| 3419 | } | 3416 | } |
| 3417 | #endif | ||
| 3420 | 3418 | ||
| 3421 | uint64_t ff_ntp_time(void) | 3419 | uint64_t ff_ntp_time(void) |
| 3422 | { | 3420 | { |
| @@ -59,5 +59,8 @@ · 58 unmodified lines | |||
| 59 | #ifndef FF_API_INTERLEAVE_PACKET | 59 | #ifndef FF_API_INTERLEAVE_PACKET |
| 60 | #define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) | 60 | #define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) |
| 61 | #endif | 61 | #endif |
| 62 | #ifndef FF_API_AV_GETTIME | ||
| 63 | #define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55) | ||
| 64 | #endif | ||
| 62 | 65 | ||
| 63 | #endif /* AVFORMAT_VERSION_H */ | 66 | #endif /* AVFORMAT_VERSION_H */ |
| @@ -36,6 +36,7 @@ HEADERS = adler32.h \ · 35 unmodified lines | |||
| 36 | rational.h \ | 36 | rational.h \ |
| 37 | samplefmt.h \ | 37 | samplefmt.h \ |
| 38 | sha.h \ | 38 | sha.h \ |
| 39 | time.h \ | ||
| 39 | 40 | ||
| 40 | ARCH_HEADERS = bswap.h \ | 41 | ARCH_HEADERS = bswap.h \ |
| 41 | intmath.h \ | 42 | intmath.h \ |
| @@ -77,6 +78,7 @@ OBJS = adler32.o \ · 35 unmodified lines | |||
| 77 | rc4.o \ | 78 | rc4.o \ |
| 78 | samplefmt.o \ | 79 | samplefmt.o \ |
| 79 | sha.o \ | 80 | sha.o \ |
| 81 | time.o \ | ||
| 80 | tree.o \ | 82 | tree.o \ |
| 81 | utils.o \ | 83 | utils.o \ |
| 82 | 84 | ||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of Libav. | ||
| 3 | * | ||
| 4 | * Libav is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * Libav is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with Libav; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stddef.h> | ||
| 20 | #include <stdint.h> | ||
| 21 | #include <sys/time.h> | ||
| 22 | |||
| 23 | #include "libavutil/time.h" | ||
| 24 | |||
| 25 | int64_t av_gettime(void) | ||
| 26 | { | ||
| 27 | struct timeval tv; | ||
| 28 | gettimeofday(&tv, NULL); | ||
| 29 | return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; | ||
| 30 | } | ||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of Libav. | ||
| 3 | * | ||
| 4 | * Libav is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * Libav is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with Libav; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef AVUTIL_TIME_H | ||
| 20 | #define AVUTIL_TIME_H | ||
| 21 | |||
| 22 | #include <stdint.h> | ||
| 23 | |||
| 24 | /** | ||
| 25 | * Get the current time in microseconds. | ||
| 26 | */ | ||
| 27 | int64_t av_gettime(void); | ||
| 28 | |||
| 29 | #endif /* AVUTIL_TIME_H */ | ||