diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-27 01:47:34 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-27 02:53:21 +0200 |
commit | 027264cb82134c83413810810b24340f6290e11a (patch) | |
tree | 11009209889b89443c2194dda88ef1ed7c4976ec | |
parent | 701012d676042608cd6ec3317c1936a246f436d7 (diff) | |
parent | ca7d8256e32e4dbafadc54a65b441945ac759ca9 (diff) | |
download | ffmpeg-027264cb82134c83413810810b24340f6290e11a.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
ARM: add ARMv6 optimised av_clip_uintp2
ARM: remove volatile from asm statements in libavutil/intmath
ARM: fix av_clipl_int32_arm()
v4l: include avdevice.h
ffserver: move close_connection() call to avoid a temporary string and copy.
lavf: initialize demuxer private options.
AVOptions: set string default values.
lavdevice: mark v4l for removal on next major bump.
swscale: fix compile on ppc.
swscale: fix compile on x86-32.
build: Remove generated .version file on distclean.
configure: Add -D_GNU_SOURCE to CPPFLAGS on OS/2.
doc: Drop hint at --enable-memalign-hack for MinGW, it is now autodetected.
ffplay: Remove disabled code.
Mark parameterless function declarations as 'void'.
swscale: use av_clip_uint8() in yuv2yuv1_c().
swscale: remove VOF/VOFW.
swscale: split chroma buffers into separate U/V planes.
swscale: replace formatConvBuffer[VOF] by allocated array.
rgb2rgb: remove duplicate mmx/mmx2/3dnow/sse2 functions.
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | doc/general.texi | 12 | ||||
-rw-r--r-- | ffmpeg.c | 2 | ||||
-rw-r--r-- | ffplay.c | 62 | ||||
-rw-r--r-- | ffserver.c | 28 | ||||
-rw-r--r-- | libavcodec/ac3enc.c | 12 | ||||
-rw-r--r-- | libavcodec/bink.c | 2 | ||||
-rw-r--r-- | libavdevice/alldevices.c | 2 | ||||
-rw-r--r-- | libavdevice/avdevice.h | 4 | ||||
-rw-r--r-- | libavdevice/libdc1394.c | 31 | ||||
-rw-r--r-- | libavdevice/v4l.c | 7 | ||||
-rw-r--r-- | libavformat/network.h | 3 | ||||
-rw-r--r-- | libavutil/arm/intmath.h | 40 | ||||
-rw-r--r-- | libavutil/opt.c | 4 |
15 files changed, 82 insertions, 130 deletions
@@ -174,7 +174,7 @@ clean:: testclean distclean:: $(RM) $(DISTCLEANSUFFIXES) - $(RM) version.h config.* libavutil/avconfig.h + $(RM) config.* .version version.h libavutil/avconfig.h config: $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) @@ -2510,6 +2510,7 @@ case $target_os in strip="lxlite -CS" ln_s="cp -f" objformat="aout" + add_cppflags -D_GNU_SOURCE add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' FFSERVERLDFLAGS="" diff --git a/doc/general.texi b/doc/general.texi index 8f0085d044..a626ffdd74 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -843,18 +843,6 @@ are listed below: FFmpeg automatically passes @code{-fno-common} to the compiler to work around a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}). -Within the MSYS shell, configure and make with: - -@example -./configure --enable-memalign-hack -make -make install -@end example - -This will install @file{ffmpeg.exe} along with many other development files -to @file{/usr/local}. You may specify another install path using the -@code{--prefix} option in @file{configure}. - Notes: @itemize @@ -707,7 +707,7 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) return err; /* copy stream format */ s->nb_streams = 0; - s->streams = av_mallocz(sizeof(*s->streams) * ic->nb_streams); + s->streams = av_mallocz(sizeof(AVStream *) * ic->nb_streams); for(i=0;i<ic->nb_streams;i++) { AVStream *st; AVCodec *codec; @@ -406,44 +406,6 @@ static inline void fill_rectangle(SDL_Surface *screen, SDL_FillRect(screen, &rect, color); } -#if 0 -/* draw only the border of a rectangle */ -void fill_border(VideoState *s, int x, int y, int w, int h, int color) -{ - int w1, w2, h1, h2; - - /* fill the background */ - w1 = x; - if (w1 < 0) - w1 = 0; - w2 = s->width - (x + w); - if (w2 < 0) - w2 = 0; - h1 = y; - if (h1 < 0) - h1 = 0; - h2 = s->height - (y + h); - if (h2 < 0) - h2 = 0; - fill_rectangle(screen, - s->xleft, s->ytop, - w1, s->height, - color); - fill_rectangle(screen, - s->xleft + s->width - w2, s->ytop, - w2, s->height, - color); - fill_rectangle(screen, - s->xleft + w1, s->ytop, - s->width - w1 - w2, h1, - color); - fill_rectangle(screen, - s->xleft + w1, s->ytop + s->height - h2, - s->width - w1 - w2, h2, - color); -} -#endif - #define ALPHA_BLEND(a, oldp, newp, s)\ ((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s)) @@ -743,23 +705,12 @@ static void video_image_display(VideoState *is) } x = (is->width - width) / 2; y = (is->height - height) / 2; - if (!is->no_background) { - /* fill the background */ - // fill_border(is, x, y, width, height, QERGB(0x00, 0x00, 0x00)); - } else { - is->no_background = 0; - } + is->no_background = 0; rect.x = is->xleft + x; rect.y = is->ytop + y; rect.w = FFMAX(width, 1); rect.h = FFMAX(height, 1); SDL_DisplayYUVOverlay(vp->bmp, &rect); - } else { -#if 0 - fill_rectangle(screen, - is->xleft, is->ytop, is->width, is->height, - QERGB(0x00, 0x00, 0x00)); -#endif } } @@ -1899,8 +1850,6 @@ static int subtitle_thread(void *arg) len1 = avcodec_decode_subtitle2(is->subtitle_st->codec, &sp->sub, &got_subtitle, pkt); -// if (len1 < 0) -// break; if (got_subtitle && sp->sub.format == 0) { sp->pts = pts; @@ -1924,9 +1873,6 @@ static int subtitle_thread(void *arg) SDL_UnlockMutex(is->subpq_mutex); } av_free_packet(pkt); -// if (step) -// if (cur_stream) -// stream_toggle_pause(cur_stream); } the_end: return 0; @@ -2254,8 +2200,6 @@ static int stream_component_open(VideoState *is, int stream_index) is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; -// is->video_current_pts_time = av_gettime(); - packet_queue_init(&is->videoq); is->video_tid = SDL_CreateThread(video_thread, is); break; @@ -2694,10 +2638,6 @@ static void stream_cycle_channel(VideoState *is, int codec_type) static void toggle_full_screen(void) { is_full_screen = !is_full_screen; - if (!fs_screen_width) { - /* use default SDL method */ -// SDL_WM_ToggleFullScreen(screen); - } video_open(cur_stream); } diff --git a/ffserver.c b/ffserver.c index 4c2c5cf890..6bd66b3f1c 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2229,12 +2229,11 @@ static int http_prepare_data(HTTPContext *c) av_metadata_set2(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); av_metadata_set2(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); - c->fmt_ctx.streams = av_mallocz(sizeof(*c->fmt_ctx.streams) * c->stream->nb_streams); + c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams); + for(i=0;i<c->stream->nb_streams;i++) { - AVStream *st; AVStream *src; - st = av_mallocz(sizeof(AVStream)); - c->fmt_ctx.streams[i] = st; + c->fmt_ctx.streams[i] = av_mallocz(sizeof(AVStream)); /* if file or feed, then just take streams from FFStream struct */ if (!c->stream->feed || c->stream->feed == c->stream) @@ -2242,9 +2241,9 @@ static int http_prepare_data(HTTPContext *c) else src = c->stream->feed->streams[c->stream->feed_streams[i]]; - *st = *src; - st->priv_data = 0; - st->codec->frame_number = 0; /* XXX: should be done in + *(c->fmt_ctx.streams[i]) = *src; + c->fmt_ctx.streams[i]->priv_data = 0; + c->fmt_ctx.streams[i]->codec->frame_number = 0; /* XXX: should be done in AVStream, not in codec */ } /* set output format parameters */ @@ -3275,7 +3274,6 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h) { HTTPContext *rtp_c; - char session_id[32]; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { @@ -3283,16 +3281,14 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader return; } - av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id)); - - /* abort the session */ - close_connection(rtp_c); - /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ - avio_printf(c->pb, "Session: %s\r\n", session_id); + avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); avio_printf(c->pb, "\r\n"); + + /* abort the session */ + close_connection(rtp_c); } @@ -3386,9 +3382,9 @@ static int rtp_new_av_stream(HTTPContext *c, if (!st) goto fail; ctx->nb_streams = 1; - ctx->streams = av_mallocz(sizeof(*ctx->streams) * ctx->nb_streams); + ctx->streams = av_mallocz(sizeof(AVStream *) * ctx->nb_streams); if (!ctx->streams) - goto fail; + goto fail; ctx->streams[0] = st; if (!c->stream->feed || diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 28b0668e8f..e30425bd4e 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -555,8 +555,8 @@ static inline float calc_cpl_coord(float energy_ch, float energy_cpl) static void apply_channel_coupling(AC3EncodeContext *s) { #if CONFIG_AC3ENC_FLOAT - DECLARE_ALIGNED(16, float, cpl_coords) [AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16]; - DECLARE_ALIGNED(16, int32_t, fixed_cpl_coords)[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16]; + DECLARE_ALIGNED(16, float, cpl_coords) [AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; + DECLARE_ALIGNED(16, int32_t, fixed_cpl_coords)[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int blk, ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int num_cpl_coefs = s->num_cpl_subbands * 12; @@ -2630,8 +2630,8 @@ static av_cold int allocate_buffers(AVCodecContext *avctx) AC3_MAX_COEFS * sizeof(*s->bap_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->bap1_buffer, AC3_MAX_BLOCKS * channels * AC3_MAX_COEFS * sizeof(*s->bap1_buffer), alloc_fail); - FF_ALLOC_OR_GOTO(avctx, s->mdct_coef_buffer, AC3_MAX_BLOCKS * channels * - AC3_MAX_COEFS * sizeof(*s->mdct_coef_buffer), alloc_fail); + FF_ALLOCZ_OR_GOTO(avctx, s->mdct_coef_buffer, AC3_MAX_BLOCKS * channels * + AC3_MAX_COEFS * sizeof(*s->mdct_coef_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->exp_buffer, AC3_MAX_BLOCKS * channels * AC3_MAX_COEFS * sizeof(*s->exp_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->grouped_exp_buffer, AC3_MAX_BLOCKS * channels * @@ -2695,8 +2695,8 @@ static av_cold int allocate_buffers(AVCodecContext *avctx) } if (CONFIG_AC3ENC_FLOAT) { - FF_ALLOC_OR_GOTO(avctx, s->fixed_coef_buffer, AC3_MAX_BLOCKS * channels * - AC3_MAX_COEFS * sizeof(*s->fixed_coef_buffer), alloc_fail); + FF_ALLOCZ_OR_GOTO(avctx, s->fixed_coef_buffer, AC3_MAX_BLOCKS * channels * + AC3_MAX_COEFS * sizeof(*s->fixed_coef_buffer), alloc_fail); for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; FF_ALLOCZ_OR_GOTO(avctx, block->fixed_coef, channels * diff --git a/libavcodec/bink.c b/libavcodec/bink.c index d1985eddb2..ef07747dbc 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1208,7 +1208,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac /** * Caclulate quantization tables for version b */ -static av_cold void binkb_calc_quant() +static av_cold void binkb_calc_quant(void) { uint8_t inv_bink_scan[64]; double s[64]; diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 3997c7380b..fad7758944 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -48,7 +48,9 @@ void avdevice_register_all(void) REGISTER_INOUTDEV (OSS, oss); REGISTER_INOUTDEV (SNDIO, sndio); REGISTER_INDEV (V4L2, v4l2); +#if FF_API_V4L REGISTER_INDEV (V4L, v4l); +#endif REGISTER_INDEV (VFWCAP, vfwcap); REGISTER_INDEV (X11_GRAB_DEVICE, x11_grab_device); diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index d31c99e654..7633af4475 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -33,6 +33,10 @@ LIBAVDEVICE_VERSION_MICRO) #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT +#ifndef FF_API_V4L +#define FF_API_V4L (LIBAVDEVICE_VERSION_MAJOR < 54) +#endif + /** * Return the LIBAVDEVICE_VERSION_INT constant. */ diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 838f01993a..b2585ac260 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -90,6 +90,21 @@ struct dc1394_frame_rate { { 0, 0 } /* gotta be the last one */ }; +static const AVOption options[] = { +#if HAVE_LIBDC1394_1 + { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, +#endif + { NULL }, +}; + +static const AVClass libdc1394_class = { + .class_name = "libdc1394 indev", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + + static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps) { @@ -245,20 +260,6 @@ static int dc1394_v1_close(AVFormatContext * context) return 0; } -static const AVOption options[] = { -#if HAVE_LIBDC1394_1 - { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, -#endif - { NULL }, -}; - -static const AVClass libdc1394_class = { - .class_name = "libdc1394 indev", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - #elif HAVE_LIBDC1394_2 static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap) { @@ -378,7 +379,7 @@ AVInputFormat ff_libdc1394_demuxer = { .read_header = dc1394_v2_read_header, .read_packet = dc1394_v2_read_packet, .read_close = dc1394_v2_close, - .flags = AVFMT_NOFILE + .flags = AVFMT_NOFILE, .priv_class = &libdc1394_class, }; diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index a49ca8005f..337b489e92 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -19,6 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "avdevice.h" + +#if FF_API_V4L + #undef __STRICT_ANSI__ //workaround due to broken kernel headers #include "config.h" #include "libavutil/rational.h" @@ -83,6 +87,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) int j; int vformat_num = FF_ARRAY_ELEMS(video_formats); + av_log(s1, AV_LOG_WARNING, "V4L input device is deprecated and will be removed in the next release."); + if (ap->time_base.den <= 0) { av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den); return -1; @@ -374,3 +380,4 @@ AVInputFormat ff_v4l_demuxer = { .flags = AVFMT_NOFILE, .priv_class = &v4l_class, }; +#endif /* FF_API_V4L */ diff --git a/libavformat/network.h b/libavformat/network.h index f2a0c97d77..1b14506fd3 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -33,7 +33,8 @@ #define ECONNREFUSED WSAECONNREFUSED #define EINPROGRESS WSAEINPROGRESS -static inline int ff_neterrno() { +static inline int ff_neterrno(void) +{ int err = WSAGetLastError(); switch (err) { case WSAEWOULDBLOCK: diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h index 8f03d4bf90..8eb346cd64 100644 --- a/libavutil/arm/intmath.h +++ b/libavutil/arm/intmath.h @@ -34,11 +34,11 @@ static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; - __asm__ volatile("cmp %3, #2 \n\t" - "ldr %1, [%4, %3, lsl #2] \n\t" - "lsrle %0, %2, #1 \n\t" - "smmulgt %0, %1, %2 \n\t" - : "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse)); + __asm__ ("cmp %3, #2 \n\t" + "ldr %1, [%4, %3, lsl #2] \n\t" + "lsrle %0, %2, #1 \n\t" + "smmulgt %0, %1, %2 \n\t" + : "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse)); return r; } @@ -46,7 +46,7 @@ static av_always_inline av_const int FASTDIV(int a, int b) static av_always_inline av_const uint8_t av_clip_uint8_arm(int a) { unsigned x; - __asm__ volatile ("usat %0, #8, %1" : "=r"(x) : "r"(a)); + __asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a)); return x; } @@ -54,7 +54,7 @@ static av_always_inline av_const uint8_t av_clip_uint8_arm(int a) static av_always_inline av_const uint8_t av_clip_int8_arm(int a) { unsigned x; - __asm__ volatile ("ssat %0, #8, %1" : "=r"(x) : "r"(a)); + __asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a)); return x; } @@ -62,7 +62,7 @@ static av_always_inline av_const uint8_t av_clip_int8_arm(int a) static av_always_inline av_const uint16_t av_clip_uint16_arm(int a) { unsigned x; - __asm__ volatile ("usat %0, #16, %1" : "=r"(x) : "r"(a)); + __asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a)); return x; } @@ -70,18 +70,27 @@ static av_always_inline av_const uint16_t av_clip_uint16_arm(int a) static av_always_inline av_const int16_t av_clip_int16_arm(int a) { int x; - __asm__ volatile ("ssat %0, #16, %1" : "=r"(x) : "r"(a)); + __asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a)); return x; } +#define av_clip_uintp2 av_clip_uintp2_arm +static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) +{ + unsigned x; + __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); + return x; +} + + #else /* HAVE_ARMV6 */ #define FASTDIV FASTDIV static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; - __asm__ volatile("umull %1, %0, %2, %3" - : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); + __asm__ ("umull %1, %0, %2, %3" + : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); return r; } @@ -91,10 +100,11 @@ static av_always_inline av_const int FASTDIV(int a, int b) static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) { int x, y; - __asm__ volatile ("adds %1, %R2, %Q2, lsr #31 \n\t" - "mvnne %1, #1<<31 \n\t" - "eorne %0, %1, %R2, asr #31 \n\t" - : "=r"(x), "=&r"(y) : "r"(a)); + __asm__ ("adds %1, %R2, %Q2, lsr #31 \n\t" + "mvnne %1, #1<<31 \n\t" + "moveq %0, %Q2 \n\t" + "eorne %0, %1, %R2, asr #31 \n\t" + : "=r"(x), "=&r"(y) : "r"(a)); return x; } diff --git a/libavutil/opt.c b/libavutil/opt.c index 1d465e7b60..8f2d9a69db 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -443,8 +443,10 @@ void av_opt_set_defaults2(void *s, int mask, int flags) } break; case FF_OPT_TYPE_STRING: + av_set_string3(s, opt->name, opt->default_val.str, 1, NULL); + break; case FF_OPT_TYPE_BINARY: - /* Cannot set default for string as default_val is of type * double */ + /* Cannot set default for binary */ break; default: av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); |