Commit e847f412 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  libspeexenc: add supported sample rates and channel layouts.
  Replace usleep() calls with av_usleep()
  lavu: add av_usleep() function
  utvideo: mark interlaced frames as such
  utvideo: Fix interlaced prediction for RGB utvideo.
  cosmetics: do not use full path for local headers
  lavu/file: include unistd.h only when available
  configure: check for unistd.h
  log: include unistd.h only when needed
  lavf: include libavutil/time.h instead of redeclaring av_gettime()

Conflicts:
	configure
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/utvideo.c
	libavutil/avutil.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 492cc9bc 9ee33348
......@@ -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
......
......@@ -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
......
......@@ -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");
......
......@@ -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;
}
......
......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
......@@ -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.
*
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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)
......
......@@ -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,
......
......@@ -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, \
......
......@@ -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
......
......@@ -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"
......
......@@ -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
}
......@@ -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 */
......@@ -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);
}
}
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment