summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure9
-rw-r--r--doc/APIchanges3
-rw-r--r--ffmpeg.c9
-rw-r--r--ffplay.c4
-rw-r--r--libavcodec/libspeexenc.c6
-rw-r--r--libavcodec/utvideo.c13
-rw-r--r--libavcodec/x86/rv40dsp_init.c2
-rw-r--r--libavformat/avformat.h8
-rw-r--r--libavformat/avio.c5
-rw-r--r--libavformat/hls.c4
-rw-r--r--libavformat/hlsproto.c4
-rw-r--r--libavformat/rtmphttp.c5
-rw-r--r--libavutil/arm/float_dsp_init_arm.c2
-rw-r--r--libavutil/arm/float_dsp_init_vfp.c2
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/file.c2
-rw-r--r--libavutil/log.c4
-rw-r--r--libavutil/time.c24
-rw-r--r--libavutil/time.h10
-rw-r--r--tools/aviocat.c4
-rw-r--r--tools/pktdumper.c3
21 files changed, 92 insertions, 33 deletions
diff --git a/configure b/configure
index 995161a3a0..f498357f5b 100755
--- a/configure
+++ b/configure
@@ -1239,6 +1239,7 @@ HAVE_LIST="
memalign
mkstemp
mmap
+ nanosleep
netinet_sctp_h
PeekNamedPipe
poll_h
@@ -1251,6 +1252,7 @@ HAVE_LIST="
sdl_video_size
setmode
setrlimit
+ Sleep
sndio_h
socklen_t
soundcard_h
@@ -1278,8 +1280,11 @@ HAVE_LIST="
threads
trunc
truncf
+ unistd_h
+ usleep
vfp_args
VirtualAlloc
+ windows_h
winsock2_h
xform_asm
xmm_clobbers
@@ -3159,6 +3164,7 @@ check_func strptime
check_func sched_getaffinity
check_func sysconf
check_func sysctl
+check_func usleep
check_func_headers conio.h kbhit
check_func_headers windows.h PeekNamedPipe
check_func_headers io.h setmode
@@ -3168,6 +3174,7 @@ check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes
check_func_headers windows.h GetSystemTimeAsFileTime
check_func_headers windows.h MapViewOfFile
+check_func_headers windows.h Sleep
check_func_headers windows.h VirtualAlloc
check_func_headers glob.h glob
@@ -3181,8 +3188,10 @@ check_header sys/param.h
check_header sys/resource.h
check_header sys/select.h
check_header termios.h
+check_header unistd.h
check_header vdpau/vdpau.h
check_header vdpau/vdpau_x11.h
+check_header windows.h
check_header X11/extensions/XvMClib.h
check_header asm/types.h
diff --git a/doc/APIchanges b/doc/APIchanges
index b36138ebae..0b5ccc9216 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -38,6 +38,9 @@ API changes, most recent first:
2012-03-26 - a67d9cf - lavfi 2.66.100
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
+2012-06-22 - xxxxxxx - lavu 51.34.0
+ Add av_usleep()
+
2012-06-20 - ae0a301 - lavu 51.33.0
Move av_gettime() to libavutil, add libavutil/time.h
diff --git a/ffmpeg.c b/ffmpeg.c
index 80f4fe4beb..d7a44a84c3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -31,7 +31,9 @@
#include <errno.h>
#include <signal.h>
#include <limits.h>
+#if HAVE_ISATTY
#include <unistd.h>
+#endif
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
@@ -51,6 +53,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/timestamp.h"
#include "libavutil/bprint.h"
+#include "libavutil/time.h"
#include "libavformat/os_support.h"
#include "libavformat/ffm.h" // not public API
@@ -2303,7 +2306,7 @@ static void rate_emu_sleep(InputStream *ist)
int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
int64_t now = av_gettime() - ist->start;
if (pts > now)
- usleep(pts - now);
+ av_usleep(pts - now);
}
}
@@ -3342,7 +3345,7 @@ static void *input_thread(void *arg)
ret = av_read_frame(f->ctx, &pkt);
if (ret == AVERROR(EAGAIN)) {
- usleep(10000);
+ av_usleep(10000);
ret = 0;
continue;
} else if (ret < 0)
@@ -3504,7 +3507,7 @@ static int transcode(void)
if (no_packet_count) {
no_packet_count = 0;
memset(no_packet, 0, nb_input_files);
- usleep(10000);
+ av_usleep(10000);
continue;
}
av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from, finishing.\n");
diff --git a/ffplay.c b/ffplay.c
index 55c7825ee3..753ff91a08 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -37,6 +37,7 @@
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/avassert.h"
+#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
@@ -57,7 +58,6 @@
#include "cmdutils.h"
-#include <unistd.h>
#include <assert.h>
const char program_name[] = "ffplay";
@@ -1015,7 +1015,7 @@ static int refresh_thread(void *opaque)
SDL_PushEvent(&event);
}
//FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
- usleep(is->audio_st && is->show_mode != SHOW_MODE_VIDEO ? rdftspeed*1000 : 5000);
+ av_usleep(is->audio_st && is->show_mode != SHOW_MODE_VIDEO ? rdftspeed*1000 : 5000);
}
return 0;
}
diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c
index b4a1853f6f..898625c855 100644
--- a/libavcodec/libspeexenc.c
+++ b/libavcodec/libspeexenc.c
@@ -67,6 +67,8 @@
#include <speex/speex.h>
#include <speex/speex_header.h>
#include <speex/speex_stereo.h>
+
+#include "libavutil/audioconvert.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
@@ -332,6 +334,10 @@ AVCodec ff_libspeex_encoder = {
.capabilities = CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
+ .channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ 0 },
+ .supported_samplerates = (const int[]){ 8000, 16000, 32000, 0 },
.long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
.priv_class = &class,
.defaults = defaults,
diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c
index 59ba7553e6..ac4438ddf7 100644
--- a/libavcodec/utvideo.c
+++ b/libavcodec/utvideo.c
@@ -437,16 +437,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
plane_start[i], c->frame_pred == PRED_LEFT);
if (ret)
return ret;
- if (c->frame_pred == PRED_MEDIAN)
+ if (c->frame_pred == PRED_MEDIAN) {
if (!c->interlaced) {
- restore_median(c->pic.data[0] + rgb_order[i], c->planes,
- c->pic.linesize[0], avctx->width, avctx->height,
- c->slices, 0);
+ restore_median(c->pic.data[0] + rgb_order[i], c->planes,
+ c->pic.linesize[0], avctx->width,
+ avctx->height, c->slices, 0);
} else {
restore_median_il(c->pic.data[0] + rgb_order[i], c->planes,
- c->pic.linesize[0], avctx->width, avctx->height,
- c->slices, 0);
+ c->pic.linesize[0], avctx->width,
+ avctx->height, c->slices, 0);
}
+ }
}
restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
avctx->width, avctx->height);
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 7186492d98..41ee6a74c6 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -26,8 +26,8 @@
* 3,3 is bugged in the rv40 format and maps to _xy2 version
*/
-#include "libavcodec/x86/dsputil_mmx.h"
#include "libavcodec/rv34dsp.h"
+#include "dsputil_mmx.h"
void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y);
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index efab990f16..143c48e17d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -201,6 +201,10 @@
#include "avio.h"
#include "libavformat/version.h"
+#if FF_API_AV_GETTIME
+#include "libavutil/time.h"
+#endif
+
struct AVFormatContext;
@@ -1854,10 +1858,6 @@ void av_dump_format(AVFormatContext *ic,
const char *url,
int is_output);
-#if FF_API_AV_GETTIME
-int64_t av_gettime(void);
-#endif
-
/**
* Return in 'buf' the path with '%d' replaced by a number.
*
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 8b7e495e55..9dca8679e3 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -19,11 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <unistd.h>
-
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "os_support.h"
#include "avformat.h"
#if CONFIG_NETWORK
@@ -268,7 +267,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
if (fast_retries)
fast_retries--;
else
- usleep(1000);
+ av_usleep(1000);
} else if (ret < 1)
return ret < 0 ? ret : len;
if (ret)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 4b5cd07422..40c417a199 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -30,9 +30,9 @@
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
-#include <unistd.h>
#include "avio_internal.h"
#include "url.h"
@@ -407,7 +407,7 @@ reload:
while (av_gettime() - v->last_load_time < reload_interval) {
if (ff_check_interrupt(c->interrupt_callback))
return AVERROR_EXIT;
- usleep(100*1000);
+ av_usleep(100*1000);
}
/* Enough time has elapsed since the last reload */
goto reload;
diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 8c25689f91..95bd047877 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -26,11 +26,11 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
#include "url.h"
#include "version.h"
-#include <unistd.h>
/*
* An apple http stream consists of a playlist with media segment files,
@@ -308,7 +308,7 @@ retry:
while (av_gettime() - s->last_load_time < reload_interval) {
if (ff_check_interrupt(&h->interrupt_callback))
return AVERROR_EXIT;
- usleep(100*1000);
+ av_usleep(100*1000);
}
goto retry;
}
diff --git a/libavformat/rtmphttp.c b/libavformat/rtmphttp.c
index 5eb5007eb0..4f94859c5e 100644
--- a/libavformat/rtmphttp.c
+++ b/libavformat/rtmphttp.c
@@ -24,11 +24,10 @@
* RTMP HTTP protocol
*/
-#include <unistd.h>
-
#include "libavutil/avstring.h"
#include "libavutil/intfloat.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "internal.h"
#include "http.h"
@@ -126,7 +125,7 @@ static int rtmp_http_read(URLContext *h, uint8_t *buf, int size)
if (rt->nb_bytes_read == 0) {
/* Wait 50ms before retrying to read a server reply in
* order to reduce the number of idle requets. */
- usleep(50000);
+ av_usleep(50000);
}
if ((ret = rtmp_http_write(h, "", 1)) < 0)
diff --git a/libavutil/arm/float_dsp_init_arm.c b/libavutil/arm/float_dsp_init_arm.c
index ab636dbcd2..f721344b39 100644
--- a/libavutil/arm/float_dsp_init_arm.c
+++ b/libavutil/arm/float_dsp_init_arm.c
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/arm/cpu.h"
#include "libavutil/float_dsp.h"
+#include "cpu.h"
#include "float_dsp_arm.h"
void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp)
diff --git a/libavutil/arm/float_dsp_init_vfp.c b/libavutil/arm/float_dsp_init_vfp.c
index dfde3fdb64..7abc3322cf 100644
--- a/libavutil/arm/float_dsp_init_vfp.c
+++ b/libavutil/arm/float_dsp_init_vfp.c
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/arm/cpu.h"
#include "libavutil/float_dsp.h"
+#include "cpu.h"
#include "float_dsp_arm.h"
void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1,
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index b3f213a240..0efaa952f4 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -153,7 +153,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 60
+#define LIBAVUTIL_VERSION_MINOR 61
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/file.c b/libavutil/file.c
index c6228effcd..d52a2e803f 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -20,7 +20,9 @@
#include "log.h"
#include <fcntl.h>
#include <sys/stat.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#if HAVE_MMAP
#include <sys/mman.h>
#elif HAVE_MAPVIEWOFFILE
diff --git a/libavutil/log.c b/libavutil/log.c
index f2272fb648..4464bd3031 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -24,7 +24,11 @@
* logging functions
*/
+#include "config.h"
+
+#if HAVE_ISATTY
#include <unistd.h>
+#endif
#include <stdlib.h>
#include "avutil.h"
#include "log.h"
diff --git a/libavutil/time.c b/libavutil/time.c
index 68f431e695..27feb0b758 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -22,13 +22,19 @@
#include <stddef.h>
#include <stdint.h>
+#include <time.h>
#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
-#elif HAVE_GETSYSTEMTIMEASFILETIME
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_WINDOWS_H
#include <windows.h>
#endif
#include "libavutil/time.h"
+#include "error.h"
int64_t av_gettime(void)
{
@@ -46,3 +52,19 @@ int64_t av_gettime(void)
return -1;
#endif
}
+
+int av_usleep(unsigned usec)
+{
+#if HAVE_NANOSLEEP
+ struct timespec ts = { usec / 1000000, usec % 1000000 * 1000 };
+ while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
+ return 0;
+#elif HAVE_USLEEP
+ return usleep(usec);
+#elif HAVE_SLEEP
+ Sleep(usec / 1000);
+ return 0;
+#else
+ return AVERROR(ENOSYS);
+#endif
+}
diff --git a/libavutil/time.h b/libavutil/time.h
index 27f4e6734a..90eb436949 100644
--- a/libavutil/time.h
+++ b/libavutil/time.h
@@ -28,4 +28,14 @@
*/
int64_t av_gettime(void);
+/**
+ * Sleep for a period of time. Although the duration is expressed in
+ * microseconds, the actual delay may be rounded to the precision of the
+ * system timer.
+ *
+ * @param usec Number of microseconds to sleep.
+ * @return zero on success or (negative) error code.
+ */
+int av_usleep(unsigned usec);
+
#endif /* AVUTIL_TIME_H */
diff --git a/tools/aviocat.c b/tools/aviocat.c
index f5da526ba9..52a96bde2f 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -20,8 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
+#include "libavutil/time.h"
#include "libavformat/avformat.h"
static int usage(const char *argv0, int ret)
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
if (bps) {
avio_flush(output);
while ((av_gettime() - start_time) * bps / AV_TIME_BASE < stream_pos)
- usleep(50 * 1000);
+ av_usleep(50 * 1000);
}
}
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index 0daa8e0941..1711210eb4 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
+#include "libavutil/time.h"
#include "libavformat/avformat.h"
#define PKTFILESUFF "_%08" PRId64 "_%02d_%010" PRId64 "_%06d_%c.bin"
@@ -122,7 +123,7 @@ int main(int argc, char **argv)
avformat_close_input(&fctx);
while (donotquit)
- usleep(60 * 1000000);
+ av_usleep(60 * 1000000);
return 0;
}