diff options
59 files changed, 362 insertions, 251 deletions
@@ -5,12 +5,22 @@ MPlayer (1.0) * YUY2 Lossless Codec (YLC0) via binary DLL * Truemotion RT codec (TR20) via binary DLL * Nogantech Codec (NTN1 and NTN2) via binary DLL - * add new FourCCs (m1v1,HDMV), TwoCCs (0xA106,0x6c75), and formats (0x11005354) - to existing codecs. + * add new FourCCs (m1v1) + TwoCCs (0xA106,0x6c75,0xAAC0) + to existing decoders. * AMR now handled via opencore decoder + * updated Windoes Media Screen Codec (MSS1,MSS2) via binary DLL + * h264 decoder (CoreAVC) on Windows only via binary DLL + * Kega Game video codec (KGV1) via binary DLL Demuxers: * support for TrueHD in BluRay streams in libmpdemux + * more BluRay codec support with lavf + + Other: + * -nosub option for disabling auto-selected subtitles + * support for displaying subs in the term (FIXME) + * support for subtitles with audio only files rc3: "BikeshedCounter" March 27, 2009 Decoders: diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 749c15e922..30043fb11b 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -2291,6 +2291,10 @@ MPlayer prints the available subtitle IDs when run in verbose (\-v) mode. If you cannot select one of the subtitles on a DVD, also try \-vobsubid. . .TP +.B \-nosub +Disables any otherwise auto-selected subtitles (as e.g. the Matroska/mkv demuxer supports). +. +.TP .B \-slang <language code[,language code,...]> (also see \-sid) Specify a priority list of subtitle languages to use. Different container formats employ different language codes. @@ -7263,6 +7267,10 @@ Files named 'shotNNNN.png' will be saved in the working directory, using the first available number \- no files will be overwritten. The filter has no overhead when not used and accepts an arbitrary colorspace, so it is safe to add it to the configuration file. +Make sure that screenshot is added after all other filters that +you want to have applied to it. +E.g. it should be the last filter if you want to have an exact +screenshot of what you see on the monitor. .RE . .TP diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index 6d30e6a112..0bd744ceaa 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 r29661 +.\" sync with en/mplayer.1 r29731 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -2182,6 +2182,10 @@ MPlayer 运行在 verbose (\-v) 模式时, 打印可用的字幕标识。 如果你不能选择 DVD 中其中之一的字幕, 也请试试 \-vobsubid。 . .TP +.B \-nosub +禁止所有默认情况下自动选择的字幕(就像比如 Matroska/mkv 流分离器所支持的那样)。 +. +.TP .B \-slang <语言代号[,语言代号,...]> (也请参见 \-sid) 指定使用字幕语言的优先级列表。 不同的容器格式使用不同的语言代号。DVDs 使用 ISO 639\-1 的 diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 053a24b372..df034ac446 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -120,10 +120,11 @@ {"loadidx", &index_file_load, CONF_TYPE_STRING, 0, 0, 0, NULL}, // select audio/video/subtitle stream - OPT_INTRANGE("aid", audio_id, 0, 0, 8190), + OPT_INTRANGE("aid", audio_id, 0, -2, 8190), {"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL}, - OPT_INTRANGE("vid", video_id, 0, 0, 8190), - OPT_INTRANGE("sid", sub_id, 0, 0, 8190), + OPT_INTRANGE("vid", video_id, 0, -2, 8190), + OPT_INTRANGE("sid", sub_id, 0, -2, 8190), + OPT_FLAG_CONSTANTS("nosub", sub_id, 0, -1, -2), OPT_FLAG_CONSTANTS("novideo", video_id, 0, -1, -2), { "hr-mp3-seek", &hr_mp3_seek, CONF_TYPE_FLAG, 0, 0, 1, NULL }, @@ -1345,7 +1345,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg, int source = -1, reset_spu = 0; char *sub_name; - if (!mpctx->sh_video || global_sub_size <= 0) + if (global_sub_size <= 0) return M_PROPERTY_UNAVAILABLE; switch (action) { @@ -1529,7 +1529,8 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg, d_sub->id = opts->sub_id; } #endif - update_subtitles(mpctx->sh_video, d_sub, 0, 1); + + update_subtitles(mpctx, &mpctx->opts, mpctx->sh_video, 0, 0, d_sub, 1); return M_PROPERTY_OK; } @@ -440,6 +440,7 @@ Advanced options: --enable-armv6 enable ARMv6 (ARM) [autodetect] --enable-armv6t2 enable ARMv6t2 (ARM) [autodetect] --enable-armvfp enable ARM VFP (ARM) [autodetect] + --enable-neon enable NEON (ARM) [autodetect] --enable-iwmmxt enable iWMMXt (ARM) [autodetect] --disable-fastmemcpy disable 3DNow!/SSE/MMX optimized memcpy [enable] --enable-big-endian force byte order to big-endian [autodetect] @@ -464,7 +465,7 @@ Use these options if autodetection fails: --with-gtk-config=PATH path to gtk*-config --with-sdl-config=PATH path to sdl*-config --with-dvdnav-config=PATH path to dvdnav-config - --with-dvdread-config=PATH path to dvdread-config + --with-dvdread-config=PATH path to dvdread-config This configure script is NOT autoconf-based, even though its output is similar. It will try to autodetect all configuration options. If you --enable an option @@ -490,6 +491,7 @@ _armv5te=auto _armv6=auto _armv6t2=auto _armvfp=auto +neon=auto _iwmmxt=auto _mtrr=auto _altivec=auto @@ -1233,6 +1235,8 @@ for ac_option do --disable-armv6t2) _armv6t2=no ;; --enable-armvfp) _armvfp=yes ;; --disable-armvfp) _armvfp=no ;; + --enable-neon) neon=yes ;; + --disable-neon) neon=no ;; --enable-iwmmxt) _iwmmxt=yes ;; --disable-iwmmxt) _iwmmxt=no ;; --enable-mmx) _mmx=yes ;; @@ -1266,6 +1270,9 @@ if test -z "$_target" ; then case "$system_name" in Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|BSD/OS|Darwin|SunOS|QNX|GNU|BeOS|MorphOS|AIX|AmigaOS) ;; + Haiku) + system_name=BeOS + ;; IRIX*) system_name=IRIX ;; @@ -1306,16 +1313,8 @@ if test -z "$_target" ; then # x86/x86pc is used by QNX case "$(uname -m 2>&1)" in - i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; + x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; ia64) host_arch=ia64 ;; - x86_64|amd64) - if [ -n "$($_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p')" -a \ - -z "$(echo $CFLAGS $_cc | grep -- -m32)" ]; then - host_arch=x86_64 - else - host_arch=i386 - fi - ;; macppc|ppc) host_arch=ppc ;; ppc64) host_arch=ppc64 ;; alpha) host_arch=alpha ;; @@ -1356,14 +1355,6 @@ else # if test -z "$_target" fi fi -echo "Detected operating system: $system_name" -echo "Detected host architecture: $host_arch" - -if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then - die "Runtime CPU detection only works for x86, x86-64 and PPC!" -fi - - extra_cflags="-I. $extra_cflags" _timer=timer-linux.c _getch=getch2.c @@ -1446,6 +1437,24 @@ echo configuration: $_configuration > "$TMPLOG" echo >> "$TMPLOG" +if test -z "$_target" && x86 ; then + cat > $TMPC << EOF +int main(void) { + int test[sizeof(char *)-7]; + return 0; +} +EOF + cc_check && host_arch=x86_64 || host_arch=i386 +fi + +echo "Detected operating system: $system_name" +echo "Detected host architecture: $host_arch" + +if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then + die "Runtime CPU detection only works for x86, x86-64 and PPC!" +fi + + # Checking CC version... # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure) if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then @@ -2297,6 +2306,7 @@ EOF cc_check -c || die "Symbol mangling check failed." sym=$($_nm -P -g $TMPEXE) extern_prefix=${sym%%ff_extern*} +def_extern_asm="#define EXTERN_ASM $extern_prefix" def_extern_prefix="#define EXTERN_PREFIX \"$extern_prefix\"" echores $extern_prefix @@ -2467,6 +2477,26 @@ EOF cc_check && ten_operands=yes && def_ten_operands='#define HAVE_TEN_OPERANDS 1' echores $ten_operands +echocheck "ebx availability" +ebx_available=no +def_ebx_available='#define HAVE_EBX_AVAILABLE 0' +cat > $TMPC << EOF +int main(void) { + int x; + __asm__ volatile( + "xor %0, %0" + :"=b"(x) + // just adding ebx to clobber list seems unreliable with some + // compilers, e.g. Haiku's gcc 2.95 + ); + // and the above check does not work for OSX 64 bit... + __asm__ volatile("":::"%ebx"); + return 0; +} +EOF +cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1' +echores $ebx_available + echocheck "yasm" if test -z "$YASMFLAGS" ; then if darwin ; then @@ -2623,6 +2653,16 @@ EOF fi echores "$_armvfp" + echocheck "ARM NEON" + if test $neon = "auto" ; then + cat > $TMPC << EOF +int main(void) { __asm__ volatile ("vadd.i16 q0, q0, q0"); return 0; } +EOF + neon=no + cc_check && neon=yes + fi + echores "$neon" + echocheck "iWMMXt (Intel XScale SIMD instructions)" if test $_iwmmxt = "auto" ; then cat > $TMPC << EOF @@ -2634,7 +2674,7 @@ EOF echores "$_iwmmxt" fi -_cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV PLD ARMV5TE ARMV6 ARMV6T2 ARMVFP IWMMXT MMI VIS MVI' +_cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV PLD ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI' test "$_altivec" = yes && _cpuexts="ALTIVEC $_cpuexts" test "$_mmx" = yes && _cpuexts="MMX $_cpuexts" test "$_mmxext" = yes && _cpuexts="MMX2 $_cpuexts" @@ -2650,6 +2690,7 @@ test "$_armv5te" = yes && _cpuexts="ARMV5TE $_cpuexts" test "$_armv6" = yes && _cpuexts="ARMV6 $_cpuexts" test "$_armv6t2" = yes && _cpuexts="ARMV6T2 $_cpuexts" test "$_armvfp" = yes && _cpuexts="ARMVFP $_cpuexts" +test "$neon" = yes && _cpuexts="NEON $_cpuexts" test "$_iwmmxt" = yes && _cpuexts="IWMMXT $_cpuexts" test "$_vis" = yes && _cpuexts="VIS $_cpuexts" test "$_mvi" = yes && _cpuexts="MVI $_cpuexts" @@ -6347,7 +6388,7 @@ echores "$_theora" echocheck "internal mp3lib support" if test "$_mp3lib" = auto ; then - test "$cc_vendor" = intel && _mp3lib=no || _mp3lib=yes + test "$cc_vendor" = intel && test "$_cc_major" -le 10 -o "$_cc_major" -eq 11 -a "$_cc_minor" -eq 0 && _mp3lib=no || _mp3lib=yes fi if test "$_mp3lib" = yes ; then def_mp3lib='#define CONFIG_MP3LIB 1' @@ -6360,7 +6401,7 @@ echores "$_mp3lib" echocheck "liba52 support" if test "$_liba52_internal" = auto ; then - test "$cc_vendor" = intel && _liba52_internal=no || _liba52_internal=yes + test "$cc_vendor" = intel && test "$_cc_major" -le 10 -o "$_cc_major" -eq 11 -a "$_cc_minor" -eq 0 && _liba52_internal=no || _liba52_internal=yes fi def_liba52='#undef CONFIG_LIBA52' def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL" @@ -6945,8 +6986,8 @@ if test "$_x264" = auto ; then cat > $TMPC << EOF #include <inttypes.h> #include <x264.h> -#if X264_BUILD < 65 -#error We do not support old versions of x264. Get the latest from SVN. +#if X264_BUILD < 76 +#error We do not support old versions of x264. Get the latest from git. #endif int main(void) { x264_encoder_open((void*)0); return 0; } EOF @@ -8097,6 +8138,7 @@ $def_vsscanf $def_asmalign_pot $def_builtin_expect $def_dl +$def_extern_asm $def_extern_prefix $def_iconv $def_kstat @@ -8404,7 +8446,7 @@ $def_yasm #define CONFIG_RDFT 1 /* Use these registers in FFmpeg x86 inline asm. No proper detection yet. */ -#define HAVE_EBX_AVAILABLE 1 +$def_ebx_available #ifndef MP_DEBUG #define HAVE_EBP_AVAILABLE 1 #else diff --git a/defaultopts.c b/defaultopts.c index d908eda347..2bd6f7e3e3 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -26,7 +26,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .doubleclick_time = 300, .audio_id = -1, .video_id = -1, - .sub_id = -2, + .sub_id = -1, .playback_speed = 1., .movie_aspect = -1., .flip = -1, diff --git a/etc/codecs.conf b/etc/codecs.conf index 782ff61809..84660fc82f 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -899,6 +899,22 @@ videocodec ffh264vdpau dll h264_vdpau out VDPAU_H264 +videocodec coreavcwindows + info "CoreAVC H.264 for x86 - http://corecodec.org/" + comment "this codec will only work after purchasing it" + status working + fourcc H264,h264 + fourcc X264,x264 + fourcc avc1 AVC1,AVC1 + fourcc davc,DAVC + fourcc VSSH + format 0x10000005 + driver dshow + dll "CoreAVCDecoder.ax" + guid 0x09571a4b, 0xf1fe, 0x4c60, 0x97, 0x60, 0xde, 0x6d, 0x31, 0x0c, 0x7c, 0x31 + out YV12,IYUV,I420,YUY2 + + videocodec ffsvq3 info "FFmpeg Sorenson Video v3 (SVQ3)" status working @@ -1148,6 +1164,16 @@ videocodec wmsdmod guid 0x7bafb3b1, 0xd8f4, 0x4279, 0x92, 0x53, 0x27, 0xda, 0x42, 0x31, 0x08, 0xde out BGR32,BGR24,BGR16 +videocodec wms10dmod + info "Windows Media Screen Codec 2 from WMP10" + status working + fourcc MSS1 + fourcc MSS2 + driver dmo + dll "wms10dmod.dll" + guid 0x7bafb3b1, 0xd8f4, 0x4279, 0x92, 0x53, 0x27, 0xda, 0x42, 0x31, 0x08, 0xde + out BGR32,BGR24,BGR16 + videocodec gotomeeting info "GoToMeeting codec" status working @@ -3499,10 +3525,12 @@ audiocodec faad fourcc "VLB " ; Used in NSV, not really working fourcc "AAC " ; Used in NSV fourcc "AACP" ; Used in NSV for AACPlus + fourcc raac,racp format 0xff format 0x706D format 0x4143 ; aac in asf format 0xA106 ; aac in avi + format 0xAAC0 ; Borgtech nonsense tag driver faad dll libfaad2 @@ -3518,6 +3546,7 @@ audiocodec ffaac format 0x706D format 0x4143 ; aac in asf format 0xA106 ; aac in avi not yet working + format 0xAAC0 ; Borgtech nonsense tag driver ffmpeg dll aac diff --git a/find_sub.c b/find_sub.c index 07d91d7e55..dcd4c4cd77 100644 --- a/find_sub.c +++ b/find_sub.c @@ -12,6 +12,7 @@ #include "mp_msg.h" #include "help_mp.h" +#include "mpcommon.h" static int current_sub=0; @@ -52,8 +53,9 @@ void step_sub(sub_data *subd, float pts, int movement) { sub_delay = subs[current_sub].start / (subd->sub_uses_time ? 100 : sub_fps) - pts; } -void find_sub(sub_data* subd,int key){ +void find_sub(struct MPContext *mpctx, sub_data* subd,int key){ subtitle *subs; + subtitle *new_sub = NULL; int i,j; if ( !subd || subd->sub_num == 0) return; @@ -77,8 +79,8 @@ void find_sub(sub_data* subd,int key){ vo_osd_changed(OSDTYPE_SUBTITLE); if(key<=0){ - vo_sub=NULL; // no sub here - return; + // no sub here + goto update; } // printf("\r---- sub changed ----\n"); @@ -89,13 +91,12 @@ void find_sub(sub_data* subd,int key){ // no sub nosub_range_start=subs[current_sub].end; nosub_range_end=subs[current_sub+1].start; - vo_sub=NULL; - return; + goto update; } // next sub? ++current_sub; - vo_sub=&subs[current_sub]; - if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! + new_sub=&subs[current_sub]; + if(key>=new_sub->start && key<=new_sub->end) goto update; // OK! } // printf("\r---- sub log search... ----\n"); @@ -106,22 +107,22 @@ void find_sub(sub_data* subd,int key){ // printf("Searching %d in %d..%d\n",key,subs[i].start,subs[j].end); while(j>=i){ current_sub=(i+j+1)/2; - vo_sub=&subs[current_sub]; - if(key<vo_sub->start) j=current_sub-1; - else if(key>vo_sub->end) i=current_sub+1; - else return; // found! + new_sub=&subs[current_sub]; + if(key<new_sub->start) j=current_sub-1; + else if(key>new_sub->end) i=current_sub+1; + else goto update; // found! } -// if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! +// if(key>=new_sub->start && key<=new_sub->end) return; // OK! // check where are we... - if(key<vo_sub->start){ + if(key<new_sub->start){ if(current_sub<=0){ // before the first sub nosub_range_start=key-1; // tricky - nosub_range_end=vo_sub->start; -// printf("FIRST... key=%d end=%d \n",key,vo_sub->start); - vo_sub=NULL; - return; + nosub_range_end=new_sub->start; +// printf("FIRST... key=%d end=%d \n",key,new_sub->start); + new_sub=NULL; + goto update; } --current_sub; if(key>subs[current_sub].end && key<subs[current_sub+1].start){ @@ -129,31 +130,33 @@ void find_sub(sub_data* subd,int key){ nosub_range_start=subs[current_sub].end; nosub_range_end=subs[current_sub+1].start; // printf("No sub... 1 \n"); - vo_sub=NULL; - return; + new_sub=NULL; + goto update; } printf("HEH???? "); } else { - if(key<=vo_sub->end) printf("JAJJ! "); else + if(key<=new_sub->end) printf("JAJJ! "); else if(current_sub+1 >= subd->sub_num){ // at the end? - nosub_range_start=vo_sub->end; + nosub_range_start=new_sub->end; nosub_range_end=0x7FFFFFFF; // MAXINT // printf("END!?\n"); - vo_sub=NULL; - return; + new_sub=NULL; + goto update; } else if(key>subs[current_sub].end && key<subs[current_sub+1].start){ // no sub nosub_range_start=subs[current_sub].end; nosub_range_end=subs[current_sub+1].start; // printf("No sub... 2 \n"); - vo_sub=NULL; - return; + new_sub=NULL; + goto update; } } - mp_msg(MSGT_FIXME,MSGL_FIXME,"SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo_sub->start,(int)vo_sub->end,current_sub); + mp_msg(MSGT_FIXME,MSGL_FIXME,"SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)new_sub->start,(int)new_sub->end,current_sub); - vo_sub=NULL; // no sub here + new_sub=NULL; // no sub here +update: + set_osd_subtitle(mpctx, new_sub); } diff --git a/help/help_mp-bg.h b/help/help_mp-bg.h index a74732cc63..bf8608360d 100644 --- a/help/help_mp-bg.h +++ b/help/help_mp-bg.h @@ -546,7 +546,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Кодекът не е указал sh->disp_w и sh->disp_h, опит за решение.\n" -#define MSGTR_VoConfigRequest "VDec: заявка на vo config - %d x %d (preferred csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Не е открит подходящ цветови формат - повторен опит с -vf scale...\n" #define MSGTR_MovieAspectIsSet "Пропорциите на филма са %.2f:1 - мащабиране до правилните пропорции .\n" #define MSGTR_MovieAspectUndefined "Не са дефинирани пропорции - без предварително мащабиране.\n" diff --git a/help/help_mp-cs.h b/help/help_mp-cs.h index 716200e25e..aa39e02a47 100644 --- a/help/help_mp-cs.h +++ b/help/help_mp-cs.h @@ -1631,8 +1631,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDek: Kodek nenastavil sh->disp_w a sh->disp_h, pokouším se to obejít.\n" -#define MSGTR_VoConfigRequest "VDek: Požadovaná konfigurace vo - %d x %d (preferovaný barevný prostor: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDek: používám %s jako výstupní csp (ne %d)\n" #define MSGTR_CouldNotFindColorspace "Nemohu nalézt společný barevný prostor - zkouším to znovu s -vf scale...\n" #define MSGTR_MovieAspectIsSet "Poměr stran obrazu filmu je %.2f:1 - škáluji na správný poměr.\n" #define MSGTR_MovieAspectUndefined "Poměr stran obrazu filmu není definován - neměním velikost.\n" diff --git a/help/help_mp-de.h b/help/help_mp-de.h index 0b5f467382..48b2e9976a 100644 --- a/help/help_mp-de.h +++ b/help/help_mp-de.h @@ -714,8 +714,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Codec hat sh->disp_w und sh->disp_h nicht gesetzt!\nVersuche Problem zu umgehen..\n" -#define MSGTR_VoConfigRequest "VDec: VO wird versucht, auf %d x %d (Bevorzugter Farbraum: %s) zu setzen.\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: Verwende %s als Ausgabefarbraum (Nummer %d).\n" #define MSGTR_CouldNotFindColorspace "Konnte keinen passenden Farbraum finden - neuer Versuch mit '-vf scale'...\n" #define MSGTR_MovieAspectIsSet "Film-Aspekt ist %.2f:1 - Vorskalierung zur Korrektur der Seitenverhältnisse.\n" #define MSGTR_MovieAspectUndefined "Film-Aspekt ist undefiniert - keine Vorskalierung durchgeführt.\n" diff --git a/help/help_mp-dk.h b/help/help_mp-dk.h index 99d554ae1a..dc8ea64f56 100644 --- a/help/help_mp-dk.h +++ b/help/help_mp-dk.h @@ -325,7 +325,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDek: codec satte ikke sh->disp_w og sh->disp_h, prøver en anden løsning!\n" -#define MSGTR_VoConfigRequest "VDek: vo konfig. anmodning - %d x %d (foretrukket csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Kunne ikke finde colorspace som matcher - prøver med -vf scale...\n" #define MSGTR_MovieAspectIsSet "Størrelsesforhold er %.2f:1 - præskalerer for at rette størrelsesforholdet.\n" #define MSGTR_MovieAspectUndefined "Størrelsesforholdet er ikke defineret - ingen præskalering benyttet.\n" diff --git a/help/help_mp-el.h b/help/help_mp-el.h index 99114c8185..0a6a5b016f 100644 --- a/help/help_mp-el.h +++ b/help/help_mp-el.h @@ -325,7 +325,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: το codec δεν όρισε sh->disp_w και sh->disp_h, προσπάθεια επίλυσης!\n" -#define MSGTR_VoConfigRequest "VDec: αίτηση για επιλογή vo - %d x %d (προτεινόμενο csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Δεν βρέθηκε αντίστοιχο colorspace - προσπάθεια με -vf scale...\n" #define MSGTR_MovieAspectIsSet "Η αναλογία της ταινίας είναι %.2f:1 - προκλιμάκωση για την διόρθωση της εμφάνισης της ταινίας.\n" #define MSGTR_MovieAspectUndefined "Η αναλογία της ταινίας δεν είναι ορισμένη - δεν εφαρμόζεται προκλιμάκωση.\n" diff --git a/help/help_mp-en.h b/help/help_mp-en.h index f1af384320..2c70f83dc4 100644 --- a/help/help_mp-en.h +++ b/help/help_mp-en.h @@ -1633,8 +1633,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Codec did not set sh->disp_w and sh->disp_h, trying workaround.\n" -#define MSGTR_VoConfigRequest "VDec: vo config request - %d x %d (preferred colorspace: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: using %s as output csp (no %d)\n" #define MSGTR_CouldNotFindColorspace "Could not find matching colorspace - retrying with -vf scale...\n" #define MSGTR_MovieAspectIsSet "Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n" #define MSGTR_MovieAspectUndefined "Movie-Aspect is undefined - no prescaling applied.\n" diff --git a/help/help_mp-es.h b/help/help_mp-es.h index 82af0a2745..59298c1e39 100644 --- a/help/help_mp-es.h +++ b/help/help_mp-es.h @@ -1618,8 +1618,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: el codec no declaró sh->disp_w y sh->disp_h, intentando solucionarlo!\n" -#define MSGTR_VoConfigRequest "VDec: vo solicitud de config - %d x %d (csp preferida: %s).\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: usando %s como salida csp (no %d)\n" #define MSGTR_CouldNotFindColorspace "No se pudo encontrar colorspace concordante - reintentando escalado -vf...\n" #define MSGTR_MovieAspectIsSet "Aspecto es %.2f:1 - prescalando a aspecto correcto.\n" #define MSGTR_MovieAspectUndefined "Aspecto de película no es definido - no se ha aplicado prescalado.\n" diff --git a/help/help_mp-fr.h b/help/help_mp-fr.h index 4350f97c0c..a3baeffd52 100644 --- a/help/help_mp-fr.h +++ b/help/help_mp-fr.h @@ -688,7 +688,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec : le codec n'a pas défini sh->disp_w et sh->disp_h, essai de contournement !\n" -#define MSGTR_VoConfigRequest "VDec : requête de config de vo - %d x %d (espace colorimétrique préferé : %s)\n" #define MSGTR_CouldNotFindColorspace "N'a pas pu trouver espace colorimétrique correspondant - nouvel essai avec -vf scale...\n" #define MSGTR_MovieAspectIsSet "L'aspect du film est %.2f:1 - pré-redimensionnement à l'aspect correct.\n" #define MSGTR_MovieAspectUndefined "L'aspect du film est indéfini - pas de pré-dimensionnement appliqué.\n" diff --git a/help/help_mp-hu.h b/help/help_mp-hu.h index f8b1a9c257..286ccc2345 100644 --- a/help/help_mp-hu.h +++ b/help/help_mp-hu.h @@ -1633,8 +1633,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: a codec nem állította be az sh->disp_w és az sh_disp_h izéket, megpróbálom workaroundolni!\n" -#define MSGTR_VoConfigRequest "VDec: vo config kérés - %d x %d (preferált színtér: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: %s használata kimeneti színtérként (nincs %d)\n" #define MSGTR_CouldNotFindColorspace "Nem találok egyező colorspace-t - újra próbálom a -vf scale filterrel...\n" #define MSGTR_MovieAspectIsSet "A film aspect értéke %.2f:1 - aspect arány javítása.\n" #define MSGTR_MovieAspectUndefined "A film aspect értéke nem definiált - nincs arányjavítás.\n" diff --git a/help/help_mp-it.h b/help/help_mp-it.h index 60006cd4c9..a7bb02bfbc 100644 --- a/help/help_mp-it.h +++ b/help/help_mp-it.h @@ -1632,8 +1632,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Il codec non ha impostato sh->disp_w and sh->disp_h, tento di risolvere.\n" -#define MSGTR_VoConfigRequest "VDec: configurazione chiesta dal vo - %d x %d (sp.col. preferito: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: uso %s come sp.colore di uscita (non %d)\n" #define MSGTR_CouldNotFindColorspace "Impossibile trovare uno spazio colore adatto - riprovo con -vf scale...\n" #define MSGTR_MovieAspectIsSet "Movie-Aspect è %.2f:1 - riscalo per ottenere un rapporto corretto.\n" #define MSGTR_MovieAspectUndefined "Movie-Aspect non definito - nessuna scalatura.\n" diff --git a/help/help_mp-ja.h b/help/help_mp-ja.h index 9aa57f2053..e2dda8df97 100644 --- a/help/help_mp-ja.h +++ b/help/help_mp-ja.h @@ -268,7 +268,6 @@ static const char help_text[]= #define MSGTR_CannotFindColorspace "common colorspaceが見付かりません, even by inserting 'scale' :(\n" // vd.c -#define MSGTR_VoConfigRequest "VDec: 映像出力設定 - %d x %d (preferred csp: %s)\n" // ====================== GUI messages/buttons ======================== diff --git a/help/help_mp-ko.h b/help/help_mp-ko.h index af277b961c..e9b606aa08 100644 --- a/help/help_mp-ko.h +++ b/help/help_mp-ko.h @@ -324,7 +324,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: 코덱이 sh->disp_w와 sh->disp_h로 설정되지 않아서, 다시 시도합니다.\n" -#define MSGTR_VoConfigRequest "VDec: vo 설정 요청 - %d x %d (선호하는 csp: %s)\n" #define MSGTR_CouldNotFindColorspace "어울리는 컬러공간을 찾을 수 없습니다. -vf 크기조절로 다시 시도합니다...\n" #define MSGTR_MovieAspectIsSet "화면비율이 %.2f:1 입니다. - 화면비율을 조정하기위해 사전 크기조절을 합니다.\n" #define MSGTR_MovieAspectUndefined "화면비율이 정의되지 않았습니다. - 사전 크기조절이 적용되지 않았습니다.\n" diff --git a/help/help_mp-mk.h b/help/help_mp-mk.h index 153a0bcca5..c33c350f87 100644 --- a/help/help_mp-mk.h +++ b/help/help_mp-mk.h @@ -325,7 +325,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Кодекот не ги подеси sh->disp_w и sh->disp_h, се обидува да заобиколи.\n" -#define MSGTR_VoConfigRequest "VDec: се бара vo конфигурирање - %d x %d (преферирано csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Не може да се пронајде соодветен простор за боја - се обидува повторно со -vf scale...\n" #define MSGTR_MovieAspectIsSet "Аспектот на Филмот е %.2f:1 - се преместува на точниот аспект на филмот.\n" #define MSGTR_MovieAspectUndefined "Аспектот на филмот не е дефиниран - не е применето преместување.\n" diff --git a/help/help_mp-nl.h b/help/help_mp-nl.h index 0030a226f3..72f39bfaf7 100644 --- a/help/help_mp-nl.h +++ b/help/help_mp-nl.h @@ -531,7 +531,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: codec stelde sh->disp_w en sh->disp_h niet in, ik probeer het probleem te omzeilen!\n" -#define MSGTR_VoConfigRequest "VDec: vo config aanvraag - %d x %d (csp voorkeur: %s)\n" #define MSGTR_CouldNotFindColorspace "Kon geen bijpassende kleurenruimte vinden - ik probeer opnieuw met -vf scale...\n" #define MSGTR_MovieAspectIsSet "Film-Aspect is %.2f:1 - voorscalering naar het correcte film-aspect.\n" #define MSGTR_MovieAspectUndefined "Movie-Aspect is niet gedefinieerd - geen voorscalering toegepast.\n" diff --git a/help/help_mp-pl.h b/help/help_mp-pl.h index bddf87af40..3df81430c9 100644 --- a/help/help_mp-pl.h +++ b/help/help_mp-pl.h @@ -652,7 +652,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Kodek nie ustawił sh->disp_w i sh->disp_h, próbuję obejścia.\n" -#define MSGTR_VoConfigRequest "VDec: wymagana konfiguracja vo - %d x %d (preferowana przestrzeń kolorów: %s)\n" #define MSGTR_CouldNotFindColorspace "Nie mogłem odnaleźć pasującej przestrzeni kolorów - próbuję ponownie z opcją -vf scale...\n" #define MSGTR_MovieAspectIsSet "Format filmu to %.2f:1 - zmieniam do poprawnego formatu filmu.\n" #define MSGTR_MovieAspectUndefined "Format filmu nie zdefiniowany - nie stosuję zmiany formatu.\n" diff --git a/help/help_mp-pt_BR.h b/help/help_mp-pt_BR.h index bcb6eeff34..ea1990cd37 100644 --- a/help/help_mp-pt_BR.h +++ b/help/help_mp-pt_BR.h @@ -330,7 +330,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: codec não configurou sh->disp_w e sh->disp_h, tentando solução alternativa!\n" -#define MSGTR_VoConfigRequest "VDec: configuração vo pedida - %d x %d (preferido csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Impossível encotrar \"colorspace\" similar - retentando com -vf scale...\n" #define MSGTR_MovieAspectIsSet "Aspecto do filme é %.2f:1 - pré-redimensionando para corrigir o aspecto do filme.\n" #define MSGTR_MovieAspectUndefined "Aspecto do filme é indefinido - nenhum pré-redimensionamento aplicado.\n" diff --git a/help/help_mp-ru.h b/help/help_mp-ru.h index 3371b8e38f..7195615efd 100644 --- a/help/help_mp-ru.h +++ b/help/help_mp-ru.h @@ -1670,8 +1670,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Кодек не установил sh->disp_w и sh->disp_h, пытаюсь обойти.\n" -#define MSGTR_VoConfigRequest "VDec: запрос vo config - %d x %d (предпочитаемое цветовое пространство: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: использую %s в качестве выходного csp (не %d)\n" #define MSGTR_CouldNotFindColorspace "Не могу найти подходящее цветовое пространство - попытаюсь с -vf scale...\n" #define MSGTR_MovieAspectIsSet "Movie-Aspect - %.2f:1 - выполняю предварительное масштабирование\nдля коррекции соотношения сторон фильма.\n" #define MSGTR_MovieAspectUndefined "Movie-Aspect не определён - предварительное масштабирование не применяется.\n" diff --git a/help/help_mp-sk.h b/help/help_mp-sk.h index 776148de87..2bf4891fee 100644 --- a/help/help_mp-sk.h +++ b/help/help_mp-sk.h @@ -635,7 +635,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: kodek nenastavil sh->disp_w a sh->disp_h, skúšam to obísť!\n" -#define MSGTR_VoConfigRequest "VDec: vo konfiguračná požiadavka - %d x %d (preferovaný csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Nemôžem nájsť zhodný priestor farieb - skúšam znova s -vf scale...\n" #define MSGTR_MovieAspectIsSet "Movie-Aspect je %.2f:1 - mením rozmery na správne.\n" #define MSGTR_MovieAspectUndefined "Movie-Aspect je nedefinovný - nemenia sa rozmery.\n" diff --git a/help/help_mp-sv.h b/help/help_mp-sv.h index aa4c45e130..ca1fd239e2 100644 --- a/help/help_mp-sv.h +++ b/help/help_mp-sv.h @@ -543,7 +543,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Codec satt inte sh->disp_w samt sh->disp_h, försöker gå runt problemet.\n" -#define MSGTR_VoConfigRequest "VDec: vo-konfigurationsbegäran - %d x %d (preferred csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Kunde inte finna matchande färgrymder - försöker åter med -vf scale...\n" // -''- #define MSGTR_MovieAspectIsSet "Movie-Aspect är %.2f:1 - prescaling till korrekt film-aspect.\n" #define MSGTR_MovieAspectUndefined "Film-Aspect är ej definerad - ingen prescaling kommer att äga rum.\n" diff --git a/help/help_mp-tr.h b/help/help_mp-tr.h index 7e32f860ae..36c8497af3 100644 --- a/help/help_mp-tr.h +++ b/help/help_mp-tr.h @@ -696,8 +696,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Kodek ayarlanamadı: sh->disp_w ve sh->disp_h, çözülmeye çalışılıyor!\n" -#define MSGTR_VoConfigRequest "VDec: vo ayar isteği - %d x %d (tercih csp: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: çıkış csp'si olarak %s kullanılıyor (%d yok)\n" #define MSGTR_CouldNotFindColorspace "Renk biçimi bulunamadı. -vf scale ile tekrar deneniyor...\n" #define MSGTR_MovieAspectIsSet "Video-Görünümü: %.2f:1 - doğru video görünümü için önölçekleniyor.\n" #define MSGTR_MovieAspectUndefined "Video-Görünümü tanımsız - önölçekleme onaylanamadı.\n" diff --git a/help/help_mp-uk.h b/help/help_mp-uk.h index f766628b6e..afd3def1fe 100644 --- a/help/help_mp-uk.h +++ b/help/help_mp-uk.h @@ -1179,7 +1179,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: Кодек не встановив sh->disp_w та sh->disp_h, спробую обійти це.\n" -#define MSGTR_VoConfigRequest "VDec: vo config запит - %d x %d (preferred csp: %s)\n" #define MSGTR_CouldNotFindColorspace "Не можу підібрати підходящу схему кольорів - повтор з -vf scale...\n" #define MSGTR_MovieAspectIsSet "Відношення сторін %.2f:1 - масштабую аби скоректувати.\n" #define MSGTR_MovieAspectUndefined "Відношення сторін не вказано - масштабування не використовується.\n" diff --git a/help/help_mp-zh_CN.h b/help/help_mp-zh_CN.h index befbac0459..69a2f4cefc 100644 --- a/help/help_mp-zh_CN.h +++ b/help/help_mp-zh_CN.h @@ -1617,8 +1617,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: 编解码器无法设置 sh->disp_w 和 sh->disp_h, 尝试绕过。\n" -#define MSGTR_VoConfigRequest "VDec: vo 配置请求 - %d x %d (色彩空间首选项: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: 使用 %s 作为输出 csp (没有 %d)\n" #define MSGTR_CouldNotFindColorspace "找不到匹配的色彩空间 - 重新尝试 -vf scale...\n" #define MSGTR_MovieAspectIsSet "电影宽高比为 %.2f:1 - 预放大到正确的电影宽高比。\n" #define MSGTR_MovieAspectUndefined "电影宽高比未定义 - 没使用预放大。\n" diff --git a/help/help_mp-zh_TW.h b/help/help_mp-zh_TW.h index ea9d6befde..3ea2e45326 100644 --- a/help/help_mp-zh_TW.h +++ b/help/help_mp-zh_TW.h @@ -670,8 +670,6 @@ static const char help_text[]= // vd.c #define MSGTR_CodecDidNotSet "VDec: 編解碼器無法設置 sh->disp_w 和 sh->disp_h, 嘗試繞過。\n" -#define MSGTR_VoConfigRequest "VDec: vo 配置請求 - %d x %d (色彩空間首選項: %s)\n" -#define MSGTR_UsingXAsOutputCspNoY "VDec: 使用 %s 作為輸出 csp (没有 %d)\n" #define MSGTR_CouldNotFindColorspace "找不到匹配的色彩空間 - 重新嘗試 -vf scale...\n" #define MSGTR_MovieAspectIsSet "電影寬高比為 %.2f:1 - 預放大到正確的電影寬高比。\n" #define MSGTR_MovieAspectUndefined "電影寬高比未定義 - 没使用預放大。\n" diff --git a/libaf/control.h b/libaf/control.h index b6a1ca8262..b99d50bcb4 100644 --- a/libaf/control.h +++ b/libaf/control.h @@ -214,44 +214,44 @@ typedef struct af_control_ext_s{ #define AF_CONTROL_PAN_NOUT 0x00001B00 | AF_CONTROL_FILTER_SPECIFIC // Balance, arg is float*; range -1 (left) to 1 (right), 0 center -#define AF_CONTROL_PAN_BALANCE 0x00002500 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_PAN_BALANCE 0x00001C00 | AF_CONTROL_FILTER_SPECIFIC // Set equalizer gain, arg is a control_ext with a float* -#define AF_CONTROL_EQUALIZER_GAIN 0x00001C00 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_EQUALIZER_GAIN 0x00001D00 | AF_CONTROL_FILTER_SPECIFIC // Delay length in ms, arg is a control_ext with a float* -#define AF_CONTROL_DELAY_LEN 0x00001D00 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_DELAY_LEN 0x00001E00 | AF_CONTROL_FILTER_SPECIFIC // Subwoofer // Channel number which to insert the filtered data, arg in int* -#define AF_CONTROL_SUB_CH 0x00001E00 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_SUB_CH 0x00001F00 | AF_CONTROL_FILTER_SPECIFIC // Cutoff frequency [Hz] for lowpass filter, arg is float* -#define AF_CONTROL_SUB_FC 0x00001F00 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_SUB_FC 0x00002000 | AF_CONTROL_FILTER_SPECIFIC // Export -#define AF_CONTROL_EXPORT_SZ 0x00002000 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_EXPORT_SZ 0x00003000 | AF_CONTROL_FILTER_SPECIFIC // ExtraStereo Multiplier -#define AF_CONTROL_ES_MUL 0x00002100 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_ES_MUL 0x00003100 | AF_CONTROL_FILTER_SPECIFIC // Center // Channel number which to inster the filtered data, arg in int* -#define AF_CONTROL_CENTER_CH 0x00002200 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_CENTER_CH 0x00003200 | AF_CONTROL_FILTER_SPECIFIC // SineSuppress -#define AF_CONTROL_SS_FREQ 0x00002300 | AF_CONTROL_FILTER_SPECIFIC -#define AF_CONTROL_SS_DECAY 0x00002400 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_SS_FREQ 0x00003300 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_SS_DECAY 0x00003400 | AF_CONTROL_FILTER_SPECIFIC -#define AF_CONTROL_PLAYBACK_SPEED 0x00002500 | AF_CONTROL_FILTER_SPECIFIC -#define AF_CONTROL_SCALETEMPO_AMOUNT 0x00002600 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_PLAYBACK_SPEED 0x00003500 | AF_CONTROL_FILTER_SPECIFIC +#define AF_CONTROL_SCALETEMPO_AMOUNT 0x00003600 | AF_CONTROL_FILTER_SPECIFIC #endif /* MPLAYER_CONTROL_H */ diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index d6b9175f52..f47b4fbf3d 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -783,8 +783,11 @@ static void reset(void) static int play(void* data, int len, int flags) { - int num_frames = len / bytes_per_sample; + int num_frames; snd_pcm_sframes_t res = 0; + if (!(flags & AOPLAY_FINAL_CHUNK)) + len = len / ao_data.outburst * ao_data.outburst; + num_frames = len / bytes_per_sample; //mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len); diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 0ff87efadd..b4e5ab49b8 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -425,8 +425,19 @@ ac3_retry: } ao_data.bps=ao_data.channels; - if(ao_data.format != AF_FORMAT_U8 && ao_data.format != AF_FORMAT_S8) + switch (ao_data.format & AF_FORMAT_BITS_MASK) { + case AF_FORMAT_8BIT: + break; + case AF_FORMAT_16BIT: ao_data.bps*=2; + break; + case AF_FORMAT_24BIT: + ao_data.bps*=3; + break; + case AF_FORMAT_32BIT: + ao_data.bps*=4; + break; + } ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down ao_data.bps*=ao_data.samplerate; diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index bf3da1cbbe..fd354f8ba7 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -68,6 +68,7 @@ static int init(sh_audio_t *sh_audio) } lavc_context->request_channels = audio_output_channels; lavc_context->codec_tag = sh_audio->format; //FOURCC + lavc_context->codec_type = CODEC_TYPE_AUDIO; lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi /* alloc extra data */ diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c index 395567128a..280b4cb8c1 100644 --- a/libmpcodecs/ad_twin.c +++ b/libmpcodecs/ad_twin.c @@ -184,7 +184,7 @@ void uninit(sh_audio_t *sh) FreeLibrary(vqf_dll); } -int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) +static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) { switch(cmd) { case ADCTRL_QUERY_FORMAT: diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c index 81b76ee062..4032141c72 100644 --- a/libmpcodecs/ae_lavc.c +++ b/libmpcodecs/ae_lavc.c @@ -170,6 +170,8 @@ int mpae_init_lavc(audio_encoder_t *encoder) return 0; } + lavc_actx->codec_type = CODEC_TYPE_AUDIO; + lavc_actx->codec_id = lavc_acodec->id; // put sample parameters lavc_actx->channels = encoder->params.channels; lavc_actx->sample_rate = encoder->params.sample_rate; diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 62a3fcbdda..1910af62ee 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -121,8 +121,9 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, if (!sh->disp_w || !sh->disp_h) return 0; - mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "VDec: vo config request - %d x %d (preferred colorspace: %s)\n", w, h, - vo_format_name(preferred_outfmt)); + mp_msg(MSGT_DECVIDEO, MSGL_V, + "VDec: vo config request - %d x %d (preferred colorspace: %s)\n", + w, h, vo_format_name(preferred_outfmt)); if (get_video_quality_max(sh) <= 0 && divx_quality) { // user wants postprocess but no pp filter yet: @@ -216,7 +217,7 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, return 0; // failed } out_fmt = sh->codec->outfmt[j]; - mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "VDec: using %s as output csp (no %d)\n", + mp_msg(MSGT_CPLAYER, MSGL_V, "VDec: using %s as output csp (no %d)\n", vo_format_name(out_fmt), j); sh->outfmtidx = j; sh->vfilter = vf; diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index dfc7958a23..886a07f3cb 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -246,6 +246,8 @@ static int init(sh_video_t *sh){ ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; avctx->opaque = sh; + avctx->codec_type = CODEC_TYPE_VIDEO; + avctx->codec_id = lavc_codec->id; #if CONFIG_VDPAU if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index c9d60a202a..f798378dbe 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -331,7 +331,7 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ int size, i; - void *p; + char *p; mux_v->bih->biWidth=width; mux_v->bih->biHeight=height; @@ -1047,6 +1047,8 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv->pic = avcodec_alloc_frame(); vf->priv->context = avcodec_alloc_context(); + vf->priv->context->codec_type = CODEC_TYPE_VIDEO; + vf->priv->context->codec_id = vf->priv->codec->id; return 1; } diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 3a909cdfb7..6733b8c641 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -59,20 +59,6 @@ static int turbo = 0; static x264_param_t param; static int parse_error = 0; -static int encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal){ - uint8_t *p = buf; - int i; - - for(i = 0; i < nnal; i++){ - int s = x264_nal_encode(p, &size, 1, nals + i); - if(s < 0) - return -1; - p += s; - } - - return p - buf; -} - static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts); static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in); @@ -189,21 +175,13 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in } if(!param.b_repeat_headers){ - uint8_t *extradata; x264_nal_t *nal; - int extradata_size, nnal, i, s = 0; + int extradata_size, nnal; - x264_encoder_headers(mod->x264, &nal, &nnal); - - /* 5 bytes NAL header + worst case escaping */ - for(i = 0; i < nnal; i++) - s += 5 + nal[i].i_payload * 4 / 3; - - extradata = malloc(s); - extradata_size = encode_nals(extradata, s, nal, nnal); + extradata_size = x264_encoder_headers(mod->x264, &nal, &nnal); mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size); - memcpy(mod->mux->bih + 1, extradata, extradata_size); + memcpy(mod->mux->bih + 1, nal->p_payload, extradata_size); mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size; } @@ -218,12 +196,10 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in static int control(struct vf_instance* vf, int request, void *data) { h264_module_t *mod=(h264_module_t*)vf->priv; - int count = 256; // giant HACK, x264_encoder_encode may incorrectly return 0 - // when threads > 1 and delayed frames pending switch(request){ case VFCTRL_FLUSH_FRAMES: - while(encode_frame(vf, NULL) == 0 && --count); - while(encode_frame(vf, NULL) > 0); + while (x264_encoder_delayed_frames(mod->x264) > 0) + encode_frame(vf, NULL); return CONTROL_TRUE; default: return CONTROL_UNKNOWN; @@ -273,23 +249,20 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) x264_picture_t pic_out; x264_nal_t *nal; int i_nal; - int i_size = 0; - int i; + int i_size; - if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) { + i_size = x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out); + + if(i_size<0) { mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n"); return -1; } - - for(i=0; i < i_nal; i++) { - int i_data = mod->mux->buffer_size - i_size; - i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]); - } if(i_size>0) { int keyframe = (pic_out.i_type == X264_TYPE_IDR) || (pic_out.i_type == X264_TYPE_I && param.i_frame_reference == 1 && !param.i_bframe); + memcpy(mod->mux->buffer, nal->p_payload, i_size); muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); } else diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 31eabc67a1..f69f2715ff 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -623,7 +623,10 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio } else { priv->last_pts += rel_seek_secs * AV_TIME_BASE; } - av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags); + if (av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags) < 0) { + avsflags ^= AVSEEK_FLAG_BACKWARD; + av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags); + } } static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg) diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index 118217e999..8280a8793e 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -240,30 +240,10 @@ add_cluster_position (mkv_demuxer_t *mkv_d, uint64_t position) static int aac_get_sample_rate_index (uint32_t sample_rate) { - if (92017 <= sample_rate) - return 0; - else if (75132 <= sample_rate) - return 1; - else if (55426 <= sample_rate) - return 2; - else if (46009 <= sample_rate) - return 3; - else if (37566 <= sample_rate) - return 4; - else if (27713 <= sample_rate) - return 5; - else if (23004 <= sample_rate) - return 6; - else if (18783 <= sample_rate) - return 7; - else if (13856 <= sample_rate) - return 8; - else if (11502 <= sample_rate) - return 9; - else if (9391 <= sample_rate) - return 10; - else - return 11; + static const int srates[] = {92017, 75132, 55426, 46009, 37566, 27713, 23004, 18783, 13856, 11502, 9391, 0}; + int i = 0; + while (sample_rate < srates[i]) i++; + return i; } /** \brief Free cached demux packets @@ -1637,7 +1617,7 @@ demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid) uint32_t type2; unsigned int cnt; - src = track->private_data + RVPROPERTIES_SIZE; + src = (uint8_t *)track->private_data + RVPROPERTIES_SIZE; cnt = track->private_size - RVPROPERTIES_SIZE; bih = realloc(bih, sizeof (BITMAPINFOHEADER)+8+cnt); @@ -2992,7 +2972,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos / (mkv_d->last_pts * 1000.0)); - max_pos = mkv_d->cluster_positions[mkv_d->num_cluster_pos-1]; + max_pos = mkv_d->num_cluster_pos ? mkv_d->cluster_positions[mkv_d->num_cluster_pos-1] : 0; if (target_filepos > max_pos) { if ((off_t) max_pos > stream_tell (s)) diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index 109275a7fa..c7966da9ba 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -2521,6 +2521,7 @@ static int parse_pmt(ts_priv_t * priv, uint16_t progid, uint16_t pid, int is_sta break; case 0x8A: case 0x82: + case 0x85: case 0x86: pmt->es[idx].type = AUDIO_DTS; break; diff --git a/libmpdemux/mp_taglists.c b/libmpdemux/mp_taglists.c index 12281ae997..286a755f8b 100644 --- a/libmpdemux/mp_taglists.c +++ b/libmpdemux/mp_taglists.c @@ -48,7 +48,6 @@ static const struct mp_AVCodecTag mp_wav_tags[] = { { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, { CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, - { CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D')}, { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, { CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2')}, { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, @@ -78,6 +77,7 @@ static const struct mp_AVCodecTag mp_codecid_override_tags[] = { { CODEC_ID_PCM_S32LE, 1}, { CODEC_ID_MP2, 0x50}, { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'G', '2')}, + { CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D')}, { 0, 0 }, }; @@ -88,6 +88,7 @@ static const struct mp_AVCodecTag mp_bmp_tags[] = { { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, { CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')}, { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, + { CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')}, { CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, { CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, { CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')}, diff --git a/libvo/aclib_template.c b/libvo/aclib_template.c index 0d486bdaec..d7b2201944 100644 --- a/libvo/aclib_template.c +++ b/libvo/aclib_template.c @@ -277,10 +277,10 @@ static void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN(4) "1: \n\t" - "movl (%0, %%"REG_a"), %%ebx \n\t" - "movl 32(%0, %%"REG_a"), %%ebx \n\t" - "movl 64(%0, %%"REG_a"), %%ebx \n\t" - "movl 96(%0, %%"REG_a"), %%ebx \n\t" + "movl (%0, %%"REG_a"), %%ecx \n\t" + "movl 32(%0, %%"REG_a"), %%ecx \n\t" + "movl 64(%0, %%"REG_a"), %%ecx \n\t" + "movl 96(%0, %%"REG_a"), %%ecx \n\t" "add $128, %%"REG_a" \n\t" "cmp %3, %%"REG_a" \n\t" " jb 1b \n\t" @@ -313,10 +313,10 @@ static void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) // a few percent speedup on out of order executing CPUs "mov %5, %%"REG_a" \n\t" "2: \n\t" - "movl (%0), %%ebx \n\t" - "movl (%0), %%ebx \n\t" - "movl (%0), %%ebx \n\t" - "movl (%0), %%ebx \n\t" + "movl (%0), %%ecx \n\t" + "movl (%0), %%ecx \n\t" + "movl (%0), %%ecx \n\t" + "movl (%0), %%ecx \n\t" "dec %%"REG_a" \n\t" " jnz 2b \n\t" #endif @@ -329,7 +329,7 @@ static void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) " jae 1b \n\t" : "+r" (from), "+r" (to), "+r" (i) : "r" ((long)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((long)CONFUSION_FACTOR) - : "%"REG_a, "%ebx" + : "%"REG_a, "%ecx" ); for(; i>0; i--) diff --git a/libvo/gl_common.c b/libvo/gl_common.c index bb351f90d6..f827771a97 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1564,6 +1564,21 @@ static XVisualInfo *getWindowVisualInfo(Window win) { return XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp); } +static void appendstr(char **dst, const char *str) +{ + int newsize; + char *newstr; + if (!str) + return; + newsize = strlen(*dst) + 1 + strlen(str) + 1; + newstr = realloc(*dst, newsize); + if (!newstr) + return; + *dst = newstr; + strcat(*dst, " "); + strcat(*dst, str); +} + /** * \brief Changes the window in which video is displayed. * If possible only transfers the context to the new window, otherwise @@ -1620,6 +1635,7 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) if (!keep_context) { void *(*getProcAddress)(const GLubyte *); const char *(*glXExtStr)(Display *, int); + char *glxstr = strdup(""); if (*context) glXDestroyContext(mDisplay, *context); *context = new_context; @@ -1632,8 +1648,17 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) if (!getProcAddress) getProcAddress = (void *)getdladdr; glXExtStr = getdladdr("glXQueryExtensionsString"); - getFunctions(getProcAddress, !glXExtStr ? NULL : - glXExtStr(mDisplay, DefaultScreen(mDisplay))); + if (glXExtStr) + appendstr(&glxstr, glXExtStr(mDisplay, DefaultScreen(mDisplay))); + glXExtStr = getdladdr("glXGetClientString"); + if (glXExtStr) + appendstr(&glxstr, glXExtStr(mDisplay, GLX_EXTENSIONS)); + glXExtStr = getdladdr("glXGetServerString"); + if (glXExtStr) + appendstr(&glxstr, glXExtStr(mDisplay, GLX_EXTENSIONS)); + + getFunctions(getProcAddress, glxstr); + free(glxstr); // and inform that reinit is neccessary return SET_WINDOW_REINIT; diff --git a/libvo/osx_common.c b/libvo/osx_common.c index 377460346a..359e6a78f7 100644 --- a/libvo/osx_common.c +++ b/libvo/osx_common.c @@ -38,7 +38,7 @@ static const struct keymap keymap[] = { // navigation block {kVK_Help, KEY_INSERT}, {kVK_ForwardDelete, KEY_DELETE}, {kVK_Home, KEY_HOME}, - {kVK_End, KEY_END}, {kVK_PageUp, KEY_PAGE_UP}, {kVK_PageUp, KEY_PAGE_DOWN}, + {kVK_End, KEY_END}, {kVK_PageUp, KEY_PAGE_UP}, {kVK_PageDown, KEY_PAGE_DOWN}, // F-keys {kVK_F1, KEY_F + 1}, {kVK_F2, KEY_F + 2}, {kVK_F3, KEY_F + 3}, {kVK_F4, KEY_F + 4}, diff --git a/libvo/sub.c b/libvo/sub.c index f729f56ad8..744652086d 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -359,9 +359,9 @@ inline static void vo_update_text_teletext(mp_osd_obj_t *obj, int dxs, int dys) //very simple teletext font auto scaling if(!vo_osd_teletext_scale && hm*(max_rows+1)>dys){ - text_font_scale_factor*=1.0*(dys)/((max_rows+1)*hm); + osd_font_scale_factor*=1.0*(dys)/((max_rows+1)*hm); force_load_font=1; - vo_osd_teletext_scale=text_font_scale_factor; + vo_osd_teletext_scale=osd_font_scale_factor; obj->flags&=~OSDFLAG_VISIBLE; return; } diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index ed90f5b14c..1748e059ec 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -161,10 +161,6 @@ static void free_file_specific(void) static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { free_file_specific(); - config_movie_aspect((float)d_width/d_height); - - vo_dwidth = d_width *= mpGLView->winSizeMult; - vo_dheight = d_height *= mpGLView->winSizeMult; //misc mplayer setup image_width = width; @@ -183,6 +179,11 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ if(!shared_buffer) { + config_movie_aspect((float)d_width/d_height); + + vo_dwidth = d_width *= mpGLView->winSizeMult; + vo_dheight = d_height *= mpGLView->winSizeMult; + image_data = malloc(image_width*image_height*image_bytes); image_datas[0] = image_data; if (vo_doublebuffering) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index a97b524c56..1bd908f22b 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -431,7 +431,7 @@ static void uninitGl(void) { DeleteBuffers(2, gl_buffer_uv); gl_buffer_uv[0] = gl_buffer_uv[1] = 0; gl_buffersize_uv = 0; gl_bufferptr_uv[0] = gl_bufferptr_uv[1] = 0; -#ifndef GL_WIN32 +#ifdef CONFIG_X11 if (mesa_bufferptr) FreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); #endif @@ -559,6 +559,10 @@ glconfig: uninitGl(); if (setGlWindow(&gl_vinfo, &gl_context, vo_window) == SET_WINDOW_FAILED) return -1; + if (mesa_buffer && !AllocateMemoryMESA) { + mp_msg(MSGT_VO, MSGL_ERR, "Can not enable mesa-buffer because AllocateMemoryMESA was not found\n"); + mesa_buffer = 0; + } initGl(vo_dwidth, vo_dheight); return 0; @@ -763,13 +767,13 @@ static uint32_t get_image(mp_image_t *mpi) { mpi->stride[0] = mpi->width * mpi->bpp / 8; needed_size = mpi->stride[0] * mpi->height; if (mesa_buffer) { -#ifndef GL_WIN32 +#ifdef CONFIG_X11 if (mesa_bufferptr && needed_size > mesa_buffersize) { FreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); mesa_bufferptr = NULL; } if (!mesa_bufferptr) - mesa_bufferptr = AllocateMemoryMESA(mDisplay, mScreen, needed_size, 0, 0, 0); + mesa_bufferptr = AllocateMemoryMESA(mDisplay, mScreen, needed_size, 0, 1.0, 1.0); mesa_buffersize = needed_size; #endif mpi->planes[0] = mesa_bufferptr; diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 71361916f4..e72f735bcd 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -114,7 +114,7 @@ static GLint getInternalFormat(void) { #ifdef GL_WIN32 PIXELFORMATDESCRIPTOR pfd; - HDC vo_hdc = GetDC(vo_window); + HDC vo_hdc = GetDC(vo_w32_window); int pf = GetPixelFormat(vo_hdc); if (!DescribePixelFormat(vo_hdc, pf, sizeof pfd, &pfd)) { r_sz = g_sz = b_sz = a_sz = 0; @@ -124,7 +124,7 @@ static GLint getInternalFormat(void) b_sz = pfd.cBlueBits; a_sz = pfd.cAlphaBits; } - ReleaseDC(vo_window, vo_hdc); + ReleaseDC(vo_w32_window, vo_hdc); #else if (glXGetConfig(mDisplay, gl_vinfo, GLX_RED_SIZE, &r_sz) != 0) r_sz = 0; if (glXGetConfig(mDisplay, gl_vinfo, GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0; diff --git a/mencoder.c b/mencoder.c index d1472a0568..7f4094f663 100644 --- a/mencoder.c +++ b/mencoder.c @@ -221,6 +221,12 @@ void mplayer_put_key(struct mp_fifo *fifo, int code) char *current_module; #include "mpcommon.h" +// Needed by mpcommon.c +void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs) { + vo_sub = subs; + vo_osd_changed(OSDTYPE_SUBTITLE); +} + //char *out_audio_codec=NULL; // override audio codec //char *out_video_codec=NULL; // override video codec @@ -526,14 +532,14 @@ play_next_file: #ifdef CONFIG_DVDREAD if(stream->type==STREAMTYPE_DVD){ if(audio_lang && opts.audio_id==-1) opts.audio_id=dvd_aid_from_lang(stream,audio_lang); - if(dvdsub_lang && opts.sub_id==-2) opts.sub_id=dvd_sid_from_lang(stream,dvdsub_lang); + if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=dvd_sid_from_lang(stream,dvdsub_lang); } #endif #ifdef CONFIG_DVDNAV if(stream->type==STREAMTYPE_DVDNAV){ if(audio_lang && opts.audio_id==-1) opts.audio_id=mp_dvdnav_aid_from_lang(stream,audio_lang); - if(dvdsub_lang && opts.sub_id==-2) opts.sub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang); + if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang); } #endif @@ -553,10 +559,10 @@ if(stream->type==STREAMTYPE_DVDNAV){ select_audio(demuxer, opts.audio_id, audio_lang); - if (opts.sub_id < 0 && dvdsub_lang) + if (opts.sub_id < -1 && dvdsub_lang) opts.sub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang); - if (opts.sub_id < 0) + if (opts.sub_id < -1) opts.sub_id = demuxer_default_sub_track(demuxer); for (i = 0; i < MAX_S_STREAMS; i++) { @@ -1470,7 +1476,7 @@ if(sh_audio && !demuxer2){ } else #endif - update_subtitles(sh_video, d_dvdsub, 0, 0); + update_subtitles(NULL, &opts, sh_video, sh_video->pts, 0, d_dvdsub, 0); frame_data = (s_frame_data){ .start = NULL, .in_size = 0, .frame_time = 0., .already_read = 0 }; @@ -11,6 +11,7 @@ #define OSD_MSG_RADIO_CHANNEL 7 /// Base id for messages generated from the commmand to property bridge. #define OSD_MSG_PROPERTY 0x100 +#define OSD_MSG_SUB_BASE 0x1000 #define MAX_OSD_LEVEL 3 #define MAX_TERM_OSD_LEVEL 1 diff --git a/mpcommon.c b/mpcommon.c index 245383c803..6e699e9866 100644 --- a/mpcommon.c +++ b/mpcommon.c @@ -66,10 +66,10 @@ if (HAVE_CMOV) } -void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, - double video_offset, int reset) +void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts, + sh_video_t *sh_video, double refpts, double sub_offset, + demux_stream_t *d_dvdsub, int reset) { - struct MPOpts *opts = sh_video->opts; unsigned char *packet=NULL; int len; char type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v'; @@ -77,25 +77,24 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, if (reset) { sub_clear_text(&subs, MP_NOPTS_VALUE); if (vo_sub) { - vo_sub = NULL; - vo_osd_changed(OSDTYPE_SUBTITLE); + set_osd_subtitle(mpctx, NULL); } if (vo_spudec) { spudec_reset(vo_spudec); vo_osd_changed(OSDTYPE_SPU); } + return; } // find sub if (subdata) { - double pts = sh_video->pts; - if (sub_fps==0) sub_fps = sh_video->fps; + if (sub_fps==0) sub_fps = sh_video ? sh_video->fps : 25; current_module = "find_sub"; - if (pts > sub_last_pts || pts < sub_last_pts-1.0) { - find_sub(subdata, (pts+sub_delay) * + if (refpts > sub_last_pts || refpts < sub_last_pts-1.0) { + find_sub(mpctx, subdata, (refpts+sub_delay) * (subdata->sub_uses_time ? 100. : sub_fps)); if (vo_sub) vo_sub_last = vo_sub; // FIXME! frame counter... - sub_last_pts = pts; + sub_last_pts = refpts; } } @@ -110,12 +109,12 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, // Vobsub len = 0; if (vo_vobsub) { - if (sh_video->pts+sub_delay >= 0) { - len = vobsub_get_packet(vo_vobsub, sh_video->pts+sub_delay, + if (refpts+sub_delay >= 0) { + len = vobsub_get_packet(vo_vobsub, refpts+sub_delay, (void**)&packet, ×tamp); if (len > 0) { - timestamp -= (sh_video->pts + sub_delay - sh_video->timer)*90000; - mp_dbg(MSGT_CPLAYER,MSGL_V,"\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,sh_video->pts,sh_video->timer,timestamp / 90000.0,timestamp); + timestamp -= (refpts + sub_delay - sh_video->timer)*90000; + mp_dbg(MSGT_CPLAYER,MSGL_V,"\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,refpts,sh_video->timer,timestamp / 90000.0,timestamp); } } } else { @@ -127,14 +126,14 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, // d_video->pts which would have been the simplest // improvement doesn't work because mpeg specific hacks // in video.c set d_video->pts to 0. - float x = d_dvdsub->pts - sh_video->pts; + float x = d_dvdsub->pts - refpts; if (x > -20 && x < 20) // prevent missing subs on pts reset timestamp = 90000*(sh_video->timer + d_dvdsub->pts - + sub_delay - sh_video->pts); + + sub_delay - refpts); else timestamp = 90000*(sh_video->timer + sub_delay); mp_dbg(MSGT_CPLAYER, MSGL_V, "\rDVD sub: len=%d " "v_pts=%5.3f s_pts=%5.3f ts=%d \n", len, - sh_video->pts, d_dvdsub->pts, timestamp); + refpts, d_dvdsub->pts, timestamp); } } if (len<=0 || !packet) break; @@ -146,14 +145,13 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, vo_osd_changed(OSDTYPE_SPU); } else if (opts->sub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) { - double curpts = sh_video->pts + sub_delay; + double curpts = refpts + sub_delay; double endpts; - vo_sub = &subs; while (d_dvdsub->first) { - double pts = ds_get_next_pts(d_dvdsub) + video_offset; - if (pts > curpts) + double subpts = ds_get_next_pts(d_dvdsub) + sub_offset; + if (subpts > curpts) break; - endpts = d_dvdsub->first->endpts + video_offset; + endpts = d_dvdsub->first->endpts + sub_offset; len = ds_get_packet_sub(d_dvdsub, &packet); if (type == 'm') { if (len < 2) continue; @@ -167,15 +165,14 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, if (!ass_track) continue; if (type == 'a') { // ssa/ass subs with libass ass_process_chunk(ass_track, packet, len, - (long long)(pts*1000 + 0.5), - (long long)((endpts-pts)*1000 + 0.5)); + (long long)(subpts*1000 + 0.5), + (long long)((endpts-subpts)*1000 + 0.5)); } else { // plaintext subs with libass - vo_sub = NULL; - if (pts != MP_NOPTS_VALUE) { - if (endpts == MP_NOPTS_VALUE) endpts = pts + 3; + if (subpts != MP_NOPTS_VALUE) { + if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3; sub_clear_text(&subs, MP_NOPTS_VALUE); sub_add_text(&subs, packet, len, endpts); - subs.start = pts * 100; + subs.start = subpts * 100; subs.end = endpts * 100; ass_process_subtitle(ass_track, &subs); } @@ -183,7 +180,7 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, continue; } #endif - if (pts != MP_NOPTS_VALUE) { + if (subpts != MP_NOPTS_VALUE) { if (endpts == MP_NOPTS_VALUE) sub_clear_text(&subs, MP_NOPTS_VALUE); if (type == 'a') { // ssa/ass subs without libass => convert to plaintext @@ -198,11 +195,11 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, packet = p; } sub_add_text(&subs, packet, len, endpts); - vo_osd_changed(OSDTYPE_SUBTITLE); + set_osd_subtitle(mpctx, &subs); } } if (sub_clear_text(&subs, curpts)) - vo_osd_changed(OSDTYPE_SUBTITLE); + set_osd_subtitle(mpctx, &subs); } current_module=NULL; } diff --git a/mpcommon.h b/mpcommon.h index 211145abfc..bbec3113a6 100644 --- a/mpcommon.h +++ b/mpcommon.h @@ -9,11 +9,14 @@ extern double sub_last_pts; extern struct ass_track *ass_track; extern subtitle *vo_sub_last; +struct MPContext; void print_version(const char* name); -void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, - double video_offset, int reset); +void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts, + sh_video_t *sh_video, double refpts, double sub_offset, + demux_stream_t *d_dvdsub, int reset); void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset); int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang); +void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs); extern int disable_system_conf; extern int disable_user_conf; @@ -1493,6 +1493,27 @@ void set_osd_bar(struct MPContext *mpctx, int type,const char* name,double min,d name, ROUND(100*(val-min)/(max-min))); } +/** + * \brief Display text subtitles on the OSD + */ +void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs) +{ + int i; + vo_sub = subs; + vo_osd_changed(OSDTYPE_SUBTITLE); + if (!mpctx->sh_video) { + // reverse order, since newest set_osd_msg is displayed first + for (i = SUB_MAX_TEXT - 1; i >= 0; i--) { + if (!subs || i >= subs->lines || !subs->text[i]) + rm_osd_msg(OSD_MSG_SUB_BASE + i); + else { + // HACK: currently display time for each sub line except the last is set to 2 seconds. + int display_time = i == subs->lines - 1 ? 180000 : 2000; + set_osd_msg(OSD_MSG_SUB_BASE + i, 1, display_time, "%s", subs->text[i]); + } + } + } +} /** * \brief Update the OSD message line. @@ -2251,7 +2272,8 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx, #endif if (decoded_frame) { // These updates are done here for vf_expand OSD/subtitles - update_subtitles(sh_video, mpctx->d_sub, mpctx->video_offset, 0); + update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts, + mpctx->video_offset, mpctx->d_sub, 0); update_teletext(sh_video, mpctx->demuxer, 0); update_osd_msg(mpctx); current_module = "filter video"; @@ -2304,7 +2326,8 @@ static double update_video(struct MPContext *mpctx, int *blit_frame) framedrop_type, pts); if (decoded_frame) { // These updates are done here for vf_expand OSD/subtitles - update_subtitles(sh_video, mpctx->d_sub, mpctx->video_offset, 0); + update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts, + mpctx->video_offset, mpctx->d_sub, 0); update_teletext(sh_video, mpctx->demuxer, 0); update_osd_msg(mpctx); current_module = "filter video"; @@ -2580,7 +2603,9 @@ static int seek(MPContext *mpctx, double amount, int style) // (which is used by at least vobsub and edl code below) may // be completely wrong (probably 0). mpctx->sh_video->pts = mpctx->d_video->pts + mpctx->video_offset; - update_subtitles(mpctx->sh_video, mpctx->d_sub, mpctx->video_offset, 1); + update_subtitles(mpctx, &mpctx->opts, mpctx->sh_video, + mpctx->sh_video->pts, mpctx->video_offset, + mpctx->d_sub, 1); update_teletext(mpctx->sh_video, mpctx->demuxer, 1); } @@ -2589,6 +2614,9 @@ static int seek(MPContext *mpctx, double amount, int style) mpctx->audio_out->reset(); // stop audio, throwing away buffered data mpctx->sh_audio->a_buffer_len = 0; mpctx->sh_audio->a_out_buffer_len = 0; + if (!mpctx->sh_video) + update_subtitles(mpctx, &mpctx->opts, NULL, mpctx->sh_audio->pts, + mpctx->video_offset, mpctx->d_sub, 1); } if (vo_vobsub && mpctx->sh_video) { @@ -3406,7 +3434,6 @@ if(stream_dump_type==5){ if(mpctx->stream->type==STREAMTYPE_DVD){ current_module="dvd lang->id"; if(opts->audio_id==-1) opts->audio_id=dvd_aid_from_lang(mpctx->stream,audio_lang); - if(dvdsub_lang && opts->sub_id==-2) opts->sub_id=-1; if(dvdsub_lang && opts->sub_id==-1) opts->sub_id=dvd_sid_from_lang(mpctx->stream,dvdsub_lang); // setup global sub numbering mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub. @@ -3419,7 +3446,6 @@ if(mpctx->stream->type==STREAMTYPE_DVD){ if(mpctx->stream->type==STREAMTYPE_DVDNAV){ current_module="dvdnav lang->id"; if(opts->audio_id==-1) opts->audio_id=mp_dvdnav_aid_from_lang(mpctx->stream,audio_lang); - if(dvdsub_lang && opts->sub_id==-2) opts->sub_id=-1; if(dvdsub_lang && opts->sub_id==-1) opts->sub_id=mp_dvdnav_sid_from_lang(mpctx->stream,dvdsub_lang); // setup global sub numbering mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub. @@ -3668,14 +3694,14 @@ if(vo_spudec==NULL && mpctx->sh_video && init_vo_spudec(mpctx); } -if(mpctx->sh_video) { // after reading video params we should load subtitles because // we know fps so now we can adjust subtitle time to ~6 seconds AST // check .sub current_module="read_subtitles_file"; + double sub_fps = mpctx->sh_video ? mpctx->sh_video->fps : 25; if(sub_name){ for (i = 0; sub_name[i] != NULL; ++i) - add_subtitles(mpctx, sub_name[i], mpctx->sh_video->fps, 0); + add_subtitles(mpctx, sub_name[i], sub_fps, 0); } if(sub_auto) { // auto load sub file ... char *psub = get_path( "sub/" ); @@ -3683,7 +3709,7 @@ if(mpctx->sh_video) { int i = 0; free(psub); // release the buffer created by get_path() above while (tmp[i]) { - add_subtitles(mpctx, tmp[i], mpctx->sh_video->fps, 1); + add_subtitles(mpctx, tmp[i], sub_fps, 1); free(tmp[i++]); } free(tmp); @@ -3693,7 +3719,7 @@ if(mpctx->sh_video) { mpctx->global_sub_indices[SUB_SOURCE_SUBS] = mpctx->global_sub_size; // the global # of the first sub. mpctx->global_sub_size += mpctx->set_of_sub_size; } -} + if (mpctx->global_sub_size) { // find the best sub to use @@ -3708,11 +3734,11 @@ if (mpctx->global_sub_size) { } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) { // if there are text subs to use, use those. (autosubs come last here) mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS]; - } else if (opts->sub_id < 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { + } else if (opts->sub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { // finally select subs by language and container hints - if (opts->sub_id < 0 && dvdsub_lang) + if (opts->sub_id == -1 && dvdsub_lang) opts->sub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang); - if (opts->sub_id < 0) + if (opts->sub_id == -1) opts->sub_id = demuxer_default_sub_track(mpctx->demuxer); if (opts->sub_id >= 0) mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + opts->sub_id; @@ -3941,6 +3967,8 @@ if(!mpctx->sh_video) { if(end_at.type == END_AT_TIME && end_at.pos < a_pos) mpctx->stop_play = PT_NEXT_ENTRY; + update_subtitles(mpctx, &mpctx->opts, NULL, a_pos, mpctx->video_offset, + mpctx->d_sub, 0); update_osd_msg(mpctx); } else { diff --git a/subreader.h b/subreader.h index 28246ec483..683d12ffbf 100644 --- a/subreader.h +++ b/subreader.h @@ -83,7 +83,8 @@ void dump_microdvd(sub_data* subd, float fps); void dump_jacosub(sub_data* subd, float fps); void dump_sami(sub_data* subd, float fps); void sub_free( sub_data * subd ); -void find_sub(sub_data* subd,int key); +struct MPContext; +void find_sub(struct MPContext *mpctx, sub_data* subd,int key); void step_sub(sub_data *subd, float pts, int movement); void sub_add_text(subtitle *sub, const char *txt, int len, double endpts); int sub_clear_text(subtitle *sub, double pts); |