diff --git a/configure b/configure index 6c8c979822..2e0f1e43cb 100755 --- a/configure +++ b/configure @@ -2252,7 +2252,7 @@ if enabled cross_compile; then die "Must specify target arch and OS when cross-compiling" fi -set_default arch target_os postproc_version +set_default postproc_version # Check if we should build alternative libpostproc version instead of current if test "$postproc_version" = $ALT_PP_VER; then @@ -2290,13 +2290,14 @@ case "$toolchain" in ld_default="c99wrap link" nm_default="dumpbin -symbols" ar_default="lib" + target_os_default="win32" ;; ?*) die "Unknown toolchain $toolchain" ;; esac -set_default cc cxx pkg_config strip sysinclude yasmexe +set_default arch cc cxx pkg_config strip sysinclude target_os yasmexe enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -2307,7 +2308,7 @@ fi exesuf() { case $1 in - mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;; + mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;; esac } @@ -2372,7 +2373,8 @@ msvc_flags(){ -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ - -wd4996 -wd4554 ;; + -wd4554 \ + -wd4996 -wd4273 ;; -std=c99) ;; -fno-math-errno) ;; -fno-common) ;; @@ -3073,6 +3075,30 @@ case $target_os in enable dos_paths add_cppflags -U__STRICT_ANSI__ ;; + win32|win64) + if enabled shared; then + # Link to the import library instead of the normal static library + # for shared libs. + LD_LIB='%.lib' + # Cannot build shared and static libraries at the same time with + # MSVC. + disable static + fi + shlibdir_default="$bindir_default" + SLIBPREF="" + SLIBSUF=".dll" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' + SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' + SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' + SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' + SLIB_INSTALL_LINKS= + SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' + SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' + SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' + objformat="win32" + ranlib=: + enable dos_paths + ;; cygwin*) target_os=cygwin shlibdir_default="$bindir_default" diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h index d6e0eed86a..c41a93ecc4 100644 --- a/libavcodec/ac3tab.h +++ b/libavcodec/ac3tab.h @@ -33,7 +33,7 @@ extern const uint16_t ff_ac3_frame_size_tab[38][3]; extern const uint8_t ff_ac3_channels_tab[8]; -extern const uint16_t avpriv_ac3_channel_layout_tab[8]; +extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8]; extern const uint8_t ff_ac3_enc_channel_map[8][2][6]; extern const uint8_t ff_ac3_dec_channel_map[8][2][6]; extern const uint16_t ff_ac3_sample_rate_tab[3]; diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index a923ef502e..02d0d81460 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1097,8 +1097,8 @@ static int decode_seq_header(AVSContext *h) { s->low_delay = get_bits1(&s->gb); h->mb_width = (s->width + 15) >> 4; h->mb_height = (s->height + 15) >> 4; - h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num; - h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den; + h->s.avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_code].num; + h->s.avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_code].den; h->s.avctx->width = s->width; h->s.avctx->height = s->height; if(!h->top_qp) diff --git a/libavcodec/dca.h b/libavcodec/dca.h index 4d2a829d00..3da93aa4d4 100644 --- a/libavcodec/dca.h +++ b/libavcodec/dca.h @@ -26,6 +26,7 @@ #define AVCODEC_DCA_H #include +#include "libavutil/internal.h" /** DCA syncwords, also used for bitstream type detection */ #define DCA_MARKER_RAW_BE 0x7FFE8001 @@ -36,6 +37,6 @@ /** DCA-HD specific block starts with this marker. */ #define DCA_HD_MARKER 0x64582025 -extern const uint32_t avpriv_dca_sample_rates[16]; +extern av_export const uint32_t avpriv_dca_sample_rates[16]; #endif /* AVCODEC_DCA_H */ diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c index 79638acea3..4fcb3a2e07 100644 --- a/libavcodec/dirac.c +++ b/libavcodec/dirac.c @@ -164,7 +164,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, /* [DIRAC_STD] preset_frame_rate(video_params, index) */ if (source->frame_rate_index > 0) { if (source->frame_rate_index <= 8) - frame_rate = avpriv_frame_rate_tab[source->frame_rate_index]; /* [DIRAC_STD] Table 10.3 values 1-8 */ + frame_rate = ff_mpeg12_frame_rate_tab[source->frame_rate_index]; else /* [DIRAC_STD] Table 10.3 values 9-10 */ frame_rate = dirac_frame_rate[source->frame_rate_index-9]; diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h index d826278216..96e18545a7 100644 --- a/libavcodec/mjpeg.h +++ b/libavcodec/mjpeg.h @@ -138,16 +138,16 @@ static inline void put_marker(PutBitContext *p, int code) case 7: ret= (left + top)>>1; break;\ } -extern const uint8_t avpriv_mjpeg_bits_dc_luminance[]; -extern const uint8_t avpriv_mjpeg_val_dc[]; +extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_dc[]; -extern const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; -extern const uint8_t avpriv_mjpeg_bits_ac_luminance[]; -extern const uint8_t avpriv_mjpeg_val_ac_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[]; -extern const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; -extern const uint8_t avpriv_mjpeg_val_ac_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_val_ac_chrominance[]; void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, const uint8_t *bits_table, diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 953cd5ec94..3d01a2ebc2 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1290,8 +1290,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { //MPEG-1 fps - avctx->time_base.den = avpriv_frame_rate_tab[s->frame_rate_index].num; - avctx->time_base.num = avpriv_frame_rate_tab[s->frame_rate_index].den; + avctx->time_base.den = ff_mpeg12_frame_rate_tab[s->frame_rate_index].num; + avctx->time_base.num = ff_mpeg12_frame_rate_tab[s->frame_rate_index].den; //MPEG-1 aspect avctx->sample_aspect_ratio = av_d2q(1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255); avctx->ticks_per_frame=1; @@ -1299,8 +1299,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) //MPEG-2 fps av_reduce(&s->avctx->time_base.den, &s->avctx->time_base.num, - avpriv_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2, - avpriv_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, + ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2, + ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, 1 << 30); avctx->ticks_per_frame = 2; //MPEG-2 aspect diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c index f4644f3f1d..d26c5da1d4 100644 --- a/libavcodec/mpeg12data.c +++ b/libavcodec/mpeg12data.c @@ -305,7 +305,7 @@ const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = { { 0xc, 10 }, }; -const AVRational avpriv_frame_rate_tab[16] = { +const AVRational ff_mpeg12_frame_rate_tab[16] = { { 0, 0}, {24000, 1001}, { 24, 1}, diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h index 7eac33baa5..0e289b2cb5 100644 --- a/libavcodec/mpeg12data.h +++ b/libavcodec/mpeg12data.h @@ -48,7 +48,7 @@ extern const uint8_t ff_mpeg12_mbPatTable[64][2]; extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]; -extern const AVRational avpriv_frame_rate_tab[]; +extern const AVRational ff_mpeg12_frame_rate_tab[]; extern const AVRational ff_mpeg2_frame_rate_tab[]; extern const float ff_mpeg1_aspect[16]; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 42731eb392..c6154170e8 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -117,7 +117,7 @@ static int find_frame_rate_index(MpegEncContext *s){ for (ext.num=1; ext.num <= 4; ext.num++) { for (ext.den=1; ext.den <= 32; ext.den++) { - AVRational q = av_mul_q(ext, avpriv_frame_rate_tab[i]); + AVRational q = av_mul_q(ext, ff_mpeg12_frame_rate_tab[i]); if(s->codec_id != AV_CODEC_ID_MPEG2VIDEO && (ext.den!=1 || ext.num!=1)) continue; @@ -189,7 +189,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } if (s->tc_opt_str) { - AVRational rate = avpriv_frame_rate_tab[s->frame_rate_index]; + AVRational rate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; int ret = av_timecode_init_from_string(&s->tc, rate, s->tc_opt_str, s); if (ret < 0) return ret; @@ -222,7 +222,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA) if (s->current_picture.f.key_frame) { - AVRational framerate= avpriv_frame_rate_tab[s->frame_rate_index]; + AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; /* mpeg1 header repeated every gop */ put_header(s, SEQ_START_CODE); @@ -982,7 +982,7 @@ AVCodec ff_mpeg1video_encoder = { .init = encode_init, .encode2 = ff_MPV_encode_picture, .close = ff_MPV_encode_end, - .supported_framerates = avpriv_frame_rate_tab+1, + .supported_framerates = ff_mpeg12_frame_rate_tab + 1, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, .capabilities = CODEC_CAP_DELAY, diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index 64839c6617..0f410455f5 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -40,7 +40,7 @@ typedef struct MPEG4AudioConfig { int ps; ///< -1 implicit, 1 presence } MPEG4AudioConfig; -extern const int avpriv_mpeg4audio_sample_rates[16]; +extern av_export const int avpriv_mpeg4audio_sample_rates[16]; extern const uint8_t ff_mpeg4audio_channels[8]; /** diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index c0d595e4c0..29a26588b2 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -29,11 +29,13 @@ #include +#include "libavutil/internal.h" + #define MODE_EXT_MS_STEREO 2 #define MODE_EXT_I_STEREO 1 -extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; -extern const uint16_t avpriv_mpa_freq_tab[3]; +extern av_export const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; +extern av_export const uint16_t avpriv_mpa_freq_tab[3]; extern const int ff_mpa_sblimit_table[5]; extern const int ff_mpa_quant_steps[17]; extern const int ff_mpa_quant_bits[17]; diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index a9ed81b33b..c60d3cd1cf 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -65,8 +65,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, did_set_size=1; } frame_rate_index = buf[3] & 0xf; - pc->frame_rate.den = avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_index].num; - pc->frame_rate.num = avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_index].den; + pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num; + pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den; avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400; avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; } diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 6e060ba27c..81f4b594d5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -228,12 +228,10 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) } else { int64_t res; -#if CONFIG_MUXERS || CONFIG_NETWORK if (s->write_flag) { flush_buffer(s); s->must_flush = 1; } -#endif /* CONFIG_MUXERS || CONFIG_NETWORK */ if (!s->seek) return AVERROR(EPIPE); if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) diff --git a/libavformat/gxf.c b/libavformat/gxf.c index c63cafb598..0286439c44 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -202,6 +202,18 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info } } +static const AVRational frame_rate_tab[] = { + { 60, 1}, + {60000, 1001}, + { 50, 1}, + { 30, 1}, + {30000, 1001}, + { 25, 1}, + { 24, 1}, + {24000, 1001}, + { 0, 0}, +}; + /** * @brief convert fps tag value to AVRational fps * @param fps fps value from tag @@ -209,7 +221,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info */ static AVRational fps_tag2avr(int32_t fps) { if (fps < 1 || fps > 9) fps = 9; - return avpriv_frame_rate_tab[9 - fps]; // values have opposite order + return frame_rate_tab[fps - 1]; } /** diff --git a/libavutil/internal.h b/libavutil/internal.h index f18e37a243..778497293c 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -48,6 +48,12 @@ #endif #endif +#if defined(_MSC_VER) && CONFIG_SHARED +# define av_export __declspec(dllimport) +#else +# define av_export +#endif + #ifndef INT_BIT # define INT_BIT (CHAR_BIT * sizeof(int)) #endif diff --git a/tests/Makefile b/tests/Makefile index e358fbda25..a0210c76f0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -54,6 +54,8 @@ ENCDEC2 = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER \ $(firstword $(2))_ENCODER $(lastword $(2))_DECODER \ $(firstword $(3))_MUXER $(lastword $(3))_DEMUXER) +DEMDEC = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER)) + include $(SRC_PATH)/tests/fate/acodec.mak include $(SRC_PATH)/tests/fate/vcodec.mak include $(SRC_PATH)/tests/fate/avformat.mak