Commit 32c30387 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  x86: swscale: Place inline assembly code under appropriate #ifdefs
  rtsp: remove terminal comma in FF_RTP_FLAG_OPTS macro.
  configure: Remove redundant RTMPT/RTMPTS dependencies
  configure: add filtering of host cflags/ldflags
  configure: initialise all flag filters at the same place
  configure: add filtering of linker flags
  configure: name some variables more consistently
  configure: remove filter_cppflags
  configure: set icc_version where it is needed
  mpegenc: remove disabled code

Conflicts:
	configure
	libavformat/movenc.c
	libswscale/x86/swscale_mmx.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1aeb87fa b2668c85
...@@ -631,27 +631,35 @@ prepend(){ ...@@ -631,27 +631,35 @@ prepend(){
} }
add_cppflags(){ add_cppflags(){
append CPPFLAGS $($filter_cppflags "$@") append CPPFLAGS "$@"
} }
add_cflags(){ add_cflags(){
append CFLAGS $($filter_cflags "$@") append CFLAGS $($cflags_filter "$@")
} }
add_cxxflags(){ add_cxxflags(){
append CXXFLAGS $($filter_cflags "$@") append CXXFLAGS $($cflags_filter "$@")
} }
add_asflags(){ add_asflags(){
append ASFLAGS $($filter_asflags "$@") append ASFLAGS $($asflags_filter "$@")
} }
add_ldflags(){ add_ldflags(){
append LDFLAGS "$@" append LDFLAGS $($ldflags_filter "$@")
} }
add_extralibs(){ add_extralibs(){
prepend extralibs "$@" prepend extralibs $($ldflags_filter "$@")
}
add_host_cflags(){
append host_cflags $($host_cflags_filter "$@")
}
add_host_ldflags(){
append host_ldflags $($host_ldflags_filter "$@")
} }
check_cmd(){ check_cmd(){
...@@ -715,7 +723,9 @@ check_ld(){ ...@@ -715,7 +723,9 @@ check_ld(){
for f; do for f; do
test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
done done
check_$type $($filter_cflags $flags) || return check_$type $($cflags_filter $flags) || return
flags=$($ldflags_filter $flags)
libs=$($ldflags_filter $libs)
check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
} }
...@@ -735,7 +745,6 @@ check_code(){ ...@@ -735,7 +745,6 @@ check_code(){
check_cppflags(){ check_cppflags(){
log check_cppflags "$@" log check_cppflags "$@"
set -- $($filter_cppflags "$@")
check_cc "$@" <<EOF && append CPPFLAGS "$@" check_cc "$@" <<EOF && append CPPFLAGS "$@"
int x; int x;
EOF EOF
...@@ -743,7 +752,7 @@ EOF ...@@ -743,7 +752,7 @@ EOF
check_cflags(){ check_cflags(){
log check_cflags "$@" log check_cflags "$@"
set -- $($filter_cflags "$@") set -- $($cflags_filter "$@")
check_cc "$@" <<EOF && append CFLAGS "$@" check_cc "$@" <<EOF && append CFLAGS "$@"
int x; int x;
EOF EOF
...@@ -751,7 +760,7 @@ EOF ...@@ -751,7 +760,7 @@ EOF
check_cxxflags(){ check_cxxflags(){
log check_cxxflags "$@" log check_cxxflags "$@"
set -- $($filter_cflags "$@") set -- $($cflags_filter "$@")
check_cxx "$@" <<EOF && append CXXFLAGS "$@" check_cxx "$@" <<EOF && append CXXFLAGS "$@"
int x; int x;
EOF EOF
...@@ -843,7 +852,7 @@ check_cpp_condition(){ ...@@ -843,7 +852,7 @@ check_cpp_condition(){
header=$1 header=$1
condition=$2 condition=$2
shift 2 shift 2
check_cpp $($filter_cppflags "$@") <<EOF check_cpp "$@" <<EOF
#include <$header> #include <$header>
#if !($condition) #if !($condition)
#error "unsatisfied condition: $condition" #error "unsatisfied condition: $condition"
...@@ -983,6 +992,7 @@ check_host_cc(){ ...@@ -983,6 +992,7 @@ check_host_cc(){
check_host_cflags(){ check_host_cflags(){
log check_host_cflags "$@" log check_host_cflags "$@"
set -- $($host_cflags_filter "$@")
check_host_cc "$@" <<EOF && append host_cflags "$@" check_host_cc "$@" <<EOF && append host_cflags "$@"
int x; int x;
EOF EOF
...@@ -1740,9 +1750,7 @@ rtmp_protocol_deps="!librtmp_protocol" ...@@ -1740,9 +1750,7 @@ rtmp_protocol_deps="!librtmp_protocol"
rtmp_protocol_select="tcp_protocol" rtmp_protocol_select="tcp_protocol"
rtmps_protocol_deps="!librtmp_protocol" rtmps_protocol_deps="!librtmp_protocol"
rtmps_protocol_select="tls_protocol" rtmps_protocol_select="tls_protocol"
rtmpt_protocol_deps="!librtmp_protocol"
rtmpt_protocol_select="ffrtmphttp_protocol" rtmpt_protocol_select="ffrtmphttp_protocol"
rtmpts_protocol_deps="!librtmp_protocol"
rtmpts_protocol_select="ffrtmphttp_protocol" rtmpts_protocol_select="ffrtmphttp_protocol"
rtp_protocol_select="udp_protocol" rtp_protocol_select="udp_protocol"
sctp_protocol_deps="network netinet_sctp_h" sctp_protocol_deps="network netinet_sctp_h"
...@@ -1941,12 +1949,18 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"' ...@@ -1941,12 +1949,18 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)' SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
asflags_filter=echo
cflags_filter=echo
ldflags_filter=echo
AS_O='-o $@' AS_O='-o $@'
CC_O='-o $@' CC_O='-o $@'
CXX_O='-o $@' CXX_O='-o $@'
host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g' host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
host_libs='-lm' host_libs='-lm'
host_cflags_filter=echo
host_ldflags_filter=echo
target_path='$(CURDIR)' target_path='$(CURDIR)'
...@@ -2224,18 +2238,14 @@ EOF ...@@ -2224,18 +2238,14 @@ EOF
die "Sanity test failed." die "Sanity test failed."
fi fi
filter_asflags=echo
filter_cflags=echo
filter_cppflags=echo
if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
cc_type=llvm_gcc cc_type=llvm_gcc
gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver" cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
speed_cflags='-O3' cflags_speed='-O3'
size_cflags='-Os' cflags_size='-Os'
elif $cc -v 2>&1 | grep -qi ^gcc; then elif $cc -v 2>&1 | grep -qi ^gcc; then
cc_type=gcc cc_type=gcc
gcc_version=$($cc --version | head -n1) gcc_version=$($cc --version | head -n1)
...@@ -2247,30 +2257,29 @@ elif $cc -v 2>&1 | grep -qi ^gcc; then ...@@ -2247,30 +2257,29 @@ elif $cc -v 2>&1 | grep -qi ^gcc; then
CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
fi fi
speed_cflags='-O3' cflags_speed='-O3'
size_cflags='-Os' cflags_size='-Os'
elif $cc --version 2>/dev/null | grep -q Intel; then elif $cc --version 2>/dev/null | grep -q Intel; then
cc_type=icc cc_type=icc
cc_ident=$($cc --version | head -n1) cc_ident=$($cc --version | head -n1)
icc_version=$($cc -dumpversion)
CC_DEPFLAGS='-MMD' CC_DEPFLAGS='-MMD'
AS_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD'
speed_cflags='-O3' cflags_speed='-O3'
size_cflags='-Os' cflags_size='-Os'
noopt_cflags='-O1' cflags_noopt='-O1'
elif $cc -v 2>&1 | grep -q xlc; then elif $cc -v 2>&1 | grep -q xlc; then
cc_type=xlc cc_type=xlc
cc_ident=$($cc -qversion 2>/dev/null | head -n1) cc_ident=$($cc -qversion 2>/dev/null | head -n1)
speed_cflags='-O5' cflags_speed='-O5'
size_cflags='-O5 -qcompact' cflags_size='-O5 -qcompact'
elif $cc -V 2>/dev/null | grep -q Compaq; then elif $cc -V 2>/dev/null | grep -q Compaq; then
cc_type=ccc cc_type=ccc
cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3) cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M' DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
debuglevel=3 debuglevel=3
add_ldflags -Wl,-z,now # calls to libots crash without this add_ldflags -Wl,-z,now # calls to libots crash without this
speed_cflags='-fast' cflags_speed='-fast'
size_cflags='-O1' cflags_size='-O1'
elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
test -d "$sysroot" || die "No valid sysroot specified." test -d "$sysroot" || die "No valid sysroot specified."
cc_type=armcc cc_type=armcc
...@@ -2286,9 +2295,9 @@ elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then ...@@ -2286,9 +2295,9 @@ elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
as_default="${cross_prefix}gcc" as_default="${cross_prefix}gcc"
CC_DEPFLAGS='-MMD' CC_DEPFLAGS='-MMD'
AS_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD'
speed_cflags='-O3' cflags_speed='-O3'
size_cflags='-Os' cflags_size='-Os'
filter_asflags="filter_out -W${armcc_opt}*" asflags_filter="filter_out -W${armcc_opt}*"
elif $cc -version 2>/dev/null | grep -q TMS470; then elif $cc -version 2>/dev/null | grep -q TMS470; then
cc_type=tms470 cc_type=tms470
cc_ident=$($cc -version | head -n1 | tr -s ' ') cc_ident=$($cc -version | head -n1 | tr -s ' ')
...@@ -2301,9 +2310,9 @@ elif $cc -version 2>/dev/null | grep -q TMS470; then ...@@ -2301,9 +2310,9 @@ elif $cc -version 2>/dev/null | grep -q TMS470; then
add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__= add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)' CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
AS_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD'
speed_cflags='-O3 -mf=5' cflags_speed='-O3 -mf=5'
size_cflags='-O3 -mf=2' cflags_size='-O3 -mf=2'
filter_cflags=tms470_flags cflags_filter=tms470_flags
tms470_flags(){ tms470_flags(){
for flag; do for flag; do
case $flag in case $flag in
...@@ -2333,17 +2342,17 @@ elif $cc -v 2>&1 | grep -q clang; then ...@@ -2333,17 +2342,17 @@ elif $cc -v 2>&1 | grep -q clang; then
cc_ident=$($cc --version | head -n1) cc_ident=$($cc --version | head -n1)
CC_DEPFLAGS='-MMD' CC_DEPFLAGS='-MMD'
AS_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD'
speed_cflags='-O3' cflags_speed='-O3'
size_cflags='-Os' cflags_size='-Os'
elif $cc -V 2>&1 | grep -q Sun; then elif $cc -V 2>&1 | grep -q Sun; then
cc_type=suncc cc_type=suncc
cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)' DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1' DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
add_ldflags -xc99 add_ldflags -xc99
speed_cflags='-O5' cflags_speed='-O5'
size_cflags='-O5 -xspace' cflags_size='-O5 -xspace'
filter_cflags=suncc_flags cflags_filter=suncc_flags
suncc_flags(){ suncc_flags(){
for flag; do for flag; do
case $flag in case $flag in
...@@ -2382,25 +2391,25 @@ elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then ...@@ -2382,25 +2391,25 @@ elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
speed_cflags='-O2' cflags_speed='-O2'
size_cflags='-Os' cflags_size='-Os'
filter_cflags='filter_out -Wdisabled-optimization' cflags_filter='filter_out -Wdisabled-optimization'
elif $cc -v 2>&1 | grep -q Open64; then elif $cc -v 2>&1 | grep -q Open64; then
cc_type=open64 cc_type=open64
cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
speed_cflags='-O2' cflags_speed='-O2'
size_cflags='-Os' cflags_size='-Os'
filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros' cflags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
elif $cc -V 2>&1 | grep -q Portland; then elif $cc -V 2>&1 | grep -q Portland; then
cc_type=pgi cc_type=pgi
cc_ident="PGI $($cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')" cc_ident="PGI $($cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
opt_common='-alias=ansi -Mlre -Mpre' opt_common='-alias=ansi -Mlre -Mpre'
speed_cflags="-O3 -Mautoinline -Munroll=c:4 $opt_common" cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
size_cflags="-O2 -Munroll=c:1 $opt_common" cflags_size="-O2 -Munroll=c:1 $opt_common"
noopt_cflags="-O1" cflags_noopt="-O1"
filter_cflags=pgi_flags cflags_filter=pgi_flags
pgi_flags(){ pgi_flags(){
for flag; do for flag; do
case $flag in case $flag in
...@@ -3509,11 +3518,11 @@ fi ...@@ -3509,11 +3518,11 @@ fi
if [ -n "$optflags" ]; then if [ -n "$optflags" ]; then
add_cflags $optflags add_cflags $optflags
elif enabled small; then elif enabled small; then
add_cflags $size_cflags add_cflags $cflags_size
elif enabled optimizations; then elif enabled optimizations; then
add_cflags $speed_cflags add_cflags $cflags_speed
else else
add_cflags $noopt_cflags add_cflags $cflags_noopt
fi fi
check_cflags -fno-math-errno check_cflags -fno-math-errno
check_cflags -fno-signed-zeros check_cflags -fno-signed-zeros
...@@ -3541,6 +3550,7 @@ if enabled icc; then ...@@ -3541,6 +3550,7 @@ if enabled icc; then
# icc 11.0 and 11.1 work with ebp_available, but don't pass the test # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
enable ebp_available enable ebp_available
if enabled x86_32; then if enabled x86_32; then
icc_version=$($cc -dumpversion)
test ${icc_version%%.*} -ge 11 && test ${icc_version%%.*} -ge 11 &&
check_cflags -falign-stack=maintain-16-byte || check_cflags -falign-stack=maintain-16-byte ||
disable aligned_stack disable aligned_stack
......
...@@ -52,7 +52,7 @@ static const AVOption options[] = { ...@@ -52,7 +52,7 @@ static const AVOption options[] = {
{ "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags) FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
{ "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{ "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
{ "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
......
...@@ -379,14 +379,6 @@ static int mpeg_mux_init(AVFormatContext *ctx) ...@@ -379,14 +379,6 @@ static int mpeg_mux_init(AVFormatContext *ctx)
av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n");
stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default
} }
#if 0
/* see VCD standard, p. IV-7*/
stream->max_buffer_size = 46 * 1024;
else
/* This value HAS to be used for SVCD (see SVCD standard, p. 26 V.2.3.2).
Right now it is also used for everything else.*/
stream->max_buffer_size = 230 * 1024;
#endif
s->video_bound++; s->video_bound++;
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
...@@ -534,92 +526,6 @@ static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts) ...@@ -534,92 +526,6 @@ static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts)
} }
#if 0 /* unused, remove? */
/* return the exact available payload size for the next packet for
stream 'stream_index'. 'pts' and 'dts' are only used to know if
timestamps are needed in the packet header. */
static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
int64_t pts, int64_t dts)
{
MpegMuxContext *s = ctx->priv_data;
int buf_index;
StreamInfo *stream;
stream = ctx->streams[stream_index]->priv_data;
buf_index = 0;
if (((s->packet_number % s->pack_header_freq) == 0)) {
/* pack header size */
if (s->is_mpeg2)
buf_index += 14;
else
buf_index += 12;
if (s->is_vcd) {
/* there is exactly one system header for each stream in a VCD MPEG,
One in the very first video packet and one in the very first
audio packet (see VCD standard p. IV-7 and IV-8).*/
if (stream->packet_number==0)
/* The system headers refer only to the stream they occur in,
so they have a constant size.*/
buf_index += 15;
} else {
if ((s->packet_number % s->system_header_freq) == 0)
buf_index += s->system_header_size;
}
}
if ((s->is_vcd && stream->packet_number==0)
|| (s->is_svcd && s->packet_number==0))
/* the first pack of each stream contains only the pack header,
the system header and some padding (see VCD standard p. IV-6)
Add the padding size, so that the actual payload becomes 0.*/
buf_index += s->packet_size - buf_index;
else {
/* packet header size */
buf_index += 6;
if (s->is_mpeg2) {
buf_index += 3;
if (stream->packet_number==0)
buf_index += 3; /* PES extension */
buf_index += 1; /* obligatory stuffing byte */
}
if (pts != AV_NOPTS_VALUE) {
if (dts != pts)
buf_index += 5 + 5;
else
buf_index += 5;
} else {
if (!s->is_mpeg2)
buf_index++;
}
if (stream->id < 0xc0) {
/* AC-3/LPCM private data header */
buf_index += 4;
if (stream->id >= 0xa0) {
int n;
buf_index += 3;
/* NOTE: we round the payload size to an integer number of
LPCM samples */
n = (s->packet_size - buf_index) % stream->lpcm_align;
if (n)
buf_index += (stream->lpcm_align - n);
}
}
if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID)
/* The VCD standard demands that 20 zero bytes follow
each audio packet (see standard p. IV-8).*/
buf_index+=20;
}
return s->packet_size - buf_index;
}
#endif
/* Write an MPEG padding packet header. */ /* Write an MPEG padding packet header. */
static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes)
{ {
...@@ -985,28 +891,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) ...@@ -985,28 +891,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
s->packet_number++; s->packet_number++;
} }
#if 0 /* unused, remove? */
static int64_t get_vcd_scr(AVFormatContext *ctx,int stream_index,int64_t pts)
{
MpegMuxContext *s = ctx->priv_data;
int64_t scr;
/* Since the data delivery rate is constant, SCR is computed
using the formula C + i * 1200 where C is the start constant
and i is the pack index.
It is recommended that SCR 0 is at the beginning of the VCD front
margin (a sequence of empty Form 2 sectors on the CD).
It is recommended that the front margin is 30 sectors long, so
we use C = 30*1200 = 36000
(Note that even if the front margin is not 30 sectors the file
will still be correct according to the standard. It just won't have
the "recommended" value).*/
scr = 36000 + s->packet_number * 1200;
return scr;
}
#endif
static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){ static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){
// MpegMuxContext *s = ctx->priv_data; // MpegMuxContext *s = ctx->priv_data;
int i; int i;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
//#define DEBUG //#define DEBUG
static const AVOption options[] = { static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTPMuxContext, flags) FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
{ "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM }, { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
{ "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }, { NULL },
......
...@@ -73,7 +73,7 @@ typedef struct RTPMuxContext RTPMuxContext; ...@@ -73,7 +73,7 @@ typedef struct RTPMuxContext RTPMuxContext;
{ "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
{ "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
{ "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
{ "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
const AVOption ff_rtsp_options[] = { const AVOption ff_rtsp_options[] = {
{ "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC }, { "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC },
FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags) FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
{ "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, \ { "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, \
{ "udp", "UDP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, \ { "udp", "UDP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
{ "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, \ { "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h" #include "libswscale/swscale_internal.h"
#if HAVE_INLINE_ASM
DECLARE_ASM_CONST(8, uint64_t, mmx_ff) = 0x00000000000000FFULL; DECLARE_ASM_CONST(8, uint64_t, mmx_ff) = 0x00000000000000FFULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL; DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
...@@ -126,8 +128,11 @@ DECLARE_ASM_CONST(8, uint64_t, mul16_mid) = 0x2080208020802080ULL; ...@@ -126,8 +128,11 @@ DECLARE_ASM_CONST(8, uint64_t, mul16_mid) = 0x2080208020802080ULL;
32-bit C version, and and&add trick by Michael Niedermayer 32-bit C version, and and&add trick by Michael Niedermayer
*/ */
#endif /* HAVE_INLINE_ASM */
void rgb2rgb_init_x86(void) void rgb2rgb_init_x86(void)
{ {
#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (cpu_flags & AV_CPU_FLAG_MMX) if (cpu_flags & AV_CPU_FLAG_MMX)
...@@ -138,4 +143,5 @@ void rgb2rgb_init_x86(void) ...@@ -138,4 +143,5 @@ void rgb2rgb_init_x86(void)
rgb2rgb_init_MMX2(); rgb2rgb_init_MMX2();
if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
rgb2rgb_init_SSE2(); rgb2rgb_init_SSE2();
#endif /* HAVE_INLINE_ASM */
} }
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#if HAVE_INLINE_ASM
#define DITHER1XBPP #define DITHER1XBPP
DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL; DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
...@@ -262,6 +264,8 @@ static void yuv2yuvX_sse3(const int16_t *filter, int filterSize, ...@@ -262,6 +264,8 @@ static void yuv2yuvX_sse3(const int16_t *filter, int filterSize,
} }
#endif #endif
#endif /* HAVE_INLINE_ASM */
#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
SwsContext *c, int16_t *data, \ SwsContext *c, int16_t *data, \
...@@ -367,6 +371,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c) ...@@ -367,6 +371,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c)
{ {
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
if (cpu_flags & AV_CPU_FLAG_MMX) if (cpu_flags & AV_CPU_FLAG_MMX)
sws_init_swScale_MMX(c); sws_init_swScale_MMX(c);
#if HAVE_MMX2 #if HAVE_MMX2
...@@ -377,6 +382,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c) ...@@ -377,6 +382,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c)
c->yuv2planeX = yuv2yuvX_sse3; c->yuv2planeX = yuv2yuvX_sse3;
} }
#endif #endif
#endif /* HAVE_INLINE_ASM */
#if HAVE_YASM #if HAVE_YASM
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "libavutil/x86_cpu.h" #include "libavutil/x86_cpu.h"
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#if HAVE_INLINE_ASM
#define DITHER1XBPP // only for MMX #define DITHER1XBPP // only for MMX
/* hope these constant values are cache line aligned */ /* hope these constant values are cache line aligned */
...@@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL; ...@@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
#include "yuv2rgb_template.c" #include "yuv2rgb_template.c"
#endif /* HAVE_MMX2 */ #endif /* HAVE_MMX2 */
#endif /* HAVE_INLINE_ASM */
SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
{ {
#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
#if HAVE_MMX2 #if HAVE_MMX2
...@@ -99,6 +104,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) ...@@ -99,6 +104,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
case PIX_FMT_RGB555: return yuv420_rgb15_MMX; case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
} }
} }
#endif /* HAVE_INLINE_ASM */
return NULL; return NULL;
} }
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