mplayerxp-cvslog Mailing List for MplayerXP-mplayer with extra performance (Page 4)
Brought to you by:
olov
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(53) |
Apr
(142) |
May
(129) |
Jun
(160) |
Jul
(102) |
Aug
(14) |
Sep
(50) |
Oct
(27) |
Nov
(52) |
Dec
(41) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(136) |
Feb
(170) |
Mar
(103) |
Apr
(102) |
May
(44) |
Jun
(25) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
(1) |
Nov
|
Dec
(4) |
2004 |
Jan
|
Feb
(21) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
(160) |
Nov
(63) |
Dec
(5) |
2005 |
Jan
(10) |
Feb
(14) |
Mar
(18) |
Apr
(74) |
May
(72) |
Jun
(22) |
Jul
(28) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(91) |
Feb
(71) |
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
(3) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(9) |
Dec
(26) |
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
(17) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(134) |
Dec
(72) |
2008 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
(1) |
Oct
(21) |
Nov
(41) |
Dec
(12) |
2009 |
Jan
(57) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(25) |
Oct
(1) |
Nov
(46) |
Dec
(59) |
2010 |
Jan
(84) |
Feb
(5) |
Mar
|
Apr
(2) |
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(122) |
Nov
(223) |
Dec
(132) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(13) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <nic...@us...> - 2012-12-20 15:07:52
|
Revision: 583 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=583&view=rev Author: nickols_k Date: 2012-12-20 15:07:43 +0000 (Thu, 20 Dec 2012) Log Message: ----------- About illegal patch: Interesting backtrace produces hacked compiler: it uses basic_string in chain of postprocessing filters: ... Probing: xvid codec_ld: ?\208?\145?\208?\184?\208?\177?\208?\187?\208?\184?\208?\190?\209?\130?\208?\181?\208?\186?\208?\176: 'libxvidcore.so' ?\208?\183?\208?\176?\208?\179?\209?\128?\209?\131?\208?\182?\208?\181?\208?\189?\208?\176 ?\209?\131?\209?\129?\208?\191?\208?\181?\209?\136?\208?\189?\208?\190 Driver: xvid supports these outfmt for XVID fourcc: YV12 (flg=0) I420 (flg=0) YUY2 (flg=0) UYVY (flg=0) YVYU (flg=0) RGB (flg=0) ?\226?\150?\146RGB (flg=0) RGB (flg=0) RGB (flg=0) codec_ld: ?\208?\145?\208?\184?\208?\177?\208?\187?\208?\184?\208?\190?\209?\130?\208?\181?\208?\186?\208?\176: 'libxvidcore.so' ?\208?\183?\208?\176?\208?\179?\209?\128?\209?\131?\208?\182?\208?\181?\208?\189?\208?\176 ?\209?\131?\209?\129?\208?\191?\208?\181?\209?\136?\208?\189?\208?\190 [XVID] using library version 1.3.2 (build xvid-1.3.2) [XVID] using 4 cpus/threads. Flags: 000001FF VDec: vo config request - 720 x 432 Can't find colorspace for: 'Planar YV12' 'Planar I420' 'Packed YUY2' 'Packed UYVY' 'Packed YVYU' 'BGRA' 'BGR 24-bit' 'BGR 15-bit' 'BGR 16-bit' Trying -vf fmtcvt Open video filter: [fmtcvt] <720x432 Planar YV12> SwScale params: -1 x -1 (-1=no scaling) Movie-Aspect is undefined - no prescaling applied. vf->config(720x432->720x432,flags=0x0,'MPlayerXP',Planar YV12) [swscaler @ 0x1f99b80] using unscaled yuv420p -> bgra special converter REQ: flags=0x401 req=0x0 [libvf] Using video filters chain: [vf_fmtcvt]: video[720x432] in[Planar YV12] -> out[RGBA] VO-CONF: [x11] 0x0 => 0x0 Unknown 0x0000 VO: Description: X11 ( XImage/Shm ) (with x11:vidix subdevice) VO: Author: Aaron Holtzman <aho...@es...> X11_System: BadValue (integer parameter out of range for operation) Type: 0, display: 1dc7a40, resourceid: f2497e20, serial: 19 Error code: 2, request code: 1, minor code: 0 X11_System error 0x49bff0 -> mplib.h:74 0x5b7915 -> mplayerxp.h:212 0x7ffff7b0d56c -> ??:0 0x7ffff7b0b177 -> ??:0 0x7ffff7b0b1b6 -> ??:0 0x7ffff7b0b798 -> ??:0 0x7ffff4a84eac -> ??:0 0x5b9938 -> x11_system.cpp:892 0x5b9ad1 -> x11_system.cpp:233 0x5b5c34 -> vo_x11.cpp:246 0x5a9ad4 -> video_out.cpp:335 0x591685 -> basic_string.h:287 0x55e2e5 -> vf.cpp:409 0x58a041 -> vf_scale.cpp:308 0x509303 -> dec_video.cpp:607 (discriminator 1) 0x51386b -> vd_xvid.cpp:446 (discriminator 1) 0x508973 -> dec_video.cpp:214 0x451dfe -> mplayerxp.cpp:1165 0x456093 -> mplayerxp.cpp:1894 uninit audio: ... <dead lock here > Modified Paths: -------------- mplayerxp/global_msg.h Modified: mplayerxp/global_msg.h =================================================================== --- mplayerxp/global_msg.h 2012-12-20 13:29:57 UTC (rev 582) +++ mplayerxp/global_msg.h 2012-12-20 15:07:43 UTC (rev 583) @@ -17,5 +17,4 @@ static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_GLOBAL); static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_GLOBAL); } // namespace mpxp - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-20 13:30:10
|
Revision: 582 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=582&view=rev Author: nickols_k Date: 2012-12-20 13:29:57 +0000 (Thu, 20 Dec 2012) Log Message: ----------- remove '\n' symbols from static NLS texts Modified Paths: -------------- mplayerxp/libmpstream2/http.cpp mplayerxp/mplayerxp.cpp mplayerxp/nls/mpxp_help-bg.h mplayerxp/nls/mpxp_help-cz.h mplayerxp/nls/mpxp_help-de.h mplayerxp/nls/mpxp_help-dk.h mplayerxp/nls/mpxp_help-el.h mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-es.h mplayerxp/nls/mpxp_help-fr.h mplayerxp/nls/mpxp_help-hu.h mplayerxp/nls/mpxp_help-it.h mplayerxp/nls/mpxp_help-ja.h mplayerxp/nls/mpxp_help-ko.h mplayerxp/nls/mpxp_help-mk.h mplayerxp/nls/mpxp_help-nb.h mplayerxp/nls/mpxp_help-nl.h mplayerxp/nls/mpxp_help-no.h mplayerxp/nls/mpxp_help-pl.h mplayerxp/nls/mpxp_help-pt.h mplayerxp/nls/mpxp_help-ro.h mplayerxp/nls/mpxp_help-ru.h mplayerxp/nls/mpxp_help-sk.h mplayerxp/nls/mpxp_help-sv.h mplayerxp/nls/mpxp_help-tr.h mplayerxp/nls/mpxp_help-uk.h mplayerxp/nls/mpxp_help-zh.h mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libmpstream2/http.cpp =================================================================== --- mplayerxp/libmpstream2/http.cpp 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/libmpstream2/http.cpp 2012-12-20 13:29:57 UTC (rev 582) @@ -306,7 +306,7 @@ const char *aut; if( *auth_retry==1 ) { - MSG_ERR(MSGTR_ConnAuthFailed); + mpxp_err<<MSGTR_ConnAuthFailed<<std::endl; return -1; } if( *auth_retry>0 ) url.clear_login(); @@ -321,7 +321,7 @@ MSG_INFO("Authentication required\n"); } if( !net_conf.username ) { - MSG_ERR(MSGTR_ConnAuthFailed); + mpxp_err<<MSGTR_ConnAuthFailed<<std::endl; return -1; } if( !net_conf.password ) MSG_INFO("No password provided, trying blank password\n"); Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/mplayerxp.cpp 2012-12-20 13:29:57 UTC (rev 582) @@ -594,7 +594,7 @@ void show_help(void) { // no file/vcd/dvd -> show HELP: - mpxp_info<<help_text<<std::endl; + for(unsigned j=0;help_text[j];j++) mpxp_info<<help_text[j]<<std::endl; Stream::print_drivers(); mpxp_info<<std::endl; mpxp_info<<"Example: mplayerxp -ao alsa:hw:0 -vo x11 your.avi"<<std::endl; @@ -1680,7 +1680,7 @@ xmp_register_main(exit_sighandler); mpxp_print_init(mp_conf.verbose+MSGL_STATUS); - mpxp_info<<banner_text<<std::endl; + for(unsigned j=0;banner_text[j];j++) mpxp_info<<banner_text[j]<<std::endl; /* currently it's lowest point of MPXPSystem initialization */ mpxp_context().engine().MPXPSys = new(zeromem) MPXPSystem; Modified: mplayerxp/nls/mpxp_help-bg.h =================================================================== --- mplayerxp/nls/mpxp_help-bg.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-bg.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,35 +3,39 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Употреба: mplayerxp [опции] [url|път/]име_на_файл\n" -"\n" -"Основни опции: (пълният списък е в ръководството - 'man mplayerxp')\n" -" -vo <дрв[:устр]> избор на видео драйвер & устройство ('-vo help' дава списък)\n" -" -ao <дрв[:устр]> избор на звуков драйвер & устройство ('-ao help' дава списък)\n" -" -play.ss <позиция>превъртане до дадена (в секунди или чч:мм:сс) позиция\n" -" -audio.off изключване на звука\n" -" -video.fs пълноекранно възпроизвеждане (или -video.vm, -video.zoom, вж. manpage)\n" -" -sub.file <файл> задава файла със субтитри\n" -" -play.list <файл> отваря playlist файл\n" -" -sync.framedrop разрешава прескачането на кадри (при бавни машини)\n" -"\n" -"Основни клавиши: (пълен списък има в ръководството, проверете също input.conf)\n" -" <- или -> превърта назад/напред с 10 секунди\n" -" up или down превърта назад/напред с 1 минута\n" -" pgup или pgdown превърта назад/напред с 10 минути\n" -" < или > стъпка назад/напред в playlist списъка\n" -" p или SPACE пауза (натиснете произволен клавиш за продължение)\n" -" q или ESC спиране на възпроизвеждането и изход от програмата\n" -" o превключва OSD режима: без/лента за превъртане/лента и таймер\n" -" * или / увеличава или намалява силата на звука (PCM)\n" -"\n" -" * * * ЗА ПОДРОБНОСТИ, ДОПЪЛНИТЕЛНИ ОПЦИИ И КЛАВИШИ, ВИЖТЕ РЪКОВОДСТВОТО! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Употреба: mplayerxp [опции] [url|път/]име_на_файл", +"", +"Основни опции: (пълният списък е в ръководството - 'man mplayerxp')", +" -vo <дрв[:устр]> избор на видео драйвер & устройство ('-vo help' дава списък)", +" -ao <дрв[:устр]> избор на звуков драйвер & устройство ('-ao help' дава списък)", +" -play.ss <позиция>превъртане до дадена (в секунди или чч:мм:сс) позиция", +" -audio.off изключване на звука", +" -video.fs пълноекранно възпроизвеждане (или -video.vm, -video.zoom, вж. manpage)", +" -sub.file <файл> задава файла със субтитри", +" -play.list <файл> отваря playlist файл", +" -sync.framedrop разрешава прескачането на кадри (при бавни машини)", +"", +"Основни клавиши: (пълен списък има в ръководството, проверете също input.conf)", +" <- или -> превърта назад/напред с 10 секунди", +" up или down превърта назад/напред с 1 минута", +" pgup или pgdown превърта назад/напред с 10 минути", +" < или > стъпка назад/напред в playlist списъка", +" p или SPACE пауза (натиснете произволен клавиш за продължение)", +" q или ESC спиране на възпроизвеждането и изход от програмата", +" o превключва OSD режима: без/лента за превъртане/лента и таймер", +" * или / увеличава или намалява силата на звука (PCM)", +"", +" * * * ЗА ПОДРОБНОСТИ, ДОПЪЛНИТЕЛНИ ОПЦИИ И КЛАВИШИ, ВИЖТЕ РЪКОВОДСТВОТО! * * *", +NULL +}; #endif #endif Modified: mplayerxp/nls/mpxp_help-cz.h =================================================================== --- mplayerxp/nls/mpxp_help-cz.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-cz.h 2012-12-20 13:29:57 UTC (rev 582) @@ -5,37 +5,40 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (viz DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"\n", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (viz DOCS!)", +NULL +}; // Překlad do češtiny Jiří Svoboda -static char help_text[]= -"Použití: mplayerxp [přepínače] [cesta/]jmenosouboru\n" -"\n" -"Přepínače:\n" -" -vo <drv[:dev]> výběr výstupního video ovladače&zařízení (-vo help pro seznam)\n" -" -ao <drv[:dev]> výběr výstupního audio ovladače&zařízení (-ao help pro seznam)\n" -" -play.ss <timepos> posun na pozici (sekundy nebo hh:mm:ss)\n" -" -audio.off přehrávat beze zvuku\n" -" -video.fs volby pro přehrávání přes celou obrazovku (celá obrazovka\n měnit videorežim, softwarový zoom)\n" -" -sub.file <file> volba souboru s titulky\n" -" -play.list <file>určení souboru se seznamem přehrávaných souborů\n" -" -sync.framedrop povolit zahazování snímků (pro pomale stroje)\n" -"\n" -"Klávesy:\n" -" <- nebo -> posun vzad/vpřed o 10 sekund\n" -" nahoru či dolů posun vzad/vpřed o 1 minutu\n" -" < nebo > posun vzad/vpřed v seznamu přehrávaných souborů\n" -" p nebo mezerník pauza při přehrávání (pokračování stiskem kterékoliv klávesy)\n" -" q nebo ESC konec přehrávání a ukončení programu\n" -" o cyklická změna režimu OSD: nic / pozice / pozice+čas\n" -" * nebo / přidat nebo ubrat hlasitost (stiskem 'm' výběr master/pcm)\n" -"\n" -" * * * * PŘEČTĚTE SI MAN STRÁNKU PRO DETAILY (DALŠÍ VOLBY A KLÁVESY)! * * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Použití: mplayerxp [přepínače] [cesta/]jmenosouboru", +"", +"Přepínače:", +" -vo <drv[:dev]> výběr výstupního video ovladače&zařízení (-vo help pro seznam)", +" -ao <drv[:dev]> výběr výstupního audio ovladače&zařízení (-ao help pro seznam)", +" -play.ss <timepos> posun na pozici (sekundy nebo hh:mm:ss)", +" -audio.off přehrávat beze zvuku", +" -video.fs volby pro přehrávání přes celou obrazovku (celá obrazovka\n měnit videorežim, softwarový zoom)", +" -sub.file <file> volba souboru s titulky", +" -play.list <file>určení souboru se seznamem přehrávaných souborů", +" -sync.framedrop povolit zahazování snímků (pro pomale stroje)", +"", +"Klávesy:", +" <- nebo -> posun vzad/vpřed o 10 sekund", +" nahoru či dolů posun vzad/vpřed o 1 minutu", +" < nebo > posun vzad/vpřed v seznamu přehrávaných souborů", +" p nebo mezerník pauza při přehrávání (pokračování stiskem kterékoliv klávesy)", +" q nebo ESC konec přehrávání a ukončení programu", +" o cyklická změna režimu OSD: nic / pozice / pozice+čas", +" * nebo / přidat nebo ubrat hlasitost (stiskem 'm' výběr master/pcm)", +"", +" * * * * PŘEČTĚTE SI MAN STRÁNKU PRO DETAILY (DALŠÍ VOLBY A KLÁVESY)! * * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-de.h =================================================================== --- mplayerxp/nls/mpxp_help-de.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-de.h 2012-12-20 13:29:57 UTC (rev 582) @@ -5,33 +5,37 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (siehe DOCS!)\n" -"\n"; +static const char* banner_text={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (siehe DOCS!)", +NULL +}; -static char help_text[]= -"Verwendung: mplayerxp [optionen] [verzeichnis/]dateiname\n" -"\n" -"Optionen:\n" -" -vo <drv[:dev]> Videoausgabetreiber & -Gerät (siehe '-vo help' für eine Liste)\n" -" -ao <drv[:dev]> Audioausgabetreiber & -Gerät (siehe '-ao help' für eine Liste)\n" -" -play.ss <timepos> Starte abspielen ab Position (Sekunden oder hh:mm:ss)\n" -" -audio.off Spiele keinen Sound\n" -" -video.fs Vollbild Optionen (Vollbild, Videomode, Softwareskalierung)\n" -" -sub.file <file>Benutze Untertitledatei\n" -" -sync.framedrop Benutze frame-dropping (für langsame Rechner)\n" -"\n" -"Tasten:\n" -" <- oder -> Springe zehn Sekunden vor/zurück\n" -" rauf / runter Springe eine Minute vor/zurück\n" -" p oder LEER PAUSE (beliebige Taste zum Fortsetzen)\n" -" q oder ESC Abspielen stoppen und Programm beenden\n" -" o OSD Mode: Aus / Suchleiste / Suchleiste + Zeit\n" -" * oder / Lautstärke verstellen ('m' für Auswahl Master/Wave)\n" -"\n" -" * * * IN DER MANPAGE STEHEN WEITERE KEYS UND OPTIONEN ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Verwendung: mplayerxp [optionen] [verzeichnis/]dateiname", +"", +"Optionen:", +" -vo <drv[:dev]> Videoausgabetreiber & -Gerät (siehe '-vo help' für eine Liste)", +" -ao <drv[:dev]> Audioausgabetreiber & -Gerät (siehe '-ao help' für eine Liste)", +" -play.ss <timepos> Starte abspielen ab Position (Sekunden oder hh:mm:ss)", +" -audio.off Spiele keinen Sound", +" -video.fs Vollbild Optionen (Vollbild, Videomode, Softwareskalierung)", +" -sub.file <file>Benutze Untertitledatei", +" -sync.framedrop Benutze frame-dropping (für langsame Rechner)", +"", +"Tasten:", +" <- oder -> Springe zehn Sekunden vor/zurück", +" rauf / runter Springe eine Minute vor/zurück", +" p oder LEER PAUSE (beliebige Taste zum Fortsetzen)", +" q oder ESC Abspielen stoppen und Programm beenden", +" o OSD Mode: Aus / Suchleiste / Suchleiste + Zeit", +" * oder / Lautstärke verstellen ('m' für Auswahl Master/Wave)", +"", +" * * * IN DER MANPAGE STEHEN WEITERE KEYS UND OPTIONEN ! * * *", +NULL +}; #endif // ========================= MPlayer Ausgaben =========================== Modified: mplayerxp/nls/mpxp_help-dk.h =================================================================== --- mplayerxp/nls/mpxp_help-dk.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-dk.h 2012-12-20 13:29:57 UTC (rev 582) @@ -4,35 +4,39 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (se DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (se DOCS!)", +NULL +}; -static char help_text[]= -"Brug: mplayerxp [muligheder] [sti/]filnavn\n" -"\n" -"Muligheder:\n" -" -vo <drv[:dev]> vælger video driver og enhed (se '-vo help for en komplet liste')\n" -" -ao <drv[:dev]> vælger lyd driver og enhed (se '-ao help for en komplet liste')\n" -" -play.ss <timepos> søger til en given (sekunder eller hh:mm:ss) position\n" -" -audio.off afspiller uden lyd\n" -" -video.fs type af afspilning i fuldskærm (fuldskærm, video mode, software skalering)\n" -" -sub.file <file>specificer undertekst-fil\n" -" -play.list<file>specificer afspilningsliste-fil\n" -" -sync.framedrop slår billede-skip til (kan hjælpe langsomme maskiner)\n" -"\n" -"Keys:\n" -" <- or -> søger 10 sekunder frem eller tilbage\n" -" up or down søger 1 minut frem eller tilbage \n" -" < or > søger frem og tilbage i en afspilningsliste\n" -" p or SPACE pause filmen (starter igen ved en vilkårlig tast)\n" -" q or ESC stop afspilning og afslut program\n" -" o vælger OSD typer: ingen / søgebar / søgebar+tid\n" -" * or / forøjer eller formindsker volumen (tryk 'm' for at vælge master/pcm)\n" -"\n" -" * * * SE MANPAGE FOR FLERE DETALJER, YDERLIGERE (AVANCEREDE) MULIGHEDER OG TASTER ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Brug: mplayerxp [muligheder] [sti/]filnavn", +"", +"Muligheder:", +" -vo <drv[:dev]> vælger video driver og enhed (se '-vo help for en komplet liste')", +" -ao <drv[:dev]> vælger lyd driver og enhed (se '-ao help for en komplet liste')", +" -play.ss <timepos> søger til en given (sekunder eller hh:mm:ss) position", +" -audio.off afspiller uden lyd", +" -video.fs type af afspilning i fuldskærm (fuldskærm, video mode, software skalering)", +" -sub.file <file>specificer undertekst-fil", +" -play.list<file>specificer afspilningsliste-fil", +" -sync.framedrop slår billede-skip til (kan hjælpe langsomme maskiner)", +"", +"Keys:", +" <- or -> søger 10 sekunder frem eller tilbage", +" up or down søger 1 minut frem eller tilbage ", +" < or > søger frem og tilbage i en afspilningsliste", +" p or SPACE pause filmen (starter igen ved en vilkårlig tast)", +" q or ESC stop afspilning og afslut program", +" o vælger OSD typer: ingen / søgebar / søgebar+tid", +" * or / forøjer eller formindsker volumen (tryk 'm' for at vælge master/pcm)", +"", +" * * * SE MANPAGE FOR FLERE DETALJER, YDERLIGERE (AVANCEREDE) MULIGHEDER OG TASTER ! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-el.h =================================================================== --- mplayerxp/nls/mpxp_help-el.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-el.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,35 +3,38 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"\n", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Usage: mplayerxp [επιλογές] [url|διαδρομή/]όνομα_αρχείου\n" -"\n" -"Βασικές επιλογές: (Ανατρέξτε στη σελίδα εγχειριδίου για ολοκληρωμένη λίστα με επιλογές)\n" -" -vo <drv[:dev]> επιλέξτε τον οδηγό εξόδου βίντεο και τη συσκευή (βλέπε '-vo help' για τη λίστα)\n" -" -ao <drv[:dev]> επιλέξτε τον οδηγό εξόδου ήχου και τη συσκευή (βλέπε '-ao help' για τη λίστα)\n" -" -play.ss <timepos> αναζήτηση σε δεδομένη θέση (δευτερόλεπτα ή ωω:λλ:δδ)\n" -" -audio.off μη αναπαραγωγή του ήχου\n" -" -video.fs επιλογές για αναπαραγωγή σε πλήρη οθόνη (ή -video.vm -video.zoom, δείτε man page για περισσότερες πληροφορίες)\n" -" -sub.file <αρχείο> επιλογή του αρχείου \n" -" -play.list <αρχείο> ορίζει το αρχείο της λίστας αναπαραγωγής\n" -" -sync.framedrop ενεργοποίηση του frame-dropping (για αργά μηχανήματα)\n" -"\n" -"Βασικά πλήκτρα: (Ανατρέξτε στη σελίδα εγχειριδίου για ολοκληρωμένη λίστα , καθώς επίσης και στο αρχείο input.conf)\n" -" <- ή -> αναζήτηση μπρος/πίσω κατά 10 δευτερόλεπτα\n" -" up ή down αναζήτηση μπρος/πίσω κατά 1 λεπτό\n" -" pgup ή pgdown αναζήτηση μπρος/πίσω κατά 10 λεπτά\n" -" < ή > αναζήτηση μπρος/πίσω στην λίστα αναπαραγωγής\n" -" p ή SPACE παύση ταινίας (πατήστε οποιοδήποτε πλήκτρο για να συνεχίσετε)\n" -" q ή ESC στοπ την αναπαραγωγή και έξοδος προγράμματος\n" -" o αλλαγή της OSD μεθόδου: τίποτα / μπάρα προόδου / μπάρα προόδου+χρόνος\n" -" * ή / αύξηση ή μείωση της έντασης του ήχου (πατήστε 'm' για επιλογή master/pcm)\n" -"\n" -" Ανατρέξτε στη σελίδα εγχειριδίου για περισσότερες λεπτομέρειες, πιο προχωρημένες επιλογές και λίστα με πλήκτρα \n" -"\n"; +static const char* help_text[]={ +"", +"Usage: mplayerxp [επιλογές] [url|διαδρομή/]όνομα_αρχείου", +"", +"Βασικές επιλογές: (Ανατρέξτε στη σελίδα εγχειριδίου για ολοκληρωμένη λίστα με επιλογές)", +" -vo <drv[:dev]> επιλέξτε τον οδηγό εξόδου βίντεο και τη συσκευή (βλέπε '-vo help' για τη λίστα)", +" -ao <drv[:dev]> επιλέξτε τον οδηγό εξόδου ήχου και τη συσκευή (βλέπε '-ao help' για τη λίστα)", +" -play.ss <timepos> αναζήτηση σε δεδομένη θέση (δευτερόλεπτα ή ωω:λλ:δδ)", +" -audio.off μη αναπαραγωγή του ήχου", +" -video.fs επιλογές για αναπαραγωγή σε πλήρη οθόνη (ή -video.vm -video.zoom, δείτε man page για περισσότερες πληροφορίες)", +" -sub.file <αρχείο> επιλογή του αρχείου ", +" -play.list <αρχείο> ορίζει το αρχείο της λίστας αναπαραγωγής", +" -sync.framedrop ενεργοποίηση του frame-dropping (για αργά μηχανήματα)", +"", +"Βασικά πλήκτρα: (Ανατρέξτε στη σελίδα εγχειριδίου για ολοκληρωμένη λίστα , καθώς επίσης και στο αρχείο input.conf)", +" <- ή -> αναζήτηση μπρος/πίσω κατά 10 δευτερόλεπτα", +" up ή down αναζήτηση μπρος/πίσω κατά 1 λεπτό", +" pgup ή pgdown αναζήτηση μπρος/πίσω κατά 10 λεπτά", +" < ή > αναζήτηση μπρος/πίσω στην λίστα αναπαραγωγής", +" p ή SPACE παύση ταινίας (πατήστε οποιοδήποτε πλήκτρο για να συνεχίσετε)", +" q ή ESC στοπ την αναπαραγωγή και έξοδος προγράμματος", +" o αλλαγή της OSD μεθόδου: τίποτα / μπάρα προόδου / μπάρα προόδου+χρόνος", +" * ή / αύξηση ή μείωση της έντασης του ήχου (πατήστε 'm' για επιλογή master/pcm)", +"", +" Ανατρέξτε στη σελίδα εγχειριδίου για περισσότερες λεπτομέρειες, πιο προχωρημένες επιλογές και λίστα με πλήκτρα ", +NULL +}; #endif #endif Modified: mplayerxp/nls/mpxp_help-en.h =================================================================== --- mplayerxp/nls/mpxp_help-en.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-en.h 2012-12-20 13:29:57 UTC (rev 582) @@ -9,62 +9,69 @@ #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static const char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static const char help_text[]= -"Usage: mplayerxp [options] [path/]filename\n" -"\n" -"Options:\n" -" -vo <drv[:dev]> select video output driver & device (see '-vo help' for list)\n" -" -ao <drv[:dev]> select audio output driver & device (see '-ao help' for list)\n" -" -play.ss <timepos> seek to given (seconds or hh:mm:ss) position\n" -" -audio.off don't play sound\n" -" -video.fs fullscreen playing options (fullscr,vidmode chg,softw.scale)\n" -" -sub.file <file> specify subtitle file to use\n" -" -play.list<file> specify playlist file\n" -" -sync.framedrop enable frame-dropping (for slow machines)\n" -"\n" -"Keys:\n" -" <- or -> seek backward/forward 10 seconds\n" -" up or down seek backward/forward 1 minute\n" -" < or > seek backward/forward in playlist\n" -" p or SPACE pause movie (press any key to continue)\n" -" q or ESC stop playing and quit program\n" -" o cycle OSD mode: none / seekbar / seekbar+timer\n" -" * or / increase or decrease volume (press 'm' to select master/pcm)\n" -"\n" -" * * * SEE MANPAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Usage: mplayerxp [options] [path/]filename", +"", +"Options:", +" -vo <drv[:dev]> select video output driver & device (see '-vo help' for list)", +" -ao <drv[:dev]> select audio output driver & device (see '-ao help' for list)", +" -play.ss <timepos> seek to given (seconds or hh:mm:ss) position", +" -audio.off don't play sound", +" -video.fs fullscreen playing options (fullscr,vidmode chg,softw.scale)," +" -sub.file <file> specify subtitle file to use", +" -play.list<file> specify playlist file", +" -sync.framedrop enable frame-dropping (for slow machines)", +"", +"Keys:", +" <- or -> seek backward/forward 10 seconds", +" up or down seek backward/forward 1 minute", +" < or > seek backward/forward in playlist", +" p or SPACE pause movie (press any key to continue)", +" q or ESC stop playing and quit program", +" o cycle OSD mode: none / seekbar / seekbar+timer", +" * or / increase or decrease volume (press 'm' to select master/pcm)", +"", +" * * * SEE MANPAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS ! * * *", +NULL +}; #endif -#endif // ========================= MPlayer messages =========================== // mplayer.c: -#ifndef MSGTR_SystemTooSlow -#define MSGTR_SystemTooSlow "\n\n"\ -" ************************************************\n"\ -" **** Your system is too SLOW to play this! ****\n"\ -" ************************************************\n"\ -"!!! Possible reasons, problems, workaround:\n"\ -"- Most common: broken/buggy AUDIO driver. Workaround: -ao sdl or -ao alsa\n"\ -"- Slow VIDEO card. Try different -vo driver (for list: -vo help)\n"\ -" -vo (*)vidix is recommended (if available) or try with -framedrop !\n"\ -"- Slow cpu. Don't try to playback big dvd/divx on slow cpu! try -hardframedrop\n"\ -"- Broken file. Try various combinations of these: -nobps -ni -mc 0 -forceidx\n"\ -"*******************************************************************************\n"\ -" Also try study these keys:\n"\ -" -video.bm (currently may work with some vidix drivers only) [speedup upto 30%]\n"\ -" '/bin/sh hdparm -u1 -d1 -a8 /dev/hdX' [25%]\n"\ -" Try disable OSD by pressing 'O' key twice [5-15%]\n"\ -"Also try to decrease the number of buffers for decoding ahead: '-core.da_buffs'\n"\ -"*******************************************************************************\n"\ -"On SMP -lavc.slices=0 may help too\n" +#ifndef MSGTR_SystemTooSlow_Text +static const char* MSGTR_SystemTooSlow[] = { +"", +" ************************************************", +" **** Your system is too SLOW to play this! ****", +" ************************************************", +"!!! Possible reasons, problems, workaround:", +"- Most common: broken/buggy AUDIO driver. Workaround: -ao sdl or -ao alsa", +"- Slow VIDEO card. Try different -vo driver (for list: -vo help)", +" -vo (*)vidix is recommended (if available) or try with -framedrop !", +"- Slow cpu. Don't try to playback big dvd/divx on slow cpu! try -hardframedrop", +"- Broken file. Try various combinations of these: -nobps -ni -mc 0 -forceidx", +"*******************************************************************************", +" Also try study these keys:", +" -video.bm (currently may work with some vidix drivers only) [speedup upto 30%]", +" '/bin/sh hdparm -u1 -d1 -a8 /dev/hdX' [25%]", +" Try disable OSD by pressing 'O' key twice [5-15%]", +"Also try to decrease the number of buffers for decoding ahead: '-core.da_buffs'", +"*******************************************************************************", +"On SMP -lavc.slices=0 may help too", +NULL +}; #endif +#endif #ifndef MSGTR_Exiting #define MSGTR_Exiting "Exiting" @@ -248,9 +255,7 @@ #define MSGTR_ConnError "Connect error: %s\n" #endif #ifndef MSGTR_ConnAuthFailed -#define MSGTR_ConnAuthFailed "Authentication failed\n"\ - "Please use the option -user and -passwd to provide your username/password for a list of URLs,\n"\ - "or form an URL like: http://username:password@hostname/file\n" +#define MSGTR_ConnAuthFailed "Authentication failed. Please use the option -user and -passwd or form an URL like: http://username:password@hostname/file" #endif #ifndef MSGTR_FileNotFound #define MSGTR_FileNotFound "File not found: '%s'\n" Modified: mplayerxp/nls/mpxp_help-es.h =================================================================== --- mplayerxp/nls/mpxp_help-es.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-es.h 2012-12-20 13:29:57 UTC (rev 582) @@ -5,35 +5,39 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (vea DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (vea DOCS!)", +NULL +}; -static char help_text[]= -"Uso: mplayerxp [opciones] [ruta/]archivo\n" -"\n" -"Opciones:\n" -" -vo <drv[:dev]> selecciona el driver de salida de video y el dispositivo ('-vo help' para obtener una lista)\n" -" -ao <drv[:dev]> selecciona el driver de salida de audio y el dispositivo ('-ao help' para obtener una lista)\n" -" -play.ss <timepos>busca una determindad posicion (en segundos o hh:mm:ss)\n" -" -audio.off no reproduce el sonido\n" -" -video.fs opciones de pantalla completa (pantalla completa,cambio de modo de video,escalado por software)\n" -" -sub.file <file> especifica el archivo de subtitulos a usar\n" -" -play.list<file> especifica el archivo con la lista de reproducción\n" -" -sync.framedrop activa frame-dropping (para máquinas lentas)\n" -"\n" -"Teclas:\n" -" <- o -> avanza/retrocede 10 segundos\n" -" arriba o abajo avanza/retrocede 1 minuto\n" -" < o > avanza/retrocede en la lista de reproducción\n" -" p o ESPACIO pausa el video (presione cualquier tecla para continuar)\n" -" q o ESC detiene la reproducción y sale del programa\n" -" o cambia el modo OSD: nada / búsqueda / búsqueda+tiempo\n" -" * o / aumenta o disminuye el volumen (presione 'm' para elegir entre master/pcm)\n" -"\n" -" * * * VEA LA PÁGINA DE MANUAL PARA MÁS DETALLES, OPCIONES AVANZADAS Y TECLAS ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Uso: mplayerxp [opciones] [ruta/]archivo", +"", +"Opciones:", +" -vo <drv[:dev]> selecciona el driver de salida de video y el dispositivo ('-vo help' para obtener una lista)", +" -ao <drv[:dev]> selecciona el driver de salida de audio y el dispositivo ('-ao help' para obtener una lista)", +" -play.ss <timepos>busca una determindad posicion (en segundos o hh:mm:ss)", +" -audio.off no reproduce el sonido", +" -video.fs opciones de pantalla completa (pantalla completa,cambio de modo de video,escalado por software)", +" -sub.file <file> especifica el archivo de subtitulos a usar", +" -play.list<file> especifica el archivo con la lista de reproducción", +" -sync.framedrop activa frame-dropping (para máquinas lentas)", +"", +"Teclas:", +" <- o -> avanza/retrocede 10 segundos", +" arriba o abajo avanza/retrocede 1 minuto", +" < o > avanza/retrocede en la lista de reproducción", +" p o ESPACIO pausa el video (presione cualquier tecla para continuar)", +" q o ESC detiene la reproducción y sale del programa", +" o cambia el modo OSD: nada / búsqueda / búsqueda+tiempo", +" * o / aumenta o disminuye el volumen (presione 'm' para elegir entre master/pcm)", +"", +" * * * VEA LA PÁGINA DE MANUAL PARA MÁS DETALLES, OPCIONES AVANZADAS Y TECLAS ! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-fr.h =================================================================== --- mplayerxp/nls/mpxp_help-fr.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-fr.h 2012-12-20 13:29:57 UTC (rev 582) @@ -5,38 +5,42 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Utilisation: mplayerxp [options] [répertoire/]fichier\n" -"\n" -"Options:\n" -" -vo <pil[:pér]> Sélectionne le pilote et le périphérique de sortie vidéo\n" -" ('-vo help' pour la liste)\n" -" -ao <pil[:pér]> Sélectionne le pilote et le périphérique de sortie audio\n" -" ('-ao help' pour la liste)\n" -" -play.ss <postemp> Démarre la lecture à partir de la pos. (secondes ou hh:mm:ss)\n" -" -audio.off Ne jouer aucun son\n" -" -video.fs Options plein-écran (fs: plein-écran, vm: changement de mode\n" -" vidéo, zoom: changement de taille (logiciel)\n" -" -sub.file <fichier>Utilise les sous-titres dans 'fichier'\n" -" -play.list<fich.>Spécifie la liste des fichiers à jouer\n" -" -sync.framedrop Active le drop d'images (pour ordinateurs lents)\n" -"\n" -"Touches:\n" -" <- ou -> Saute en avant/arrière de 10 secondes\n" -" haut ou bas Saute en avant/arrière de 1 minute\n" -" < ou > Saute en avant/arrière dans la playlist\n" -" p ou ESPACE Pause (presser n'importe quelle touche pour continuer)\n" -" q ou ESC Arrête la lecture et quitter le programme\n" -" o Mode OSD: aucun / cherchable / cherchable+temps\n" -" * ou / Augmente/diminue volume ('m' pour sélectionner maître/pcm)\n" -"\n" -" * * * IL Y A D'AUTRES TOUCHES ET OPTIONS DANS LA PAGE MAN ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Utilisation: mplayerxp [options] [répertoire/]fichier", +"", +"Options:", +" -vo <pil[:pér]> Sélectionne le pilote et le périphérique de sortie vidéo", +" ('-vo help' pour la liste)", +" -ao <pil[:pér]> Sélectionne le pilote et le périphérique de sortie audio", +" ('-ao help' pour la liste)", +" -play.ss <postemp> Démarre la lecture à partir de la pos. (secondes ou hh:mm:ss)", +" -audio.off Ne jouer aucun son", +" -video.fs Options plein-écran (fs: plein-écran, vm: changement de mode", +" vidéo, zoom: changement de taille (logiciel)", +" -sub.file <fichier>Utilise les sous-titres dans 'fichier'", +" -play.list<fich.>Spécifie la liste des fichiers à jouer", +" -sync.framedrop Active le drop d'images (pour ordinateurs lents)", +"", +"Touches:", +" <- ou -> Saute en avant/arrière de 10 secondes", +" haut ou bas Saute en avant/arrière de 1 minute", +" < ou > Saute en avant/arrière dans la playlist", +" p ou ESPACE Pause (presser n'importe quelle touche pour continuer)", +" q ou ESC Arrête la lecture et quitter le programme", +" o Mode OSD: aucun / cherchable / cherchable+temps", +" * ou / Augmente/diminue volume ('m' pour sélectionner maître/pcm)", +"", +" * * * IL Y A D'AUTRES TOUCHES ET OPTIONS DANS LA PAGE MAN ! * * *", +NULL +}; #endif // ========================= Messages MPlayer =========================== Modified: mplayerxp/nls/mpxp_help-hu.h =================================================================== --- mplayerxp/nls/mpxp_help-hu.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-hu.h 2012-12-20 13:29:57 UTC (rev 582) @@ -4,34 +4,38 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (lásd DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (lásd DOCS!)", +NULL +}; -static char help_text[]= -"Indítás: mplayerxp [opciók] [útvonal/]filenév\n" -"\n" -"Opciók:\n" -" -vo <drv[:dev]> videomeghajtó és -alegység kiválasztása (lista: '-vo help')\n" -" -ao <drv[:dev]> audiomeghajtó és -alegység kiválasztása (lista: '-ao help')\n" -" -play.ss <időpoz>a megadott (másodperc v. óra:perc:mperc) pozícióra tekerés\n" -" -audio.off hanglejátszás kikapcsolása\n" -" -video.fs teljesképernyős lejátszás opciói (teljkép,módvált,szoft.nagy)\n" -" -sub.file <file>felhasználandó felirat-file megadása\n" -" -sync.framedrop képkockák eldobásának engedélyezése (lassú gépekhez)\n" -"\n" -"Billentyűk:\n" -" <- vagy -> 10 másodperces hátra/előre ugrás\n" -" fel vagy le 1 percnyi hátra/előre ugrás\n" -" pgup v. pgdown 10 percnyi hátra/előre ugrás\n" -" p vagy SPACE pillanatállj (bármely billentyűre továbbmegy)\n" -" q vagy ESC kilépés\n" -" o OSD-mód váltása: nincs / keresősáv / keresősáv+idő\n" -" * vagy / hangerő fel/le ('m' billentyű master/pcm között vált)\n" -"\n" -" * * * A MANPAGE TOVÁBBI RÉSZLETEKET, OPCIÓKAT, BILLENTYŰKET TARTALMAZ ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Indítás: mplayerxp [opciók] [útvonal/]filenév", +"", +"Opciók:", +" -vo <drv[:dev]> videomeghajtó és -alegység kiválasztása (lista: '-vo help')", +" -ao <drv[:dev]> audiomeghajtó és -alegység kiválasztása (lista: '-ao help')", +" -play.ss <időpoz>a megadott (másodperc v. óra:perc:mperc) pozícióra tekerés", +" -audio.off hanglejátszás kikapcsolása", +" -video.fs teljesképernyős lejátszás opciói (teljkép,módvált,szoft.nagy)", +" -sub.file <file>felhasználandó felirat-file megadása", +" -sync.framedrop képkockák eldobásának engedélyezése (lassú gépekhez)", +"", +"Billentyűk:", +" <- vagy -> 10 másodperces hátra/előre ugrás", +" fel vagy le 1 percnyi hátra/előre ugrás", +" pgup v. pgdown 10 percnyi hátra/előre ugrás", +" p vagy SPACE pillanatállj (bármely billentyűre továbbmegy)", +" q vagy ESC kilépés", +" o OSD-mód váltása: nincs / keresősáv / keresősáv+idő", +" * vagy / hangerő fel/le ('m' billentyű master/pcm között vált)", +"", +" * * * A MANPAGE TOVÁBBI RÉSZLETEKET, OPCIÓKAT, BILLENTYŰKET TARTALMAZ ! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-it.h =================================================================== --- mplayerxp/nls/mpxp_help-it.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-it.h 2012-12-20 13:29:57 UTC (rev 582) @@ -7,35 +7,39 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (vedi DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (vedi DOCS!)", +NULL +}; -static char help_text[]= -"Uso: mplayerxp [opzioni] [percorso/]nome_file\n" -"\n" -"Opzioni:\n" -" -vo <drv[:dev]> seleziona il driver ed il dispositivo video di output ('-vo help' per la lista)\n" -" -ao <drv[:dev]> seleziona il driver ed il dispositivo audio di output ('-ao help' per la lista)\n" -" -play.ss <timepos>cerca una determinata posizione (in secondi o in hh:mm:ss) \n" -" -audio.off non riproduce l\'audio\n" -" -video.fs opzioni di riproduzione a schermo intero (schermo int,cambia video,scalatura softw)\n" -" -sub.file <file>specifica il file dei sottotitoli da usare\n" -" -play.list<file> specifica il file della playlist\n" -" -sync.framedrop abilita lo scarto dei fotogrammi (per macchine lente)\n" -"\n" -"Tasti:\n" -" <- o -> va indietro/avanti di 10 secondi\n" -" su o giù va indietro/avanti di 1 minuto\n" -" < o > va indietro/avanti nella playlist\n" -" p o SPAZIO mette in pausa il filmato (premere un qualunque tasto per continuare)\n" -" q o ESC ferma la riproduzione ed esce dal programma\n" -" o cambia tra le modalità OSD: niente / barra di ricerca / barra di ricerca + tempo\n" -" * o / incrementa o decrementa il volume (premere 'm' per selezionare master/pcm)\n" -"\n" -" * * * VEDI LA PAGINA MAN PER DETTAGLI, ULTERIORI OPZIONI AVANZATE E TASTI ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Uso: mplayerxp [opzioni] [percorso/]nome_file", +"", +"Opzioni:", +" -vo <drv[:dev]> seleziona il driver ed il dispositivo video di output ('-vo help' per la lista)", +" -ao <drv[:dev]> seleziona il driver ed il dispositivo audio di output ('-ao help' per la lista)", +" -play.ss <timepos>cerca una determinata posizione (in secondi o in hh:mm:ss) ", +" -audio.off non riproduce l\'audio", +" -video.fs opzioni di riproduzione a schermo intero (schermo int,cambia video,scalatura softw)", +" -sub.file <file>specifica il file dei sottotitoli da usare", +" -play.list<file> specifica il file della playlist", +" -sync.framedrop abilita lo scarto dei fotogrammi (per macchine lente)", +"", +"Tasti:", +" <- o -> va indietro/avanti di 10 secondi", +" su o giù va indietro/avanti di 1 minuto", +" < o > va indietro/avanti nella playlist", +" p o SPAZIO mette in pausa il filmato (premere un qualunque tasto per continuare)", +" q o ESC ferma la riproduzione ed esce dal programma", +" o cambia tra le modalità OSD: niente / barra di ricerca / barra di ricerca + tempo", +" * o / incrementa o decrementa il volume (premere 'm' per selezionare master/pcm)", +"", +" * * * VEDI LA PAGINA MAN PER DETTAGLI, ULTERIORI OPZIONI AVANZATE E TASTI ! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-ja.h =================================================================== --- mplayerxp/nls/mpxp_help-ja.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-ja.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,35 +3,39 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"使い方: mplayerxp [オプション] [url|パス/]ファイル名\n" -"\n" -"基本的なオプション: (man page に全て網羅されています)\n" -" -vo <drv[:dev]> 映像出力ドライバ及びデバイスを選択します ('-vo help'で一覧表示されます)\n" -" -ao <drv[:dev]> 音声出力ドライバ及びデバイスを選択します ('-ao help'で一覧表示されます)\n" -" -play.ss <timepos>timeposに与えられた場所から再生します(seconds or hh:mm:ss)\n" -" -audio.off 音声出力を抑止します\n" -" -video.fs フルスクリーン表示します(もしくは -video.vm, -video.zoom, 詳細はmanにあります)\n" -" -sub.file <file> 利用する subtitle ファイルを選択する\n" -" -play.list<file> playlistファイルを選択する\n" -" -sync.framedrop frame droppingを有効にする (低速なマシン向きです)\n" -"\n" -"基本的なコマンド: (man pageに全て網羅されています。事前にinput.confも確認して下さい)\n" -" <- or -> 10秒単位で前後にシークします\n" -" up or down 1分単位で前後にシークします\n" -" pgup or pgdown 10分単位で前後にシークします\n" -" < or > プレイリストを元に前後のファイルに遷移します\n" -" p or SPACE 再生を静止します(何かボタンを押下すると再生を開始します)\n" -" q or ESC 再生を静止し、プログラムを停止します\n" -" o cycle OSD mode: none / seekbar / seekbar + timer\n" -" * or / PCM 音量を上げたり下げたりする\n" -"\n" -" * * * man pageに詳細がありますので、確認して下さい。さらに高度で進んだオプションやキーも記載してます * * *\n" -"\n"; +static const char* help_text[]={ +"", +"使い方: mplayerxp [オプション] [url|パス/]ファイル名", +"", +"基本的なオプション: (man page に全て網羅されています)", +" -vo <drv[:dev]> 映像出力ドライバ及びデバイスを選択します ('-vo help'で一覧表示されます)", +" -ao <drv[:dev]> 音声出力ドライバ及びデバイスを選択します ('-ao help'で一覧表示されます)", +" -play.ss <timepos>timeposに与えられた場所から再生します(seconds or hh:mm:ss)", +" -audio.off 音声出力を抑止します", +" -video.fs フルスクリーン表示します(もしくは -video.vm, -video.zoom, 詳細はmanにあります)", +" -sub.file <file> 利用する subtitle ファイルを選択する", +" -play.list<file> playlistファイルを選択する", +" -sync.framedrop frame droppingを有効にする (低速なマシン向きです)", +"", +"基本的なコマンド: (man pageに全て網羅されています。事前にinput.confも確認して下さい)", +" <- or -> 10秒単位で前後にシークします", +" up or down 1分単位で前後にシークします", +" pgup or pgdown 10分単位で前後にシークします", +" < or > プレイリストを元に前後のファイルに遷移します", +" p or SPACE 再生を静止します(何かボタンを押下すると再生を開始します)", +" q or ESC 再生を静止し、プログラムを停止します", +" o cycle OSD mode: none / seekbar / seekbar + timer", +" * or / PCM 音量を上げたり下げたりする", +"", +" * * * man pageに詳細がありますので、確認して下さい。さらに高度で進んだオプションやキーも記載してます * * *", +NULL +}; #endif #endif Modified: mplayerxp/nls/mpxp_help-ko.h =================================================================== --- mplayerxp/nls/mpxp_help-ko.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-ko.h 2012-12-20 13:29:57 UTC (rev 582) @@ -7,35 +7,39 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (DOCS 참조!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (DOCS 참조!)", +NULL +}; -static char help_text[]= -"사용법: mplayerxp [선택사항] [경로/]파일명\n" -"\n" -"선택사항들:\n" -" -vo <drv[:dev]> 비디오 출력 드라이버 및 장치 선택 (목록보기는 '-vo help')\n" -" -ao <drv[:dev]> 오디오 출력 드라이버 및 장치 선택 (목록보기는 '-ao help')\n" -" -play.ss <timepos>특정 위치로 찾아가기 (초 또는 시:분:초)\n" -" -audio.off 소리 재생 안함\n" -" -video.fs 화면 크기 지정 (전체화면, 비디오모드, s/w확대)\n" -" -sub.file <file> 사용할 자막파일 지정\n" -" -play.list<file> 재생목록파일 지정\n" -" -sync.framedrop 프레임 빠뜨리기 사용 (느린 machine용)\n" -"\n" -"조정키:\n" -" <- 또는 -> 10초 뒤로/앞으로 이동\n" -" up 또는 dn 1분 뒤로/앞으로 이동\n" -" < 또는 > 재생목록에서 뒤로/앞으로 이동\n" -" p 또는 SPACE 잠시 멈춤 (아무키나 누르면 계속)\n" -" q 또는 ESC 재생을 멈추고 프로그램을 끝냄\n" -" o OSD모드 변경: 없음/탐색줄/탐색줄+타이머\n" -" * 또는 / 볼륨 높임/낮춤 ('m'을 눌러 master/pcm 선택)\n" -"\n" -" * * * 자세한 사항(더 많은 선택사항 및 조정키등)은 MANPAGE를 참조하세요 ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"사용법: mplayerxp [선택사항] [경로/]파일명", +"", +"선택사항들:", +" -vo <drv[:dev]> 비디오 출력 드라이버 및 장치 선택 (목록보기는 '-vo help')", +" -ao <drv[:dev]> 오디오 출력 드라이버 및 장치 선택 (목록보기는 '-ao help')", +" -play.ss <timepos>특정 위치로 찾아가기 (초 또는 시:분:초)", +" -audio.off 소리 재생 안함", +" -video.fs 화면 크기 지정 (전체화면, 비디오모드, s/w확대)", +" -sub.file <file> 사용할 자막파일 지정", +" -play.list<file> 재생목록파일 지정", +" -sync.framedrop 프레임 빠뜨리기 사용 (느린 machine용)", +"", +"조정키:", +" <- 또는 -> 10초 뒤로/앞으로 이동", +" up 또는 dn 1분 뒤로/앞으로 이동", +" < 또는 > 재생목록에서 뒤로/앞으로 이동", +" p 또는 SPACE 잠시 멈춤 (아무키나 누르면 계속)", +" q 또는 ESC 재생을 멈추고 프로그램을 끝냄", +" o OSD모드 변경: 없음/탐색줄/탐색줄+타이머", +" * 또는 / 볼륨 높임/낮춤 ('m'을 눌러 master/pcm 선택)", +"", +" * * * 자세한 사항(더 많은 선택사항 및 조정키등)은 MANPAGE를 참조하세요 ! * * *", +NULL +}; #endif // ========================= MPlayer 메세지 =========================== Modified: mplayerxp/nls/mpxp_help-mk.h =================================================================== --- mplayerxp/nls/mpxp_help-mk.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-mk.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,35 +3,39 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Употреба: mplayerxp [опции] [url|патека/]ИмеНаДатотеката\n" -"\n" -"Основни Опции: (комплетна листа на man страницата)\n" -" -vo <drv[:dev]> избира излезен видео драјвер и уред ('-vo help' за листа)\n" -" -ao <drv[:dev]> избира излезен аудио драјвер и уред ('-ao help' за листа)\n" -" -play.ss <timepos>бара до дадената (секунди или hh:mm:ss) позиција\n" -" -audio.off не го пушта звукот\n" -" -video.fs плејбек на цел екран (или -video.vm, -video.zoom, подетално во man страната)\n" -" -sub.file <file> одредува датотека со превод за употреба\n" -" -play.list <file>одредува датотека со плејлиста\n" -" -sync.framedrop овозможува отфрлање на фрејмови (за слаби машини)\n" -"\n" -"Основни копчиња: (комплетна листа во man страната, проверете го исто така и input.conf)\n" -" <- или -> бара назад/напред за 10 секунди\n" -" up или down бара назад/напред за 1 минута\n" -" pgup или pgdown бара назад/напред за 10 минути\n" -" < или > чекор назад/напред во плејлистата\n" -" p или SPACE го паузира филмот (притиснете на било кое копче да продолжи)\n" -" q или ESC го стопира пуштањето и излегува од програмата\n" -" o цикличен OSD мод: ниеден / барот за барање / барот за барање + тајмер\n" -" * или / зголемување или намалување на PCM тонот\n" -"\n" -" * * * ВИДЕТЕ ЈА MAN СТРАНАТА ЗА ДЕТАЛИ, ПОВЕЌЕ (НАПРЕДНИ) ОПЦИИ И КОПЧИЊА* * *\n" -"\n"; +static const char* help_text[]={ +"", +"Употреба: mplayerxp [опции] [url|патека/]ИмеНаДатотеката", +"", +"Основни Опции: (комплетна листа на man страницата)", +" -vo <drv[:dev]> избира излезен видео драјвер и уред ('-vo help' за листа)", +" -ao <drv[:dev]> избира излезен аудио драјвер и уред ('-ao help' за листа)", +" -play.ss <timepos>бара до дадената (секунди или hh:mm:ss) позиција", +" -audio.off не го пушта звукот", +" -video.fs плејбек на цел екран (или -video.vm, -video.zoom, подетално во man страната)", +" -sub.file <file> одредува датотека со превод за употреба", +" -play.list <file>одредува датотека со плејлиста", +" -sync.framedrop овозможува отфрлање на фрејмови (за слаби машини)", +"", +"Основни копчиња: (комплетна листа во man страната, проверете го исто така и input.conf)", +" <- или -> бара назад/напред за 10 секунди", +" up или down бара назад/напред за 1 минута", +" pgup или pgdown бара назад/напред за 10 минути", +" < или > чекор назад/напред во плејлистата", +" p или SPACE го паузира филмот (притиснете на било кое копче да продолжи)", +" q или ESC го стопира пуштањето и излегува од програмата", +" o цикличен OSD мод: ниеден / барот за барање / барот за барање + тајмер", +" * или / зголемување или намалување на PCM тонот", +"", +" * * * ВИДЕТЕ ЈА MAN СТРАНАТА ЗА ДЕТАЛИ, ПОВЕЌЕ (НАПРЕДНИ) ОПЦИИ И КОПЧИЊА* * *", +NULL +}; #endif #endif Modified: mplayerxp/nls/mpxp_help-nb.h =================================================================== --- mplayerxp/nls/mpxp_help-nb.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-nb.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,33 +3,37 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Bruk: mplayerxp [valg] [sti/]filnavn\n" -"\n" -"Valg:\n" -" -vo <drv[:dev]> velg video-ut driver og enhet (se '-vo help' for liste)\n" -" -ao <drv[:dev]> velg lyd-ut driver og enhet (se '-ao help' for liste)\n" -" -play.ss <timepos>søk til gitt (sekunder eller hh:mm:ss) posisjon\n" -" -audio.off ikke spill av lyd\n" -" -video.fs fullskjerm avspillings valg (fullscr,vidmode chg,softw.scale)\n" -" -sub.file <fil> spesifiser hvilken subtitle fil som skal brukes\n" -" -sync.framedrop slå på bilde-dropping (for trege maskiner)\n" -"\n" -"Tastatur:\n" -" <- eller -> søk bakover/fremover 10 sekunder\n" -" opp eller ned søk bakover/fremover 1 minutt\n" -" < or > søk bakover/fremover i playlisten\n" -" p eller MELLOMROM pause filmen (trykk en tast for å fortsette)\n" -" q eller ESC stopp avspilling og avslutt programmet\n" -" o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning\n" -" * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)\n" -"\n" -" * * * SE PÅ MANSIDE FOR DETALJER, FLERE (AVANSERTE) VALG OG TASTER! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Bruk: mplayerxp [valg] [sti/]filnavn", +"", +"Valg:", +" -vo <drv[:dev]> velg video-ut driver og enhet (se '-vo help' for liste)", +" -ao <drv[:dev]> velg lyd-ut driver og enhet (se '-ao help' for liste)", +" -play.ss <timepos>søk til gitt (sekunder eller hh:mm:ss) posisjon", +" -audio.off ikke spill av lyd", +" -video.fs fullskjerm avspillings valg (fullscr,vidmode chg,softw.scale)", +" -sub.file <fil> spesifiser hvilken subtitle fil som skal brukes", +" -sync.framedrop slå på bilde-dropping (for trege maskiner)", +"", +"Tastatur:", +" <- eller -> søk bakover/fremover 10 sekunder", +" opp eller ned søk bakover/fremover 1 minutt", +" < or > søk bakover/fremover i playlisten", +" p eller MELLOMROM pause filmen (trykk en tast for å fortsette)", +" q eller ESC stopp avspilling og avslutt programmet", +" o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning", +" * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)", +"", +" * * * SE PÅ MANSIDE FOR DETALJER, FLERE (AVANSERTE) VALG OG TASTER! * * *", +NULL +}; #endif #endif Modified: mplayerxp/nls/mpxp_help-nl.h =================================================================== --- mplayerxp/nls/mpxp_help-nl.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-nl.h 2012-12-20 13:29:57 UTC (rev 582) @@ -2,36 +2,40 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (zie DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (zie DOCS!)", +NULL +}; -static char help_text[]= -"Gebruik: mplayerxp [opties] [pad/]bestandsnaam\n" -"\n" -"Opties:\n" -" -vo <drv[:dev]> selecteer video uitvoer driver & device (zie '-vo help' voor lijst)\n" -" -ao <drv[:dev]> selecteer audio uitvoer driver & device (zie '-ao help' voor lijst)\n" -" -play.ss <timepos>ga naar opgegeven (seconden of hh:mm:ss) positie\n" -" -audio.off speel het geluid niet af\n" -" -video.fs volledig scherm afspeel opties (fullscr,vidmode chg,softw.scale)\n" -" -sub.file <bestand>specificeer het te gebruiken ondertitel bestand\n" -" -play.list<file> specificeer het te gebruiken playlist bestand\n" -" -sync.framedrop activeer frame-dropping (voor trage machines)\n" -"\n" -"Toetsen:\n" -" <- of -> ga 10 seconden achterwaarts/voorwaarts\n" -" omhoog of omlaag ga 1 minuut achterwaarts/voorwaarts\n" -" PGUP of PGDOWN ga 10 minuten achterwaarts/voorwaarts\n" -" < or > ga naar vorige/volgende item in playlist\n" -" p of SPACE pauzeer film (druk eender welke toets om verder te gaan)\n" -" q of ESC stop afspelen en sluit programma af\n" -" o cycle OSD mode: geen / zoekbalk / zoekbalk+tijd\n" -" * of / verhoog of verlaag volume (druk 'm' om master/pcm te selecteren)\n" -"\n" -" * * * ZIE MANPAGE VOOR DETAILS, OVERIGE (GEAVANCEERDE) OPTIES EN TOETSEN ! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Gebruik: mplayerxp [opties] [pad/]bestandsnaam", +"", +"Opties:", +" -vo <drv[:dev]> selecteer video uitvoer driver & device (zie '-vo help' voor lijst)", +" -ao <drv[:dev]> selecteer audio uitvoer driver & device (zie '-ao help' voor lijst)", +" -play.ss <timepos>ga naar opgegeven (seconden of hh:mm:ss) positie", +" -audio.off speel het geluid niet af", +" -video.fs volledig scherm afspeel opties (fullscr,vidmode chg,softw.scale)", +" -sub.file <bestand>specificeer het te gebruiken ondertitel bestand", +" -play.list<file> specificeer het te gebruiken playlist bestand", +" -sync.framedrop activeer frame-dropping (voor trage machines)", +"", +"Toetsen:", +" <- of -> ga 10 seconden achterwaarts/voorwaarts", +" omhoog of omlaag ga 1 minuut achterwaarts/voorwaarts", +" PGUP of PGDOWN ga 10 minuten achterwaarts/voorwaarts", +" < or > ga naar vorige/volgende item in playlist", +" p of SPACE pauzeer film (druk eender welke toets om verder te gaan)", +" q of ESC stop afspelen en sluit programma af", +" o cycle OSD mode: geen / zoekbalk / zoekbalk+tijd", +" * of / verhoog of verlaag volume (druk 'm' om master/pcm te selecteren)", +"", +" * * * ZIE MANPAGE VOOR DETAILS, OVERIGE (GEAVANCEERDE) OPTIES EN TOETSEN ! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-no.h =================================================================== --- mplayerxp/nls/mpxp_help-no.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-no.h 2012-12-20 13:29:57 UTC (rev 582) @@ -5,34 +5,38 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (se DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (se DOCS!)", +NULL +}; -static char help_text[]= -"Bruk: mplayerxp [valg] [sti/]filnavn\n" -"\n" -"Valg:\n" -" -vo <drv[:dev]> velg video-ut driver og enhet (se '-vo help' for liste)\n" -" -ao <drv[:dev]> velg lyd-ut driver og enhet (se '-ao help' for liste)\n" -" -play.ss <timepos>søk til gitt (sekunder eller hh:mm:ss) posisjon\n" -" -audio.off ikke spill av lyd\n" -" -video.fs fullskjerm avspillings valg (fullscr,vidmode chg,softw.scale)\n" -" -sub.file <fil> spesifiser hvilken subtitle fil som skal brukes\n" -" -sync.framedrop slå på bilde-dropping (for trege maskiner)\n" -"\n" -"Tastatur:\n" -" <- eller -> søk bakover/fremover 10 sekunder\n" -" opp eller ned søk bakover/fremover 1 minutt\n" -" < or > søk bakover/fremover i playlisten\n" -" p eller MELLOMROM pause filmen (trykk en tast for å fortsette)\n" -" q eller ESC stopp avspilling og avslutt programmet\n" -" o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning\n" -" * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)\n" -"\n" -" * * * SE PÅ MANSIDE FOR DETALJER, FLERE (AVANSERTE) VALG OG TASTER! * * *\n" -"\n"; +static const char* help_text[]={ +"", +"Bruk: mplayerxp [valg] [sti/]filnavn", +"", +"Valg:", +" -vo <drv[:dev]> velg video-ut driver og enhet (se '-vo help' for liste)", +" -ao <drv[:dev]> velg lyd-ut driver og enhet (se '-ao help' for liste)", +" -play.ss <timepos>søk til gitt (sekunder eller hh:mm:ss) posisjon", +" -audio.off ikke spill av lyd", +" -video.fs fullskjerm avspillings valg (fullscr,vidmode chg,softw.scale)", +" -sub.file <fil> spesifiser hvilken subtitle fil som skal brukes", +" -sync.framedrop slå på bilde-dropping (for trege maskiner)", +"", +"Tastatur:", +" <- eller -> søk bakover/fremover 10 sekunder", +" opp eller ned søk bakover/fremover 1 minutt", +" < or > søk bakover/fremover i playlisten", +" p eller MELLOMROM pause filmen (trykk en tast for å fortsette)", +" q eller ESC stopp avspilling og avslutt programmet", +" o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning", +" * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)", +"", +" * * * SE PÅ MANSIDE FOR DETALJER, FLERE (AVANSERTE) VALG OG TASTER! * * *", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-pl.h =================================================================== --- mplayerxp/nls/mpxp_help-pl.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-pl.h 2012-12-20 13:29:57 UTC (rev 582) @@ -4,36 +4,40 @@ #ifdef HELP_MPXP_DEFINE_STATIC #define MSGTR_BANNER_TEXT 1 -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Użycie: mplayerxp [opcje] [ścieżka/]nazwa\n" -"\n" -"Opcje:\n" -" -vo <drv[:dev]> wybór sterownika[:urządzenia] video (lista po '-vo help')\n" -" -ao <drv[:dev]> wybór sterownika[:urządzenia] audio (lista po '-ao help')\n" -" -play.ss <timepos>skok do podanej pozycji (sekundy albo hh:mm:ss)\n" -" -audio.off odtwarzanie bez dźwięku\n" -" -video.fs opcje pełnoekranowe (pełen ekran,zmiana trybu,skalowanie)\n" -" -sub.file <file>wybór pliku z napisami\n" -" -play.list<file>wybór pliku z playlistą\n" -" -sync.framedrop gubienie klatek (dla wolnych maszyn)\n" -"\n" -"Klawisze:\n" -" Right,Up,PgUp skok naprzód o 10 sekund, 1 minutę, 10 minut\n" -" Left,Down,PgDn skok do tyłu o 10 sekund, 1 minutę, 10 minut\n" -" < lub > przeskok o jedną pozycję w playliście\n" -" p lub SPACE zatrzymanie filmu (kontynuacja - dowolny klawisz)\n" -" q lub ESC zatrzymanie odtwarzania i wyjście z programu\n" -" o przełączanie trybów OSD: pusty / belka / belka i zegar\n" -" * lub / zwiększenie lub zmniejszenie natężenia dźwięku\n" -" (naciśnij 'm' żeby wybrać master/pcm)\n" -"\n" -" **** DOKŁADNY SPIS WSZYSTKICH DOSTĘPNYCH OPCJI ZNAJDUJE SIĘ W MANUALU! ****\n" -"\n"; +static const char* help_text[]={ +"", +"Użycie: mplayerxp [opcje] [ścieżka/]nazwa", +"", +"Opcje:", +" -vo <drv[:dev]> wybór sterownika[:urządzenia] video (lista po '-vo help')", +" -ao <drv[:dev]> wybór sterownika[:urządzenia] audio (lista po '-ao help')", +" -play.ss <timepos>skok do podanej pozycji (sekundy albo hh:mm:ss)", +" -audio.off odtwarzanie bez dźwięku", +" -video.fs opcje pełnoekranowe (pełen ekran,zmiana trybu,skalowanie)", +" -sub.file <file>wybór pliku z napisami", +" -play.list<file>wybór pliku z playlistą", +" -sync.framedrop gubienie klatek (dla wolnych maszyn)", +"", +"Klawisze:", +" Right,Up,PgUp skok naprzód o 10 sekund, 1 minutę, 10 minut", +" Left,Down,PgDn skok do tyłu o 10 sekund, 1 minutę, 10 minut", +" < lub > przeskok o jedną pozycję w playliście", +" p lub SPACE zatrzymanie filmu (kontynuacja - dowolny klawisz)", +" q lub ESC zatrzymanie odtwarzania i wyjście z programu", +" o przełączanie trybów OSD: pusty / belka / belka i zegar", +" * lub / zwiększenie lub zmniejszenie natężenia dźwięku", +" (naciśnij 'm' żeby wybrać master/pcm)", +"", +" **** DOKŁADNY SPIS WSZYSTKICH DOSTĘPNYCH OPCJI ZNAJDUJE SIĘ W MANUALU! ****", +NULL +}; #endif // ========================= MPlayer messages =========================== Modified: mplayerxp/nls/mpxp_help-pt.h =================================================================== --- mplayerxp/nls/mpxp_help-pt.h 2012-12-20 09:57:50 UTC (rev 581) +++ mplayerxp/nls/mpxp_help-pt.h 2012-12-20 13:29:57 UTC (rev 582) @@ -3,38 +3,42 @@ // UTF-8 #ifdef HELP_MPXP_DEFINE_STATIC #ifndef MSGTR_BANNER_TEXT -static char* banner_text= -"\n\n" -"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)\n" -"\n"; +static const char* banner_text[]={ +"", +"", +"MPlayerXP " VERSION "(C) 2002 Nickols_K 2000-2002 Arpad Gereoffy (see DOCS!)", +NULL +}; -static char help_text[]= -"Uso: mplayerxp [opções] [url|caminho/]nome-d... [truncated message content] |
From: <nic...@us...> - 2012-12-20 09:58:00
|
Revision: 581 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=581&view=rev Author: nickols_k Date: 2012-12-20 09:57:50 +0000 (Thu, 20 Dec 2012) Log Message: ----------- remove many NLS translations because they are incompatible with new stream-based output methods. Furthermore, project should distinguish RTL and LTR probably with using of std::pair or std::tuple classes Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpstream2/stream.cpp mplayerxp/mplayerxp.cpp mplayerxp/nls/mpxp_help-cz.h mplayerxp/nls/mpxp_help-de.h mplayerxp/nls/mpxp_help-dk.h mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-es.h mplayerxp/nls/mpxp_help-fr.h mplayerxp/nls/mpxp_help-hu.h mplayerxp/nls/mpxp_help-it.h mplayerxp/nls/mpxp_help-ko.h mplayerxp/nls/mpxp_help-nl.h mplayerxp/nls/mpxp_help-no.h mplayerxp/nls/mpxp_help-pl.h mplayerxp/nls/mpxp_help-ro.h mplayerxp/nls/mpxp_help-ru.h mplayerxp/nls/mpxp_help-sk.h Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/dump.cpp 2012-12-20 09:57:50 UTC (rev 581) @@ -59,7 +59,7 @@ f=fopen(name,"wb"); if(!f){ MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } MSG_INFO("Dumping stream to %s\n",name); while(!stream->eof()){ @@ -137,17 +137,17 @@ else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); else { MSG_FATAL("Unsupported muxer format %s found\n",media); - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } priv->mux_file=fopen(stream_dump_name,"wb"); MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); if(!priv->mux_file){ MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { MSG_FATAL("Can't initialize muxer\n"); - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-20 09:57:50 UTC (rev 581) @@ -2,6 +2,8 @@ #include "osdep/mplib.h" using namespace mpxp; //=================== DEMUXER v2.5 ========================= +#include <iomanip> + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -163,7 +165,7 @@ Demuxer::~Demuxer() { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); unsigned i; - MSG_V("DEMUXER: freeing demuxer at %p \n",this); + mpxp_v<<"[Demuxer]: "<<"freeing demuxer at 0x"<<std::hex<<reinterpret_cast<long>(this)<<std::endl; if(dpriv.driver) dpriv.driver->close(this); @@ -180,8 +182,7 @@ { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_A_STREAMS-1 || id < 0) { - MSG_WARN("Requested audio stream id overflow (%d > %d)\n", - id, MAX_A_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested audio stream id overflow ("<<id<<" > "<<MAX_A_STREAMS<<")"<<std::endl; return NULL; } check_pin("demuxer",pin,DEMUX_PIN); @@ -191,21 +192,20 @@ sh_audio_t* Demuxer::new_sh_audio_aid(int id,int aid) { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_A_STREAMS-1 || id < 0) { - MSG_WARN("Requested audio stream id overflow (%d > %d)\n", - id, MAX_A_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested audio stream id overflow ("<<id<<" > "<<MAX_A_STREAMS<<")"<<std::endl; return NULL; } if(dpriv.a_streams[id]) { - MSG_WARN(MSGTR_AudioStreamRedefined,id); + mpxp_warn<<MSGTR_AudioStreamRedefined<<": "<<id<<std::endl; } else { sh_audio_t *sh; - MSG_V("==> Found audio stream: %d\n",id); + mpxp_v<<"Demuxer: "<<"==> Found audio stream: "<<id<<std::endl; dpriv.a_streams[id]=new(zeromem) sh_audio_t; sh = dpriv.a_streams[id]; // set some defaults sh->afmt=bps2afmt(2); /* PCM */ sh->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ - MSG_V("ID_AUDIO_ID=%d\n", aid); + mpxp_v<<"Demuxer: "<<"ID_AUDIO_ID="<<aid<<std::endl; } dpriv.a_streams[id]->id = aid; check_pin("demuxer",pin,DEMUX_PIN); @@ -216,8 +216,7 @@ { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_V_STREAMS-1 || id < 0) { - MSG_WARN("Requested video stream id overflow (%d > %d)\n", - id, MAX_V_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested video stream id overflow ("<<id<<" > "<<MAX_V_STREAMS<<")"<<std::endl; return NULL; } check_pin("demuxer",pin,DEMUX_PIN); @@ -227,16 +226,15 @@ sh_video_t* Demuxer::new_sh_video_vid(int id,int vid) { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_V_STREAMS-1 || id < 0) { - MSG_WARN("Requested video stream id overflow (%d > %d)\n", - id, MAX_V_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested video stream id overflow ("<<id<<" > "<<MAX_V_STREAMS<<")"<<std::endl; return NULL; } if(dpriv.v_streams[id]) { - MSG_WARN(MSGTR_VideoStreamRedefined,id); + mpxp_warn<<"[Demuxer]: "<<MSGTR_VideoStreamRedefined<<": "<<id<<std::endl; } else { - MSG_V("==> Found video stream: %d\n",id); + mpxp_v<<"[Demuxer]: "<<"==> Found video stream: "<<id<<std::endl; dpriv.v_streams[id]=new(zeromem) sh_video_t; - MSG_V("ID_VIDEO_ID=%d\n", vid); + mpxp_v<<"[Demuxer]: "<<"ID_VIDEO_ID="<<vid<<std::endl; } dpriv.v_streams[id]->id = vid; check_pin("demuxer",pin,DEMUX_PIN); @@ -247,8 +245,7 @@ { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_A_STREAMS-1 || id < 0) { - MSG_WARN("Requested sub stream id overflow (%d > %d)\n", - id, MAX_A_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested sub stream id overflow ("<<id<<" > "<<MAX_S_STREAMS<<")"<<std::endl; return NULL; } check_pin("demuxer",pin,DEMUX_PIN); @@ -258,14 +255,13 @@ char Demuxer::new_sh_sub(int id) { demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); if(id > MAX_V_STREAMS-1 || id < 0) { - MSG_WARN("Requested video stream id overflow (%d > %d)\n", - id, MAX_V_STREAMS); + mpxp_warn<<"[Demuxer]: "<<"Requested sub stream id overflow ("<<id<<" > "<<MAX_S_STREAMS<<")"<<std::endl; return NULL; } if(dpriv.s_streams[id]) { - MSG_WARN(MSGTR_SubStreamRedefined,id); + mpxp_warn<<"[Demuxer]: "<<MSGTR_SubStreamRedefined<<": "<<id<<std::endl; } else { - MSG_V("==> Found video stream: %d\n",id); + mpxp_v<<"[Demuxer]: "<<"==> Found video stream: "<<id<<std::endl; dpriv.s_streams[id]=1; } check_pin("demuxer",pin,DEMUX_PIN); @@ -379,15 +375,15 @@ const demuxer_driver_t* drv; drv=demux_find_driver(demux_conf.type); if(!drv) { - MSG_ERR("Can't find demuxer driver: '%s'\n",demux_conf.type); + mpxp_err<<"[Demuxer]: "<<"Can't find demuxer driver: '"<<demux_conf.type<<"'"<<std::endl; goto err_exit; } - MSG_V("Forcing %s ... ",drv->name); + mpxp_v<<"[Demuxer]: "<<"Forcing "<<drv->name<<" ..."<<std::endl; /* don't remove it from loop!!! (for initializing) */ stream->reset(); stream->seek(stream->start_pos()); if(drv->probe(this)!=MPXP_Ok) { - MSG_ERR("Can't probe stream with driver: '%s'\n",demux_conf.type); + mpxp_err<<"[Demuxer]: "<<"Can't probe stream with driver: '"<<demux_conf.type<<"'"<<std::endl; goto err_exit; } dpriv.driver = drv; @@ -395,34 +391,34 @@ } again: for(;ddrivers[i]!=&demux_null;i++) { - MSG_V("Probing %s ... ",ddrivers[i]->name); + mpxp_v<<"[Demuxer]: "<<"Probing "<<ddrivers[i]->name<<" ...:"; /* don't remove it from loop!!! (for initializing) */ stream->reset(); stream->seek(stream->start_pos()); if(ddrivers[i]->probe(this)==MPXP_Ok) { - MSG_V("OK\n"); + mpxp_v<<"Ok"<<std::endl; dpriv.driver = ddrivers[i]; break; } - MSG_V("False\n"); + mpxp_v<<"False"<<std::endl; } if(!dpriv.driver) { dpriv.driver=demuxer_driver_by_name(stream->mime_type()); if(dpriv.driver!=&demux_null) goto force_driver; dpriv.driver=NULL; err_exit: - MSG_ERR(MSGTR_FormatNotRecognized); + mpxp_err<<"[Demuxer]: "<<MSGTR_FormatNotRecognized<<std::endl; return MPXP_False; } force_driver: if(!(priv=dpriv.driver->open(this))) { - MSG_ERR("Can't open stream with '%s'\n", dpriv.driver->name); + mpxp_err<<"[Demuxer]: "<<"Can't open stream with '"<<dpriv.driver->name<<"'"<<std::endl; dpriv.driver=NULL; i++; if(demux_conf.type) goto err_exit; else goto again; } - MSG_OK("Using: %s\n",dpriv.driver->name); + mpxp_ok<<"[Demuxer]: "<<"Using: "<<dpriv.driver->name<<std::endl; for(i=0;i<sizeof(stream_txt_ids)/sizeof(struct s_stream_txt_ids);i++) if(!info().get(stream_txt_ids[i].demuxer_id)) { char stream_name[256]; @@ -441,7 +437,7 @@ if(demux_conf.audio_stream) { as = new(zeromem) Stream(); if(as->open(libinput,demux_conf.audio_stream,&afmt)!=MPXP_Ok) { - MSG_ERR("Can't open audio stream: %s\n",demux_conf.audio_stream); + mpxp_err<<"[Demuxer]: "<<"Can't open audio stream: "<<demux_conf.audio_stream<<std::endl; delete as; return NULL; } @@ -449,7 +445,7 @@ if(demux_conf.sub_stream) { ss = new(zeromem) Stream(); if(ss->open(libinput,demux_conf.sub_stream,&sfmt)!=MPXP_Ok) { - MSG_ERR("Can't open subtitles stream: %s\n",demux_conf.sub_stream); + mpxp_err<<"[Demuxer]: "<<"Can't open subtitles stream: "<<demux_conf.sub_stream<<std::endl; delete ss; return NULL; } @@ -463,7 +459,7 @@ if(as) { ad = new(zeromem) Demuxer(as,audio_id,-2,-2); if(ad->open()!=MPXP_Ok) { - MSG_WARN("Failed to open audio demuxer: %s\n",demux_conf.audio_stream); + mpxp_warn<<"[Demuxer]: "<<"Failed to open audio demuxer: "<<demux_conf.audio_stream<<std::endl; delete ad; ad = NULL; } else if(ad->audio->sh && ((sh_audio_t*)ad->audio->sh)->wtag == 0x55) // MP3 @@ -472,7 +468,7 @@ if(ss) { sd = new(zeromem) Demuxer(ss,-2,-2,dvdsub_id); if(sd->open()!=MPXP_Ok) { - MSG_WARN("Failed to open subtitles demuxer: %s\n",demux_conf.sub_stream); + mpxp_warn<<"[Demuxer]: "<<"Failed to open subtitles demuxer: "<<demux_conf.sub_stream<<std::endl; delete sd; sd = NULL; } } @@ -492,12 +488,12 @@ if(!(stream->type()&Stream::Type_Seekable)) { - MSG_WARN("Stream is not seekable\n"); + mpxp_warn<<"[Demuxer]: "<<"Stream is not seekable"<<std::endl; return 0; } if(!(flags&Seekable)) { - MSG_WARN("Demuxer is not seekable\n"); + mpxp_warn<<"[Demuxer]: "<<"Demuxer is not seekable"<<std::endl; return 0; } @@ -513,7 +509,7 @@ if(sh_audio) sh_audio->timer=0; if(dpriv.driver->seek) dpriv.driver->seek(this,seeka); - else MSG_WARN("Demuxer seek error\n"); + else mpxp_warn<<"[Demuxer]: "<<"seek error"<<std::endl; check_pin("demuxer",pin,DEMUX_PIN); return 1; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-20 09:57:50 UTC (rev 581) @@ -13,7 +13,6 @@ struct demuxer_driver_t; extern int index_mode; /**< -1=untouched 0=don't use index 1=use (geneate) index */ namespace mpxp { -#define MAX_PACK_BYTES (0x1024*0x1024*4) /** Describes interface to stream associated with this demuxer */ enum { DS_PIN=RND_NUMBER1+RND_CHAR1 @@ -22,7 +21,8 @@ enum { MAX_A_STREAMS =256, MAX_V_STREAMS =256, - MAX_S_STREAMS =256 + MAX_S_STREAMS =256, + MAX_PACK_BYTES =(0x1024*0x1024*4) }; /** Describes demuxer (demultiplexer) of movie */ Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/libmpstream2/stream.cpp 2012-12-20 09:57:50 UTC (rev 581) @@ -2,6 +2,7 @@ #include "osdep/mplib.h" using namespace mpxp; #include <algorithm> +#include <iomanip> #include <ctype.h> #include <errno.h> @@ -101,7 +102,7 @@ } Stream::~Stream(){ - MSG_INFO("\n*** free_stream(drv:%s) called [errno: %s]***\n",driver_info->mrl,strerror(errno)); + mpxp_info<<std::endl<<"*** free_stream(drv:"<<driver_info->mrl<<") called [errno: "<<strerror(errno)<<"]***"<<std::endl; if(driver) close(); delete driver; } @@ -131,18 +132,18 @@ for(i=0;sdrivers[i]!=&null_stream;i++) { mrl_len=strlen(sdrivers[i]->mrl); if(filename.substr(0,mrl_len)==sdrivers[i]->mrl||sdrivers[i]->mrl[0]=='*') { - MSG_V("Opening %s ... ",sdrivers[i]->mrl); + mpxp_v<<"[Stream]: "<<"Opening "<<sdrivers[i]->mrl<<" ... "; Stream_Interface* drv = sdrivers[i]->query_interface(libinput); if(sdrivers[i]->mrl[0]=='*') mrl_len=0; if(drv->open(&filename[mrl_len],0)==MPXP_Ok) { - MSG_V("OK\n"); + mpxp_v<<"Ok"<<std::endl; *ff = file_format; driver_info=sdrivers[i]; driver=drv; return MPXP_Ok; } delete drv; - MSG_V("False\n"); + mpxp_v<<"False"<<std::endl; } } Stream_Interface* file_drv = file_stream.query_interface(libinput); @@ -171,10 +172,12 @@ /* ------------ print packet ---------- */ unsigned j,_lim=std::min(sp.len,20); int printable=1; - MSG_DBG4("%i=[stream.read(%p,%i)] [%016X]",rc,sp.buf,sp.len,_off); + mpxp_dbg4<<rc<<"=[stream.read("<<sp.buf<<","<<sp.len<<")] ["<<std::hex<<std::setfill('0')<<std::setw(16)<<_off<<"] "; for(j=0;j<_lim;j++) { if(!isprint(sp.buf[j])) { printable=0; break; } } - if(printable) MSG_DBG4("%20s",sp.buf); - else for(j=0;j<_lim;j++) MSG_DBG4("%02X ",(unsigned char)sp.buf[j]); + if(printable) mpxp_dbg4<<std::string(sp.buf).substr(0,20); + else for(j=0;j<_lim;j++) + mpxp_dbg4<<std::hex<<std::setfill('0')<<std::setw(2)<<(unsigned)sp.buf[j]; + mpxp_dbg4<<std::endl; /* ------------ print packet ---------- */ return rc; } @@ -243,9 +246,9 @@ void Stream::print_drivers() { unsigned i; - MSG_INFO("Available stream drivers:\n"); + mpxp_info<<"[Stream]: "<<"Available stream drivers:"<<std::endl; for(i=0;sdrivers[i];i++) { - MSG_INFO(" %-10s %s\n",sdrivers[i]->mrl,sdrivers[i]->descr); + mpxp_info<<std::left<<std::setw(10)<<sdrivers[i]->mrl<<" "<<sdrivers[i]->descr<<std::endl; } } Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/mplayerxp.cpp 2012-12-20 09:57:50 UTC (rev 581) @@ -874,7 +874,7 @@ if(!vo_inited){ mpxp_fatal<<MSGTR_InvalidVOdriver<<": "<<(mp_conf.video_driver?mp_conf.video_driver:"?")<<std::endl; - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } // check audio_out driver name: @@ -995,7 +995,7 @@ if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) mpxp_info<<std::setw(4)<<c; else - mpxp_info<<std::hex<<std::setw(8)<<fmt; + mpxp_info<<std::hex<<std::setfill('0')<<std::setw(8)<<fmt; } if(sh_audio) { mpxp_info<<" Audio="; @@ -1004,7 +1004,7 @@ if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) mpxp_info<<std::setw(4)<<c; else - mpxp_info<<std::hex<<std::setw(8)<<fmt; + mpxp_info<<std::hex<<std::setfill('0')<<std::setw(8)<<fmt; } mpxp_info<<std::endl; } @@ -1131,8 +1131,8 @@ if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) mpxp_err<<std::setw(4)<<" '"<<fmt<<"'!"<<std::endl; else - mpxp_err<<" 0x"<<std::hex<<std::setprecision(8)<<sh_audio->wtag<<"!"<<std::endl; - MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); + mpxp_err<<" 0x"<<std::hex<<std::setfill('0')<<std::setw(8)<<sh_audio->wtag<<"!"<<std::endl; + mpxp_hint<<get_path("win32codecs.conf")<<":"<<MSGTR_TryUpgradeCodecsConfOrRTFM<<std::endl; d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } else { @@ -1145,7 +1145,7 @@ ao_inited=mpxp_context().audio().output->_register(mp_conf.audio_driver?mp_conf.audio_driver:"",0); if (ao_inited!=MPXP_Ok){ mpxp_fatal<<MSGTR_InvalidAOdriver<<": "<<mp_conf.audio_driver<<std::endl; - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } } } @@ -1193,8 +1193,8 @@ if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) mpxp_err<<std::setw(4)<<" '"<<fmt<<"'!"<<std::endl; else - mpxp_err<<" 0x"<<std::hex<<std::setw(8)<<sh_video->fourcc<<std::endl; - MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); + mpxp_err<<" 0x"<<std::hex<<std::setfill('0')<<std::setw(8)<<sh_video->fourcc<<std::endl; + mpxp_hint<<get_path("win32codecs.conf")<<":"<<MSGTR_TryUpgradeCodecsConfOrRTFM<<std::endl; d_video->sh = NULL; sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); rc=MPXP_False; @@ -1245,7 +1245,7 @@ } else { mpxp_v<<"AF_pre: "<<samplerate<<"Hz "<<channels<<"ch (" <<ao_format_name(format)<< - ") afmt="<<std::hex<<std::setw(8)<<format + ") afmt="<<std::hex<<std::setfill('0')<<std::setw(8)<<format <<" sh_audio_min="<<sh_audio->audio_out_minsize<<std::endl; } @@ -1301,8 +1301,8 @@ sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); /* PAINT audio OSD */ unsigned ipts,rpts; - unsigned char h,m,s,rh,rm,rs; - static char ph=0,pm=0,ps=0; + unsigned h,m,s,rh,rm,rs; + static unsigned ph=0,pm=0,ps=0; ipts=(unsigned)(sh_audio->timer-mpxp_context().audio().output->get_delay()); rpts=_demuxer->movi_length-ipts; h = ipts/3600; @@ -1314,8 +1314,12 @@ rs = rpts%60; } else rh=rm=rs=0; if(h != ph || m != pm || s != ps) { - mpxp_status<<std::setw(2)<<">"<<h<<":"<<m<<":"<<s - <<"("<<rh<<":"<<rm<<":"<<rs<<")\r"; + mpxp_status<<">"<<std::setfill('0')<<std::setw(2)<<h<<":" + <<std::setfill('0')<<std::setw(2)<<m<<":" + <<std::setfill('0')<<std::setw(2)<<s<<"(" + <<std::setfill('0')<<std::setw(2)<<rh<<":" + <<std::setfill('0')<<std::setw(2)<<rm<<":" + <<std::setfill('0')<<std::setw(2)<<rs<<")\r"; mpxp_status.flush(); ph = h; pm = m; @@ -1775,7 +1779,7 @@ if(mp_conf.stream_dump) if((stream_dump_type=dump_parse(mp_conf.stream_dump))==0) { mpxp_err<<"Wrong dump parameters! Unable to continue"<<std::endl; - exit_player(MSGTR_Exit_error); + exit_player(MSGTR_Fatal_error); } if(stream_dump_type) mp_conf.s_cache_size=0; @@ -1812,7 +1816,7 @@ MP_UNIT("demux_open"); if(!input_state.after_dvdmenu) MPXPSys.assign_demuxer(Demuxer::open(stream,MPXPSys.libinput(),mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id)); - if(!MPXPSys.demuxer()) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR + if(!MPXPSys.demuxer()) goto goto_next_file; input_state.after_dvdmenu=0; Demuxer_Stream *d_video; @@ -1841,7 +1845,7 @@ if(!sh_video && !sh_audio) { mpxp_fatal<<"No stream found"<<std::endl; - goto goto_next_file; // exit_player(MSGTR_Exit_error); + goto goto_next_file; } //================== Read SUBTITLES (DVD & TEXT) ========================== @@ -1959,7 +1963,7 @@ if(mp_conf.force_fps && sh_video) { sh_video->fps=mp_conf.force_fps; - MSG_INFO(MSGTR_FPSforced,sh_video->fps,1.0f/sh_video->fps); + mpxp_info<<MSGTR_FPSforced<<sh_video->fps<<"(fitme: "<<1.0f/sh_video->fps<<")"<<std::endl; } /* Init timers and benchmarking */ @@ -2003,7 +2007,7 @@ <<")"<<std::endl; //==================== START PLAYING ======================= - mpxp_ok<<MSGTR_StartPlaying<<std::endl; + mpxp_ok<<MSGTR_Playing<<"..."<<std::endl; mpxp_print_flush(); while(!eof){ Modified: mplayerxp/nls/mpxp_help-cz.h =================================================================== --- mplayerxp/nls/mpxp_help-cz.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/nls/mpxp_help-cz.h 2012-12-20 09:57:50 UTC (rev 581) @@ -40,144 +40,10 @@ // ========================= MPlayer messages =========================== -// mplayer.c: - #define MSGTR_Exiting "Končím" #define MSGTR_Exit_frames "Požadovaný počet snímků přehrán" #define MSGTR_Exit_quit "Konec" #define MSGTR_Exit_eof "Konec souboru" -#define MSGTR_Exit_error "Závažná chyba" -#define MSGTR_IntBySignal "\nMPlayerXP přerušen signálem %d v modulu: %s \n" -#define MSGTR_NoHomeDir "Nemohu nalézt domácí (HOME) adresář\n" -#define MSGTR_GetpathProblem "get_path(\"config\") problém\n" -#define MSGTR_CreatingCfgFile "Vytvářím konfigurační soubor" -#define MSGTR_InvalidVOdriver "Neplané jméno výstupního videoovladače" -#define MSGTR_InvalidAOdriver "Neplané jméno výstupního audioovladače" -#define MSGTR_CopyCodecsConf "(copy/ln etc/codecs.conf (ze zdrojových kódů MPlayerXPu) do ~/.mplayerxp/codecs.conf)\n" -#define MSGTR_CantLoadFont "Nemohu načíst font" -#define MSGTR_CantLoadSub "Nemohu načíst titulky" -#define MSGTR_ErrorDVDkey "Chyba při zpracování klíče DVD.\n" -#define MSGTR_CmdlineDVDkey "DVD klíč požadovaný na příkazové řádce je uschován pro rozkódování.\n" -#define MSGTR_DVDauthOk "DVD autentikační sekvence vypadá vpořádku.\n" -#define MSGTR_DumpSelectedSteramMissing "dump: FATAL: požadovaný proud chybí!\n" -#define MSGTR_CantOpenDumpfile "Nelze otevřít soubor pro dump!!!\n" -#define MSGTR_CoreDumped "jádro vypsáno :)\n" -#define MSGTR_FPSnotspecified "V hlavičce souboru není udáno (nebo je špatné) FPS! Použijte volbu -fps !\n" -#define MSGTR_NoVideoStream "Bohužel, žádný videoproud... to se zatím nedá přehrát.\n" -#define MSGTR_TryForceAudioFmt "Pokouším se vynutit rodinu audiokodeku" -#define MSGTR_CantFindAfmtFallback "Nemohu nalézt audio kodek pro požadovanou rodinu, použiji ostatní.\n" -#define MSGTR_CantFindAudioCodec "Nemohu nalézt kodek pro audio formát" -#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Pokuste se upgradovat %s z etc/codecs.conf\n*** Pokud problém přetrvá, pak si přečtěte DOCS/CODECS!\n" -#define MSGTR_CouldntInitAudioCodec "Nelze inicializovat audio kodek! -> beze zvuku\n" -#define MSGTR_TryForceVideoFmt "Pokuším se vynutit rodinu videokodeku" -#define MSGTR_CantFindVfmtFallback "Nemohu nalézt video kodek pro požadovanou rodinu, použiji ostatní.\n" -#define MSGTR_CantFindVideoCodec "Nemohu nalézt kodek pro video formát" -#define MSGTR_VOincompCodec "Bohužel, vybrané video_out zařízení je nekompatibilní s tímto kodekem.\n" -#define MSGTR_CouldntInitVideoCodec "FATAL: Nemohu inicializovat videokodek :(\n" -#define MSGTR_EncodeFileExists "Soubor již existuje: %s (nepřepište si svůj oblíbený AVI soubor!)\n" -#define MSGTR_CantCreateEncodeFile "Nemohu vytvořit soubor\n" // toto doopravit - need to be corrected -#define MSGTR_CannotInitVO "FATAL: Nemohu inicializovat video driver!\n" -#define MSGTR_CannotInitAO "nemohu otevřít/inicializovat audio driver -> TICHO\n" -#define MSGTR_StartPlaying "Začínám přehrávat...\n" - +#define MSGTR_Fatal_error "Závažná chyba" +#define MSGTR_NoHomeDir "Nemohu nalézt domácí (HOME) adresář" #define MSGTR_Playing "Přehrávám" -#define MSGTR_NoSound "Audio: beze zvuku!!!\n" -#define MSGTR_FPSforced "FPS vynuceno na hodnotu %5.3f (ftime: %5.3f)\n" - -// open.c, stream.c: -#define MSGTR_CdDevNotfound "CD-ROM zařízení '%s' nenalezeno!\n" -#define MSGTR_ErrTrackSelect "Chyba při výběru VCD stopy!" -#define MSGTR_ReadSTDIN "Čtu ze stdin...\n" -#define MSGTR_UnableOpenURL "Nelze otevřít URL: %s\n" -#define MSGTR_ConnToServer "Připojen k serveru: %s\n" -#define MSGTR_FileNotFound "Soubor nenalezen: '%s'\n" - -#define MSGTR_CantOpenDVD "Nelze otevřít DVD zařízení: %s\n" -#define MSGTR_DVDwait "Čtu strukturu disku, prosím čekejte...\n" -#define MSGTR_DVDnumTitles "Na tomto DVD je %d titulů.\n" -#define MSGTR_DVDinvalidTitle "Neplatné číslo DVD titulu: %d\n" -#define MSGTR_DVDinvalidChapter "Neplatné číslo kapitoly DVD: %d\n" -#define MSGTR_DVDnumAngles "Na tomto DVD je %d úhlů pohledu.\n" -#define MSGTR_DVDinvalidAngle "Neplatné číslo úhlu pohledu DVD: %d\n" -#define MSGTR_DVDnoIFO "Nemohu otevřít soubor IFO pro DVD titul %d.\n" -#define MSGTR_DVDnoVOBs "Nemohu otevřít VOB soubor (VTS_%02d_1.VOB).\n" -#define MSGTR_DVDopenOk "DVD úspěšně otevřeno!\n" - -// demuxer.c, demux_*.c: -#define MSGTR_AudioStreamRedefined "Upozornění! Hlavička audio proudu %d předefinována!\n" -#define MSGTR_VideoStreamRedefined "Upozornění! Hlavička video proudu %d předefinována!\n" -#define MSGTR_TooManyAudioInBuffer "\nDEMUXER: Příliš mnoho (%d v %d bajtech) audio paketů v bufferu!\n" -#define MSGTR_TooManyVideoInBuffer "\nDEMUXER: Příliš mnoho (%d v %d bajtech) video paketů v bufferu!\n" -#define MSGTR_MaybeNI "(možná přehráváte neprokládaný proud/soubor nebo kodek selhal)\n" -#define MSGTR_DetectedFILMfile "Detekován FILM formát souboru!\n" -#define MSGTR_DetectedFLIfile "Detekován FLI formát souboru!\n" -#define MSGTR_DetectedROQfile "Detekován RoQ formát souboru!\n" -#define MSGTR_DetectedREALfile "Detekován REAL formát souboru!\n" -#define MSGTR_DetectedAVIfile "Detekován AVI formát souboru!\n" -#define MSGTR_DetectedASFfile "Detekován ASF formát souboru!\n" -#define MSGTR_DetectedMPEGPESfile "Detekován MPEG-PES formát souboru!\n" -#define MSGTR_DetectedMPEGPSfile "Detekován MPEG-PS formát souboru!\n" -#define MSGTR_DetectedMPEGESfile "Detekován MPEG-ES formát souboru!\n" -#define MSGTR_DetectedQTMOVfile "Detekován QuickTime/MOV formát souboru!\n" -#define MSGTR_MissingMpegVideo "Chybějící MPEG video proud!? Kontaktujte autora, možná to je chyba (bug) :(\n" -#define MSGTR_InvalidMPEGES "Neplatný MPEG-ES proud!? Kontaktuje autora, možná to je chyba (bug) :(\n" -#define MSGTR_FormatNotRecognized "========== Bohužel, tento formát souboru není rozpoznán/podporován =========\n"\ - "==== Pokud je tento soubor AVI, ASF nebo MPEG proud, kontaktuje autora! ====\n" -#define MSGTR_MissingVideoStream "Žádný video proud nenalezen!\n" -#define MSGTR_MissingAudioStream "Žádný audio proud nenalezen... ->beze zvuku\n" -#define MSGTR_MissingVideoStreamBug "Chybějící video proud!? Kontaktuje autora, možná to je chyba (bug) :(\n" - -#define MSGTR_DoesntContainSelectedStream "demux: soubor neobsahuje vybraný audio nebo video proud\n" - -#define MSGTR_NI_Forced "Vynucen" -#define MSGTR_NI_Detected "Detekován" -#define MSGTR_NI_Message "%s NEPROKLÁDANÝ formát souboru AVI!\n" - -#define MSGTR_UsingNINI "Používám NEPROKLÁDANÝ poškozený formát souboru AVI!\n" //tohle taky nějak opravit -#define MSGTR_CouldntDetFNo "Nemohu určit počet snímků (pro SOFní posun) \n" -#define MSGTR_CantSeekRawAVI "Nelze se posouvat v surových (raw) .AVI proudech! (Potřebuji index, zkuste použít volbu -idx !) \n" -#define MSGTR_CantSeekFile "Nemohu posouvat v tomto souboru! \n" - -#define MSGTR_MOVcomprhdr "MOV: Komprimované hlavičky nejsou (ještě) podporovány!\n" -#define MSGTR_MOVvariableFourCC "MOV: Upozornění! proměnná FOURCC detekována!?\n" -#define MSGTR_MOVtooManyTrk "MOV: Upozornění! Příliš mnoho stop!" -#define MSGTR_MOVnotyetsupp "\n****** Quicktime MOV formát není ještě podporován !!! *******\n" - -// dec_video.c & dec_audio.c: -#define MSGTR_CantOpenCodec "nemohu otevřít kodek\n" -#define MSGTR_CantCloseCodec "nemohu uzavřít kodek\n" - -#define MSGTR_MissingDLLcodec "CHYBA: Nemohu otevřít potřebný DirectShow kodek: %s\n" -#define MSGTR_ACMiniterror "Nemohu načíst/inicializovat Win32/ACM AUDIO kodek (chybějící soubor DLL?)\n" -#define MSGTR_MissingLAVCcodec "Nemohu najít kodek '%s' v libavcodec...\n" - -#define MSGTR_NoDShowSupport "MPlayerXP byl přeložen BEZ podpory directshow!\n" -#define MSGTR_NoWfvSupport "Podpora pro kodeky win32 neaktivní nebo nedostupná mimo platformy x86!\n" -#define MSGTR_NoDivx4Support "MPlayerXP byl přeložen BEZ podpory DivX4Linux (libdivxdecore.so)!\n" -#define MSGTR_NoLAVCsupport "MPlayerXP byl přeložen BEZ podpory lavc/libavcodec!\n" -#define MSGTR_NoACMSupport "Win32/ACM audio kodek neaktivní nebo nedostupný mimo platformy x86 -> vynuceno beze zvuku :(\n" -#define MSGTR_NoDShowAudio "Přeloženo BEZ podpory DirectShow -> vynuceno beze zvuku :(\n" -#define MSGTR_NoOggVorbis "OggVorbis audio kodek neaktivní -> vynuceno beze zvuku :(\n" -#define MSGTR_NoXAnimSupport "MPlayerXP byl přeložen BEZ podpory XAnim!\n" - -#define MSGTR_MpegNoSequHdr "MPEG: FATAL: EOF - konec souboru v průběhu vyhledávání hlavičky sekvence\n" -#define MSGTR_CannotReadMpegSequHdr "FATAL: Nelze přečíst hlavičku sekvence!\n" -#define MSGTR_CannotReadMpegSequHdrEx "FATAL: Nelze přečíst rozšíření hlavičky sekvence!\n" -#define MSGTR_BadMpegSequHdr "MPEG: Špatná hlavička sekvence!\n" -#define MSGTR_BadMpegSequHdrEx "MPEG: Špatné rozšíření hlavičky sekvence!\n" - -#define MSGTR_ShMemAllocFail "Nemohu alokovat sdílenou paměť\n" -#define MSGTR_OutOfMemory "nedostatek paměti\n" -#define MSGTR_CantAllocAudioBuf "Nemohu alokovat paměť pro výstupní audio buffer\n" -#define MSGTR_NoMemForDecodedImage "nedostatek paměti pro buffer pro dekódování obrazu (%ld bytes)\n" - -#define MSGTR_AC3notvalid "Neplatný AC3 proud.\n" -#define MSGTR_AC3only48k "Pouze proudy o frekvenci 48000 Hz podporovány.\n" -#define MSGTR_UnknownAudio "Neznámý/chybějící audio formát -> beze zvuku\n" - -// LIRC: -#define MSGTR_SettingUpLIRC "Nastavuji podporu lirc ...\n" -#define MSGTR_LIRCdisabled "Nebudete moci používat dálkový ovladač.\n" -#define MSGTR_LIRCopenfailed "Selhal pokus o otevření podpory LIRC!\n" -#define MSGTR_LIRCsocketerr "Nějaká chyba se soketem lirc: %s\n" -#define MSGTR_LIRCcfgerr "Selhalo čtení konfiguračního souboru LIRC %s !\n" Modified: mplayerxp/nls/mpxp_help-de.h =================================================================== --- mplayerxp/nls/mpxp_help-de.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/nls/mpxp_help-de.h 2012-12-20 09:57:50 UTC (rev 581) @@ -42,138 +42,6 @@ #define MSGTR_Exit_frames "Angeforderte Anzahl an Frames gespielt" #define MSGTR_Exit_quit "Ende" #define MSGTR_Exit_eof "Ende der Datei" -#define MSGTR_Exit_error "Schwerer Fehler" -#define MSGTR_IntBySignal "\nMPlayerXP wurde durch Signal %d von Modul %s beendet\n" -#define MSGTR_NoHomeDir "Kann Homeverzeichnis nicht finden\n" -#define MSGTR_GetpathProblem "get_path(\"config\") Problem\n" -#define MSGTR_CreatingCfgFile "Erstelle Konfigurationsdatei" -#define MSGTR_InvalidVOdriver "Ungültiger Videoausgabetreibername" -#define MSGTR_InvalidAOdriver "Ungültiger Audioausgabetreibername" -#define MSGTR_CopyCodecsConf "(kopiere/linke etc/codecs.conf nach ~/.mplayerxp/codecs.conf)\n" -#define MSGTR_CantLoadFont "Kann Schriftdatei nicht laden" -#define MSGTR_CantLoadSub "Kann Untertitel nicht laden" -#define MSGTR_ErrorDVDkey "Fehler beim Bearbeiten des DVD-Schlüssels..\n" -#define MSGTR_CmdlineDVDkey "Der DVD-Schlüssel der Kommandozeile wurde für das Descrambeln gespeichert.\n" -#define MSGTR_DVDauthOk "DVD Authentifizierungssequenz scheint OK zu sein.\n" -#define MSGTR_DumpSelectedSteramMissing "dump: FATAL: Ausgewählter Stream fehlt!\n" -#define MSGTR_CantOpenDumpfile "Kann dump-Datei nicht öffnen!!!\n" -#define MSGTR_CoreDumped "core dumped :)\n" -#define MSGTR_FPSnotspecified "FPS ist im Header nicht angegeben (oder ungültig)! Benutze -fps Option!\n" -#define MSGTR_NoVideoStream "Sorry, kein Videostream... ist nicht abspielbar\n" -#define MSGTR_TryForceAudioFmt "Erzwinge Audiocodecgruppe" -#define MSGTR_CantFindAfmtFallback "Kann keinen Audiocodec für gewünschte Gruppe finden, verwende anderen.\n" -#define MSGTR_CantFindAudioCodec "Kann Codec für Audioformat nicht finden:" -#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Versuche %s mit etc/codecs.conf zu erneuern\n*** Sollte es weiterhin nicht gehen, dann lese DOCS/CODECS!\n" -#define MSGTR_CouldntInitAudioCodec "Kann Audiocodec nicht finden! -> Kein Ton\n" -#define MSGTR_TryForceVideoFmt "Erzwinge Videocodecgruppe" -#define MSGTR_CantFindVfmtFallback "Kann keinen Videocodec für gewünschte Gruppe finden, verwende anderen.\n" -#define MSGTR_CantFindVideoCodec "Kann Videocodec für Format nicht finden:" -#define MSGTR_VOincompCodec "Sorry, der ausgewählte Videoausgabetreiber ist nicht kompatibel mit diesem Codec.\n" -#define MSGTR_CouldntInitVideoCodec "FATAL: Kann Videocodec nicht initialisieren :(\n" -#define MSGTR_EncodeFileExists "Datei existiert: %s (überschreibe nicht deine schönsten AVI's!)\n" -#define MSGTR_CantCreateEncodeFile "Kann Datei zum Encoden nicht öffnen\n" -#define MSGTR_CannotInitVO "FATAL: Kann Videoausgabetreiber nicht initialisieren!\n" -#define MSGTR_CannotInitAO "Kann Audiotreiber/Soundkarte nicht initialisieren -> Kein Ton\n" -#define MSGTR_StartPlaying "Starte Wiedergabe...\n" - +#define MSGTR_Fatal_error "Schwerer Fehler" +#define MSGTR_NoHomeDir "Kann Homeverzeichnis nicht finden" #define MSGTR_Playing "Spiele" -#define MSGTR_NoSound "Audio: kein Ton!!!\n" -#define MSGTR_FPSforced "FPS fixiert auf %5.3f (ftime: %5.3f)\n" - -// open.c, stream.c: -#define MSGTR_CdDevNotfound "CD-ROM Gerät '%s' nicht gefunden!\n" -#define MSGTR_ErrTrackSelect "Fehler beim Auswählen des VCD Tracks!" -#define MSGTR_ReadSTDIN "Lese von stdin...\n" -#define MSGTR_UnableOpenURL "Kann URL nicht öffnen: %s\n" -#define MSGTR_ConnToServer "Verbunden mit Server: %s\n" -#define MSGTR_FileNotFound "Datei nicht gefunden: '%s'\n" - -#define MSGTR_CantOpenDVD "Kann DVD Gerät nicht öffnen: %s\n" -#define MSGTR_DVDwait "Lese Disk-Struktur, bitte warten...\n" -#define MSGTR_DVDnumTitles "Es sind %d Titel auf dieser DVD.\n" -#define MSGTR_DVDinvalidTitle "Ungültige DVD Titelnummer: %d\n" -#define MSGTR_DVDinvalidChapter "Ungültige DVD Kapitelnummer: %d\n" -#define MSGTR_DVDnumAngles "Es sind %d Sequenzen auf diesem DVD Titel.\n" -#define MSGTR_DVDinvalidAngle "Ungültige DVD Sequenznummer: %d\n" -#define MSGTR_DVDnoIFO "Kann die IFO-Datei für den DVD-Titel nicht öffnen %d.\n" -#define MSGTR_DVDnoVOBs "Kann Titel-VOBS (VTS_%02d_1.VOB) nicht öffnen.\n" -#define MSGTR_DVDopenOk "DVD erfolgreich geöffnet!\n" - -// demuxer.c, demux_*.c: -#define MSGTR_AudioStreamRedefined "Warnung! Audiostreamheader %d redefiniert!\n" -#define MSGTR_VideoStreamRedefined "Warnung! Videostreamheader %d redefiniert!\n" -#define MSGTR_TooManyAudioInBuffer "\nDEMUXER: Zu viele (%d in %d bytes) Audiopakete im Puffer!\n" -#define MSGTR_TooManyVideoInBuffer "\nDEMUXER: Zu viele (%d in %d bytes) Videopakete im Puffer!\n" -#define MSGTR_MaybeNI "Vielleicht spielst du einen non-interleaved Stream/Datei oder der Codec funktioniert nicht.\n" -#define MSGTR_DetectedFILMfile "FILM Dateiformat erkannt!\n" -#define MSGTR_DetectedFLIfile "FLI Dateiformat erkannt!\n" -#define MSGTR_DetectedROQfile "RoQ Dateiformat erkannt!\n" -#define MSGTR_DetectedREALfile "REAL Dateiformat erkannt!\n" -#define MSGTR_DetectedAVIfile "AVI Dateiformat erkannt!\n" -#define MSGTR_DetectedASFfile "ASF Dateiformat erkannt!\n" -#define MSGTR_DetectedMPEGPESfile "MPEG-PES Dateiformat erkannt!\n" -#define MSGTR_DetectedMPEGPSfile "MPEG-PS Dateiformat erkannt!\n" -#define MSGTR_DetectedMPEGESfile "MPEG-ES Dateiformat erkannt!\n" -#define MSGTR_DetectedQTMOVfile "QuickTime/MOV Dateiformat erkannt!\n" -#define MSGTR_MissingMpegVideo "Vermisse MPEG Videostream!? Kontaktiere den Author, das könnte ein Bug sein :(\n" -#define MSGTR_InvalidMPEGES "Ungültiger MPEG-ES Stream??? Kontaktiere den Author, das könnte ein Bug sein :(\n" -#define MSGTR_FormatNotRecognized "=========== Sorry, das Dateiformat/Codec wird nicht unterstützt ==============\n"\ - "============== Sollte dies ein AVI, ASF oder MPEG Stream sein, ===============\n"\ - "================== dann kontaktiere bitte den Author =========================\n" -#define MSGTR_MissingVideoStream "kann keinen Videostream finden!\n" -#define MSGTR_MissingAudioStream "kann keinen Audiostream finden... -> kein Ton\n" -#define MSGTR_MissingVideoStreamBug "Vermisse Videostream!? Kontaktiere den Author, möglicherweise ein Bug :(\n" - -#define MSGTR_DoesntContainSelectedStream "Demux: Datei enthält den gewählen Audio- oder Videostream nicht\n" - -#define MSGTR_NI_Forced "Erzwungen" -#define MSGTR_NI_Detected "Erkannt" -#define MSGTR_NI_Message "%s NON-INTERLEAVED AVI Dateiformat!\n" - -#define MSGTR_UsingNINI "Verwende NON-INTERLEAVED defektes AVI Dateiformat!\n" -#define MSGTR_CouldntDetFNo "Konnte die Anzahl der Frames (für absulute Suche) nicht finden \n" -#define MSGTR_CantSeekRawAVI "Kann keine RAW .AVI-Streams durchsuchen! (Index erforderlich, versuche es mit der -idx Option!) \n" -#define MSGTR_CantSeekFile "Kann diese Datei nicht durchsuchen! \n" - -#define MSGTR_MOVcomprhdr "MOV: Komprimierte Header werden (zur Zeit) nicht unterstützt!\n" -#define MSGTR_MOVvariableFourCC "MOV: Warnung! Variable FOURCC erkannt!?\n" -#define MSGTR_MOVtooManyTrk "MOV: Warnung! Zu viele Tracks!" -#define MSGTR_MOVnotyetsupp "\n******** Quicktime MOV Format wird zu Zeit nicht unterstützt!!!!!!! *********\n" - -// dec_video.c & dec_audio.c: -#define MSGTR_CantOpenCodec "kann Codec nicht öffnen\n" -#define MSGTR_CantCloseCodec "kann Codec nicht schließen\n" - -#define MSGTR_MissingDLLcodec "FEHLER: Kann erforderlichen DirectShow Codec nicht finden: %s\n" -#define MSGTR_ACMiniterror "Kann Win32/ACM AUDIO Codec nicht finden (fehlende DLL-Datei?)\n" -#define MSGTR_MissingLAVCcodec "Kann Codec '%s' von libavcodec nicht finden...\n" - -#define MSGTR_NoDShowSupport "MPlayerXP wurde OHNE DirectShow Unterstützung kompiliert!\n" -#define MSGTR_NoWfvSupport "Unterstützung für Win32 Codecs ausgeschaltet oder nicht verfügbar auf nicht-x86 Plattformen!\n" -#define MSGTR_NoDivx4Support "MPlayerXP wurde OHNE DivX4Linux (libdivxdecore.so) Unterstützung kompiliert!\n" -#define MSGTR_NoLAVCsupport "MPlayerXP wurde OHNE lavc/libavcodec Unterstützung kompiliert!\n" -#define MSGTR_NoACMSupport "Win32/ACM Audiocodecs ausgeschaltet oder nicht verfügbar auf nicht-x86 Plattformen -> erzwinge -nosound :(\n" -#define MSGTR_NoDShowAudio "MPlayerXP wurde ohne DirectShow Unterstützung kompiliert -> erzwinge -nosound :(\n" -#define MSGTR_NoOggVorbis "OggVorbis Audiocodec ausgeschaltet -> erzwinge -nosound :(\n" - -#define MSGTR_MpegNoSequHdr "MPEG: FATAL: Ende der Datei während der Suche für Sequenzheader\n" -#define MSGTR_CannotReadMpegSequHdr "FATAL: Kann Sequenzheader nicht lesen!\n" -#define MSGTR_CannotReadMpegSequHdrEx "FATAL: Kann Sequenzheader-Erweiterung nicht lesen!\n" -#define MSGTR_BadMpegSequHdr "MPEG: Schlechte Sequenzheader!\n" -#define MSGTR_BadMpegSequHdrEx "MPEG: Schlechte Sequenzheader-Erweiterung!\n" - -#define MSGTR_ShMemAllocFail "Kann keine gemeinsamen Speicher zuweisen\n" -#define MSGTR_OutOfMemory "Kein Speicher mehr verfügbar!\n" -#define MSGTR_CantAllocAudioBuf "Kann keinen Audioausgabe-Puffer zuweisen\n" -#define MSGTR_NoMemForDecodedImage "nicht genug Speicher für den Puffer der dekodierten Bilder (%ld Bytes)\n" - -#define MSGTR_AC3notvalid "AC3 Stream ungültig.\n" -#define MSGTR_AC3only48k "Nur 48000 Hz Streams werden unterstützt.\n" -#define MSGTR_UnknownAudio "Unbekanntes/fehlendes Audioformat -> kein Ton\n" - -// LIRC: -#define MSGTR_SettingUpLIRC "Initialisiere Lirc Unterstützung...\n" -#define MSGTR_LIRCdisabled "Verwenden der Fernbedienung nicht möglich\n" -#define MSGTR_LIRCopenfailed "Fehler beim Öffnen der LIRC Unterstützung!\n" -#define MSGTR_LIRCsocketerr "Fehler im LIRC Socket: %s\n" -#define MSGTR_LIRCcfgerr "Kann LIRC Konfigurationsdatei nicht lesen %s !\n" Modified: mplayerxp/nls/mpxp_help-dk.h =================================================================== --- mplayerxp/nls/mpxp_help-dk.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/nls/mpxp_help-dk.h 2012-12-20 09:57:50 UTC (rev 581) @@ -43,138 +43,7 @@ #define MSGTR_Exit_frames "Anmoder om et antal billeder bliver afspillet" #define MSGTR_Exit_quit "Afslut" #define MSGTR_Exit_eof "Slutningen af filen" -#define MSGTR_Exit_error "Fatal fejl" -#define MSGTR_IntBySignal "\nMPlayerXP afbrudt af signal %d i modul: %s \n" -#define MSGTR_NoHomeDir "Kan ikke finde hjemmekatalog (HOME)\n" -#define MSGTR_GetpathProblem "get_path(\"config\") problem\n" -#define MSGTR_CreatingCfgFile "Genererer konfig fil" -#define MSGTR_InvalidVOdriver "Ugyldig valg af video driver" -#define MSGTR_InvalidAOdriver "Ugyldig valg af lyd driver" -#define MSGTR_CopyCodecsConf "(kopier/linker etc/codecs.conf (fra MPlayerXP kilde (source) katalog) til ~/.mplayerxp/codecs.conf)\n" -#define MSGTR_CantLoadFont "Kan ikke loade fonten" -#define MSGTR_CantLoadSub "Kan ikke loade undertekst-filen" -#define MSGTR_ErrorDVDkey "Fejl under afvikling af DVD NØGLE.\n" -#define MSGTR_CmdlineDVDkey "DVD kommandolinje nøgle er gemt til dekryptering.\n" -#define MSGTR_DVDauthOk "DVD auth sekvens synes af være OK.\n" -#define MSGTR_DumpSelectedSteramMissing "dump: FATAL: kan ikke finde den valge fil eller adresse!\n" -#define MSGTR_CantOpenDumpfile "Kan ikke åbne dump filen!!!\n" -#define MSGTR_CoreDumped "kernen dumped :)\n" -#define MSGTR_FPSnotspecified "FPS ikke specificeret (eller ugyldig) i headeren! Brug -fps !\n" -#define MSGTR_NoVideoStream "Desværre, filmen kan enten ikke findes eller kan ikke afspilles endnu\n" -#define MSGTR_TryForceAudioFmt "Prøver at tvinge en lyd codec driver familie" -#define MSGTR_CantFindAfmtFallback "Kan ikke finde lyd codec for den tvungede driver familie, falder tilbage på en anden driver.\n" -#define MSGTR_CantFindAudioCodec "Kan ikke finde codec til lyd formatet" -#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Prøv at opgradere %s fra etc/codecs.conf\n*** Hvis dette ikke hjælper, så læs filen DOCS/codecs.html!\n" -#define MSGTR_CouldntInitAudioCodec "Kunne ikke initialisere lyd codec! -> ingen lyd\n" -#define MSGTR_TryForceVideoFmt "Prøver at tvinge en video codec driver familie" -#define MSGTR_CantFindVfmtFallback "Kan ikke finde video codec for den tvungede driver familie, falder tilbage på en anden driver.\n" -#define MSGTR_CantFindVideoCodec "Kan ikke finde video codec til formatet" -#define MSGTR_VOincompCodec "Desværre, den valgte video driver enhed er ikke kompatibel med dette codec.\n" -#define MSGTR_CouldntInitVideoCodec "FATAL: Kunne ikke initialisere video codec :(\n" -#define MSGTR_EncodeFileExists "Filen eksisterer allerede: %s (overskriv ikke din favorit film (AVI)!)\n" -#define MSGTR_CantCreateEncodeFile "Kan ikke oprette fil til enkodning\n" -#define MSGTR_CannotInitVO "FATAL: Kan ikke initialisere video driveren!\n" -#define MSGTR_CannotInitAO "Kunne ikke åbne/initialisere lydkortet -> INGEN LYD\n" -#define MSGTR_StartPlaying "Starter afspilning ...\n" - +#define MSGTR_Fatal_error "Fatal fejl" +#define MSGTR_NoHomeDir "Kan ikke finde hjemmekatalog (HOME)" #define MSGTR_Playing "Afspiller" -#define MSGTR_NoSound "Lyd: ingen lyd!!!\n" -#define MSGTR_FPSforced "FPS tvunget til %5.3f (ftime: %5.3f)\n" -// open.c, stream.c: -#define MSGTR_CdDevNotfound "CD-ROM Drev '%s' ikke fundet!\n" -#define MSGTR_ErrTrackSelect "Fejl i valg af VCD nummer!" -#define MSGTR_ReadSTDIN "Læser fra stdin...\n" -#define MSGTR_UnableOpenURL "Ikke mulig at få kontakt til URL: %s\n" -#define MSGTR_ConnToServer "Koblet op til serveren: %s\n" -#define MSGTR_FileNotFound "Filen blev ikke fundet: '%s'\n" - -#define MSGTR_CantOpenDVD "Kunne ikke åbne DVD drev: %s\n" -#define MSGTR_DVDwait "Læser disken struktur, vent venligst...\n" -#define MSGTR_DVDnumTitles "Der er %d titler på denne DVD.\n" -#define MSGTR_DVDinvalidTitle "Forkert DVD titel nummer: %d\n" -#define MSGTR_DVDinvalidChapter "Forkert DVD katalog nummmer: %d\n" -#define MSGTR_DVDnumAngles "Der er %d vinkler i denne DVD titel.\n" -#define MSGTR_DVDinvalidAngle "Forkert DVD vinkelnummer: %d\n" -#define MSGTR_DVDnoIFO "Kan ikke finde IFO filen for DVD titlen %d.\n" -#define MSGTR_DVDnoVOBs "Kan ikke åbne titlen VOBS (VTS_%02d_1.VOB).\n" -#define MSGTR_DVDopenOk "DVD korrekt åbnet!\n" - -// demuxer.c, demux_*.c: -#define MSGTR_AudioStreamRedefined "Advarsel! Lyd-filens header %d er blevet omdefineret!\n" -#define MSGTR_VideoStreamRedefined "Advarsel! Video-filens header %d er blevet omdefineret!\n" -#define MSGTR_TooManyAudioInBuffer "\nDEMUXER: For mange (%d i %d bytes) lyd pakker i bufferen!\n" -#define MSGTR_TooManyVideoInBuffer "\nDEMUXER: For mange (%d i %d bytes) video pakker i bufferen!\n" -#define MSGTR_MaybeNI "(måske afspiller du en 'non-interleaved' stream/fil ellers fejlede codec'et)\n" -#define MSGTR_DetectedFILMfile "Detecterede FILM fil format!\n" -#define MSGTR_DetectedFLIfile "Detecterede FLI fil format!\n" -#define MSGTR_DetectedROQfile "Detecterede RoQ fil format!\n" -#define MSGTR_DetectedREALfile "Detecterede REAL fil format!\n" -#define MSGTR_DetectedAVIfile "Detecterede AVI fil format!\n" -#define MSGTR_DetectedASFfile "Detecterede ASF fil format!\n" -#define MSGTR_DetectedMPEGPESfile "Detecterede MPEG-PES fil format!\n" -#define MSGTR_DetectedMPEGPSfile "Detecterede MPEG-PS fil format!\n" -#define MSGTR_DetectedMPEGESfile "Detecterede MPEG-ES fil format!\n" -#define MSGTR_DetectedQTMOVfile "Detecterede QuickTime/MOV fil format!\n" -#define MSGTR_MissingMpegVideo "Manglende MPEG video stream!? Rapporter venligst dette, det kan være en bug :(\n" -#define MSGTR_InvalidMPEGES "Ugyldig MPEG-ES stream??? Rapporter venligst dette, det kunne være en bug :(\n" -#define MSGTR_FormatNotRecognized \ -"============= Desværre, dette fil-format er ikke detecteret eller understøttet ===============\n"\ -"=== Hvis denne fil er en AVI, ASF or MPEG stream, så rapporter venligst dette, det kunne være en bug :(===\n" -#define MSGTR_MissingVideoStream "Ingen video stream fundet!\n" -#define MSGTR_MissingAudioStream "Ingen lyd stream fundet... ->ingen lyd\n" -#define MSGTR_MissingVideoStreamBug "Manglende video stream!? Rapporter venligst dette, det kunne være en bug :(\n" - -#define MSGTR_DoesntContainSelectedStream "demux: filen indeholder ikke den valgte lyd eller video stream\n" - -#define MSGTR_NI_Forced "Tvunget" -#define MSGTR_NI_Detected "Detecteret" -#define MSGTR_NI_Message "%s NON-INTERLEAVED AVI fil-format!\n" - -#define MSGTR_UsingNINI "Bruger NON-INTERLEAVED ødelagt AVI fil-format!\n" -#define MSGTR_CouldntDetFNo "Kunne ikke finde antallet af billeder (for en SOF søgning) \n" -#define MSGTR_CantSeekRawAVI "Kan ikke søge i rå .AVI streams! (manglende index, prøv med -idx!) \n" -#define MSGTR_CantSeekFile "Kan ikke søge i denne fil! \n" - -#define MSGTR_MOVcomprhdr "MOV: Komprimeret header (endnu) ikke supported!\n" -#define MSGTR_MOVvariableFourCC "MOV: Advarsel! variablen FOURCC detecteret!?\n" -#define MSGTR_MOVtooManyTrk "MOV: Advarsel! For mange numre!" -#define MSGTR_MOVnotyetsupp "\n****** Quicktime MOV format endnu ikke supporteret!!!!!!! *******\n" - -// dec_video.c & dec_audio.c: -#define MSGTR_CantOpenCodec "kunne ikke åbne codec\n" -#define MSGTR_CantCloseCodec "kunne ikke afslutte codec\n" - -#define MSGTR_MissingDLLcodec "FEJL: Kunne ikke åbne DirectShow codec: %s\n" -#define MSGTR_ACMiniterror "Kunne ikke loade/initialisere Win32/ACM LYD codec (manglende DLL fil?)\n" -#define MSGTR_MissingLAVCcodec "Kunne ikke finde codec '%s' i libavcodec...\n" - -#define MSGTR_NoDShowSupport "MPlayerXP blev kompileret uden directshow support!\n" -#define MSGTR_NoWfvSupport "Support for win32 codecs slået fra, eller er ikke tilråde på ikke-x86 platforme!\n" -#define MSGTR_NoDivx4Support "MPlayerXP blev kompileret UDEN DivX4Linux (libdivxdecore.so) support!\n" -#define MSGTR_NoLAVCsupport "MPlayerXP was kompileret UDEN lavc/libavcodec support!\n" -#define MSGTR_NoACMSupport "Win32/ACM lyd codec slået fra, eller ikke tilråde på ikke-x86 CPU -> ingen lyd tvunget :(\n" -#define MSGTR_NoDShowAudio "Kompileret uden DirectShow support -> tvunget ingen lyd :(\n" -#define MSGTR_NoOggVorbis "OggVorbis lyd codec slået fra -> tvunget ingen lyd :(\n" -#define MSGTR_NoXAnimSupport "MPlayerXP blev kompileret UDEN XAnim support!\n" - -#define MSGTR_MpegNoSequHdr "MPEG: FATAL: EOF under søgning efter sekvens header\n" -#define MSGTR_CannotReadMpegSequHdr "FATAL: Kunne ikke læse sekvens header!\n" -#define MSGTR_CannotReadMpegSequHdrEx "FATAL: Kunne ikke læse sekvems header extension!\n" -#define MSGTR_BadMpegSequHdr "MPEG: Ugyldig sekvens header!\n" -#define MSGTR_BadMpegSequHdrEx "MPEG: Ugyldig sekvens header extension!\n" - -#define MSGTR_ShMemAllocFail "Kunne ikke allokere delt ram\n" -#define MSGTR_CantAllocAudioBuf "Kunne ikke allokere lyd buffer\n" -#define MSGTR_NoMemForDecodedImage "ikke nok ram til at dekode billed buffer (%ld bytes)\n" - -#define MSGTR_AC3notvalid "AC3 stream invalid.\n" -#define MSGTR_AC3only48k "Kun 48000 Hz streams supporteret.\n" -#define MSGTR_UnknownAudio "Ukendt/manglende lyd format, slår over til ingen lyd\n" - -// LIRC: -#define MSGTR_SettingUpLIRC "Sætter LIRC support op...\n" -#define MSGTR_LIRCdisabled "Du vil ikke være i stand til at bruge din fjernbetjening\n" -#define MSGTR_LIRCopenfailed "Ingen lirc support!\n" -#define MSGTR_LIRCsocketerr "Der er noget galt med LIRC socket: %s\n" -#define MSGTR_LIRCcfgerr "Kunne ikke læse LIRC config file %s !\n" Modified: mplayerxp/nls/mpxp_help-en.h =================================================================== --- mplayerxp/nls/mpxp_help-en.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/nls/mpxp_help-en.h 2012-12-20 09:57:50 UTC (rev 581) @@ -78,15 +78,20 @@ #ifndef MSGTR_Exit_eof #define MSGTR_Exit_eof "End of file" #endif -#ifndef MSGTR_Exit_error -#define MSGTR_Exit_error "Fatal error" +#ifndef MSGTR_Fatal_error +#define MSGTR_Fatal_error "Fatal error" #endif +#ifndef MSGTR_NoHomeDir +#define MSGTR_NoHomeDir "Can't find HOME dir" +#endif +#ifndef MSGTR_Playing +#define MSGTR_Playing "Playing" +#endif + + #ifndef MSGTR_IntBySignal #define MSGTR_IntBySignal "\nMPlayerXP interrupted by signal %d in module: %s \n" #endif -#ifndef MSGTR_NoHomeDir -#define MSGTR_NoHomeDir "Can't find HOME dir\n" -#endif #ifndef MSGTR_GetpathProblem #define MSGTR_GetpathProblem "get_path(\"config\") problem\n" #endif @@ -142,7 +147,7 @@ #define MSGTR_CantFindAudioCodec "Can't find codec for audio format" #endif #ifndef MSGTR_TryUpgradeCodecsConfOrRTFM -#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Try to upgrade %s from etc/codecs.conf\n*** If it's still not OK, then read DOCS/codecs.html!\n" +#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Try to upgrade it from etc/codecs.conf*** If it's still not OK, then read DOCS/codecs.html!" #endif #ifndef MSGTR_CouldntInitAudioCodec #define MSGTR_CouldntInitAudioCodec "Couldn't initialize audio codec! -> nosound\n" @@ -174,9 +179,6 @@ #ifndef MSGTR_CannotInitAO #define MSGTR_CannotInitAO "couldn't open/init audio device -> NOSOUND\n" #endif -#ifndef MSGTR_StartPlaying -#define MSGTR_StartPlaying "Start playing...\n" -#endif #ifndef MSGTR_CODEC_INITAL_AV_RESYNC #define MSGTR_CODEC_INITAL_AV_RESYNC "i_bps==0!!! You may have initial A-V resync\nUse '-' and '+' keys to supress that\n" @@ -213,14 +215,11 @@ #endif //#define MSGTR_NoGui "MPlayer was compiled WITHOUT GUI support!\n" //#define MSGTR_GuiNeedsX "MPlayer GUI requires X11!\n" -#ifndef MSGTR_Playing -#define MSGTR_Playing "Playing" -#endif #ifndef MSGTR_NoSound #define MSGTR_NoSound "Audio: no sound!!!\n" #endif #ifndef MSGTR_FPSforced -#define MSGTR_FPSforced "FPS forced to be %5.3f (ftime: %5.3f)\n" +#define MSGTR_FPSforced "FPS forced to be" #endif // open.c, stream.c: @@ -293,13 +292,13 @@ // demuxer.c, demux_*.c: #ifndef MSGTR_AudioStreamRedefined -#define MSGTR_AudioStreamRedefined "Warning! Audio stream header %d redefined!\n" +#define MSGTR_AudioStreamRedefined "Warning! Audio stream header redefined" #endif #ifndef MSGTR_VideoStreamRedefined -#define MSGTR_VideoStreamRedefined "Warning! video stream header %d redefined!\n" +#define MSGTR_VideoStreamRedefined "Warning! video stream header redefined" #endif #ifndef MSGTR_SubStreamRedefined -#define MSGTR_SubStreamRedefined "Warning! subtitle stream id: %d redefined!\n" +#define MSGTR_SubStreamRedefined "Warning! subtitle stream header redefined" #endif #ifndef MSGTR_TooManyAudioInBuffer #define MSGTR_TooManyAudioInBuffer "\nDEMUXER: Too many (%d in %d bytes) audio packets in the buffer!\n" @@ -310,45 +309,8 @@ #ifndef MSGTR_MaybeNI #define MSGTR_MaybeNI "(maybe you play a non-interleaved stream/file or the codec failed)\n" #endif -#ifndef MSGTR_DetectedFILMfile -#define MSGTR_DetectedFILMfile "Detected FILM file format!\n" -#endif -#ifndef MSGTR_DetectedFLIfile -#define MSGTR_DetectedFLIfile "Detected FLI file format!\n" -#endif -#ifndef MSGTR_DetectedROQfile -#define MSGTR_DetectedROQfile "Detected RoQ file format!\n" -#endif -#ifndef MSGTR_DetectedREALfile -#define MSGTR_DetectedREALfile "Detected REAL file format!\n" -#endif -#ifndef MSGTR_DetectedAVIfile -#define MSGTR_DetectedAVIfile "Detected AVI file format!\n" -#endif -#ifndef MSGTR_DetectedASFfile -#define MSGTR_DetectedASFfile "Detected ASF file format!\n" -#endif -#ifndef MSGTR_DetectedMPEGPESfile -#define MSGTR_DetectedMPEGPESfile "Detected MPEG-PES file format!\n" -#endif -#ifndef MSGTR_DetectedMPEGPSfile -#define MSGTR_DetectedMPEGPSfile "Detected MPEG-PS file format!\n" -#endif -#ifndef MSGTR_DetectedMPEGESfile -#define MSGTR_DetectedMPEGESfile "Detected MPEG-ES file format!\n" -#endif -#ifndef MSGTR_DetectedQTMOVfile -#define MSGTR_DetectedQTMOVfile "Detected QuickTime/MOV file format!\n" -#endif -#ifndef MSGTR_MissingMpegVideo -#define MSGTR_MissingMpegVideo "Missing MPEG video stream!? contact the author, it may be a bug :(\n" -#endif -#ifndef MSGTR_InvalidMPEGES -#define MSGTR_InvalidMPEGES "Invalid MPEG-ES stream??? contact the author, it may be a bug :(\n" -#endif #ifndef MSGTR_FormatNotRecognized -#define MSGTR_FormatNotRecognized "============= Sorry, this file format not recognized/supported ===============\n"\ - "=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===\n" +#define MSGTR_FormatNotRecognized "============= Sorry, this file format not recognized/supported ===============" #endif #ifndef MSGTR_MissingVideoStream #define MSGTR_MissingVideoStream "No video stream found!\n" Modified: mplayerxp/nls/mpxp_help-es.h =================================================================== --- mplayerxp/nls/mpxp_help-es.h 2012-12-20 08:10:31 UTC (rev 580) +++ mplayerxp/nls/mpxp_help-es.h 2012-12-20 09:57:50 UTC (rev 581) @@ -44,138 +44,6 @@ #define MSGTR_Exit_frames "Número de cuadros requeridos reproducidos" #define MSGTR_Exit_quit "Salida" #define MSGTR_Exit_eof "Fin del archivo" -#define MSGTR_Exit_error "Error fatal" -#define MSGTR_IntBySignal "\nMPlayerXP interrumpido por señal %d en el módulo: %s \n" -#define MSGTR_NoHomeDir "No se puede encontrar el directorio HOME\n" -#define MSGTR_GetpathProblem "problema en get_path(\"config\")\n" -#define MSGTR_CreatingCfgFile "Creando archivo de configuración" -#define MSGTR_InvalidVOdriver "Nombre del driver de salida de video incorrecto" -#define MSGTR_InvalidAOdriver "Nombre del driver de salida de audio incorrecto" -#define MSGTR_CopyCodecsConf "(copie/ln etc/codecs.conf (en el árbol del codigo fuente de MPlayerXP) a ~/.mplayerxp/codecs.conf)\n" -#define MSGTR_CantLoadFont "No se puede cargar la fuente" -#define MSGTR_CantLoadSub "No se puede cargar el subtítulo" -#define MSGTR_ErrorDVDkey "Error procesando la clave del DVD.\n" -#define MSGTR_CmdlineDVDkey "Clave de DVD requerida en la línea de comandos esta almacenada para 'descrambling'.\n" -#define MSGTR_DVDauthOk "La secuencia de autorización del DVD parece estar bien.\n" -#define MSGTR_DumpSelectedSteramMissing "dump: FATAL: no se encuentra el stream seleccionado!\n" -#define MSGTR_CantOpenDumpfile "No se puede abrir el archivo de dump!!!\n" -#define MSGTR_CoreDumped "core dumped :)\n" -#define MSGTR_FPSnotspecified "FPS no especificado (o inválido) en la cabecera! Use la opción -fps!\n" -#define MSGTR_NoVideoStream "Disculpe, no tiene stream de video... no es reproducible todavía\n" -#define MSGTR_TryForceAudioFmt "Tratando de forzar la familia del codec de audio" -#define MSGTR_CantFindAfmtFallback "No se encuentra codec de audio para la familia forzada, se usan otros drivers.\n" -#define MSGTR_CantFindAudioCodec "No se encuentra codec para el formato de audio" -#define MSGTR_TryUpgradeCodecsConfOrRTFM "*** Intente actualizar %s en etc/codecs.conf\n*** Si todavía no funciona, lea DOCS/codecs.html!\n" -#define MSGTR_CouldntInitAudioCodec "No se pudo inicializar el codec de audio! -> sin sonido\n" -#define MSGTR_TryForceVideoFmt "Tratando de forzar la familia del codec de video" -#define MSGTR_CantFindVfmtFallback "No se encuentra codec de video para la familia forzada, se usan otros drivers.\n" -#define MSGTR_CantFindVideoCodec "No se encuentra codec para el formato de video" -#define MSGTR_VOincompCodec "Disculpe, el dispositivo de salida de video es incompatible con este codec.\n" -#define MSGTR_CouldntInitVideoCodec "FATAL: No se puede inicializar el codec de video :(\n" -#define MSGTR_EncodeFileExists "El archivo ya existe: %s (no sobrescriba su AVI favorito!)\n" -#define MSGTR_CantCreateEncodeFile "No se puede crear el archivo para 'encodear'\n" -#define MSGTR_CannotInitVO "FATAL: No se puede inicializar el driver de video!\n" -#define MSGTR_CannotInitAO "no se puede abrir/inicializar dispositivo de audio -> SIN SONIDO\n" -#define MSGTR_StartPlaying "Empezando a reproducir...\n" - +#define MSGTR_Fatal_error "Error fatal" +#define MSGTR_NoHomeDir "No se puede encontrar el directorio HOME" #define MSGTR_Playing "Reproduciendo" -#define MSGTR_NoSound "Audio: sin sonido!!!\n" -#define MSGTR_FPSforced "FPS forzado en %5.3f (ftime: %5.3f)\n" - -// open.c, stream.c: -#define MSGTR_CdDevNotfound "Dispositivo de CD-ROM '%s' no encontrado!\n" -#define MSGTR_ErrTrackSelect "Error seleccionando la pista de VCD!" -#define MSGTR_ReadSTDIN "Leyendo desde la entrada estándar (stdin)...\n" -#define MSGTR_UnableOpenURL "No es posible abrir URL: %s\n" -#define MSGTR_ConnToServer "Connectado al servidor: %s\n" -#define MSGTR_FileNotFound "Archivo no encontrado: '%s'\n" - -#define MSGTR_CantOpenDVD "No se puede abrir el dispositivo de DVD: %s\n" -#define MSGTR_DVDwait "Leyendo la estructura del disco, espere por favor...\n" -#define MSGTR_DVDnumTitles "Hay %d títulos en este DVD.\n" -#define MSGTR_DVDinvalidTitle "Número de título de DVD inválido: %d\n" -#define MSGTR_DVDinvalidChapter "Número de capítulo de DVD inválido: %d\n" -#define MSGTR_DVDnumAngles "Hay %d ángulos en este título de DVD.\n" -#define MSGTR_DVDinvalidAngle "Número de ángulo de DVD inválido: %d\n" -#define MSGTR_DVDnoIFO "No se puede abrir archivo IFO para el título de DVD %d.\n" -#define MSGTR_DVDnoVOBs "No se puede abrir VOBS del título (VTS_%02d_1.VOB).\n" -#define MSGTR_DVDopenOk "DVD abierto existosamente!\n" - -// demuxer.c, demux_*.c: -#define MSGTR_AudioStreamRedefined "Advertencia! Cabecera de stream de audio %d redefinida!\n" -#define MSGTR_VideoStreamRedefined "Advertencia! Cabecera de stream de video %d redefinida!\n" -#define MSGTR_TooManyAudioInBuffer "\nDEMUXER: Demasiados (%d en %d bytes) paquetes de audio en el buffer!\n" -#define MSGTR_TooManyVideoInBuffer "\nDEMUXER: Demasiados (%d en %d bytes) paquetes de video en el buffer!\n" -#define MSGTR_MaybeNI "(tal vez está reproduciendo un stream/archivo 'non-interleaved' o falló el codec)\n" -#define MSGTR_DetectedFILMfile "Detectado formato de archivo FILM!\n" -#define MSGTR_DetectedFLIfile "Detectado formato de archivo FLI!\n" -#define MSGTR_DetectedROQfile "Detectado formato de archivo RoQ!\n" -#define MSGTR_DetectedREALfile "Detectado formato de archivo REAL!\n" -#define MSGTR_DetectedAVIfile "Detectado formato de archivo AVI!\n" -#define MSGTR_DetectedASFfile "Detectado formato de archivo ASF!\n" -#define MSGTR_DetectedMPEGPESfile "Detectado formato de archivo MPEG-PES!\n" -#define MSGTR_DetectedMPEGPSfile "Detectado formato de archivo MPEG-PS!\n" -#define MSGTR_DetectedMPEGESfile "Detectado formato de archivo MPEG-ES!\n" -#define MSGTR_DetectedQTMOVfile "Detectado formato de archivo QuickTime/MOV!\n" -#define MSGTR_MissingMpegVideo "Stream de video MPEG no encontrado!? contacte al autor, puede ser un bug :(\n" -#define MSGTR_InvalidMPEGES "Stream MPEG-ES inválido??? contacte al autor, puede ser un bug :(\n" -#define MSGTR_FormatNotRecognized "============ Disculpe, este formato no está soporta... [truncated message content] |
From: <nic...@us...> - 2012-12-20 08:10:38
|
Revision: 580 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=580&view=rev Author: nickols_k Date: 2012-12-20 08:10:31 +0000 (Thu, 20 Dec 2012) Log Message: ----------- small fixes! About illegal patch: i still cannot fix segfault in int32_to_int16 function. Below printed gdb's listing of this place. It seems that i have substituted content of stdint.h file with extremely substituted #defines which time from time restore original value of types. More that obviously that such behaviour is impossible without hacked compiler. Breakpoint 1, int32_to_int16_SSE3 (in_data=0x7fffee0a4a20, out_data= 0x7fffe80009b0, inlen=9216, final=0) at ./aflib_accel.h:131 131 unsigned i,insamples = inlen/sizeof(int32_t); (gdb) n 140 i=0; (gdb) print insamples $1 = 9216 (gdb) n 134 len_mm=inlen&(~(_ivec_size()-1)); (gdb) print insamples $2 = 9216 (gdb) print inlen $3 = 9216 (gdb) n 131 unsigned i,insamples = inlen/sizeof(int32_t); (gdb) print insamples $4 = 9216 (gdb) n 142 if(!_ivec_aligned(out_data)) (gdb) print insamples $5 = 2304 (gdb) n 147 if((len_mm-i)>=_ivec_size()) (gdb) n 135 mm_insamples=len_mm/sizeof(int32_t); (gdb) n 148 for(;i<mm_insamples;i+=vec_insamples) (gdb) print mm_insamples $6 = <optimized out> (gdb) print insamples $7 = 2304 Modified Paths: -------------- mplayerxp/mpxp_msg.cpp mplayerxp/mpxp_msg.h Modified: mplayerxp/mpxp_msg.cpp =================================================================== --- mplayerxp/mpxp_msg.cpp 2012-12-19 17:44:09 UTC (rev 579) +++ mplayerxp/mpxp_msg.cpp 2012-12-20 08:10:31 UTC (rev 580) @@ -48,7 +48,7 @@ void mpxp_streambuf::put_chars(char const* begin, char const* end) const { if(!(parent._type&mp_conf.msg_filter)) { parent.setstate(std::ios_base::badbit); return; } - if(::isatty(::fileno(::stderr))) std::cerr<<data; + if(::isatty(::fileno(::stderr))) ::fwrite(data.c_str(),data.length(),1,::stderr); ::fwrite(begin,end-begin,1,::stderr); } Modified: mplayerxp/mpxp_msg.h =================================================================== --- mplayerxp/mpxp_msg.h 2012-12-19 17:44:09 UTC (rev 579) +++ mplayerxp/mpxp_msg.h 2012-12-20 08:10:31 UTC (rev 580) @@ -70,7 +70,7 @@ // For EOF detection typedef std::char_traits< char > Traits; // Work in buffer mode. It is also possible to work without buffer. - static size_t const BUF_SIZE = 256; + static size_t const BUF_SIZE = 2048; Opaque unusable; char buf[BUF_SIZE]; // This is example about userdata This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-19 17:44:21
|
Revision: 579 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=579&view=rev Author: nickols_k Date: 2012-12-19 17:44:09 +0000 (Wed, 19 Dec 2012) Log Message: ----------- NEW: use std::iostream library based output methods Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/input2/in_msg.h mplayerxp/libao3/ao_msg.h mplayerxp/libmpcodecs/ad_msg.h mplayerxp/libmpcodecs/codecs_ld.cpp mplayerxp/libmpcodecs/vd_msg.h mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpconf/codec-cfg.cpp mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpconf/m_property.cpp mplayerxp/libmpconf/m_struct.cpp mplayerxp/libmpconf/subopt-helper.cpp mplayerxp/libmpdemux/demux_msg.h mplayerxp/libmpstream2/stream_msg.h mplayerxp/libmpsub/find_sub.cpp mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/subreader.cpp mplayerxp/libmpsub/vobsub.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/playtree.cpp mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libvo2/vo_msg.h mplayerxp/mplayerxp.cpp mplayerxp/mpxp_msg.cpp mplayerxp/mpxp_msg.h mplayerxp/nls/mpxp_help-cz.h mplayerxp/nls/mpxp_help-de.h mplayerxp/nls/mpxp_help-dk.h mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-es.h mplayerxp/nls/mpxp_help-fr.h mplayerxp/nls/mpxp_help-hu.h mplayerxp/nls/mpxp_help-it.h mplayerxp/nls/mpxp_help-ko.h mplayerxp/nls/mpxp_help-nl.h mplayerxp/nls/mpxp_help-no.h mplayerxp/nls/mpxp_help-pl.h mplayerxp/nls/mpxp_help-ro.h mplayerxp/nls/mpxp_help-ru.h mplayerxp/nls/mpxp_help-sk.h mplayerxp/nls/nls_msg.h mplayerxp/osdep/osdep_msg.h mplayerxp/postproc/postprocess.cpp mplayerxp/postproc/pp_msg.h mplayerxp/postproc/swscale.cpp mplayerxp/xmpcore/sig_hand.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aframe.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_image.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/global_msg.h mplayerxp/libmpconf/parser_msg.h mplayerxp/libmpsub/mpsub_msg.h mplayerxp/libplaytree/playtree_msg.h mplayerxp/player_msg.h Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/dump.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -17,8 +17,7 @@ #include "libmpdemux/muxer.h" #include "libmpstream2/stream.h" #include "libmpstream2/mrl.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "mpxp_msg.h" +#include "global_msg.h" #include "dump.h" namespace mpxp { Added: mplayerxp/global_msg.h =================================================================== --- mplayerxp/global_msg.h (rev 0) +++ mplayerxp/global_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -0,0 +1,21 @@ +#ifndef GLOBAL_MSG_H +#define GLOBAL_MSG_H 1 + +#define MSGT_CLASS MSGT_GLOBAL +#include "mpxp_msg.h" + +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_GLOBAL); + static mpxp_ostream_fatal mpxp_fatal(MSGT_GLOBAL); + static mpxp_ostream_err mpxp_err(MSGT_GLOBAL); + static mpxp_ostream_warn mpxp_warn(MSGT_GLOBAL); + static mpxp_ostream_ok mpxp_ok(MSGT_GLOBAL); + static mpxp_ostream_hint mpxp_hint(MSGT_GLOBAL); + static mpxp_ostream_status mpxp_status(MSGT_GLOBAL); + static mpxp_ostream_v mpxp_v(MSGT_GLOBAL); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_GLOBAL); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_GLOBAL); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_GLOBAL); +} // namespace mpxp + +#endif Property changes on: mplayerxp/global_msg.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/input2/in_msg.h =================================================================== --- mplayerxp/input2/in_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/input2/in_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_INPUT #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_INPUT); + static mpxp_ostream_fatal mpxp_fatal(MSGT_INPUT); + static mpxp_ostream_err mpxp_err(MSGT_INPUT); + static mpxp_ostream_warn mpxp_warn(MSGT_INPUT); + static mpxp_ostream_ok mpxp_ok(MSGT_INPUT); + static mpxp_ostream_hint mpxp_hint(MSGT_INPUT); + static mpxp_ostream_status mpxp_status(MSGT_INPUT); + static mpxp_ostream_v mpxp_v(MSGT_INPUT); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_INPUT); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_INPUT); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_INPUT); +} // namespace mpxp + #endif Modified: mplayerxp/libao3/ao_msg.h =================================================================== --- mplayerxp/libao3/ao_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libao3/ao_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_AO #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_AO); + static mpxp_ostream_fatal mpxp_fatal(MSGT_AO); + static mpxp_ostream_err mpxp_err(MSGT_AO); + static mpxp_ostream_warn mpxp_warn(MSGT_AO); + static mpxp_ostream_ok mpxp_ok(MSGT_AO); + static mpxp_ostream_hint mpxp_hint(MSGT_AO); + static mpxp_ostream_status mpxp_status(MSGT_AO); + static mpxp_ostream_v mpxp_v(MSGT_AO); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_AO); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_AO); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_AO); +} // namespace mpxp + #endif Modified: mplayerxp/libmpcodecs/ad_msg.h =================================================================== --- mplayerxp/libmpcodecs/ad_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpcodecs/ad_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_DECAUDIO #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_DECAUDIO); + static mpxp_ostream_fatal mpxp_fatal(MSGT_DECAUDIO); + static mpxp_ostream_err mpxp_err(MSGT_DECAUDIO); + static mpxp_ostream_warn mpxp_warn(MSGT_DECAUDIO); + static mpxp_ostream_ok mpxp_ok(MSGT_DECAUDIO); + static mpxp_ostream_hint mpxp_hint(MSGT_DECAUDIO); + static mpxp_ostream_status mpxp_status(MSGT_DECAUDIO); + static mpxp_ostream_v mpxp_v(MSGT_DECAUDIO); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_DECAUDIO); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_DECAUDIO); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_DECAUDIO); +} // namespace mpxp + #endif Modified: mplayerxp/libmpcodecs/codecs_ld.cpp =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpcodecs/codecs_ld.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -11,8 +11,7 @@ #include <stdarg.h> #include "codecs_ld.h" #include "mpxp_help.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "mpxp_msg.h" +#include "global_msg.h" any_t* ld_codec(const char *name,const char *url_hint) { Modified: mplayerxp/libmpcodecs/vd_msg.h =================================================================== --- mplayerxp/libmpcodecs/vd_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpcodecs/vd_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_DECVIDEO #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_DECVIDEO); + static mpxp_ostream_fatal mpxp_fatal(MSGT_DECVIDEO); + static mpxp_ostream_err mpxp_err(MSGT_DECVIDEO); + static mpxp_ostream_warn mpxp_warn(MSGT_DECVIDEO); + static mpxp_ostream_ok mpxp_ok(MSGT_DECVIDEO); + static mpxp_ostream_hint mpxp_hint(MSGT_DECVIDEO); + static mpxp_ostream_status mpxp_status(MSGT_DECVIDEO); + static mpxp_ostream_v mpxp_v(MSGT_DECVIDEO); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_DECVIDEO); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_DECVIDEO); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_DECVIDEO); +} // namespace mpxp + #endif Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -34,8 +34,7 @@ #include "mplayerxp.h" #include "cfgparser.h" #include "libplaytree/playtree.h" -#define MSGT_CLASS MSGT_CFGPARSER -#include "mpxp_msg.h" +#include "parser_msg.h" inline void SET_GLOBAL(m_config_t& c) { c.flags |= CONFIG_GLOBAL; } inline void UNSET_GLOBAL(m_config_t& c) { c.flags &= (!CONFIG_GLOBAL); } Modified: mplayerxp/libmpconf/codec-cfg.cpp =================================================================== --- mplayerxp/libmpconf/codec-cfg.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/codec-cfg.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -25,8 +25,7 @@ #include "loader/wine/avifmt.h" #include "libvo2/img_format.h" #include "codec-cfg.h" -#define MSGT_CLASS MSGT_CODECCFG -#include "mpxp_msg.h" +#include "parser_msg.h" #define MAX_NR_TOKEN 16 Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -16,8 +16,7 @@ #include "cfgparser.h" #include "m_option.h" #include "libmpstream2/url.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mpxp_msg.h" +#include "parser_msg.h" // Don't mp_free for 'production' atm #ifndef MP_DEBUG Modified: mplayerxp/libmpconf/m_property.cpp =================================================================== --- mplayerxp/libmpconf/m_property.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/m_property.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -14,8 +14,7 @@ #include "m_option.h" #include "m_property.h" #include "mpxp_help.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mpxp_msg.h" +#include "parser_msg.h" #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) Modified: mplayerxp/libmpconf/m_struct.cpp =================================================================== --- mplayerxp/libmpconf/m_struct.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/m_struct.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -9,8 +9,7 @@ #include "m_option.h" #include "m_struct.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mpxp_msg.h" +#include "parser_msg.h" const m_option_t* m_struct_get_field(const m_struct_t* st,const char* f) { Added: mplayerxp/libmpconf/parser_msg.h =================================================================== --- mplayerxp/libmpconf/parser_msg.h (rev 0) +++ mplayerxp/libmpconf/parser_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -0,0 +1,21 @@ +#ifndef PARSER_MSG_H +#define PARSER_MSG_H 1 + +#define MSGT_CLASS MSGT_PARSER +#include "mpxp_msg.h" + +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_PARSER); + static mpxp_ostream_fatal mpxp_fatal(MSGT_PARSER); + static mpxp_ostream_err mpxp_err(MSGT_PARSER); + static mpxp_ostream_warn mpxp_warn(MSGT_PARSER); + static mpxp_ostream_ok mpxp_ok(MSGT_PARSER); + static mpxp_ostream_hint mpxp_hint(MSGT_PARSER); + static mpxp_ostream_status mpxp_status(MSGT_PARSER); + static mpxp_ostream_v mpxp_v(MSGT_PARSER); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_PARSER); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_PARSER); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_PARSER); +} // namespace mpxp + +#endif Property changes on: mplayerxp/libmpconf/parser_msg.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/libmpconf/subopt-helper.cpp =================================================================== --- mplayerxp/libmpconf/subopt-helper.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpconf/subopt-helper.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -25,8 +25,7 @@ #include <assert.h> #include "subopt-helper.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "mpxp_msg.h" +#include "global_msg.h" #ifndef MP_DEBUG #define NDEBUG Modified: mplayerxp/libmpdemux/demux_msg.h =================================================================== --- mplayerxp/libmpdemux/demux_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpdemux/demux_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_DEMUXER #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_DEMUXER); + static mpxp_ostream_fatal mpxp_fatal(MSGT_DEMUXER); + static mpxp_ostream_err mpxp_err(MSGT_DEMUXER); + static mpxp_ostream_warn mpxp_warn(MSGT_DEMUXER); + static mpxp_ostream_ok mpxp_ok(MSGT_DEMUXER); + static mpxp_ostream_hint mpxp_hint(MSGT_DEMUXER); + static mpxp_ostream_status mpxp_status(MSGT_DEMUXER); + static mpxp_ostream_v mpxp_v(MSGT_DEMUXER); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_DEMUXER); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_DEMUXER); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_DEMUXER); +} // namespace mpxp + #endif Modified: mplayerxp/libmpstream2/stream_msg.h =================================================================== --- mplayerxp/libmpstream2/stream_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpstream2/stream_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -4,4 +4,18 @@ #define MSGT_CLASS MSGT_STREAM #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_STREAM); + static mpxp_ostream_fatal mpxp_fatal(MSGT_STREAM); + static mpxp_ostream_err mpxp_err(MSGT_STREAM); + static mpxp_ostream_warn mpxp_warn(MSGT_STREAM); + static mpxp_ostream_ok mpxp_ok(MSGT_STREAM); + static mpxp_ostream_hint mpxp_hint(MSGT_STREAM); + static mpxp_ostream_status mpxp_status(MSGT_STREAM); + static mpxp_ostream_v mpxp_v(MSGT_STREAM); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_STREAM); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_STREAM); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_STREAM); +} // namespace mpxp + #endif Modified: mplayerxp/libmpsub/find_sub.cpp =================================================================== --- mplayerxp/libmpsub/find_sub.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpsub/find_sub.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -11,8 +11,7 @@ #include "libvo2/video_out.h" #include "libvo2/sub.h" #include "subreader.h" -#define MSGT_CLASS MSGT_FINDSUB -#include "mpxp_msg.h" +#include "mpsub_msg.h" static int current_sub=0; Added: mplayerxp/libmpsub/mpsub_msg.h =================================================================== --- mplayerxp/libmpsub/mpsub_msg.h (rev 0) +++ mplayerxp/libmpsub/mpsub_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -0,0 +1,21 @@ +#ifndef MPSUB_MSG_H +#define MPSUB_MSG_H 1 + +#define MSGT_CLASS MSGT_MPSUB +#include "mpxp_msg.h" + +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_MPSUB); + static mpxp_ostream_fatal mpxp_fatal(MSGT_MPSUB); + static mpxp_ostream_err mpxp_err(MSGT_MPSUB); + static mpxp_ostream_warn mpxp_warn(MSGT_MPSUB); + static mpxp_ostream_ok mpxp_ok(MSGT_MPSUB); + static mpxp_ostream_hint mpxp_hint(MSGT_MPSUB); + static mpxp_ostream_status mpxp_status(MSGT_MPSUB); + static mpxp_ostream_v mpxp_v(MSGT_MPSUB); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_MPSUB); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_MPSUB); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_MPSUB); +} // namespace mpxp + +#endif Property changes on: mplayerxp/libmpsub/mpsub_msg.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/libmpsub/spudec.cpp =================================================================== --- mplayerxp/libmpsub/spudec.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpsub/spudec.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -27,8 +27,7 @@ #include "xmpcore/xmp_core.h" #include "spudec.h" #include "mpxp_conf_lavc.h" -#define MSGT_CLASS MSGT_SPUDEC -#include "mpxp_msg.h" +#include "mpsub_msg.h" /* Valid values for spu_aamode: 0: none (fastest, most ugly) Modified: mplayerxp/libmpsub/subreader.cpp =================================================================== --- mplayerxp/libmpsub/subreader.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpsub/subreader.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -24,8 +24,7 @@ #include <iconv.h> #endif #endif -#define MSGT_CLASS MSGT_SUBREADER -#include "mpxp_msg.h" +#include "mpsub_msg.h" /* Maximal length of line of a subtitle */ #define LINE_LEN 1000 Modified: mplayerxp/libmpsub/vobsub.cpp =================================================================== --- mplayerxp/libmpsub/vobsub.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libmpsub/vobsub.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -21,8 +21,7 @@ #include "libmpstream2/stream.h" #include "vobsub.h" #include "spudec.h" -#define MSGT_CLASS MSGT_VOBSUB -#include "mpxp_msg.h" +#include "mpsub_msg.h" #ifdef HAVE_GETLINE extern ssize_t getline(char **, size_t *, FILE *); Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -13,8 +13,7 @@ #include "asxparser.h" #include "libmpconf/cfgparser.h" #include "mplayerxp.h" -#define MSGT_CLASS MSGT_PLAYTREE -#include "mpxp_msg.h" +#include "playtree_msg.h" namespace mpxp { Modified: mplayerxp/libplaytree/playtree.cpp =================================================================== --- mplayerxp/libplaytree/playtree.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libplaytree/playtree.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -13,8 +13,7 @@ #endif #include "libmpstream2/stream.h" #include "playtree.h" -#define MSGT_CLASS MSGT_PLAYTREE -#include "mpxp_msg.h" +#include "playtree_msg.h" static int play_tree_is_valid(play_tree_t* pt); Added: mplayerxp/libplaytree/playtree_msg.h =================================================================== --- mplayerxp/libplaytree/playtree_msg.h (rev 0) +++ mplayerxp/libplaytree/playtree_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -0,0 +1,21 @@ +#ifndef PLAYTREE_MSG_H +#define PLAYTREE_MSG_H 1 + +#define MSGT_CLASS MSGT_PLAYTREE +#include "mpxp_msg.h" + +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_PLAYTREE); + static mpxp_ostream_fatal mpxp_fatal(MSGT_PLAYTREE); + static mpxp_ostream_err mpxp_err(MSGT_PLAYTREE); + static mpxp_ostream_warn mpxp_warn(MSGT_PLAYTREE); + static mpxp_ostream_ok mpxp_ok(MSGT_PLAYTREE); + static mpxp_ostream_hint mpxp_hint(MSGT_PLAYTREE); + static mpxp_ostream_status mpxp_status(MSGT_PLAYTREE); + static mpxp_ostream_v mpxp_v(MSGT_PLAYTREE); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_PLAYTREE); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_PLAYTREE); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_PLAYTREE); +} // namespace mpxp + +#endif Property changes on: mplayerxp/libplaytree/playtree_msg.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/libplaytree/playtreeparser.cpp =================================================================== --- mplayerxp/libplaytree/playtreeparser.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libplaytree/playtreeparser.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -17,8 +17,7 @@ #include "asxparser.h" #include "playtree.h" #include "playtreeparser.h" -#define MSGT_CLASS MSGT_PLAYTREE -#include "mpxp_msg.h" +#include "playtree_msg.h" #define BUF_STEP 1024 Modified: mplayerxp/libvo2/vo_msg.h =================================================================== --- mplayerxp/libvo2/vo_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/libvo2/vo_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -6,4 +6,18 @@ #endif #include "mpxp_msg.h" +namespace mpxp { + static mpxp_ostream_info mpxp_info(MSGT_VO); + static mpxp_ostream_fatal mpxp_fatal(MSGT_VO); + static mpxp_ostream_err mpxp_err(MSGT_VO); + static mpxp_ostream_warn mpxp_warn(MSGT_VO); + static mpxp_ostream_ok mpxp_ok(MSGT_VO); + static mpxp_ostream_hint mpxp_hint(MSGT_VO); + static mpxp_ostream_status mpxp_status(MSGT_VO); + static mpxp_ostream_v mpxp_v(MSGT_VO); + static mpxp_ostream_dbg2 mpxp_dbg2(MSGT_VO); + static mpxp_ostream_dbg3 mpxp_dbg3(MSGT_VO); + static mpxp_ostream_dbg4 mpxp_dbg4(MSGT_VO); +} // namespace mpxp + #endif Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/mplayerxp.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -4,6 +4,8 @@ /* MplayerXP (C) 2000-2002. by A'rpi/ESP-team (C) 2002. by Nickols_K */ #include <algorithm> #include <iostream> +#include <iomanip> + #include <ctype.h> #include <stdio.h> #include <stdlib.h> @@ -55,8 +57,7 @@ #include "postproc/libmenu/menu.h" #include "input2/input.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mpxp_msg.h" +#include "player_msg.h" #include "xmpcore/xmp_core.h" #include "xmpcore/xmp_vplayer.h" #include "xmpcore/xmp_adecoder.h" @@ -233,18 +234,18 @@ rc|=mp_mprotect((any_t*)antiviral_hole4,sizeof(antiviral_hole4),MP_DENY_ALL); if(verbose) { if(rc) - MSG_ERR("*** Error! Cannot initialize antiviral protection: '%s' ***!\n",strerror(errno)); + mpxp_err<<"*** Error! Cannot initialize antiviral protection: '"<<strerror(errno)<<"' ***!"<<std::endl; else - MSG_OK("*** Antiviral protection was inited ***!!!\n"); + mpxp_ok<<"*** Antiviral protection was inited ***!!!"<<std::endl; } return rc; } static MPXP_Rc mpxp_test_antiviral_protection(int* verbose) { - if(*verbose) MSG_INFO("Your've specified test-av option!\nRight now MPlayerXP should make coredump!\n"); + if(*verbose) mpxp_info<<"Your've specified test-av option!\nRight now MPlayerXP should make coredump!"<<std::endl; *verbose=antiviral_hole1[0]|antiviral_hole2[0]|antiviral_hole3[0]|antiviral_hole4[0]; - MSG_ERR("Antiviral protection of MPlayerXP doesn't work!"); + mpxp_err<<"Antiviral protection of MPlayerXP doesn't work!"<<std::endl; return MPXP_Virus; } @@ -388,7 +389,7 @@ MP_UNIT("exit_player"); - if(!why.empty()) MSG_HINT(MSGTR_Exiting,why.c_str()); + if(!why.empty()) mpxp_hint<<std::endl<<MSGTR_Exiting<<"...("<<why<<")"<<std::endl; if(mpxp_context().mconfig) m_config_free(mpxp_context().mconfig); mpxp_print_uninit(); mpxp_uninit_structs(); @@ -428,20 +429,20 @@ char *conffile; int conffile_fd; if ((conffile = get_path("")) == NULL) { - MSG_WARN(MSGTR_NoHomeDir); + mpxp_warn<<MSGTR_NoHomeDir<<std::endl; } else { mkdir(conffile, 0777); delete conffile; if ((conffile = get_path("config")) == NULL) { - MSG_ERR(MSGTR_GetpathProblem); + mpxp_err<<MSGTR_GetpathProblem<<std::endl; conffile=(char*)mp_malloc(strlen("config")+1); if(conffile) strcpy(conffile,"config"); } if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) { - MSG_INFO(MSGTR_CreatingCfgFile, conffile); - write(conffile_fd, default_config, strlen(default_config)); - close(conffile_fd); + mpxp_info<<MSGTR_CreatingCfgFile<<": "<<conffile<<std::endl; + ::write(conffile_fd, default_config, strlen(default_config)); + ::close(conffile_fd); } if (m_config_parse_config_file(conf, conffile) != MPXP_Ok) exit(1); delete conffile; @@ -508,26 +509,26 @@ gCpuCaps.hasAVX= gCpuCaps.hasFMA=0; } - MSG_V("User corrected CPU flags: MMX=%d MMX2=%d 3DNow=%d 3DNow2=%d SSE=%d SSE2=%d SSE3=%d SSSE3=%d SSE41=%d SSE42=%d AES=%d AVX=%d FMA=%d\n", - gCpuCaps.hasMMX, - gCpuCaps.hasMMX2, - gCpuCaps.has3DNow, - gCpuCaps.has3DNowExt, - gCpuCaps.hasSSE, - gCpuCaps.hasSSE2, - gCpuCaps.hasSSE3, - gCpuCaps.hasSSSE3, - gCpuCaps.hasSSE41, - gCpuCaps.hasSSE42, - gCpuCaps.hasAES, - gCpuCaps.hasAVX, - gCpuCaps.hasFMA); + mpxp_v<<"User corrected CPU flags: MMX="<<gCpuCaps.hasMMX + <<" MMX2="<<gCpuCaps.hasMMX2 + <<" 3DNow="<<gCpuCaps.has3DNow + <<" 3DNow2="<<gCpuCaps.has3DNowExt + <<" SSE="<<gCpuCaps.hasSSE + <<" SSE2="<<gCpuCaps.hasSSE2 + <<" SSE3="<<gCpuCaps.hasSSE3 + <<" SSSE3="<<gCpuCaps.hasSSSE3 + <<" SSE41="<<gCpuCaps.hasSSE41 + <<" SSE42="<<gCpuCaps.hasSSE42 + <<" AES="<<gCpuCaps.hasAES + <<" AVX="<<gCpuCaps.hasAVX + <<" FMA="<<gCpuCaps.hasFMA + <<std::endl; if(gCpuCaps.hasMMX) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMX; if(gCpuCaps.hasMMX2) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMXEXT; if(gCpuCaps.hasSSE) mpxp_context().mplayer_accel |= MM_ACCEL_X86_SSE; if(gCpuCaps.has3DNow) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOW; if(gCpuCaps.has3DNowExt) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; - MSG_V("mpxp_context().mplayer_accel=%i\n",mpxp_context().mplayer_accel); + mpxp_v<<"mpxp_context().mplayer_accel="<<mpxp_context().mplayer_accel<<std::endl; } #endif @@ -569,7 +570,7 @@ /* check codec.conf*/ if(!parse_codec_cfg(get_path("win32codecs.conf"))) { if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")) { - MSG_HINT(MSGTR_CopyCodecsConf); + mpxp_hint<<MSGTR_CopyCodecsConf<<std::endl; mpxp_uninit_structs(); exit(0); } @@ -593,10 +594,11 @@ void show_help(void) { // no file/vcd/dvd -> show HELP: - MSG_INFO("%s",help_text); + mpxp_info<<help_text<<std::endl; Stream::print_drivers(); - MSG_INFO("\nExample: mplayerxp -ao alsa:hw:0 -vo x11 your.avi\n" - "Use --long-help option for full help\n"); + mpxp_info<<std::endl; + mpxp_info<<"Example: mplayerxp -ao alsa:hw:0 -vo x11 your.avi"<<std::endl; + mpxp_info<<"Use --long-help option for full help"<<std::endl; } void show_long_help(void) { @@ -614,7 +616,7 @@ /* check codec.conf*/ if(!parse_codec_cfg(get_path("win32codecs.conf"))){ if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")){ - MSG_HINT(MSGTR_CopyCodecsConf); + mpxp_hint<<MSGTR_CopyCodecsConf<<std::endl; mpxp_uninit_structs(); exit(0); } @@ -776,37 +778,41 @@ mpxp_context().bench->total_start=GetTimer()-mpxp_context().bench->total_start; total_time_usage = (float)mpxp_context().bench->total_start*0.000001; - MSG_INFO("\nAVE BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs = %8.4fs C:%8.3fs\n", - mpxp_context().bench->video,mpxp_context().bench->vout,mpxp_context().bench->audio+mpxp_context().bench->audio_decode, - mpxp_context().bench->demux,mpxp_context().bench->c2,tot); + mpxp_info<<std::endl<<std::setprecision(3) + <<"AVE BENCHMARKs: VC:"<<mpxp_context().bench->video<<"s" + <<" VO:"<<mpxp_context().bench->vout<<"s" + <<" A:"<<mpxp_context().bench->audio+mpxp_context().bench->audio_decode<<"s" + <<" D:"<<mpxp_context().bench->demux<<"s="<<mpxp_context().bench->c2<<"s" + <<" C:"<<tot<<"s"<<std::endl; if(total_time_usage>0.0) - MSG_INFO("AVE BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", - 100.0*mpxp_context().bench->video/total_time_usage, - 100.0*mpxp_context().bench->vout/total_time_usage, - 100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/total_time_usage, - 100.0*mpxp_context().bench->demux/total_time_usage, - 100.0*mpxp_context().bench->c2/total_time_usage, - 100.0*tot/total_time_usage); + mpxp_info<<std::setprecision(4) + <<"AVE BENCHMARK%: VC:"<<100.0*mpxp_context().bench->video/total_time_usage<<"%" + <<" VO:"<<100.0*mpxp_context().bench->vout/total_time_usage<<"%" + <<" A:"<<100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/total_time_usage<<"%" + <<" D:"<<100.0*mpxp_context().bench->demux/total_time_usage<<"%" + <<" C:"<<100.0*mpxp_context().bench->c2/total_time_usage<<"%" + <<" = "<<100.0*tot/total_time_usage<<"%"<<std::endl; unsigned nframes=mpxp_context().engine().xp_core->video->num_played_frames; - MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" - ,nframes,mpxp_context().engine().xp_core->video->num_dropped_frames); + mpxp_info<<std::endl<<"REAL RESULTS: from "<<nframes<<"was dropped="<<mpxp_context().engine().xp_core->video->num_dropped_frames<<std::endl; } static void show_benchmark_status(void) { MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys.demuxer()->audio->sh); + float rev_time=(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0; if(xmp_test_model(XMP_Run_AudioPlayback)) - MSG_STATUS("A:%6.1f %4.1f%%\r" - ,sh_audio->timer-mpxp_context().audio().output->get_delay() - ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 - ); + mpxp_status<<std::setprecision(1) + <<"A:"<<sh_audio->timer-mpxp_context().audio().output->get_delay() + <<" "<<rev_time + <<"\r"; else - MSG_STATUS("A:%6.1f %4.1f%% B:%4.1f\r" - ,sh_audio->timer-mpxp_context().audio().output->get_delay() - ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 - ,get_delay_audio_buffer() - ); + mpxp_status<<std::setprecision(1) + <<"A:"<<sh_audio->timer-mpxp_context().audio().output->get_delay() + <<" "<<rev_time + <<" B:"<<get_delay_audio_buffer() + <<"\r"; + mpxp_status.flush(); } // for multifile support: @@ -832,7 +838,8 @@ #ifdef USE_OSD if(mp_conf.font_name){ mpxp_context().video().output->font=read_font_desc(mp_conf.font_name,mp_conf.font_factor,mp_conf.verbose>1); - if(!mpxp_context().video().output->font) MSG_ERR(MSGTR_CantLoadFont,mp_conf.font_name); + if(!mpxp_context().video().output->font) + mpxp_err<<MSGTR_CantLoadFont<<": "<<mp_conf.font_name<<std::endl; } else { // try default: mpxp_context().video().output->font=read_font_desc(get_path("font/font.desc"),mp_conf.font_factor,mp_conf.verbose>1); @@ -845,13 +852,13 @@ const char *menu_cfg; menu_cfg = get_path("menu.conf"); if(menu_init(NULL, menu_cfg)) - MSG_INFO("Menu initialized: %s\n", menu_cfg); + mpxp_info<<"Menu initialized: "<<menu_cfg<<std::endl; else { menu_cfg="/etc/menu.conf"; if(menu_init(NULL, menu_cfg)) - MSG_INFO("Menu initialized: %s\n", menu_cfg); + mpxp_info<<"Menu initialized: "<<menu_cfg<<std::endl; else - MSG_WARN("Menu init failed\n"); + mpxp_warn<<"Menu init failed"<<std::endl; } } MP_UNIT("init_osd"); @@ -866,7 +873,7 @@ vo_inited = (mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:"")==MPXP_Ok)?1:0; if(!vo_inited){ - MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); + mpxp_fatal<<MSGTR_InvalidVOdriver<<": "<<(mp_conf.video_driver?mp_conf.video_driver:"?")<<std::endl; exit_player(MSGTR_Exit_error); } @@ -893,7 +900,7 @@ if (mp_conf.vobsub_name){ mpxp_context().video().output->vobsub=vobsub_open(mp_conf.vobsub_name,mp_conf.spudec_ifo,1,&mpxp_context().video().output->spudec); if(mpxp_context().video().output->vobsub==NULL) - MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); + mpxp_err<<MSGTR_CantLoadSub<<": "<<mp_conf.vobsub_name<<std::endl; else { inited_flags|=INITED_VOBSUB; vobsub_set_from_lang(mpxp_context().video().output->vobsub, mp_conf.dvdsub_lang); @@ -921,7 +928,7 @@ play_tree_t* entry; // Handle playlist MP_UNIT("handle_playlist"); - MSG_V("Parsing playlist %s...\n",filename); + mpxp_v<<"Parsing playlist "<<filename<<"..."<<std::endl; entry = parse_playtree(_libinput,stream); if(!entry) { entry = playtree_iter->tree; @@ -979,27 +986,27 @@ sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); int fmt; char *c; - MSG_INFO("[Stream]:"); + mpxp_info<<"[Stream]:"; if(sh_video) { - MSG_INFO("Video="); + mpxp_info<<"Video="; if(sh_video->bih)fmt=sh_video->bih->biCompression; else fmt=sh_video->fourcc; c=(char *)&fmt; if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) - MSG_INFO("%.4s",c); + mpxp_info<<std::setw(4)<<c; else - MSG_INFO("%08X",fmt); + mpxp_info<<std::hex<<std::setw(8)<<fmt; } if(sh_audio) { - MSG_INFO(" Audio="); + mpxp_info<<" Audio="; fmt=sh_audio->wtag; c=(char *)&fmt; if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) - MSG_INFO("%.4s",c); + mpxp_info<<std::setw(4)<<c; else - MSG_INFO("%08X",fmt); + mpxp_info<<std::hex<<std::setw(8)<<fmt; } - MSG_INFO("\n"); + mpxp_info<<std::endl; } void MPXPSystem::read_video_properties() const { @@ -1007,21 +1014,22 @@ Demuxer_Stream *d_video=_demuxer->video; MP_UNIT("video_read_properties"); if(!sh_video->read_properties()) { - MSG_ERR("Video: can't read properties\n"); + mpxp_err<<"Video: can't read properties"<<std::endl; d_video->sh=NULL; sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } else { - MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", - _demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, - sh_video->fps,1/sh_video->fps - ); + mpxp_v<<"[V] filefmt:"<<_demuxer->file_format + <<"fourcc:0x"<<std::hex<<sh_video->fourcc + <<" size:"<<sh_video->src_w<<"x"<<sh_video->src_h + <<" fps:"<<std::setprecision(2)<<sh_video->fps + <<" ftime:="<<1/sh_video->fps<<std::endl; /* need to set fps here for output encoders to pick it up in their init */ if(mp_conf.force_fps){ sh_video->fps=mp_conf.force_fps; } if(!sh_video->fps && !mp_conf.force_fps){ - MSG_ERR(MSGTR_FPSnotspecified); + mpxp_err<<MSGTR_FPSnotspecified<<std::endl; d_video->sh=NULL; sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } @@ -1064,7 +1072,7 @@ MP_UNIT("read_subtitles_file"); if(mp_conf.sub_name){ mpxp_context().subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); - if(!mpxp_context().subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); + if(!mpxp_context().subtitles) mpxp_err<<MSGTR_CantLoadSub<<": "<<mp_conf.sub_name<<std::endl; } else if(mp_conf.sub_auto) { // auto load sub file ... mpxp_context().subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); @@ -1087,13 +1095,13 @@ #ifdef ENABLE_WIN32LOADER if(!found) { // Go through the codec.conf and find the best codec... - if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); + if(mp_conf.audio_family) mpxp_info<<MSGTR_TryForceAudioFmt<<": "<<mp_conf.audio_family<<std::endl; while(1) { sh_audio->codec=find_codec(sh_audio->wtag,NULL,sh_audio->codec,1); if(!sh_audio->codec) { if(mp_conf.audio_family) { sh_audio->codec=NULL; /* re-search */ - MSG_ERR(MSGTR_CantFindAfmtFallback); + mpxp_err<<MSGTR_CantFindAfmtFallback<<std::endl; mp_conf.audio_family=NULL; continue; } @@ -1102,7 +1110,10 @@ if(mp_conf.audio_codec && strcmp(sh_audio->codec->codec_name,mp_conf.audio_codec)) continue; else if(mp_conf.audio_family && strcmp(sh_audio->codec->driver_name,mp_conf.audio_family)) continue; if(afm_find_driver(sh_audio->codec->driver_name)) { - MSG_V("%s audio codec: [%s] drv:%s (%s)\n",mp_conf.audio_codec?"Forcing":"Detected",sh_audio->codec->codec_name,sh_audio->codec->driver_name,sh_audio->codec->s_info); + mpxp_v<<mp_conf.audio_codec?"Forcing":"Detected" + <<" audio codec: ["<<sh_audio->codec->codec_name + <<"] drv:"<<sh_audio->codec->driver_name + <<" ("<<sh_audio->codec->s_info<<")"<<std::endl; found=1; break; } @@ -1115,25 +1126,25 @@ #endif if(!found) { const char *fmt; - MSG_ERR(MSGTR_CantFindAudioCodec); + mpxp_err<<MSGTR_CantFindAudioCodec<<std::endl; fmt = (const char *)&sh_audio->wtag; if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) - MSG_ERR(" '%c%c%c%c'!\n",fmt[0],fmt[1],fmt[2],fmt[3]); + mpxp_err<<std::setw(4)<<" '"<<fmt<<"'!"<<std::endl; else - MSG_ERR(" 0x%08X!\n",sh_audio->wtag); + mpxp_err<<" 0x"<<std::hex<<std::setprecision(8)<<sh_audio->wtag<<"!"<<std::endl; MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } else { if(!(mpxp_context().audio().output=new(zeromem) Audio_Output(ao_subdevice?ao_subdevice:""))) { - MSG_ERR(MSGTR_CannotInitAO); + mpxp_err<<MSGTR_CannotInitAO<<std::endl; d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) delete ao_subdevice; ao_inited=mpxp_context().audio().output->_register(mp_conf.audio_driver?mp_conf.audio_driver:"",0); if (ao_inited!=MPXP_Ok){ - MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); + mpxp_fatal<<MSGTR_InvalidAOdriver<<": "<<mp_conf.audio_driver<<std::endl; exit_player(MSGTR_Exit_error); } } @@ -1158,12 +1169,12 @@ codecs_reset_selection(0); if(mp_conf.video_codec) { /* forced codec by name: */ - MSG_INFO("Forced video codec: %s\n",mp_conf.video_codec); + mpxp_info<<"Forced video codec: "<<mp_conf.video_codec<<std::endl; sh_video->decoder=mpcv_init(sh_video,mp_conf.video_codec,NULL,-1,_libinput); } else { int status; /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ - if(mp_conf.video_family) MSG_INFO(MSGTR_TryForceVideoFmt,mp_conf.video_family); + if(mp_conf.video_family) mpxp_info<<MSGTR_TryForceVideoFmt<<": "<<mp_conf.video_family<<std::endl; for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ if(mp_conf.video_family) /* try first the preferred codec family:*/ if((sh_video->decoder=mpcv_init(sh_video,NULL,mp_conf.video_family,status,_libinput))) break; @@ -1177,12 +1188,12 @@ if(!sh_video->inited) { const char *fmt; - MSG_ERR(MSGTR_CantFindVideoCodec); + mpxp_err<<MSGTR_CantFindVideoCodec<<std::endl; fmt = (const char *)&sh_video->fourcc; if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) - MSG_ERR(" '%c%c%c%c'!\n",fmt[0],fmt[1],fmt[2],fmt[3]); + mpxp_err<<std::setw(4)<<" '"<<fmt<<"'!"<<std::endl; else - MSG_ERR(" 0x%08X!\n",sh_video->fourcc); + mpxp_err<<" 0x"<<std::hex<<std::setw(8)<<sh_video->fourcc<<std::endl; MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_video->sh = NULL; sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); @@ -1190,8 +1201,10 @@ } else inited_flags|=INITED_VCODEC; if(sh_video) - MSG_V("%s video codec: [%s] vfm:%s (%s)\n", - mp_conf.video_codec?"Forcing":"Detected",sh_video->codec->codec_name,sh_video->codec->driver_name,sh_video->codec->s_info); + mpxp_v<<(mp_conf.video_codec?"Forcing":"Detected") + <<" video codec: ["<<std::string(sh_video->codec->codec_name) + <<"] vfm:"<<std::string(sh_video->codec->driver_name) + <<" ("<<std::string(sh_video->codec->s_info)<<std::endl; return rc; } @@ -1202,22 +1215,19 @@ int rc=0; const ao_info_t *info=mpxp_context().audio().output->get_info(); MP_UNIT("setup_audio"); - MSG_V("AO: [%s] %iHz %s %s\n", - info->short_name, - mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate, - sh_audio->nch>7?"surround71": + mpxp_v<<"AO: ["<<info->short_name<<"] " + <<(mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate)<<"Hz " + <<(sh_audio->nch>7?"surround71": sh_audio->nch>6?"surround61": sh_audio->nch>5?"surround51": sh_audio->nch>4?"surround41": sh_audio->nch>3?"surround40": sh_audio->nch>2?"stereo2.1": - sh_audio->nch>1?"Stereo":"Mono", - ao_format_name(sh_audio->afmt) - ); - MSG_V("AO: Description: %s\nAO: Author: %s\n", - info->name, info->author); - if(strlen(info->comment) > 0) - MSG_V("AO: Comment: %s\n", info->comment); + sh_audio->nch>1?"Stereo":"Mono") + <<ao_format_name(sh_audio->afmt)<<std::endl; + mpxp_v<<"AO: Description: "<<info->name<<std::endl; + mpxp_v<<"AO: Author: "<<info->author<<std::endl; + if(strlen(info->comment) > 0) mpxp_v<<"AO: Comment: "<<info->comment<<std::endl; MP_UNIT("af_preinit"); unsigned samplerate,channels,format; @@ -1231,19 +1241,19 @@ sh_audio->nch, sh_audio->afmt, // output: &samplerate, &channels, &format)!=MPXP_Ok){ - MSG_ERR("Audio filter chain preinit failed\n"); + mpxp_err<<"Audio filter chain preinit failed"<<std::endl; } else { - MSG_V("AF_pre: %dHz %dch (%s) afmt=%08X sh_audio_min=%i\n", - samplerate, channels, - ao_format_name(format),format - ,sh_audio->audio_out_minsize); + mpxp_v<<"AF_pre: "<<samplerate<<"Hz "<<channels<<"ch (" + <<ao_format_name(format)<< + ") afmt="<<std::hex<<std::setw(8)<<format + <<" sh_audio_min="<<sh_audio->audio_out_minsize<<std::endl; } if(MPXP_Ok!=mpxp_context().audio().output->configure( samplerate, channels, format)) { - MSG_ERR("Can't configure audio device\n"); + mpxp_err<<"Can't configure audio device"<<std::endl; d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); if(sh_video == NULL) rc=-1; @@ -1258,7 +1268,7 @@ mpaf_format_e(mpxp_context().audio().output->format()), mpxp_context().audio().output->outburst()*4, mpxp_context().audio().output->buffersize())!=MPXP_Ok) { - MSG_ERR("No matching audio filter found!\n"); + mpxp_err<<"No matching audio filter found!"<<std::endl; } } return rc; @@ -1269,15 +1279,19 @@ sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); MP_UNIT("init_xp"); if(sh_video && mpxp_context().engine().xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ - MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",3,mpxp_context().engine().xp_core->num_v_buffs); + mpxp_fatal<<"Not enough buffers for DECODING AHEAD!"<<std::endl; + mpxp_fatal<<"Need 3 buffers but exist only " + <<mpxp_context().engine().xp_core->num_v_buffs<<std::endl; exit_player("Try other '-vo' driver.\n"); } if(xmp_init_engine(sh_video,sh_audio)!=0) exit_player("Can't initialize decoding ahead!\n"); if(xmp_run_decoders()!=0) exit_player("Can't run decoding ahead!\n"); - if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",mpxp_context().engine().xp_core->num_v_buffs); - else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",mpxp_context().engine().xp_core->num_a_buffs); + if(sh_video) + mpxp_ok<<"Using DECODING AHEAD mplayer's core with "<<mpxp_context().engine().xp_core->num_v_buffs<<" video buffers"<<std::endl; + else + mpxp_ok<<"Using DECODING AHEAD mplayer's core with "<<mpxp_context().engine().xp_core->num_a_buffs<<" audio buffers"<<std::endl; /* reset counters */ if(sh_video) mpxp_context().engine().xp_core->video->num_dropped_frames=0; inited_flags|=INITED_XMP; @@ -1300,7 +1314,9 @@ rs = rpts%60; } else rh=rm=rs=0; if(h != ph || m != pm || s != ps) { - MSG_STATUS(">%02u:%02u:%02u (%02u:%02u:%02u)\r",h,m,s,rh,rm,rs); + mpxp_status<<std::setw(2)<<">"<<h<<":"<<m<<":"<<s + <<"("<<rh<<":"<<rm<<":"<<rs<<")\r"; + mpxp_status.flush(); ph = h; pm = m; ps = s; @@ -1325,7 +1341,7 @@ rect_highlight_t hl; if(stream->ctrl(SCTRL_VID_GET_HILIGHT,&hl)==MPXP_Ok) { osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); - MSG_V("Set nav box: %i %i %i %i\n",hl.sx, hl.sy, hl.ex, hl.ey); + mpxp_v<<"Set nav box: "<<hl.sx<<" "<<hl.sy<<" "<<hl.ex<<" "<<hl.ey<<std::endl; vo_osd_changed (OSDTYPE_DVDNAV); } } @@ -1339,8 +1355,8 @@ mpxp_context().video().output->pause(); } if(mp_conf.verbose) { - MSG_STATUS("\n------ PAUSED -------\r"); - fflush(stdout); + mpxp_status<<std::endl<<"------ PAUSED -------\r"; + mpxp_status.flush(); } if (ao_inited==MPXP_Ok && sh_audio) { @@ -1412,16 +1428,16 @@ case MP_CMD_SPEED_INCR : case MP_CMD_SPEED_MULT : case MP_CMD_SPEED_SET : - MSG_WARN("Speed adjusting is not implemented yet!\n"); + mpxp_warn<<"Speed adjusting is not implemented yet!"<<std::endl; break; case MP_CMD_SWITCH_AUDIO : - MSG_INFO("ID_AUDIO_TRACK=%i\n",demuxer_switch_audio_r(_demuxer, _demuxer->audio->id+1)); + mpxp_info<<"ID_AUDIO_TRACK="<<demuxer_switch_audio_r(_demuxer, _demuxer->audio->id+1)<<std::endl; break; case MP_CMD_SWITCH_VIDEO : - MSG_INFO("ID_VIDEO_TRACK=%i\n",demuxer_switch_video_r(_demuxer, _demuxer->video->id+1)); + mpxp_info<<"ID_VIDEO_TRACK="<<demuxer_switch_video_r(_demuxer, _demuxer->video->id+1)<<std::endl; break; case MP_CMD_SWITCH_SUB : - MSG_INFO("ID_SUB_TRACK=%i\n",demuxer_switch_subtitle_r(_demuxer, _demuxer->sub->id+1)); + mpxp_info<<"ID_SUB_TRACK="<<demuxer_switch_subtitle_r(_demuxer, _demuxer->sub->id+1)<<std::endl; break; case MP_CMD_FRAME_STEP : case MP_CMD_PAUSE : @@ -1595,7 +1611,7 @@ vo_osd_changed(OSDTYPE_SUBTITLE); } break; default : - MSG_ERR("Received unknow cmd %s\n",cmd->name); + mpxp_err<<"Received unknow cmd "<<cmd->name<<std::endl; } mp_cmd_free(cmd); } @@ -1660,7 +1676,7 @@ xmp_register_main(exit_sighandler); mpxp_print_init(mp_conf.verbose+MSGL_STATUS); - MSG_INFO("%s",banner_text); + mpxp_info<<banner_text<<std::endl; /* currently it's lowest point of MPXPSystem initialization */ mpxp_context().engine().MPXPSys = new(zeromem) MPXPSystem; @@ -1680,8 +1696,8 @@ exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { - MSG_ERR("Error: detected option: -core.xp=0\n" - "Note! Single-thread mode is not longer supported by MPlayerXP\n"); + mpxp_err<<"Error: detected option: -core.xp=0"<<std::endl; + mpxp_err<<"Note! Single-thread mode is not longer supported by MPlayerXP"<<std::endl; exit_player(MSGTR_Exit_quit); } if(mp_conf.test_av) { @@ -1720,9 +1736,9 @@ // Many users forget to include command line in bugreports... if(mp_conf.verbose){ - MSG_INFO("CommandLine:"); - for(i=1;i<argc;i++) MSG_INFO(" '%s'",argv[i]); - MSG_INFO("\n"); + mpxp_info<<"CommandLine:"; + for(i=1;i<argc;i++) mpxp_info<<" '"<<argv[i]<<"'"; + mpxp_info<<std::endl; } //------ load global data first ------ @@ -1736,7 +1752,7 @@ play_next_file: ao_subdevice=MPXPSys.init_output_subsystems(); - if(filename) MSG_OK(MSGTR_Playing, filename); + if(filename) mpxp_ok<<MSGTR_Playing<<" "<<filename<<std::endl; forced_subs_only=MPXPSys.init_vobsub(filename); @@ -1758,7 +1774,7 @@ stream_dump_type=0; if(mp_conf.stream_dump) if((stream_dump_type=dump_parse(mp_conf.stream_dump))==0) { - MSG_ERR("Wrong dump parameters! Unable to continue\n"); + mpxp_err<<"Wrong dump parameters! Unable to continue"<<std::endl; exit_player(MSGTR_Exit_error); } @@ -1770,7 +1786,7 @@ new(zeromem) Cached_Stream(MPXPSys.libinput(),mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20): new(zeromem) Stream; if(stream->open(MPXPSys.libinput(),filename,&file_format)!=MPXP_Ok) { // error... - MSG_ERR("Can't open: %s\n",filename); + mpxp_err<<"Can't open: "<<filename<<std::endl; eof = MPXPSys.libmpdemux_was_interrupted(PT_NEXT_ENTRY); goto goto_next_file; } @@ -1824,7 +1840,7 @@ fflush(stdout); if(!sh_video && !sh_audio) { - MSG_FATAL("No stream found\n"); + mpxp_fatal<<"No stream found"<<std::endl; goto goto_next_file; // exit_player(MSGTR_Exit_error); } @@ -1844,18 +1860,20 @@ /* is it non duplicate block fro find_acodec() ??? */ if(sh_audio){ - MSG_V("Initializing audio codec...\n"); + mpxp_v<<"Initializing audio codec..."<<std::endl; if(!mpxp_context().audio().decoder) { if((mpxp_context().audio().decoder=mpca_init(sh_audio))==NULL){ - MSG_ERR(MSGTR_CouldntInitAudioCodec); + mpxp_err<<MSGTR_CouldntInitAudioCodec<<std::endl; d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } } if(sh_audio) { - MSG_V("AUDIO: srate=%d chans=%d bps=%d sfmt=0x%X ratio: %d->%d\n" - ,sh_audio->rate,sh_audio->nch,afmt2bps(sh_audio->afmt) - ,sh_audio->afmt,sh_audio->i_bps,sh_audio->af_bps); + mpxp_v<<"AUDIO: srate="<<sh_audio->rate + <<" chans="<<sh_audio->nch + <<" bps="<<afmt2bps(sh_audio->afmt) + <<" sfmt=0x"<<std::hex<<sh_audio->afmt + <<" ratio: "<<sh_audio->i_bps<<"->"<<sh_audio->af_bps<<std::endl; } } @@ -1885,14 +1903,14 @@ if(rc==MPXP_Ok) mpxp_context().output_quality=quality; if(mp_conf.autoq>mpxp_context().output_quality) mp_conf.autoq=mpxp_context().output_quality; else mpxp_context().output_quality=mp_conf.autoq; - MSG_V("AutoQ: setting quality to %d\n",mpxp_context().output_quality); + mpxp_v<<"AutoQ: setting quality to "<<mpxp_context().output_quality<<std::endl; mpcv_set_quality(mpxp_context().video().decoder,mpxp_context().output_quality); } // ========== Init display (sh_video->src_w*sh_video->src_h/out_fmt) ============ MPXPSys.inited_flags|=INITED_VO; - MSG_V("INFO: Video OUT driver init OK!\n"); + mpxp_v<<"INFO: Video OUT driver init OK!"<<std::endl; MP_UNIT("init_libvo"); fflush(stdout); @@ -1924,14 +1942,14 @@ sh_audio->chapter_change=0; sh_audio->a_pts=HUGE; } else { - MSG_INFO(MSGTR_NoSound); + mpxp_info<<MSGTR_NoSound<<std::endl; d_audio->free_packs(); // mp_free buffered chunks d_audio->id=-2; // do not read audio chunks if(MPXPSys.ao_inited==MPXP_Ok) MPXPSys.uninit_player(INITED_AO); // close device } if(!sh_video){ - MSG_INFO("Video: no video!!!\n"); + mpxp_info<<"Video: no video!!!"<<std::endl; d_video->free_packs(); d_video->id=-2; if(MPXPSys.vo_inited) MPXPSys.uninit_player(INITED_VO); @@ -1947,7 +1965,7 @@ /* Init timers and benchmarking */ mpxp_context().rtc_fd=InitTimer(); if(!mp_conf.nortc && mpxp_context().rtc_fd>0) { close(mpxp_context().rtc_fd); mpxp_context().rtc_fd=-1; } - MSG_V("Using %s timing\n",mpxp_context().rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); + mpxp_v<<"Using "<<(mpxp_context().rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()")<<" timing"<<std::endl; mpxp_context().bench->total_start=GetTimer(); mpxp_context().bench->audio=0; mpxp_context().bench->audio_decode=0; mpxp_context().bench->video=0; @@ -1975,18 +1993,17 @@ // TODO: rewrite test backtrace in .asm // mpxp_test_backtrace(); if(xmp_run_players()!=0) exit_player("Can't run xp players!\n"); - MSG_OK("Using the next %i threads:\n",mpxp_context().engine().xp_core->num_threads); + mpxp_ok<<"Using the next "<<mpxp_context().engine().xp_core->num_threads<<" threads:"<<std::endl; unsigned idx; for(idx=0;idx<mpxp_context().engine().xp_core->num_threads;idx++) - MSG_OK("[%i] %s (id=%u, pth_id=%lu)\n" - ,idx - ,mpxp_context().engine().xp_core->mpxp_threads[idx]->name - ,mpxp_context().engine().xp_core->mpxp_threads[idx]->pid - ,mpxp_context().engine().xp_core->mpxp_threads[idx]->pth_id); - + mpxp_ok<<"["<<idx<<"] " + <<mpxp_context().engine().xp_core->mpxp_threads[idx]->name + <<" (id="<<mpxp_context().engine().xp_core->mpxp_threads[idx]->pid + <<" pth_id="<<mpxp_context().engine().xp_core->mpxp_threads[idx]->pth_id + <<")"<<std::endl; //==================== START PLAYING ======================= - MSG_OK(MSGTR_StartPlaying);fflush(stdout); + mpxp_ok<<MSGTR_StartPlaying<<std::endl; mpxp_print_flush(); while(!eof){ @@ -2026,7 +2043,7 @@ } /* Looping. */ if(eof && mp_conf.loop_times>=0) { - MSG_V("loop_times = %d, eof = %d\n", mp_conf.loop_times,eof); + mpxp_v<<"loop_times = "<<mp_conf.loop_times<<", eof = "<<eof<<std::endl; if(mp_conf.loop_times>1) mp_conf.loop_times--; else if(mp_conf.loop_times==1) mp_conf.loop_times=-1; @@ -2063,7 +2080,7 @@ #endif } // while(!eof) - MSG_V("EOF code: %d\n",eof); + mpxp_v<<"EOF code: "<<eof<<std::endl; goto_next_file: // don't jump here after ao/vo/getch initialization! Modified: mplayerxp/mpxp_msg.cpp =================================================================== --- mplayerxp/mpxp_msg.cpp 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/mpxp_msg.cpp 2012-12-19 17:44:09 UTC (rev 579) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; +#include <algorithm> + #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -13,6 +15,130 @@ #include "mpxp_msg.h" namespace mpxp { +mpxp_streambuf::mpxp_streambuf(mpxp_ostream& _parent,const std::string& _data) + :data(_data) + ,parent(_parent) +{ + setp(buf, buf + BUF_SIZE); +} + +mpxp_streambuf::~mpxp_streambuf() {} + +int mpxp_streambuf::overflow(int c) { + // Handle output + put_chars(pbase(), pptr()); + if (c != Traits::eof()) { + char c2 = c; + // Handle the one character that didn't fit to buffer + put_chars(&c2, &c2 + 1); + } + // This tells that buffer is empty again + setp(buf, buf + BUF_SIZE); + // I'm not sure about this return value! + return 0; +} + +int mpxp_streambuf::sync() { + // Handle output + put_chars(pbase(), pptr()); + // This tells that buffer is empty again + setp(buf, buf + BUF_SIZE); + return 0; +} + +void mpxp_streambuf::put_chars(char const* begin, char const* end) const { + if(!(parent._type&mp_conf.msg_filter)) { parent.setstate(std::ios_base::badbit); return; } + if(::isatty(::fileno(::stderr))) std::cerr<<data; + ::fwrite(begin,end-begin,1,::stderr); +} + +static const char* msg_prefix[] = { + "GLOBAL", + "PLAYER", + "LIBVO", + "LIBAO", + "DEMUX", + "PARSER", + "DECAUD", + "DECVID", + "MPSUB", + "OSDEP", + "PLAYTR", + "INPUT", + "OSD", + "CPUDTC", + "CODCFG", + "SWS", + "POSTPR", + "NLS", + "STREAM", + "UNKNOWN" +}; + +mpxp_ostream::mpxp_ostream(const std::string& data,mpxp_msgt_e type) + :std::basic_ostream< char, std::char_traits< char > >(&buf) + ,_type(type) + ,idx(compute_idx(type)) + ,buf(*this,mp_conf.verbose>1?data+msg_prefix[idx]+": ":data) {} +mpxp_ostream::~mpxp_ostream() {} + +unsigned mpxp_ostream::compute_idx(mpxp_msgt_e type) const { + unsigned mod_idx=0,_idx=type; + while((_idx&0x1)==0) { mod_idx++; _idx>>=1; } + return std::min(_idx,unsigned(sizeof(msg_prefix)/sizeof(msg_prefix[0]))); +} + +/* TODO: replace this block with std::string */ +static const char blue[]="\033[0;34;40m"; +static const char green[]="\033[0;32;40m"; +static const char cyan[]="\033[0;36;40m"; +static const char red[]="\033[0;31;40m"; +static const char magenta[]="\033[0;35;40m"; +static const char brown[]="\033[0;33;40m"; +static const char gray[]="\033[0;37;40m"; +static const char light_blue[]="\033[1;34;40m"; +static const char light_green[]="\033[1;32;40m"; +static const char light_cyan[]="\033[1;36;40m"; +static const char light_red[]="\033[1;31;40m"; +static const char light_magenta[]="\033[1;35;40m"; +static const char yellow[]="\033[1;33;40m"; +static const char white[]="\033[1;37;40m"; + +mpxp_ostream_info::mpxp_ostream_info(mpxp_msgt_e type):mpxp_ostream(gray,type){} +mpxp_ostream_info::~mpxp_ostream_info() {} + +mpxp_ostream_fatal::mpxp_ostream_fatal(mpxp_msgt_e type):mpxp_ostream(light_red,type){} +mpxp_ostream_fatal::~mpxp_ostream_fatal() {} + +mpxp_ostream_err::mpxp_ostream_err(mpxp_msgt_e type):mpxp_ostream(red,type){} +mpxp_ostream_err::~mpxp_ostream_err() {} + +mpxp_ostream_warn::mpxp_ostream_warn(mpxp_msgt_e type):mpxp_ostream(yellow,type){} +mpxp_ostream_warn::~mpxp_ostream_warn() {} + +mpxp_ostream_ok::mpxp_ostream_ok(mpxp_msgt_e type):mpxp_ostream(light_green,type){} +mpxp_ostream_ok::~mpxp_ostream_ok() {} + +mpxp_ostream_hint::mpxp_ostream_hint(mpxp_msgt_e type):mpxp_ostream(light_cyan,type){} +mpxp_ostream_hint::~mpxp_ostream_hint() {} + +mpxp_ostream_status::mpxp_ostream_status(mpxp_msgt_e type):mpxp_ostream(light_blue,type){} +mpxp_ostream_status::~mpxp_ostream_status() {} + +mpxp_ostream_v::mpxp_ostream_v(mpxp_msgt_e type):mpxp_ostream(cyan,type){ if(mp_conf.verbose<1) setstate(ios_base::badbit); /* do not display */ } +mpxp_ostream_v::~mpxp_ostream_v() {} + +mpxp_ostream_dbg2::mpxp_ostream_dbg2(mpxp_msgt_e type):mpxp_ostream(gray,type){ if(mp_conf.verbose<2) setstate(ios_base::badbit); /* do not display */ } +mpxp_ostream_dbg2::~mpxp_ostream_dbg2() {} + +mpxp_ostream_dbg3::mpxp_ostream_dbg3(mpxp_msgt_e type):mpxp_ostream(gray,type){ if(mp_conf.verbose<3) setstate(ios_base::badbit); /* do not display */ } +mpxp_ostream_dbg3::~mpxp_ostream_dbg3() {} + +mpxp_ostream_dbg4::mpxp_ostream_dbg4(mpxp_msgt_e type):mpxp_ostream(gray,type){ if(mp_conf.verbose<4) setstate(ios_base::badbit); /* do not display */ } +mpxp_ostream_dbg4::~mpxp_ostream_dbg4() {} + +/* old stuff: */ + inline int _bg(int x) { return x >> 4; } inline int _fg(int x) { return x & 0x0f; } struct priv_t { @@ -59,30 +185,6 @@ delete priv; } -static const char * msg_prefix[] = -{ - "GLOBAL", - "PLAYER", - "LIBVO", - "LIBAO", - "DEMUX", - "CFGPRS", - "DECAUD", - "DECVID", - "VOBSUB", - "OSDEP", - "SPUDEC", - "PLAYTR", - "INPUT", - "OSD", - "CPUDTC", - "CODCFG", - "SWS", - "FINDSB", - "SUBRDR", - "POSTPR" -}; - int mpxp_printf( unsigned x, const std::string& format, ... ){ /* TODO: more useful usage of module_id */ int rc=0; Modified: mplayerxp/mpxp_msg.h =================================================================== --- mplayerxp/mpxp_msg.h 2012-12-19 12:02:27 UTC (rev 578) +++ mplayerxp/mpxp_msg.h 2012-12-19 17:44:09 UTC (rev 579) @@ -1,7 +1,9 @@ #ifndef __MPXP_MSG_H_INCLUDED #define __MPXP_MSG_H_INCLUDED 1 #include "mplayerxp.h" +#include "osdep/mplib.h" +#include <iostream> #include <string> /* TODO: more highlighted levels */ @@ -11,49 +13,153 @@ namespace mpxp { -enum { - MSGL_FATAL =0U, /* will exit/abort LightRed */ - MSGL_ERR =1U, /* continues Red */ - MSGL_WARN =2U, /* only warning Yellow */ - MSGL_OK =3U, /* checkpoint was passed OK. LightGreen */ - MSGL_HINT =4U, /* short help message LightCyan */ - MSGL_INFO =5U, /* -quiet LightGray */ - MSGL_STATUS =6U, /* v=0 (old status line) LightBlue */ - MSGL_V =7U, /* v=1 Cyan */ - MSGL_DBG2 =8U, /* v=2 LightGray */ - MSGL_DBG3 =9U, /* v=3 LightGray */ - MSGL_DBG4 =10U,/* v=4 LightGray */ + enum mpxp_msgl_e { + MSGL_FATAL =0U, /* will exit/abort LightRed */ + MSGL_ERR =1U, /* continues Red */ + MSGL_WARN =2U, /* only warning Yellow */ + MSGL_OK =3U, /* checkpoint was passed OK. LightGreen */ + MSGL_HINT =4U, /* short help message LightCyan */ + MSGL_INFO =5U, /* -quiet LightGray */ + MSGL_STATUS =6U, /* v=0 (old status line) LightBlue */ + MSGL_V =7U, /* v=1 Cyan */ + MSGL_DBG2 =8U, /* v=2 LightGray */ + MSGL_DBG3 =9U, /* v=3 LightGray */ + MSGL_DBG4 =10U,/* v=4 LightGray */ + MSGL_MASK =0xF0000000 + }; - MSGL_MASK =0xF0000000 -}; -// code/module: -enum { - MSGT_GLOBAL =0x00000001, - MSGT_CPLAYER =0x00000002, - MSGT_VO =0x00000004, - MSGT_AO =0x00000008, - MSGT_DEMUXER =0x00000010, - MSGT_CFGPARSER =0x00000020, - MSGT_DECAUDIO =0x00000040, - MSGT_DECVIDEO =0x00000080, - MSGT_VOBSUB =0x00000100, - MSGT_OSDEP =0x00000200, - MSGT_SPUDEC =0x00000400, - MSGT_PLAYTREE =0x00000800, - MSGT_INPUT =0x00001000, - MSGT_OSD =0x00002000, - MSGT_CPUDETECT =0x00004000, - MSGT_CODECCFG =0x00008000, - MSGT_SWS =0x00010000, - MSGT_FINDSUB =0x00020000, - MSGT_SUBREADER =0x00040000, - MSGT_PP =0x00080000, - MSGT_NLS =0x00100000, - MSGT_STREAM =0x00200000, + // code/module: + enum mpxp_msgt_e { + MSGT_GLOBAL =0x00000001, + MSGT_CPLAYER =0x00000002, + MSGT_VO =0x00000004, + MSGT_AO =0x00000008, + MSGT_DEMUXER =0x00000010, + MSGT_PARSER =0x00000020, + MSGT_DECAUDIO =0x00000040, + MSGT_DECVIDEO =0x00000080, + MSGT_MPSUB =0x00000100, + MSGT_OSDEP =0x00000200, + MSGT_PLAYTREE =0x00000400, + MSGT_INPUT =0x00000800, + MSGT_OSD =0x00001000, + MSGT_CPUDETECT =0x00002000, + ... [truncated message content] |
From: <nic...@us...> - 2012-12-19 12:02:34
|
Revision: 578 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=578&view=rev Author: nickols_k Date: 2012-12-19 12:02:27 +0000 (Wed, 19 Dec 2012) Log Message: ----------- simplify logic Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libao3/audio_out.h mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/demuxer_stream.h mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h mplayerxp/mplayerxp.cpp mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/af.cpp mplayerxp/postproc/af.h mplayerxp/postproc/af_internal.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_internal.h Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/input2/input.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -87,8 +87,11 @@ mp_cmd_filter_t* next; }; -struct libinput_t { - char antiviral_hole[RND_CHAR1]; +struct libinput_t : public Opaque { + libinput_t() {} + virtual ~libinput_t() {} + + Opaque unusable; // These are the user defined binds mp_cmd_bind_t* cmd_binds; mp_cmd_filter_t* cmd_filters; @@ -743,7 +746,6 @@ filter->ctx = ctx; filter->next = priv.cmd_filters; priv.cmd_filters = filter; - fill_false_pointers(priv.antiviral_hole,offsetof(libinput_t,cmd_binds)-offsetof(libinput_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { Modified: mplayerxp/libao3/audio_out.h =================================================================== --- mplayerxp/libao3/audio_out.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libao3/audio_out.h 2012-12-19 12:02:27 UTC (rev 578) @@ -64,6 +64,7 @@ //virtual void mixer_setbothvolume( int v ); inline void mixer_setbothvolume(float v) const { mixer_setvolume(v,v); } + Opaque unusable; char* subdevice; float pts; /**< PTS of audio buffer */ private: Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -149,7 +149,6 @@ :demuxer_priv(new(zeromem) demuxer_priv_t), _info(new(zeromem) Demuxer_Info) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DEMUX_PIN; } @@ -157,7 +156,6 @@ :demuxer_priv(new(zeromem) demuxer_priv_t), _info(new(zeromem) Demuxer_Info) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DEMUX_PIN; _init(_stream,a_id,v_id,s_id); } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-19 12:02:27 UTC (rev 578) @@ -123,7 +123,7 @@ virtual int switch_subtitle(int id) const; virtual MPXP_Rc ctrl(int cmd, any_t*arg) const; - char antiviral_hole[RND_CHAR3]; + Opaque unusable; unsigned pin; /**< personal identification number */ Stream* stream; /**< stream for movie reading */ Demuxer_Stream* audio; /**< audio buffer/demuxer */ Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -16,7 +16,6 @@ Demuxer_Stream::Demuxer_Stream(Demuxer *_demuxer,int _id) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DS_PIN; _buffer_pos=_buffer_size=0; _buffer=NULL; Modified: mplayerxp/libmpdemux/demuxer_stream.h =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer_stream.h 2012-12-19 12:02:27 UTC (rev 578) @@ -33,7 +33,7 @@ void buffer_roll_back(int size); // deprecated (added for ad_lavc) int id; /**< stream ID (for multiple audio/video streams) */ - char antiviral_hole[RND_CHAR2]; + Opaque unusable; unsigned pin; /**< personal identification number */ float pts; /**< current buffer's PTS */ int eof; /**< end of demuxed stream? (true if all buffer empty) */ Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpstream2/stream.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -96,7 +96,6 @@ Stream::Stream(Stream::type_e t) :_type(t) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole[0])); pin=STREAM_PIN; reset(); } Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpstream2/stream.h 2012-12-19 12:02:27 UTC (rev 578) @@ -84,7 +84,7 @@ virtual unsigned read_int24(); uint32_t read_fourcc() { return read_dword_le(); } - char antiviral_hole[RND_CHAR3]; + Opaque unusable; unsigned pin; /**< personal identification number */ int file_format; /**< detected file format (by http:// protocol for example) */ const stream_interface_info_t* driver_info; Modified: mplayerxp/libvo2/video_out.cpp =================================================================== --- mplayerxp/libvo2/video_out.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libvo2/video_out.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -111,7 +111,7 @@ vo_priv_t(); virtual ~vo_priv_t(); - char antiviral_hole[RND_CHAR8]; + Opaque unusable; uint32_t srcFourcc,image_format,image_width,image_height; uint32_t org_width,org_height; unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ @@ -125,7 +125,6 @@ }; vo_priv_t::vo_priv_t() { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); dri.num_xp_frames=1; } @@ -139,8 +138,6 @@ inited=0; osd_progbar_type=-1; osd_progbar_value=100; // 0..256 - - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole[0])); } Video_Output::~Video_Output() { Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libvo2/video_out.h 2012-12-19 12:02:27 UTC (rev 578) @@ -200,7 +200,7 @@ virtual void dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const; virtual void dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const; - char antiviral_hole[RND_CHAR4]; + Opaque unusable; vo_flags_e flags; /* subtitle support */ char* osd_text; Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/mplayerxp.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -109,9 +109,9 @@ int next_file; }; -struct MPXPSystem { +struct MPXPSystem : public Opaque { public: - MPXPSystem():inited_flags(0),osd_function(OSD_PLAY),_libinput(mp_input_open()) { fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } + MPXPSystem():inited_flags(0),osd_function(OSD_PLAY),_libinput(mp_input_open()) { } virtual ~MPXPSystem() {} void uninit_player(unsigned int mask); @@ -154,7 +154,7 @@ int osd_function; play_tree_t* playtree; private: - char antiviral_hole[RND_CHAR0]; + Opaque unusable; Demuxer* _demuxer; libinput_t& _libinput; }; Modified: mplayerxp/osdep/mplib.cpp =================================================================== --- mplayerxp/osdep/mplib.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/osdep/mplib.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -36,7 +36,7 @@ for(i=0;i<psize/sizeof(long);i++) { filler=rand()&lo_mask; filler=(reinterpret_cast<long>(buffer)&hi_mask)|lo_mask; - ((long *)buffer)[i]=filler; + ((long *)buffer)[i]=rand()%2?filler:0; } memset(&((char *)buffer)[psize],0,size-psize); return buffer; @@ -48,4 +48,10 @@ return stack[2+num_caller]; } +Opaque::Opaque() { + fill_false_pointers(&false_pointers,reinterpret_cast<long>(&unusable)-reinterpret_cast<long>(&false_pointers)); + fill_false_pointers(&unusable,sizeof(any_t*)); +} + +Opaque::~Opaque() {} } // namespace mpxp Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/osdep/mplib.h 2012-12-19 12:02:27 UTC (rev 578) @@ -62,7 +62,7 @@ MP_PROT_READ =0x1, /* Page can be read. */ MP_PROT_WRITE =0x2, /* Page can be written. */ MP_PROT_EXEC =0x4, /* Page can be executed. */ - MP_DENY_ALL =0x0, /* Page can not be accessed. */ + MP_DENY_ALL =0x0, /* Page can not be accessed. */ }; int __FASTCALL__ mp_mprotect(any_t* addr,size_t len,enum mp_prot_e flags); void print_backtrace(const std::string& why,any_t** stack,unsigned num); @@ -93,8 +93,11 @@ class Opaque { public: - Opaque() {} - virtual ~Opaque() {} + Opaque(); + virtual ~Opaque(); + + any_t* false_pointers[RND_CHAR0]; + any_t* unusable; }; } // namespace mpxp Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -112,7 +112,6 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } - fill_false_pointers(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters @@ -617,7 +616,6 @@ af_stream_t *rval; rval = new(zeromem) af_stream_t; rval->parent = _parent; - fill_false_pointers(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); return rval; } Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af.h 2012-12-19 12:02:27 UTC (rev 578) @@ -79,7 +79,7 @@ // Current audio stream struct af_stream_t { - char antiviral_hole[RND_CHAR7]; + Opaque unusable; // The first and last filter in the list af_instance_t* first; af_instance_t* last; Modified: mplayerxp/postproc/af_internal.h =================================================================== --- mplayerxp/postproc/af_internal.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af_internal.h 2012-12-19 12:02:27 UTC (rev 578) @@ -3,8 +3,8 @@ // Linked list of audio filters struct af_instance_t { + Opaque unusable; const af_info_t* info; - char antiviral_hole[RND_CHAR6]; unsigned pin; // personal identification number MPXP_Rc (* __FASTCALL__ config_af)(af_instance_t* af, const af_conf_t* arg); MPXP_Rc (* __FASTCALL__ control_af)(af_instance_t* af, int cmd, any_t* arg); Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -302,7 +302,6 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=new(zeromem) vf_instance_t(libinput); - fill_false_pointers(vf->antiviral_hole,reinterpret_cast<long>(&vf->pin)-reinterpret_cast<long>(&vf->antiviral_hole)); vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf.h 2012-12-19 12:02:27 UTC (rev 578) @@ -51,6 +51,7 @@ vf_stream_t(libinput_t& _libinput):libinput(_libinput) {} ~vf_stream_t() {} + Opaque unusable; vf_instance_t* first; libinput_t& libinput; }; Modified: mplayerxp/postproc/vf_internal.h =================================================================== --- mplayerxp/postproc/vf_internal.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf_internal.h 2012-12-19 12:02:27 UTC (rev 578) @@ -31,22 +31,17 @@ ~vf_instance_t() {} const vf_info_t* info; - char antiviral_hole[RND_CHAR5]; + Opaque unusable; unsigned pin; // personal identification number // funcs: int (* __FASTCALL__ config_vf)(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e flags, unsigned int outfmt); - MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, - int request, any_t* data); - int (* __FASTCALL__ query_format)(vf_instance_t* vf, - unsigned int fmt,unsigned w,unsigned h); - void (* __FASTCALL__ get_image)(vf_instance_t* vf, - mp_image_t *mpi); - int (* __FASTCALL__ put_slice)(vf_instance_t* vf, - mp_image_t *mpi); - void (* __FASTCALL__ start_slice)(vf_instance_t* vf, - mp_image_t *mpi); + MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, int request, any_t* data); + int (* __FASTCALL__ query_format)(vf_instance_t* vf,unsigned int fmt,unsigned w,unsigned h); + void (* __FASTCALL__ get_image)(vf_instance_t* vf, mp_image_t *mpi); + int (* __FASTCALL__ put_slice)(vf_instance_t* vf, mp_image_t *mpi); + void (* __FASTCALL__ start_slice)(vf_instance_t* vf, mp_image_t *mpi); void (* __FASTCALL__ uninit)(vf_instance_t* vf); // optional: maybe NULL void (* __FASTCALL__ print_conf)(vf_instance_t* vf); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-19 09:28:24
|
Revision: 577 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=577&view=rev Author: nickols_k Date: 2012-12-19 09:28:13 +0000 (Wed, 19 Dec 2012) Log Message: ----------- addon for minor antiviral patch Modified Paths: -------------- mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/libmpstream2/s_oss.cpp mplayerxp/libvo2/video_out.h mplayerxp/libvo2/vidix_system.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_x11.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/postproc/af.h mplayerxp/postproc/aflib.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/libmenu/menu_list.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/libmenu/menu_pt.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo2.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp mplayerxp/xmpcore/Makefile Added Paths: ----------- mplayerxp/xmpcore/xmp_aframe.cpp mplayerxp/xmpcore/xmp_aframe.h mplayerxp/xmpcore/xmp_image.cpp mplayerxp/xmpcore/xmp_image.h Removed Paths: ------------- mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/mp_aframe.h mplayerxp/xmpcore/mp_image.cpp mplayerxp/xmpcore/mp_image.h Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-12-19 09:28:13 UTC (rev 577) @@ -1,7 +1,7 @@ #ifndef DEC_AUDIO_H_INCLUDED #define DEC_AUDIO_H_INCLUDED 1 #include "ad.h" -#include "xmpcore/mp_aframe.h" +#include "xmpcore/xmp_aframe.h" #include "xmpcore/xmp_enums.h" struct audio_decoder_t { Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -620,8 +620,8 @@ return MPXP_True; } -// mp_imgtype: buffering type, see mp_image.h -// mp_imgflag: buffer requirements (read/write, preserve, stride limits), see mp_image.h +// mp_imgtype: buffering type, see xmp_image.h +// mp_imgflag: buffer requirements (read/write, preserve, stride limits), see xmp_image.h // returns NULL or allocated mp_image_t* // Note: buffer allocation may be moved to mpcodecs_config_vf() later... mp_image_t* mpcodecs_get_image(video_decoder_t *opaque, int mp_imgtype, int mp_imgflag,int w, int h){ Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libmpdemux/stheader.h 2012-12-19 09:28:13 UTC (rev 577) @@ -11,7 +11,7 @@ #ifdef __cplusplus } #endif -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "demuxer_stream.h" struct ImageDescription; Modified: mplayerxp/libmpstream2/s_oss.cpp =================================================================== --- mplayerxp/libmpstream2/s_oss.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libmpstream2/s_oss.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -17,7 +17,7 @@ #include <string.h> #include "mplayerxp.h" -#include "xmpcore/mp_aframe.h" +#include "xmpcore/xmp_aframe.h" #include "postproc/af.h" #include "libao3/afmt.h" #include "libao3/audio_out.h" Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libvo2/video_out.h 2012-12-19 09:28:13 UTC (rev 577) @@ -25,7 +25,7 @@ #include "sub.h" #include "libmpsub/subreader.h" #include "img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "xmpcore/xmp_enums.h" namespace mpxp { Modified: mplayerxp/libvo2/vidix_system.cpp =================================================================== --- mplayerxp/libvo2/vidix_system.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libvo2/vidix_system.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -27,7 +27,7 @@ #include "vidix_system.h" #include "osdep/fastmemcpy.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vo_msg.h" using namespace vidix; Modified: mplayerxp/libvo2/vo_sdl.cpp =================================================================== --- mplayerxp/libvo2/vo_sdl.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libvo2/vo_sdl.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -129,7 +129,7 @@ #include "input2/input.h" #include "input2/mouse.h" #include "osdep/keycodes.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #ifdef CONFIG_VIDIX #include "vidix_system.h" #endif Modified: mplayerxp/libvo2/vo_x11.cpp =================================================================== --- mplayerxp/libvo2/vo_x11.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libvo2/vo_x11.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -48,7 +48,7 @@ #include "vidix_system.h" #endif #include "dri_vo.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vo_msg.h" namespace mpxp { Modified: mplayerxp/libvo2/vo_xv.cpp =================================================================== --- mplayerxp/libvo2/vo_xv.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/libvo2/vo_xv.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -35,7 +35,7 @@ #include "sub.h" #include "aspect.h" #include "dri_vo.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vo_msg.h" Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/af.h 2012-12-19 09:28:13 UTC (rev 577) @@ -6,7 +6,7 @@ #include "mpxp_config.h" #include "af_control.h" #include "xmpcore/xmp_enums.h" -#include "xmpcore/mp_aframe.h" +#include "xmpcore/xmp_aframe.h" struct af_instance_t; Modified: mplayerxp/postproc/aflib.h =================================================================== --- mplayerxp/postproc/aflib.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/aflib.h 2012-12-19 09:28:13 UTC (rev 577) @@ -12,7 +12,7 @@ #define _AFLIB_H 1 #include "mpxp_config.h" -#include "xmpcore/mp_aframe.h" +#include "xmpcore/xmp_aframe.h" /* Implementation of routines used for DSP */ /* Size of floating point type used in routines */ Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -20,7 +20,7 @@ #include "libvo2/img_format.h" #include "libvo2/video_out.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -10,7 +10,7 @@ #include <string.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/libmenu/menu_console.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -17,7 +17,7 @@ #include <errno.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/cfgparser.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/libmenu/menu_filesel.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -20,7 +20,7 @@ #include "libmpconf/cfgparser.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "menu.h" #include "menu_list.h" Modified: mplayerxp/postproc/libmenu/menu_list.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -8,7 +8,7 @@ #include "libvo2/img_format.h" #include "libvo2/sub.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/m_struct.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -20,7 +20,7 @@ #include "libplaytree/asxparser.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "menu.h" #include "menu_list.h" Modified: mplayerxp/postproc/libmenu/menu_pt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -8,7 +8,7 @@ #include "mpxp_help.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/m_struct.h" #include "libmpconf/m_option.h" Modified: mplayerxp/postproc/libmenu/menu_txt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -10,7 +10,7 @@ #include "libvo2/img_format.h" #include "libvo2/sub.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libmpconf/cfgparser.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -11,7 +11,7 @@ #include "libvo2/img_format.h" #include "libvo2/video_out.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "swscale.h" Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf.h 2012-12-19 09:28:13 UTC (rev 577) @@ -2,7 +2,7 @@ #define __VF_H_INCLUDED 1 #include <stdint.h> #include "xmpcore/xmp_enums.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libvo2/video_out.h" // for vo_flags_e #include "vfcap.h" Modified: mplayerxp/postproc/vf_1bpp.cpp =================================================================== --- mplayerxp/postproc/vf_1bpp.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_1bpp.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_2xsai.cpp =================================================================== --- mplayerxp/postproc/vf_2xsai.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_2xsai.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_aspect.cpp =================================================================== --- mplayerxp/postproc/vf_aspect.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_aspect.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_delogo.cpp =================================================================== --- mplayerxp/postproc/vf_delogo.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_delogo.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -30,7 +30,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_denoise3d.cpp =================================================================== --- mplayerxp/postproc/vf_denoise3d.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_denoise3d.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -26,7 +26,7 @@ #include <math.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_dint.cpp =================================================================== --- mplayerxp/postproc/vf_dint.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_dint.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -8,7 +8,7 @@ #include "osdep/fastmemcpy.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "libvo2/img_format.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_down3dright.cpp =================================================================== --- mplayerxp/postproc/vf_down3dright.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_down3dright.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -9,7 +9,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_eq.cpp =================================================================== --- mplayerxp/postproc/vf_eq.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_eq.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -22,7 +22,7 @@ #include "libvo2/img_format.h" #include "libvo2/video_out.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_expand.cpp =================================================================== --- mplayerxp/postproc/vf_expand.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_expand.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -8,7 +8,7 @@ #include <string.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_flip.cpp =================================================================== --- mplayerxp/postproc/vf_flip.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_flip.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -25,7 +25,7 @@ #include "pp_msg.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_format.cpp =================================================================== --- mplayerxp/postproc/vf_format.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_format.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_framestep.cpp =================================================================== --- mplayerxp/postproc/vf_framestep.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_framestep.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -58,7 +58,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_il.cpp =================================================================== --- mplayerxp/postproc/vf_il.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_il.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -26,7 +26,7 @@ #include <assert.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_menu.cpp =================================================================== --- mplayerxp/postproc/vf_menu.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_menu.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -11,7 +11,7 @@ #include "mplayerxp.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_mirror.cpp =================================================================== --- mplayerxp/postproc/vf_mirror.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_mirror.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_noise.cpp =================================================================== --- mplayerxp/postproc/vf_noise.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_noise.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -28,7 +28,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_ow.cpp =================================================================== --- mplayerxp/postproc/vf_ow.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_ow.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -34,7 +34,7 @@ #include <math.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_palette.cpp =================================================================== --- mplayerxp/postproc/vf_palette.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_palette.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_panscan.cpp =================================================================== --- mplayerxp/postproc/vf_panscan.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_panscan.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -10,7 +10,7 @@ #include <string.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_perspective.cpp =================================================================== --- mplayerxp/postproc/vf_perspective.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_perspective.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -27,7 +27,7 @@ #include <math.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_pp.cpp =================================================================== --- mplayerxp/postproc/vf_pp.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_pp.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -10,7 +10,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_raw.cpp =================================================================== --- mplayerxp/postproc/vf_raw.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_raw.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -11,7 +11,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_rectangle.cpp =================================================================== --- mplayerxp/postproc/vf_rectangle.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_rectangle.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -4,7 +4,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_rgb2bgr.cpp =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_rotate.cpp =================================================================== --- mplayerxp/postproc/vf_rotate.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_rotate.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_scale.cpp =================================================================== --- mplayerxp/postproc/vf_scale.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_scale.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -9,7 +9,7 @@ #include "osdep/cpudetect.h" #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_smartblur.cpp =================================================================== --- mplayerxp/postproc/vf_smartblur.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_smartblur.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -30,7 +30,7 @@ #endif #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_softpulldown.cpp =================================================================== --- mplayerxp/postproc/vf_softpulldown.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_softpulldown.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -6,7 +6,7 @@ #include <string.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_swapuv.cpp =================================================================== --- mplayerxp/postproc/vf_swapuv.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_swapuv.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -26,7 +26,7 @@ #include <assert.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_test.cpp =================================================================== --- mplayerxp/postproc/vf_test.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_test.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -26,7 +26,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "swscale.h" Modified: mplayerxp/postproc/vf_unsharp.cpp =================================================================== --- mplayerxp/postproc/vf_unsharp.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_unsharp.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -34,7 +34,7 @@ #endif #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_vo2.cpp =================================================================== --- mplayerxp/postproc/vf_vo2.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_vo2.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -5,7 +5,7 @@ #include <stdlib.h> #include <string.h> -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "vfcap.h" Modified: mplayerxp/postproc/vf_yuvcsp.cpp =================================================================== --- mplayerxp/postproc/vf_yuvcsp.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_yuvcsp.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_yuy2.cpp =================================================================== --- mplayerxp/postproc/vf_yuy2.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_yuy2.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_yvu9.cpp =================================================================== --- mplayerxp/postproc/vf_yvu9.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/postproc/vf_yvu9.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -7,7 +7,7 @@ #include <inttypes.h> #include "libvo2/img_format.h" -#include "xmpcore/mp_image.h" +#include "xmpcore/xmp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/xmpcore/Makefile =================================================================== --- mplayerxp/xmpcore/Makefile 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/xmpcore/Makefile 2012-12-19 09:28:13 UTC (rev 577) @@ -9,7 +9,7 @@ xmp_vdecoder.cpp \ xmp_adecoder.cpp -SRCS+=sig_hand.cpp mp_image.cpp mp_aframe.cpp +SRCS+=sig_hand.cpp xmp_image.cpp xmp_aframe.cpp OBJS=$(SRCS:.cpp=.o) CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall Deleted: mplayerxp/xmpcore/mp_aframe.cpp =================================================================== --- mplayerxp/xmpcore/mp_aframe.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/xmpcore/mp_aframe.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -1,328 +0,0 @@ -#include "mpxp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <string.h> -#include <stdio.h> - -#include "mp_aframe.h" -#include "libao3/afmt.h" -#include "loader/wine/mmreg.h" -#include "mpxp_msg.h" - -namespace mpxp { - -enum { AFMT_AF_FLAGS=0x70000000 }; - -/* Decodes the format from mplayer format to libaf format */ -mpaf_format_e __FASTCALL__ afmt2mpaf(unsigned ifmt) -{ - mpaf_format_e ofmt = mpaf_format_e(0); - // Check input ifmt - switch(ifmt){ - case AFMT_U8: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|1); break; - case AFMT_S8: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|1); break; - case AFMT_S16_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|2); break; - case AFMT_S16_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|2); break; - case AFMT_U16_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|2); break; - case AFMT_U16_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|2); break; - case AFMT_S24_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|3); break; - case AFMT_S24_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|3); break; - case AFMT_U24_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|3); break; - case AFMT_U24_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|3); break; - case AFMT_S32_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|4); break; - case AFMT_S32_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|4); break; - case AFMT_U32_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|4); break; - case AFMT_U32_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|4); break; - case AFMT_FLOAT32:ofmt = mpaf_format_e(MPAF_PCM|MPAF_F |MPAF_NE|4); break; - - case AFMT_IMA_ADPCM: ofmt = mpaf_format_e(MPAF_IMA_ADPCM|1); break; - case AFMT_MPEG: ofmt = mpaf_format_e(MPAF_MPEG2|1); break; - case AFMT_AC3: ofmt = mpaf_format_e(MPAF_AC3|1); break; - default: - if ((ifmt & AFMT_AF_FLAGS) == AFMT_AF_FLAGS) { - ofmt = mpaf_format_e((ifmt&(~AFMT_AF_FLAGS))|2); - break; - } - //This can not happen .... - MSG_FATAL("[af_mp] Unrecognized input audio format %i\n",ifmt); - break; - } - return ofmt; -} - -/* Encodes the format from libaf format to mplayer (OSS) format */ -unsigned __FASTCALL__ mpaf2afmt(mpaf_format_e fmt) -{ - switch(fmt&MPAF_SPECIAL_MASK) { - case 0: // PCM: - if((fmt&MPAF_POINT_MASK)==MPAF_I) { - if((fmt&MPAF_SIGN_MASK)==MPAF_SI){ - // signed int PCM: - switch(fmt&MPAF_BPS_MASK){ - case MPAF_BPS_1: return AFMT_S8; - default: - case MPAF_BPS_2: return (fmt&MPAF_LE)?AFMT_S16_LE:AFMT_S16_BE; - case MPAF_BPS_3: return (fmt&MPAF_LE)?AFMT_S24_LE:AFMT_S24_BE; - case MPAF_BPS_4: return (fmt&MPAF_LE)?AFMT_S32_LE:AFMT_S32_BE; - } - } else { - // unsigned int PCM: - switch(fmt&MPAF_BPS_MASK){ - case MPAF_BPS_1: return AFMT_U8; - default: - case MPAF_BPS_2: return (fmt&MPAF_LE)?AFMT_U16_LE:AFMT_U16_BE; - case MPAF_BPS_3: return (fmt&MPAF_LE)?AFMT_U24_LE:AFMT_U24_BE; - case MPAF_BPS_4: return (fmt&MPAF_LE)?AFMT_U32_LE:AFMT_U32_BE; - } - } - } else { - // float PCM: - return AFMT_FLOAT32; // FIXME? - } - break; - default: - case MPAF_MPEG2: return AFMT_MPEG; - case MPAF_AC3: return AFMT_AC3; - case MPAF_IMA_ADPCM: return AFMT_IMA_ADPCM; - } - return fmt|AFMT_AF_FLAGS; -} - -static const struct fmt_alias_s { - const char *name; - unsigned short wtag; -} fmt_aliases[]= { - { "adpcm", WAVE_FORMAT_ADPCM }, - { "vselp", WAVE_FORMAT_VSELP }, - { "cvsd", WAVE_FORMAT_IBM_CVSD }, - { "dts", WAVE_FORMAT_DTS }, - { "oki_adpcm", WAVE_FORMAT_OKI_ADPCM }, - { "dvi_adpcm", WAVE_FORMAT_DVI_ADPCM }, - { "ima_adpcm", WAVE_FORMAT_IMA_ADPCM }, - { "mediaspace_adpcm", WAVE_FORMAT_MEDIASPACE_ADPCM }, - { "sierra_adpcm", WAVE_FORMAT_SIERRA_ADPCM }, - { "g723_adpcm", WAVE_FORMAT_G723_ADPCM }, - { "digistd", WAVE_FORMAT_DIGISTD }, - { "digifix", WAVE_FORMAT_DIGIFIX }, - { "dialogic_oki_adpcm", WAVE_FORMAT_DIALOGIC_OKI_ADPCM }, - { "mediavision_adpcm", WAVE_FORMAT_MEDIAVISION_ADPCM }, - { "cu_codec", WAVE_FORMAT_CU_CODEC }, - { "yamaha_adpcm", WAVE_FORMAT_YAMAHA_ADPCM }, - { "sonarc", WAVE_FORMAT_SONARC }, - { "dspgroup_truespeech", WAVE_FORMAT_DSPGROUP_TRUESPEECH }, - { "echosc1", WAVE_FORMAT_ECHOSC1 }, - { "audiofile_af36", WAVE_FORMAT_AUDIOFILE_AF36 }, - { "aptx", WAVE_FORMAT_APTX }, - { "audiofile_af10", WAVE_FORMAT_AUDIOFILE_AF10 }, - { "prosody_1612", WAVE_FORMAT_PROSODY_1612 }, - { "lrc", WAVE_FORMAT_LRC }, - { "dolby_ac2", WAVE_FORMAT_DOLBY_AC2 }, - { "gsm610", WAVE_FORMAT_GSM610 }, - { "msnaudio", WAVE_FORMAT_MSNAUDIO }, - { "antex_adpcme", WAVE_FORMAT_ANTEX_ADPCME }, - { "control_res_vqlpc", WAVE_FORMAT_CONTROL_RES_VQLPC }, - { "digireal", WAVE_FORMAT_DIGIREAL }, - { "digiadpcm", WAVE_FORMAT_DIGIADPCM }, - { "control_res_cr10", WAVE_FORMAT_CONTROL_RES_CR10 }, - { "nms_vbxadpcm", WAVE_FORMAT_NMS_VBXADPCM }, - { "cs_imaadpcm", WAVE_FORMAT_CS_IMAADPCM }, - { "echosc3", WAVE_FORMAT_ECHOSC3 }, - { "rockwell_adpcm", WAVE_FORMAT_ROCKWELL_ADPCM }, - { "rockwell_digitalk", WAVE_FORMAT_ROCKWELL_DIGITALK }, - { "xebec", WAVE_FORMAT_XEBEC }, - { "g721_adpcm", WAVE_FORMAT_G721_ADPCM }, - { "g728_celp", WAVE_FORMAT_G728_CELP }, - { "msg723", WAVE_FORMAT_MSG723 }, - { "mp2", WAVE_FORMAT_MPEG }, - { "rt24", WAVE_FORMAT_RT24 }, - { "pac", WAVE_FORMAT_PAC }, - { "mp3", WAVE_FORMAT_MPEGLAYER3 }, - { "lucent_g723", WAVE_FORMAT_LUCENT_G723 }, - { "cirrus", WAVE_FORMAT_CIRRUS }, - { "espcm", WAVE_FORMAT_ESPCM }, - { "voxware", WAVE_FORMAT_VOXWARE }, - { "canopus_atrac", WAVE_FORMAT_CANOPUS_ATRAC }, - { "g726_adpcm", WAVE_FORMAT_G726_ADPCM }, - { "g722_adpcm", WAVE_FORMAT_G722_ADPCM }, - { "dsat_display", WAVE_FORMAT_DSAT_DISPLAY }, - { "voxware_byte_aligned", WAVE_FORMAT_VOXWARE_BYTE_ALIGNED }, - { "voxware_ac8", WAVE_FORMAT_VOXWARE_AC8 }, - { "voxware_ac10", WAVE_FORMAT_VOXWARE_AC10 }, - { "voxware_ac16", WAVE_FORMAT_VOXWARE_AC16 }, - { "voxware_ac20", WAVE_FORMAT_VOXWARE_AC20 }, - { "voxware_rt24", WAVE_FORMAT_VOXWARE_RT24 }, - { "voxware_rt29", WAVE_FORMAT_VOXWARE_RT29 }, - { "voxware_rt29hw", WAVE_FORMAT_VOXWARE_RT29HW }, - { "voxware_vr12", WAVE_FORMAT_VOXWARE_VR12 }, - { "voxware_vr18", WAVE_FORMAT_VOXWARE_VR18 }, - { "voxware_tq40", WAVE_FORMAT_VOXWARE_TQ40 }, - { "softsound", WAVE_FORMAT_SOFTSOUND }, - { "voxware_tq60", WAVE_FORMAT_VOXWARE_TQ60 }, - { "msrt24", WAVE_FORMAT_MSRT24 }, - { "g729a", WAVE_FORMAT_G729A }, - { "mvi2", WAVE_FORMAT_MVI_MVI2 }, - { "df_g726", WAVE_FORMAT_DF_G726 }, - { "df_gsm610", WAVE_FORMAT_DF_GSM610 }, - { "isiaudio", WAVE_FORMAT_ISIAUDIO }, - { "onlive", WAVE_FORMAT_ONLIVE }, - { "sbc24", WAVE_FORMAT_SBC24 }, - { "dolby_ac3_spdif", WAVE_FORMAT_DOLBY_AC3_SPDIF }, - { "mediasonic_g723", WAVE_FORMAT_MEDIASONIC_G723 }, - { "prosody_8k", WAVE_FORMAT_PROSODY_8KBPS }, - { "zyxel_adpcm", WAVE_FORMAT_ZYXEL_ADPCM }, - { "philips_lpcbb", WAVE_FORMAT_PHILIPS_LPCBB }, - { "packed", WAVE_FORMAT_PACKED }, - { "malden_phonytalk", WAVE_FORMAT_MALDEN_PHONYTALK }, - { "phetorex_adpcm", WAVE_FORMAT_RHETOREX_ADPCM }, - { "irat", WAVE_FORMAT_IRAT }, - { "vivo_g723", WAVE_FORMAT_VIVO_G723 }, - { "vivo_siren", WAVE_FORMAT_VIVO_SIREN }, - { "digital_g723", WAVE_FORMAT_DIGITAL_G723 }, - { "sanyo_ld_adpcm", WAVE_FORMAT_SANYO_LD_ADPCM }, - { "siprolab_acelpnet", WAVE_FORMAT_SIPROLAB_ACEPLNET }, - { "siprolab_acelp4800", WAVE_FORMAT_SIPROLAB_ACELP4800 }, - { "siprolab_acelp8v3", WAVE_FORMAT_SIPROLAB_ACELP8V3 }, - { "siprolab_g729", WAVE_FORMAT_SIPROLAB_G729 }, - { "siprolab_g729a", WAVE_FORMAT_SIPROLAB_G729A }, - { "siprolab_kelvin", WAVE_FORMAT_SIPROLAB_KELVIN }, - { "g726adpcm", WAVE_FORMAT_G726ADPCM }, - { "qualcomm_purevoice", WAVE_FORMAT_QUALCOMM_PUREVOICE }, - { "qualcomm_halfrate", WAVE_FORMAT_QUALCOMM_HALFRATE }, - { "tubgsm", WAVE_FORMAT_TUBGSM }, - { "msaudio1", WAVE_FORMAT_MSAUDIO1 }, - { "creative_adpcm", WAVE_FORMAT_CREATIVE_ADPCM }, - { "creative_fastspeech8", WAVE_FORMAT_CREATIVE_FASTSPEECH8 }, - { "creative_fastspeech10", WAVE_FORMAT_CREATIVE_FASTSPEECH10 }, - { "uher_adpcm", WAVE_FORMAT_UHER_ADPCM }, - { "quarterdeck", WAVE_FORMAT_QUARTERDECK }, - { "ilink_vc", WAVE_FORMAT_ILINK_VC }, - { "raw_sport", WAVE_FORMAT_RAW_SPORT }, - { "ipi_hsx", WAVE_FORMAT_IPI_HSX }, - { "ipi_rpelp", WAVE_FORMAT_IPI_RPELP }, - { "cs2", WAVE_FORMAT_CS2 }, - { "sony_scx", WAVE_FORMAT_SONY_SCX }, - { "fm_towns_snd", WAVE_FORMAT_FM_TOWNS_SND }, - { "btv_digital", WAVE_FORMAT_BTV_DIGITAL }, - { "qdesign_music", WAVE_FORMAT_QDESIGN_MUSIC }, - { "vme_vmpcm", WAVE_FORMAT_VME_VMPCM }, - { "tpc", WAVE_FORMAT_TPC }, - { "oligsm", WAVE_FORMAT_OLIGSM }, - { "oliadpcm", WAVE_FORMAT_OLIADPCM }, - { "olicelp", WAVE_FORMAT_OLICELP }, - { "olisbc", WAVE_FORMAT_OLISBC }, - { "oliopr", WAVE_FORMAT_OLIOPR }, - { "lh_codec", WAVE_FORMAT_LH_CODEC }, - { "norris", WAVE_FORMAT_NORRIS }, - { "soundspace_musicompress", WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS }, - { "ac3", WAVE_FORMAT_DVM } -}; - -// Convert from string to format -mpaf_format_e mpaf_str2fmt(const char *str) -{ - unsigned i,fmt; - char val[3]; - fmt=0; - if(strlen(str)<3) goto bad_fmt; - /* check for special cases */ - if(strncmp(str,"float",5)==0 || strncmp(str,"FLOAT",5)==0) { fmt |= MPAF_F; str = &str[4]; } - else - if(str[0]=='S' || str[0]=='s') fmt|=MPAF_SI; - else - if(str[0]=='U' || str[0]=='u') fmt|=MPAF_US; - else goto try_special; - val[0]=str[1]; - val[1]=str[2]; - val[2]='\0'; - if(strcmp(val,"08")==0) fmt|=1; - else - if(strcmp(val,"16")==0) fmt|=2; - else - if(strcmp(val,"24")==0) fmt|=3; - else - if(strcmp(val,"32")==0) fmt|=4; - else - if(strcmp(val,"64")==0) fmt|=8; - else goto try_special; - if(str[3]=='\0') { -#ifdef WORDS_BIGENDIAN - fmt|=MPAF_BE; -#else - fmt|=MPAF_LE; -#endif - } - else if(strcmp(&str[3],"LE")==0 || strcmp(&str[3],"le")==0) fmt |= MPAF_LE; - else if(strcmp(&str[3],"BE")==0 || strcmp(&str[3],"be")==0) fmt |= MPAF_BE; - else goto try_special; - return mpaf_format_e(fmt); - - try_special: - for(i=0;i<sizeof(fmt_aliases)/sizeof(struct fmt_alias_s);i++) { - if(strcasecmp(str,fmt_aliases[i].name)==0) return mpaf_format_e(fmt_aliases[i].wtag<<16); - } - bad_fmt: - MSG_ERR("[af_format] Bad value %s. Examples: S08LE U24BE S32 MP3 AC3\n",str); - return mpaf_format_e(MPAF_BE); -} - -/* Convert format to str input str is a buffer for the - converted string, size is the size of the buffer */ -char* mpaf_fmt2str(mpaf_format_e format, char* str, size_t size) -{ - int i=0; - // Print endinaness - - if(format & MPAF_SPECIAL_MASK) { - unsigned short wtag; - unsigned j; - wtag = format >> 16; - for(j=0;j<sizeof(fmt_aliases)/sizeof(struct fmt_alias_s);j++) { - if(fmt_aliases[j].wtag==wtag) { - i+=snprintf(&str[i],size-i,fmt_aliases[j].name); - break; - } - } - } else { - // Type - if(MPAF_F == (format & MPAF_POINT_MASK)) i+=snprintf(&str[i],size,"FLOAT"); - else { - if(MPAF_US == (format & MPAF_SIGN_MASK)) i+=snprintf(&str[i],size-i,"U"); - else i+=snprintf(&str[i],size-i,"S"); - } - // size - i+=snprintf(&str[i],size,"%d",(format&MPAF_BPS_MASK)*8); - // endian - if(MPAF_LE == (format & MPAF_END_MASK)) i+=snprintf(&str[i],size,"LE"); - else i+=snprintf(&str[i],size,"BE"); - } - return str; -} - - -mp_aframe_t* new_mp_aframe(unsigned rate,unsigned nch,mpaf_format_e format,unsigned xp_idx) { - mp_aframe_t* mpaf = new(zeromem) mp_aframe_t; - if(!mpaf) return NULL; - mpaf->rate = rate; - mpaf->nch = nch; - mpaf->format = format; - mpaf->xp_idx = xp_idx; - return mpaf; -} - -int free_mp_aframe(mp_aframe_t* mpaf) { - if(!mpaf) return 0; - if(mpaf->audio) delete mpaf->audio; - delete mpaf; - return 1; -} - -mp_aframe_t* new_mp_aframe_genome(const mp_aframe_t* in) { - mp_aframe_t* out = new(zeromem) mp_aframe_t; - memcpy(out,in,sizeof(mp_aframe_t)); - out->audio = NULL; - return out; -} - -void mp_alloc_aframe(mp_aframe_t* it) { it->audio = new uint8_t[it->len]; } - -} // namespace mpxp \ No newline at end of file Deleted: mplayerxp/xmpcore/mp_aframe.h =================================================================== --- mplayerxp/xmpcore/mp_aframe.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/xmpcore/mp_aframe.h 2012-12-19 09:28:13 UTC (rev 577) @@ -1,82 +0,0 @@ -#ifndef __MP_AUDIO_FRAME_INCLUDED_H -#define __MP_AUDIO_FRAME_INCLUDED_H 1 - -#include "mpxp_config.h" -#include <stdlib.h> -#include <stdint.h> - -namespace mpxp { - - /* The sample format system is based on bitmasks. The - format definition only refers to the storage format not the - resolution. */ - typedef enum mpaf_format_enum{ - MPAF_BPS_MASK =0x00000FFFUL, /* byte per sample */ - MPAF_BPS_1 =0x00000001UL, - MPAF_BPS_2 =0x00000002UL, - MPAF_BPS_3 =0x00000003UL, - MPAF_BPS_4 =0x00000004UL, -// Endianess - MPAF_BE =0x00000000UL, // Big Endian - MPAF_LE =0x00001000UL, // Little Endian - MPAF_END_MASK =0x00001000UL, -#if WORDS_BIGENDIAN // Native endian of cpu - MPAF_NE =MPAF_BE, -#else - MPAF_NE =MPAF_LE, -#endif -// Signed/unsigned - MPAF_SI =0x00000000UL, // SIgned - MPAF_US =0x00002000UL, // Un Signed - MPAF_SIGN_MASK =0x00002000UL, -// Fixed or floating point - MPAF_I =0x00000000UL, // Integer - MPAF_F =0x00004000UL, // Foating point - MPAF_POINT_MASK =0x00004000UL, -// Special flags refering to non pcm data - MPAF_PCM =0x00000000UL, // - MPAF_IMA_ADPCM =0x00110000UL, // Same as 16 bit signed int - MPAF_MPEG2 =0x00500000UL, // MPEG1 layer2 audio - MPAF_MPEG3 =0x00550000UL, // MPEG1 layer3 audio - MPAF_AC3 =0x20000000UL, // Dolby Digital AC3 - MPAF_SPECIAL_MASK=0xFFFF0000UL - }mpaf_format_e; - inline mpaf_format_e operator~(mpaf_format_e a) { return static_cast<mpaf_format_e>(~static_cast<unsigned>(a)); } - inline mpaf_format_e operator|(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } - inline mpaf_format_e operator&(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } - inline mpaf_format_e operator^(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline mpaf_format_e operator|=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline mpaf_format_e operator&=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline mpaf_format_e operator^=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } - - /* Decodes the format from mplayer format to libaf format */ - mpaf_format_e __FASTCALL__ afmt2mpaf(unsigned format); - unsigned __FASTCALL__ mpaf2afmt(mpaf_format_e fmt); - char* __FASTCALL__ mpaf_fmt2str(mpaf_format_e format, char* str, size_t size); - mpaf_format_e __FASTCALL__ mpaf_str2fmt(const char *str); - - inline int mpaf_test(mpaf_format_e f,unsigned bits) { return f&bits; } - inline int mpaf_testa(mpaf_format_e f,unsigned bits) { return (f&bits)==bits; } - - enum { - MP_AFLG_FINALIZED =0x80000000 - }; - - struct mp_aframe_t { - unsigned flags; /* currently unused */ - float pts; /* PTS if this frame */ - unsigned xp_idx;/* index in ring buffer */ - uint8_t* audio; /* data of audio frame */ - unsigned len; /* length of data */ - /*------ stream description ----------*/ - unsigned rate; /* rate of audio */ - unsigned nch; /* number of channels */ - mpaf_format_e format;/* PCM format of audio */ - }; - - mp_aframe_t* new_mp_aframe(unsigned rate,unsigned nch,mpaf_format_e format,unsigned xp_idx); - mp_aframe_t* new_mp_aframe_genome(const mp_aframe_t* in); - void mp_alloc_aframe(mp_aframe_t* it); - int free_mp_aframe(mp_aframe_t* mpaf); -} // namespace -#endif Deleted: mplayerxp/xmpcore/mp_image.cpp =================================================================== --- mplayerxp/xmpcore/mp_image.cpp 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/xmpcore/mp_image.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -1,224 +0,0 @@ -#include "mpxp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "mplayerxp.h" -#include "libvo2/img_format.h" -#include "mp_image.h" -#include "osdep/fastmemcpy.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mpxp_msg.h" - -namespace mpxp { -void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ - mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); - mpi->imgfmt=out_fmt; - if(out_fmt == IMGFMT_MPEGPES){ - mpi->bpp=0; - return; - } - if(out_fmt == IMGFMT_ZRMJPEGNI || - out_fmt == IMGFMT_ZRMJPEGIT || - out_fmt == IMGFMT_ZRMJPEGIB){ - mpi->bpp=0; - return; - } - if(IMGFMT_IS_XVMC(out_fmt)){ - mpi->bpp=0; - return; - } - mpi->num_planes=1; - if (IMGFMT_IS_RGB(out_fmt) || IMGFMT_IS_BGR(out_fmt)) { - mpi->bpp = rgbfmt_depth(out_fmt); - if(IMGFMT_IS_BGR(out_fmt)) mpi->flags|=MP_IMGFLAG_SWAPPED; - return; - } - mpi->flags|=MP_IMGFLAG_YUV; - mpi->num_planes=3; - switch(out_fmt){ - case IMGFMT_I420: - case IMGFMT_IYUV: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YV12: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=1; - return; - case IMGFMT_420A: - case IMGFMT_IF09: - mpi->num_planes=4; - case IMGFMT_YVU9: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=9; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height>>2); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=2; - return; - case IMGFMT_444P16_LE: - case IMGFMT_444P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=48; - mpi->chroma_width=(mpi->width); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=0; - return; - case IMGFMT_444P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=24; - mpi->chroma_width=(mpi->width); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=0; - return; - case IMGFMT_422P16_LE: - case IMGFMT_422P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=32; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=0; - return; - case IMGFMT_422P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=16; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=0; - return; - case IMGFMT_420P16_LE: - case IMGFMT_420P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=24; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=0; - return; - case IMGFMT_411P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=0; - return; - case IMGFMT_Y800: - case IMGFMT_Y8: - /* they're planar ones, but for easier handling use them as packed */ -// mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=8; - mpi->num_planes=1; - return; - case IMGFMT_UYVY: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YUY2: - mpi->bpp=16; - mpi->num_planes=1; - return; - case IMGFMT_NV12: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_NV21: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->num_planes=2; - mpi->chroma_width=(mpi->width>>0); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=1; - return; - } - MSG_WARN("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); - show_backtrace("outfmt",10); - mpi->bpp=0; -} - -mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx){ - mp_image_t* mpi=new(zeromem) mp_image_t; - if(!mpi) return NULL; // error! - mpi->xp_idx = xp_idx; - mpi->width=mpi->w=w; - mpi->height=mpi->h=h; - return mpi; -} - -void free_mp_image(mp_image_t* mpi){ - if(!mpi) return; - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - /* becouse we allocate the whole image in once */ - if(mpi->planes[0]) delete mpi->planes[0]; - } - delete mpi; -} - -mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx) { - mp_image_t* mpi = new_mp_image(w,h,xp_idx); - - mp_image_setfmt(mpi,fmt); - mpi_alloc_planes(mpi); - return mpi; -} - -void mpi_alloc_planes(mp_image_t *mpi) { - unsigned size,delta; - size=mpi->bpp*mpi->width*(mpi->height+2)/8; - delta=0; - // IF09 - allocate space for 4. plane delta info - unused - if (mpi->imgfmt == IMGFMT_IF09) delta=mpi->chroma_width*mpi->chroma_height; - mpi->planes[0]=new(alignmem,64) unsigned char[size+delta]; - if(delta) /* delta table, just for fun ;) */ - mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height); - if(mpi->flags&MP_IMGFLAG_PLANAR){ - // YV12/I420/YVU9/IF09. feel mp_free to add other planar formats here... - if(!mpi->stride[0]) mpi->stride[0]=mpi->width; - if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; - if(mpi->flags&MP_IMGFLAG_SWAPPED){ - // I420/IYUV (Y,U,V) - mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height; - } else { - // YV12,YVU9,IF09 (Y,V,U) - mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; - } - } else { - if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; - } - mpi->flags|=MP_IMGFLAG_ALLOCATED; -} - -void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { - if(mpi->flags&MP_IMGFLAG_PLANAR){ - memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); - memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1],mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2],mpi->stride[2]); - } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); - } -} - -void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned h) -{ - *dmpi = *mpi; - dmpi->y = y; - dmpi->h = h; - dmpi->chroma_height = h >> mpi->chroma_y_shift; - dmpi->xp_idx = mpi->xp_idx; - dmpi->flags&=~MP_IMGFLAG_ALLOCATED; -} - -} // namespace mpxp Deleted: mplayerxp/xmpcore/mp_image.h =================================================================== --- mplayerxp/xmpcore/mp_image.h 2012-12-19 08:57:43 UTC (rev 576) +++ mplayerxp/xmpcore/mp_image.h 2012-12-19 09:28:13 UTC (rev 577) @@ -1,100 +0,0 @@ -#ifndef __MP_IMAGE_H -#define __MP_IMAGE_H 1 - -#include <stdlib.h> -#include <limits.h> - -#include "mpxp_config.h" - -namespace mpxp { - //--- buffer content restrictions: - enum { - MP_IMGFLAG_PRESERVE=0x00001, // set if buffer content shouldn't be modified: - MP_IMGFLAG_READABLE=0x00002 // set if buffer content will be READ for next frame's MC: (I/P mpeg frames) - }; - - //--- buffer width/stride/plane restrictions: (used for direct rendering) - enum { -// stride _have_to_ be aligned to MB boundary: [for DR restrictions] - MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE=0x00004, /* no flag - should be neg value of MP_IMGFLAG_ACCEPT_STRIDE */ -// stride should be aligned to MB boundary: [for buffer allocation] - MP_IMGFLAG_PREFER_ALIGNED_STRIDE=0x00008, /* sould be no flag - everything prefer aligned strides */ - MP_IMGFLAG_ACCEPT_STRIDE =0x00010, // codec accept any stride (>=width): - MP_IMGFLAG_ACCEPT_WIDTH =0x00020, // codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): -//--- for planar formats only: -// uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift - MP_IMGFLAG_COMMON_STRIDE =0x00040, /* UNUSED */ -// uses only planes[0], and calculates planes[1,2] from width,height,imgfmt - MP_IMGFLAG_COMMON_PLANE =0x00080, /* UNUSED */ - MP_IMGFLAGMASK_RESTRICTIONS =0x000FF, -//--------- color info (filled by mp_image_setfmt() ) ----------- - MP_IMGFLAG_PLANAR =0x00100, // set if number of planes > 1 - MP_IMGFLAG_YUV =0x00200, // set if it's YUV colorspace - MP_IMGFLAG_SWAPPED =0x00400, // set if it's swapped (BGR or YVU) plane/byteorder - MP_IMGFLAG_RGB_PALETTE =0x00800, // using palette for RGB data - MP_IMGFLAGMASK_COLORS =0x00F00, -// codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) -// [the codec will set this flag if it supports callbacks, and the vo _may_ -// clear it in get_image() if draw_slice() not implemented] - MP_IMGFLAG_DRAW_CALLBACK =0x01000, - MP_IMGFLAG_DIRECT =0x02000, // set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] - MP_IMGFLAG_ALLOCATED =0x04000, // set if buffer is allocated (used in destination images): - MP_IMGFLAG_TYPE_DISPLAYED =0x08000, // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) - MP_IMGFLAG_FINAL =0x10000, // buffer is video memory - MP_IMGFLAG_RENDERED =0x20000, // final buffer was already painted - MP_IMGFLAG_FINALIZED =0x40000 // indicates final step of image processing from CPU side!!! - }; - - /* codec doesn't support any form of direct rendering - it has own buffer */ - enum { - MP_IMGTYPE_EXPORT =0, // allocation. so we just export its buffer pointers: - MP_IMGTYPE_STATIC =1, // codec requires a static WO buffer, but it does only partial updates later: - MP_IMGTYPE_TEMP =2, // codec just needs some WO memory, where it writes/copies the whole frame to: - MP_IMGTYPE_IP =3, // I+P type, requires 2+ independent static R/W buffers - MP_IMGTYPE_IPB =4, // I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers - - MP_MAX_PLANES =4 - }; - enum { - MP_IMGFIELD_ORDERED =0x01, - MP_IMGFIELD_TOP_FIRST =0x02, - MP_IMGFIELD_REPEAT_FIRST=0x04, - MP_IMGFIELD_TOP =0x08, - MP_IMGFIELD_BOTTOM =0x10, - MP_IMGFIELD_INTERLACED =0x20 - }; - - enum { XP_IDX_INVALID=UINT_MAX }; - struct mp_image_t { - unsigned xp_idx; /* index of xp_frame associated with this image */ - unsigned int flags; - unsigned char type; - unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 - unsigned int imgfmt; - unsigned width,height; // stored dimensions - int x,y,w,h; // slice dimensions - unsigned num_planes; - unsigned char* planes[MP_MAX_PLANES]; - unsigned int stride[MP_MAX_PLANES]; - char * qscale; - unsigned qstride; - unsigned qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 - unsigned pict_type; // 0->unknown, 1->I, 2->P, 3->B - unsigned fields; - /* these are only used by planar formats Y,U(Cb),V(Cr) */ - int chroma_width; - int chroma_height; - int chroma_x_shift; // horizontal - int chroma_y_shift; // vertical - any_t* priv; /* for private use by filter or vo driver (to store buffer id or dmpi) */ - }; - - void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); - mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx); - void free_mp_image(mp_image_t* mpi); - mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx); - void mpi_alloc_planes(mp_image_t *mpi); - void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); - void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); -}// namespace -#endif Copied: mplayerxp/xmpcore/xmp_aframe.cpp (from rev 576, mplayerxp/xmpcore/mp_aframe.cpp) =================================================================== --- mplayerxp/xmpcore/xmp_aframe.cpp (rev 0) +++ mplayerxp/xmpcore/xmp_aframe.cpp 2012-12-19 09:28:13 UTC (rev 577) @@ -0,0 +1,328 @@ +#include "mpxp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +#include <string.h> +#include <stdio.h> + +#include "xmp_aframe.h" +#include "libao3/afmt.h" +#include "loader/wine/mmreg.h" +#include "mpxp_msg.h" + +namespace mpxp { + +enum { AFMT_AF_FLAGS=0x70000000 }; + +/* Decodes the format from mplayer format to libaf format */ +mpaf_format_e __FASTCALL__ afmt2mpaf(unsigned ifmt) +{ + mpaf_format_e ofmt = mpaf_format_e(0); + // Check input ifmt + switch(ifmt){ + case AFMT_U8: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|1); break; + case AFMT_S8: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|1); break; + case AFMT_S16_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|2); break; + case AFMT_S16_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|2); break; + case AFMT_U16_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|2); break; + case AFMT_U16_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|2); break; + case AFMT_S24_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|3); break; + case AFMT_S24_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|3); break; + case AFMT_U24_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|3); break; + case AFMT_U24_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|3); break; + case AFMT_S32_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_SI|4); break; + case AFMT_S32_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_SI|4); break; + case AFMT_U32_LE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_LE|MPAF_US|4); break; + case AFMT_U32_BE: ofmt = mpaf_format_e(MPAF_PCM|MPAF_BE|MPAF_US|4); break; + case AFMT_FLOAT32:ofmt = mpaf_format_e(MPAF_PCM|MPAF_F |MPAF_NE|4); break; + + case AFMT_IMA_ADPCM: ofmt = mpaf_format_e(MPAF_IMA_ADPCM|1); break; + case AFMT_MPEG: ofmt = mpaf_format_e(MPAF_MPEG2|1); break; + case AFMT_AC3: ofmt = mpaf_format_e(MPAF_AC3|1); break; + default: + if ((ifmt & AFMT_AF_FLAGS) == AFMT_AF_FLAGS) { + ofmt = mpaf_format_e((ifmt&(~AFMT_AF_FLAGS))|2); + break; + } + //This can not happen .... + MSG_FATAL("[af_mp] Unrecognized input audio format %i\n",ifmt); + break; + } + return ofmt; +} + +/* Encodes the format from libaf format to mplayer (OSS) format */ +unsigned __FASTCALL__ mpaf2afmt(mpaf_format_e fmt) +{ + switch(fmt&MPAF_SPECIAL_MASK) { + case 0: // PCM: + if((fmt&MPAF_POINT_MASK)==MPAF_I) { + if((fmt&MPAF_SIGN_MASK)==MPAF_SI){ + // signed int PCM: + switch(fmt&MPAF_BPS_MASK){ + case MPAF_BPS_1: return AFMT_S8; + default: + case MPAF_BPS_2: return (fmt&MPAF_LE)?AFMT_S16_LE:AFMT_S16_BE; + case MPAF_BPS_3: return (fmt&MPAF_LE)?AFMT_S24_LE:AFMT_S24_BE; + case MPAF_BPS_4: return (fmt&MPAF_LE)?AFMT_S32_LE:AFMT_S32_BE; + } + } else { + // unsigned int PCM: + switch(fmt&MPAF_BPS_MASK){ + case MPAF_BPS_1: return AFMT_U8; + default: + case MPAF_BPS_2: return (fmt&MPAF_LE)?AFMT_U16_LE:AFMT_U16_BE; + case MPAF_BPS_3: return (fmt&MPAF_LE)?AFMT_U24_LE:AFMT_U24_BE; + case MPAF_BPS_4: return (fmt&MPAF_LE)?AFMT_U32_LE:AFMT_U32_BE; + } + } + } else { + // float PCM: + return AFMT_FLOAT32; // FIXME? + } + break; + default: + case MPAF_MPEG2: return AFMT_MPEG; + case MPAF_AC3: return AFMT_AC3; + case MPAF_IMA_ADPCM: return AFMT_IMA_ADPCM; + } + return fmt|AFMT_AF_FLAGS; +} + +static const struct fmt_alias_s { + const char *name; + unsigned short wtag; +} fmt_aliases[]= { + { "adpcm", WAVE_... [truncated message content] |
From: <nic...@us...> - 2012-12-19 08:57:58
|
Revision: 576 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=576&view=rev Author: nickols_k Date: 2012-12-19 08:57:43 +0000 (Wed, 19 Dec 2012) Log Message: ----------- minor antiviral patch Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/dump.cpp mplayerxp/input2/Makefile mplayerxp/input2/in_msg.h mplayerxp/input2/input.cpp mplayerxp/input2/input.h mplayerxp/input2/joystick.cpp mplayerxp/input2/lirc.cpp mplayerxp/libao3/Makefile mplayerxp/libao3/afmt.cpp mplayerxp/libao3/afmt.h mplayerxp/libao3/ao_alsa.cpp mplayerxp/libao3/ao_arts.cpp mplayerxp/libao3/ao_esd.cpp mplayerxp/libao3/ao_jack.cpp mplayerxp/libao3/ao_msg.h mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_openal.cpp mplayerxp/libao3/ao_oss.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libao3/ao_wav.cpp mplayerxp/libao3/audio_out.cpp mplayerxp/libao3/audio_out.h mplayerxp/libao3/audio_out_internal.h mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_acm.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_dmo.cpp mplayerxp/libmpcodecs/ad_dshow.cpp mplayerxp/libmpcodecs/ad_dvdpcm.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/ad_hwac3.cpp mplayerxp/libmpcodecs/ad_lavc.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/libmpcodecs/ad_msg.h mplayerxp/libmpcodecs/ad_null.cpp mplayerxp/libmpcodecs/ad_pcm.cpp mplayerxp/libmpcodecs/ad_qtaudio.cpp mplayerxp/libmpcodecs/ad_real.cpp mplayerxp/libmpcodecs/ad_twin.cpp mplayerxp/libmpcodecs/ad_vorbis.cpp mplayerxp/libmpcodecs/codecs_ld.cpp mplayerxp/libmpcodecs/codecs_ld.h mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/liba52/Makefile mplayerxp/libmpcodecs/liba52/a52.h mplayerxp/libmpcodecs/liba52/bit_allocate.cpp mplayerxp/libmpcodecs/liba52/bitstream.cpp mplayerxp/libmpcodecs/liba52/crc.cpp mplayerxp/libmpcodecs/liba52/downmix.cpp mplayerxp/libmpcodecs/liba52/imdct.cpp mplayerxp/libmpcodecs/liba52/parse.cpp mplayerxp/libmpcodecs/liba52/resample.cpp mplayerxp/libmpcodecs/libdca/Makefile mplayerxp/libmpcodecs/libdca/bitstream.cpp mplayerxp/libmpcodecs/libdca/dca.h mplayerxp/libmpcodecs/libdca/downmix.cpp mplayerxp/libmpcodecs/libdca/parse.cpp mplayerxp/libmpcodecs/libdca/resample.cpp mplayerxp/libmpcodecs/libnuppelvideo/Makefile mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp mplayerxp/libmpcodecs/libnuppelvideo/minilzo.cpp mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_dmo.cpp mplayerxp/libmpcodecs/vd_dshow.cpp mplayerxp/libmpcodecs/vd_huffyuv.cpp mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_mpegpes.cpp mplayerxp/libmpcodecs/vd_msg.h mplayerxp/libmpcodecs/vd_null.cpp mplayerxp/libmpcodecs/vd_nuv.cpp mplayerxp/libmpcodecs/vd_qtvideo.cpp mplayerxp/libmpcodecs/vd_raw.cpp mplayerxp/libmpcodecs/vd_real.cpp mplayerxp/libmpcodecs/vd_theora.cpp mplayerxp/libmpcodecs/vd_vfw.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpcodecs/vd_xvid.cpp mplayerxp/libmpconf/Makefile mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpconf/codec-cfg.cpp mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpconf/m_property.cpp mplayerxp/libmpconf/m_struct.cpp mplayerxp/libmpconf/subopt-helper.cpp mplayerxp/libmpconf/subopt-helper.h mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/aviheader.h mplayerxp/libmpdemux/aviprint.cpp mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mp3.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_msg.h mplayerxp/libmpdemux/demux_musepack.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_null.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.cpp mplayerxp/libmpdemux/demux_snd_au.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_voc.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_wav.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_info.h mplayerxp/libmpdemux/demuxer_packet.h mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/demuxer_stream.h mplayerxp/libmpdemux/mp3_hdr.cpp mplayerxp/libmpdemux/mpdemux.cpp mplayerxp/libmpdemux/mpeg_hdr.cpp mplayerxp/libmpdemux/mux_lavf.cpp mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/mux_raw.cpp mplayerxp/libmpdemux/muxer.cpp mplayerxp/libmpdemux/parse_es.cpp mplayerxp/libmpdemux/parse_mp4.cpp mplayerxp/libmpdemux/stheader.cpp mplayerxp/libmpdemux/sub_cc.cpp mplayerxp/libmpdemux/sub_ty.cpp mplayerxp/libmpdemux/yuv4mpeg.cpp mplayerxp/libmpdemux/yuv4mpeg_ratio.cpp mplayerxp/libmpstream2/Makefile mplayerxp/libmpstream2/cache2.cpp mplayerxp/libmpstream2/cdda.cpp mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/freesdp/Makefile mplayerxp/libmpstream2/freesdp/common.cpp mplayerxp/libmpstream2/freesdp/common.h mplayerxp/libmpstream2/freesdp/errorlist.cpp mplayerxp/libmpstream2/freesdp/parser.cpp mplayerxp/libmpstream2/http.cpp mplayerxp/libmpstream2/http.h mplayerxp/libmpstream2/librtsp/Makefile mplayerxp/libmpstream2/librtsp/rtsp.cpp mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.h mplayerxp/libmpstream2/mrl.cpp mplayerxp/libmpstream2/mrl.h mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/network_asf.h mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/network_nop.cpp mplayerxp/libmpstream2/network_pnm.cpp mplayerxp/libmpstream2/network_real_rtsp.cpp mplayerxp/libmpstream2/network_rtp.cpp mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/pnm.cpp mplayerxp/libmpstream2/realrtsp/Makefile mplayerxp/libmpstream2/realrtsp/asmrp.cpp mplayerxp/libmpstream2/realrtsp/md5.h mplayerxp/libmpstream2/realrtsp/real.cpp mplayerxp/libmpstream2/realrtsp/rmff.cpp mplayerxp/libmpstream2/realrtsp/rmff.h mplayerxp/libmpstream2/realrtsp/sdpplin.cpp mplayerxp/libmpstream2/realrtsp/xbuffer.cpp mplayerxp/libmpstream2/realrtsp/xbuffer.h mplayerxp/libmpstream2/rtp_cache.cpp mplayerxp/libmpstream2/s_cdd.cpp mplayerxp/libmpstream2/s_dvdnav.cpp mplayerxp/libmpstream2/s_dvdread.cpp mplayerxp/libmpstream2/s_file.cpp mplayerxp/libmpstream2/s_ftp.cpp mplayerxp/libmpstream2/s_lavc.cpp mplayerxp/libmpstream2/s_network.cpp mplayerxp/libmpstream2/s_null.cpp mplayerxp/libmpstream2/s_oss.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_tv.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/s_vcdnav.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libmpstream2/stream_internal.h mplayerxp/libmpstream2/stream_msg.h mplayerxp/libmpstream2/tcp.cpp mplayerxp/libmpstream2/tvi/Makefile mplayerxp/libmpstream2/tvi/frequencies.cpp mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp mplayerxp/libmpstream2/tvi/tvi_dummy.cpp mplayerxp/libmpstream2/tvi/tvi_v4l.cpp mplayerxp/libmpstream2/udp.cpp mplayerxp/libmpstream2/url.cpp mplayerxp/libmpsub/Makefile mplayerxp/libmpsub/find_sub.cpp mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/subreader.cpp mplayerxp/libmpsub/vobsub.cpp mplayerxp/libplaytree/Makefile mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/playtree.cpp mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libvo2/Makefile mplayerxp/libvo2/aspect.cpp mplayerxp/libvo2/aspect.h mplayerxp/libvo2/font_load.cpp mplayerxp/libvo2/img_format.cpp mplayerxp/libvo2/img_format.h mplayerxp/libvo2/jpeg_enc.cpp mplayerxp/libvo2/osd_render.cpp mplayerxp/libvo2/screenshot.cpp mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h mplayerxp/libvo2/vidix_system.cpp mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/libvo2/vo_msg.h mplayerxp/libvo2/vo_null.cpp mplayerxp/libvo2/vo_opengl.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_vesa.cpp mplayerxp/libvo2/vo_x11.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/libvo2/x11_system.cpp mplayerxp/loader/Makefile mplayerxp/loader/com.h mplayerxp/loader/dmo/DMO_AudioDecoder.c mplayerxp/loader/dmo/DMO_VideoDecoder.c mplayerxp/loader/dmo/Makefile mplayerxp/loader/dmo/dmo.c mplayerxp/loader/driver.c mplayerxp/loader/dshow/DS_AudioDecoder.c mplayerxp/loader/dshow/DS_Filter.c mplayerxp/loader/dshow/DS_VideoDecoder.c mplayerxp/loader/dshow/Makefile mplayerxp/loader/dshow/allocator.c mplayerxp/loader/ldt_keeper.h mplayerxp/loader/module.c mplayerxp/loader/win32.c mplayerxp/loader/wine/windef.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/nls/Makefile mplayerxp/nls/nls_msg.h mplayerxp/nls/recode.cpp mplayerxp/osdep/Makefile mplayerxp/osdep/aclib.cpp mplayerxp/osdep/bswap.h mplayerxp/osdep/cpudetect.cpp mplayerxp/osdep/fastmemcpy.h mplayerxp/osdep/get_path.cpp mplayerxp/osdep/getch2.cpp mplayerxp/osdep/lrmi.cpp mplayerxp/osdep/lrmi.h mplayerxp/osdep/mp_malloc.cpp mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/osdep/osdep_msg.h mplayerxp/osdep/shmem.cpp mplayerxp/osdep/timer-lx.cpp mplayerxp/osdep/timer.cpp mplayerxp/osdep/vbelib.cpp mplayerxp/osdep/vbelib.h mplayerxp/postproc/Makefile mplayerxp/postproc/af.cpp mplayerxp/postproc/af.h mplayerxp/postproc/af_ao3.cpp mplayerxp/postproc/af_channels.cpp mplayerxp/postproc/af_crystality.cpp mplayerxp/postproc/af_delay.cpp mplayerxp/postproc/af_dyn.cpp mplayerxp/postproc/af_echo3d.cpp mplayerxp/postproc/af_equalizer.cpp mplayerxp/postproc/af_export.cpp mplayerxp/postproc/af_extrastereo.cpp mplayerxp/postproc/af_ffenc.cpp mplayerxp/postproc/af_format.cpp mplayerxp/postproc/af_hrtf.cpp mplayerxp/postproc/af_karaoke.cpp mplayerxp/postproc/af_lp.cpp mplayerxp/postproc/af_null.cpp mplayerxp/postproc/af_pan.cpp mplayerxp/postproc/af_raw.cpp mplayerxp/postproc/af_resample.cpp mplayerxp/postproc/af_scaletempo.cpp mplayerxp/postproc/af_sinesuppress.cpp mplayerxp/postproc/af_sub.cpp mplayerxp/postproc/af_surround.cpp mplayerxp/postproc/af_tools.cpp mplayerxp/postproc/af_volnorm.cpp mplayerxp/postproc/af_volume.cpp mplayerxp/postproc/aflib.cpp mplayerxp/postproc/aflib.h mplayerxp/postproc/libmenu/Makefile mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/libmenu/menu_list.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/libmenu/menu_pt.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/postprocess.cpp mplayerxp/postproc/postprocess.h mplayerxp/postproc/pp_msg.h mplayerxp/postproc/swscale.cpp mplayerxp/postproc/swscale.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_null.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo2.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp mplayerxp/xmpcore/Makefile mplayerxp/xmpcore/PointerProtector.h mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/mp_aframe.h mplayerxp/xmpcore/mp_image.cpp mplayerxp/xmpcore/mp_image.h mplayerxp/xmpcore/sig_hand.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_context.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/mpxp_msg.cpp mplayerxp/mpxp_msg.h mplayerxp/nls/mpxp_help-bg.h mplayerxp/nls/mpxp_help-cz.h mplayerxp/nls/mpxp_help-de.h mplayerxp/nls/mpxp_help-dk.h mplayerxp/nls/mpxp_help-el.h mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-es.h mplayerxp/nls/mpxp_help-fr.h mplayerxp/nls/mpxp_help-hu.h mplayerxp/nls/mpxp_help-it.h mplayerxp/nls/mpxp_help-ja.h mplayerxp/nls/mpxp_help-ko.h mplayerxp/nls/mpxp_help-mk.h mplayerxp/nls/mpxp_help-nb.h mplayerxp/nls/mpxp_help-nl.h mplayerxp/nls/mpxp_help-no.h mplayerxp/nls/mpxp_help-pl.h mplayerxp/nls/mpxp_help-pt.h mplayerxp/nls/mpxp_help-ro.h mplayerxp/nls/mpxp_help-ru.h mplayerxp/nls/mpxp_help-sk.h mplayerxp/nls/mpxp_help-sv.h mplayerxp/nls/mpxp_help-tr.h mplayerxp/nls/mpxp_help-uk.h mplayerxp/nls/mpxp_help-zh.h Removed Paths: ------------- mplayerxp/mp_msg.cpp mplayerxp/mp_msg.h mplayerxp/nls/help_mp-bg.h mplayerxp/nls/help_mp-cz.h mplayerxp/nls/help_mp-de.h mplayerxp/nls/help_mp-dk.h mplayerxp/nls/help_mp-el.h mplayerxp/nls/help_mp-en.h mplayerxp/nls/help_mp-es.h mplayerxp/nls/help_mp-fr.h mplayerxp/nls/help_mp-hu.h mplayerxp/nls/help_mp-it.h mplayerxp/nls/help_mp-ja.h mplayerxp/nls/help_mp-ko.h mplayerxp/nls/help_mp-mk.h mplayerxp/nls/help_mp-nb.h mplayerxp/nls/help_mp-nl.h mplayerxp/nls/help_mp-no.h mplayerxp/nls/help_mp-pl.h mplayerxp/nls/help_mp-pt.h mplayerxp/nls/help_mp-ro.h mplayerxp/nls/help_mp-ru.h mplayerxp/nls/help_mp-sk.h mplayerxp/nls/help_mp-sv.h mplayerxp/nls/help_mp-tr.h mplayerxp/nls/help_mp-uk.h mplayerxp/nls/help_mp-zh.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/Makefile 2012-12-19 08:57:43 UTC (rev 576) @@ -7,7 +7,7 @@ # a BSD compatible 'install' program INSTALL = install -include mp_config.mak +include mpxp_config.mak TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them @@ -21,7 +21,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mplayerxp.cpp dump.cpp mp_msg.cpp +SRCS = mplayerxp.cpp dump.cpp mpxp_msg.cpp OBJS = $(SRCS:.cpp=.o) @@ -100,8 +100,8 @@ $(DO_MAKE) -rm -f *~ $(TARGET_EXE) $(OBJS) -rm -f *.o *.a .depend configure.log - -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h - -rm -f cpuinfo help_mp.h + -rm -f mpxp_config.h mpxp_config.mak mpxp_conf_lavc.h version.h + -rm -f cpuinfo mpxp_help.h dep: .depend Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/configure 2012-12-19 08:57:43 UTC (rev 576) @@ -20,14 +20,14 @@ # # GOTCHAS: # - config files are currently: -# mp_config.h mp_config.mak libvo/mp_config.mak libao2/mp_config.mak +# mpxp_config.h mpxp_config.mak # ############################################################################# . ../functions init_functions cd nls -LANGUAGES=`echo help_mp-??.h | sed "s/help_mp-\(..\).h/\1/g"` +LANGUAGES=`echo mpxp_help-??.h | sed "s/mpxp_help-\(..\).h/\1/g"` cd .. linguas=`echo $LANG | sed 's/^\([^_]*\).*$/\1/'` test -z $linguas && linguas=en @@ -226,7 +226,7 @@ test -n $gas && as=$gas mktmps -guess_target mp_config.mak mp_config.h +guess_target mpxp_config.mak mpxp_config.h # config files @@ -323,15 +323,15 @@ test $($pkg_config --version 2>/dev/null) || die "no pkg-config found" ############################################################################# enabled profile && disable fastcall -print_config __USE mp_config.h mp_config.mak fastcall +print_config __USE mpxp_config.h mpxp_config.mak fastcall -test_optimizations mp_config.mak mp_config.h +test_optimizations mpxp_config.mak mpxp_config.h # Checking for GOMP enabled gomp && check_ldflags -fopenmp || disable gomp enabled gomp && require2 gomp omp.h omp_get_thread_num -lgomp || disable gomp enabled gomp && check_cflags -fopenmp || disable gomp -print_config HAVE_ mp_config.h mp_config.mak gomp +print_config HAVE_ mpxp_config.h mpxp_config.mak gomp #enabled gomp && check_cflags -ftree-parallelize-loops=4 ##################################################### add_cflags "-Warray-bounds -Wreturn-type -Wuninitialized -Wlogical-op -Waddress" @@ -363,7 +363,7 @@ test -f "../lavc/libavcodec/avcodec.h" && enable lavc disabled lavc && die "**FATAL**: local copy of lavc doesn't exist!" add_cflags "-I$srcdir/../lavc" -print_config HAVE_ mp_config.h mp_config.mak lavc +print_config HAVE_ mpxp_config.h mpxp_config.mak lavc # Configuring external lavc stuff lavc_args="--enable-static --disable-shared --enable-gpl --enable-pthreads --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-avdevice --disable-avfilter --disable-avresample" if test -n $host ; then @@ -387,24 +387,24 @@ echores "done" ################################### -print_config ENABLE_ mp_config.h mp_config.mak gpl_only +print_config ENABLE_ mpxp_config.h mpxp_config.mak gpl_only check_header inttypes.h || die "cannot find header inttypes.h (see in DOC/faq.html)" require2 libdl dlfcn.h dlsym -ldl || die "dynamic loader was not found" -print_config HAVE_ mp_config.h mp_config.mak libdl +print_config HAVE_ mpxp_config.h mpxp_config.mak libdl require2 libkstat kstat.h kstat_open -lkstat -print_config HAVE_ mp_config.h mp_config.mak libkstat +print_config HAVE_ mpxp_config.h mpxp_config.mak libkstat require2 posix4 time.h nanosleep -lposix4 -print_config HAVE_ mp_config.h mp_config.mak posix4 +print_config HAVE_ mpxp_config.h mpxp_config.mak posix4 check_func2 time.h nanosleep -print_config HAVE_ mp_config.h mp_config.mak nanosleep +print_config HAVE_ mpxp_config.h mpxp_config.mak nanosleep check_func2 execinfo.h backtrace -print_config HAVE_ mp_config.h mp_config.mak backtrace +print_config HAVE_ mpxp_config.h mpxp_config.mak backtrace disable inet_pton if enabled streaming ; then @@ -418,18 +418,18 @@ # well, try alternative if disabled inet_pton ; then require2 aton "sys/types.h sys/socket.h arpa/inet.h" inet_aton -print_config USE_ mp_config.h mp_config.mak aton +print_config USE_ mpxp_config.h mpxp_config.mak aton fi -print_config HAVE_ mp_config.h mp_config.mak socklib +print_config HAVE_ mpxp_config.h mpxp_config.mak socklib if enabled winsock2 && ! cygwin ; then require2 winsock2 winsock2.h gethostbyname -lws2_32 -print_config HAVE_ mp_config.h mp_config.mak winsock2 +print_config HAVE_ mpxp_config.h mpxp_config.mak winsock2 fi fi #enabled streaming disabled inet_pton && disable streaming -print_config HAVE_ mp_config.h mp_config.mak streaming +print_config HAVE_ mpxp_config.h mpxp_config.mak streaming enabled streaming && inputmodules="streaming $inputmodules" || noinputmodules="streaming $noinputmodules" disabled streaming && disable af_inet6 @@ -437,7 +437,7 @@ if enabled af_inet6 ; then enabled winsock2 && require3 af_inet6 ws2tcpip.h AF_INET6 socket disabled winsock2 && require3 af_inet6 "sys/socket.h netinet/in.h" AF_INET6 socket -print_config HAVE_ mp_config.h mp_config.mak af_inet6 +print_config HAVE_ mpxp_config.h mpxp_config.mak af_inet6 fi # find if .align arg is power-of-two or not @@ -471,22 +471,22 @@ echores "$vm_pagesize" check_func3 _ISOC9X_SOURCE math.h lrint -lm -print_config HAVE_ mp_config.h mp_config.mak lrint +print_config HAVE_ mpxp_config.h mpxp_config.mak lrint check_func3 _ISOC9X_SOURCE math.h llrint -lm -print_config HAVE_ mp_config.h mp_config.mak llrint +print_config HAVE_ mpxp_config.h mpxp_config.mak llrint check_func3 _ISOC9X_SOURCE math.h HUGE -lm -print_config HAVE_ mp_config.h mp_config.mak HUGE +print_config HAVE_ mpxp_config.h mpxp_config.mak HUGE check_func2 "sys/types.h sys/mman.h" mmap sys_mman_h=$mmap -print_config HAVE_ mp_config.h mp_config.mak sys_mman_h +print_config HAVE_ mpxp_config.h mpxp_config.mak sys_mman_h enabled mmap && check_func2 "sys/mman.h" mlock -print_config HAVE_ mp_config.h mp_config.mak mlock +print_config HAVE_ mpxp_config.h mpxp_config.mak mlock check_func2 "stdio.h stdarg.h" vsscanf -print_config HAVE_ mp_config.h mp_config.mak vsscanf +print_config HAVE_ mpxp_config.h mpxp_config.mak vsscanf if enabled termcap; then disable termcap @@ -494,43 +494,43 @@ disabled termcap && require2 termcap stdio.h tgetent $ld_i enabled termcap && break done -print_config HAVE_ mp_config.h mp_config.mak termcap +print_config HAVE_ mpxp_config.h mpxp_config.mak termcap fi if enabled termios; then check_header sys/termios.h -print_config HAVE_ mp_config.h mp_config.mak sys_termios_h +print_config HAVE_ mpxp_config.h mpxp_config.mak sys_termios_h disabled sys_termios_h && check_header termios.h -disabled sys_termios_h && print_config HAVE_ mp_config.h mp_config.mak termios_h +disabled sys_termios_h && print_config HAVE_ mpxp_config.h mpxp_config.mak termios_h fi enabled shm && require2 shm "sys/types.h sys/shm.h" shmget -print_config HAVE_ mp_config.h mp_config.mak shm +print_config HAVE_ mpxp_config.h mpxp_config.mak shm require2 zlib zlib.h inflate -lz -print_config HAVE_ mp_config.h mp_config.mak zlib +print_config HAVE_ mpxp_config.h mpxp_config.mak zlib if linux; then enabled rtc && require2 rtc "sys/ioctl.h linux/rtc.h" RTC_IRQP_READ -print_config HAVE_ mp_config.h mp_config.mak rtc +print_config HAVE_ mpxp_config.h mpxp_config.mak rtc fi if enabled iconv; then require2 giconv giconv.h iconv_open -lgiconv -print_config HAVE_ mp_config.h mp_config.mak giconv +print_config HAVE_ mpxp_config.h mpxp_config.mak giconv disable iconv for ld_i in "" -liconv ; do disabled iconv && require2 iconv iconv.h iconv_open $ld_i enabled iconv && break done -print_config HAVE_ mp_config.h mp_config.mak iconv +print_config HAVE_ mpxp_config.h mpxp_config.mak iconv fi enabled lirc && require2 lirc lirc/lirc_client.h lirc_init -llirc_client -print_config HAVE_ mp_config.h mp_config.mak lirc +print_config HAVE_ mpxp_config.h mpxp_config.mak lirc enabled lircc && require2 lircc lirc/lircc.h lircc_init -llircc -print_config HAVE_ mp_config.h mp_config.mak lircc +print_config HAVE_ mpxp_config.h mpxp_config.mak lircc disable pthread for ld_i in "-lpthreadGC2" "-lpthread" "-pthread" "" ; do @@ -538,23 +538,23 @@ enabled pthread && break done disabled pthread && die "Lib pthread not found. (needed by xp mode)" -print_config HAVE_ mp_config.h mp_config.mak pthread +print_config HAVE_ mpxp_config.h mpxp_config.mak pthread check_func2 malloc.h malloc disabled malloc && die "malloc is not supported by your system" -print_config HAVE_ mp_config.h mp_config.mak malloc +print_config HAVE_ mpxp_config.h mpxp_config.mak malloc check_func2 malloc.h memalign disabled memalign && die "memalign is not supported by your system" -print_config HAVE_ mp_config.h mp_config.mak memalign +print_config HAVE_ mpxp_config.h mpxp_config.mak memalign check_func2 alloca.h alloca -print_config HAVE_ mp_config.h mp_config.mak alloca +print_config HAVE_ mpxp_config.h mpxp_config.mak alloca require2 sys_soundcard_h sys/soundcard.h SNDCARD_SB -print_config HAVE_ mp_config.h mp_config.mak sys_soundcard_h +print_config HAVE_ mpxp_config.h mpxp_config.mak sys_soundcard_h require2 soundcard_h soundcard.h SNDCARD_SB -print_config HAVE_ mp_config.h mp_config.mak soundcard_h +print_config HAVE_ mpxp_config.h mpxp_config.mak soundcard_h # XXX: FIXME, add runtime checking echocheck "linux devfs" @@ -564,15 +564,15 @@ echocheck "language" linguas=$language test -z $linguas && linguas=`echo $LANG | sed 's/^\([^_]*\).*$/\1/'` -if test -f "nls/help_mp-$linguas.h" ; then +if test -f "nls/mpxp_help-$linguas.h" ; then echores "$linguas" else echores "$linguas not found, using en" linguas="en" fi -mp_help="nls/help_mp-$linguas.h" -test -f nls/help_mp-$linguas.h || die "nls/help_mp-$linguas.h not found" -echo "#define I18N_LANGUAGE \"$linguas\"" >>mp_config.h +mpxp_help="nls/mpxp_help-$linguas.h" +test -f nls/mpxp_help-$linguas.h || die "nls/mpxp_help-$linguas.h not found" +echo "#define I18N_LANGUAGE \"$linguas\"" >>mpxp_config.h enabled gpl_only && disable win32loader @@ -580,7 +580,7 @@ disable win32loader fi win32 && add_ldflags -lkernel32 -print_config ENABLE_ mp_config.h mp_config.mak win32loader +print_config ENABLE_ mpxp_config.h mpxp_config.mak win32loader echo -n "win32 dll's ... " if test -z "$win32libdir" ; then @@ -592,29 +592,29 @@ done fi echo "$win32libdir" -echo "#define WIN32_PATH \"$win32libdir\"" >>mp_config.h +echo "#define WIN32_PATH \"$win32libdir\"" >>mpxp_config.h ######### # VIDEO # ######### check_pkg x11 x11 enabled x11 && require2 x11 "X11/Xlib.h X11/Xutil.h" XCreateWindow -lXext -print_config HAVE_ mp_config.h mp_config.mak x11 +print_config HAVE_ mpxp_config.h mpxp_config.mak x11 enabled x11 && vomodules="x11 $vomodules" || novomodules="x11 $novomodules" disabled x11 && disable xdpms enabled xdpms && require2 xdpms "X11/Xlib.h X11/extensions/dpms.h" DPMSQueryExtension disabled xdpms && require2 xdpms "X11/Xlib.h X11/extensions/dpms.h" DPMSQueryExtension -lXdpms -print_config HAVE_ mp_config.h mp_config.mak xdpms +print_config HAVE_ mpxp_config.h mpxp_config.mak xdpms disabled x11 && disable xv enabled xv && require2 xv "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -print_config HAVE_ mp_config.h mp_config.mak xv +print_config HAVE_ mpxp_config.h mpxp_config.mak xv enabled xv && vomodules="xv $vomodules" || novomodules="xv $novomodules" disabled x11 && disable xinerama enabled xinerama && require2 xinerama "X11/Xlib.h X11/extensions/Xinerama.h" XineramaIsActive -lXinerama -print_config HAVE_ mp_config.h mp_config.mak xinerama +print_config HAVE_ mpxp_config.h mpxp_config.mak xinerama if win32 ; then enabled opengl && require2 opengl "windows.h GL/gl.h" wglCreateContext -lopengl32 -lgdi32 @@ -622,7 +622,7 @@ disabled x11 && disable opengl enabled opengl && require2 opengl "GL/gl.h GL/glx.h GL/glut.h" glutInitWindowSize -lglut -lGL -lGLU fi -print_config HAVE_ mp_config.h mp_config.mak opengl +print_config HAVE_ mpxp_config.h mpxp_config.mak opengl enabled opengl && vomodules="opengl $vomodules" || novomodules="opengl $novomodules" # Note: the -lXxf86vm library is the VideoMode extension and though it's not @@ -632,12 +632,12 @@ # If you run into problems, remove '-lXxf86vm'. disabled x11 && disable xf86vm enabled xf86vm && require2 xf86vm "X11/Xlib.h X11/extensions/xf86vmode.h" XF86VidModeQueryExtension -lXxf86vm -print_config HAVE_ mp_config.h mp_config.mak xf86vm +print_config HAVE_ mpxp_config.h mpxp_config.mak xf86vm disabled x11 && disable dga enabled fbdev && require2 fbdev "sys/ioctl.h linux/fb.h" ioctl -print_config HAVE_ mp_config.h mp_config.mak fbdev +print_config HAVE_ mpxp_config.h mpxp_config.mak fbdev enabled fbdev && vomodules="fbdev $vomodules" || novomodules="fbdev $novomodules" if test "$fbdev_nocopy" = yes ; then def_fbdev_nocopy='#define USE_CONVERT2FB 1' @@ -645,15 +645,15 @@ if enabled png; then require2 png png.h PNG_LIBPNG_VER_STRING -lpng -print_config HAVE_ mp_config.h mp_config.mak png +print_config HAVE_ mpxp_config.h mpxp_config.mak png disabled png && require2 libpng_png libpng/png.h PNG_LIBPNG_VER_STRING -lpng -lm -print_config HAVE_ mp_config.h mp_config.mak libpng_png +print_config HAVE_ mpxp_config.h mpxp_config.mak libpng_png enabled libpng_png && enable png fi enabled png && vomodules="png $vomodules" || novomodules="png $novomodules" enabled jpg && require2 jpeg "stdio.h stdlib.h setjmp.h string.h jpeglib.h" jpeg_write_scanlines -ljpeg -print_config HAVE_ mp_config.h mp_config.mak jpeg +print_config HAVE_ mpxp_config.h mpxp_config.mak jpeg enabled jpeg && vomodules="jpeg $vomodules" || novomodules="jpeg $novomodules" x86_32 || disable vesa @@ -663,7 +663,7 @@ vesa=$_vesa enabled vesa && require3 vesa "asm/vm86.h string.h" X86_EFLAGS_VIF memset fi -print_config HAVE_ mp_config.h mp_config.mak vesa +print_config HAVE_ mpxp_config.h mpxp_config.mak vesa enabled vesa && vomodules="vesa $vomodules" || novomodules="vesa $novomodules" ################# @@ -672,21 +672,21 @@ enabled sdl && check_pkg sdl sdl enabled sdl && require2 sdl SDL/SDL.h SDL_CreateYUVOverlay -print_config HAVE_ mp_config.h mp_config.mak sdl +print_config HAVE_ mpxp_config.h mpxp_config.mak sdl disabled sdl && disable sdl_image if enabled sdl; then enabled sdl_image && require2 sdl_image SDL/SDL_image.h IMG_Load_RW -lSDL_image -print_config HAVE_ mp_config.h mp_config.mak sdl_image +print_config HAVE_ mpxp_config.h mpxp_config.mak sdl_image fi enabled sdl && aomodules="sdl $aomodules" || noaomodules="sdl $noaomodules" enabled sdl && vomodules="sdl $vomodules" || novomodules="sdl $novomodules" enabled sdl_image && vomodules="sdl_image $vomodules" || novomodules="sdl_image $novomodules" enabled libcdio && require2 libcdio "cdio/cdio.h" cdio_read_mode2_sectors -lcdio -print_config HAVE_ mp_config.h mp_config.mak libcdio +print_config HAVE_ mpxp_config.h mpxp_config.mak libcdio enabled libcdio && require2 libcdio_cdda "cdio/cdda.h" cdio_cddap_read -lcdio_cdda -print_config HAVE_ mp_config.h mp_config.mak libcdio_cdda +print_config HAVE_ mpxp_config.h mpxp_config.mak libcdio_cdda enabled libcdio_cdda && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" ######### @@ -695,7 +695,7 @@ enabled ossaudio && require2 ossaudio sys/soundcard.h SNDCTL_DSP_SETFRAGMENT oss_audio=$ossaudio -print_config USE_ mp_config.h mp_config.mak oss_audio +print_config USE_ mpxp_config.h mpxp_config.mak oss_audio enabled ossaudio && aomodules="oss $aomodules" || noaomodules="oss $noaomodules" if test "$linux_devfs" = yes; then def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound/dsp"' @@ -706,71 +706,71 @@ fi enabled alsa && require2 alsa alsa/asoundlib.h SND_LIB_MAJOR -lasound -print_config HAVE_ mp_config.h mp_config.mak alsa +print_config HAVE_ mpxp_config.h mpxp_config.mak alsa enabled alsa && aomodules="alsa $aomodules" || noaomodules="alsa $noaomodules" # It seems that aRts doesn't support pkg-config enabled arts && check_cflags $(artsc-config --cflags) && add_cflags $(artsc-config --cflags) || disable arts enabled arts && check_ldflags $(artsc-config --libs) && add_extralibs $(artsc-config --libs) || disable arts enabled arts && require2 arts artsc.h arts_write -lartsc -print_config HAVE_ mp_config.h mp_config.mak arts +print_config HAVE_ mpxp_config.h mpxp_config.mak arts enabled arts && aomodules="arts $aomodules" || noaomodules="arts $noaomodules" check_pkg esd esound enabled esd && require2 esd esd.h esd_open_sound -print_config HAVE_ mp_config.h mp_config.mak esd +print_config HAVE_ mpxp_config.h mpxp_config.mak esd enabled esd && aomodules="esd $aomodules" || noaomodules="esd $noaomodules" enabled openal && require2 openal AL/al.h alSourceQueueBuffers -lopenal -print_config HAVE_ mp_config.h mp_config.mak openal +print_config HAVE_ mpxp_config.h mpxp_config.mak openal enabled openal && aomodules="openal $aomodules" || noaomodules="openal $noaomodules" enabled nas && require2 nas audio/audiolib.h AuOpenServer -laudio -print_config HAVE_ mp_config.h mp_config.mak nas +print_config HAVE_ mpxp_config.h mpxp_config.mak nas enabled nas && aomodules="nas $aomodules" || noaomodules="nas $noaomodules" check_pkg jack jack enabled jack && require2 jack jack/jack.h jack_client_open -print_config HAVE_ mp_config.h mp_config.mak jack +print_config HAVE_ mpxp_config.h mpxp_config.mak jack enabled jack && aomodules="jack $aomodules" || noaomodules="jack $noaomodules" enabled libdvdread && require2 libdvdread "stdint.h dvdread/dvd_reader.h dvdread/ifo_types.h dvdread/ifo_read.h dvdread/nav_read.h" DVDOpenFile -ldvdread dvdread=$libdvdread -print_config USE_ mp_config.h mp_config.mak dvdread +print_config USE_ mpxp_config.h mpxp_config.mak dvdread enabled libdvdread && inputmodules="libdvdread $inputmodules" || noinputmodules="libdvdread $noinputmodules" enabled libdvdnav && require2 libdvdnav dvdnav/dvdnav.h dvdnav_set_PGC_positioning_flag -ldvdnav dvdnav=$libdvdnav -print_config USE_ mp_config.h mp_config.mak dvdnav +print_config USE_ mpxp_config.h mpxp_config.mak dvdnav enabled libdvdnav && inputmodules="libdvdnav $inputmodules" || noinputmodules="libdvdnav $noinputmodules" enabled libvcd && require2 libvcd libvcd/info.h vcdinfo_open -lvcdinfo -print_config USE_ mp_config.h mp_config.mak libvcd +print_config USE_ mpxp_config.h mpxp_config.mak libvcd enabled libvcd && inputmodules="libvcd $inputmodules" || noinputmodules="libvcd $noinputmodules" enabled libdv && check_pkg libdv libdv enabled libdv && require2 libdv "libdv/dv.h" dv_encoder_new -ldv -print_config HAVE_ mp_config.h mp_config.mak libdv +print_config HAVE_ mpxp_config.h mpxp_config.mak libdv enabled libdv && inputmodules="libdv $inputmodules" || noinputmodules="libdv $noinputmodules" enabled fastmemcpy && x86 || disable fastmemcpy -print_config USE_ mp_config.h mp_config.mak fastmemcpy +print_config USE_ mpxp_config.h mpxp_config.mak fastmemcpy -enabled tv && print_config USE_ mp_config.h mp_config.mak tv +enabled tv && print_config USE_ mpxp_config.h mpxp_config.mak tv enabled tv && inputmodules="tv $inputmodules" || noinputmodules="tv $noinputmodules" -print_config HAVE_ mp_config.h mp_config.mak audio_select +print_config HAVE_ mpxp_config.h mpxp_config.mak audio_select enabled libvorbis && check_pkg libvorbis vorbis -print_config HAVE_ mp_config.h mp_config.mak libvorbis +print_config HAVE_ mpxp_config.h mpxp_config.mak libvorbis enabled libvorbis && inputmodules="libvorbis $inputmodules" || noinputmodules="libvorbis $noinputmodules" enabled libtheora && check_pkg libtheora theora -print_config HAVE_ mp_config.h mp_config.mak libtheora +print_config HAVE_ mpxp_config.h mpxp_config.mak libtheora enabled libtheora && inputmodules="libtheora $inputmodules" || noinputmodules="libtheora $noinputmodules" enabled libbz2 && require2 libbz2 bzlib.h BZ2_bzlibVersion -lbz2 || disable libbz2 -print_config HAVE_ mp_config.h mp_config.mak libbz2 +print_config HAVE_ mpxp_config.h mpxp_config.mak libbz2 CFLAGS="$CFLAGS -W -Wall -Wextra -Wshadow" # Thread support @@ -792,12 +792,12 @@ # Checking for VIDIX enabled vidix && xxrequire2 vidix "vidix/vidix.h vidix/vidixlibxx.h" Vidix -lvidixxx -print_config CONFIG_ mp_config.h mp_config.mak vidix +print_config CONFIG_ mpxp_config.h mpxp_config.mak vidix enabled x11 && enabled vidix && vomodules=":vidix $vomodules" || novomodules=":vidix $novomodules" enabled joystick && test linux || disable joystick -print_config HAVE_ mp_config.h mp_config.mak joystick +print_config HAVE_ mpxp_config.h mpxp_config.mak joystick # pseudo-ramdom names cat > $TMPC << EOF @@ -885,8 +885,8 @@ ./version.sh ############################################################################# -echo "Creating mp_config.mak" -cat >> mp_config.mak << EOF +echo "Creating mpxp_config.mak" +cat >> mpxp_config.mak << EOF # -------- Generated by configure ----------- LANG = C @@ -922,13 +922,13 @@ # --- HAZARDOUS STUFF EOF -echo "EXTRALIBS=$extralibs" >> mp_config.mak -echo "LDFLAGS=$LDFLAGS" >> mp_config.mak -echo "LDXXFLAGS=$LDXXFLAGS" >> mp_config.mak +echo "EXTRALIBS=$extralibs" >> mpxp_config.mak +echo "LDFLAGS=$LDFLAGS" >> mpxp_config.mak +echo "LDXXFLAGS=$LDXXFLAGS" >> mpxp_config.mak ############################################################################# -echo "Creating mp_config.h" -cat >> mp_config.h << EOF +echo "Creating mpxp_config.h" +cat >> mpxp_config.h << EOF #ifndef MPXP_CONFIG_H #define MPXP_CONFIG_H 1 /* -------- This file has been automatically generated by configure --------- @@ -1133,16 +1133,21 @@ ############################################################################# -echo "Creating help_mp.h" -cat > help_mp.h << EOF -#include "$mp_help" -#include "nls/help_mp-en.h" +echo "Creating mpxp_help.h" +cat > mpxp_help.h << EOF +#ifndef __MPXP_HELP_H_INCLUDED +#define __MPXP_HELP_H_INCLUDED 1 + +#include "$mpxp_help" +#include "nls/mpxp_help-en.h" + +#endif EOF -echo "Creating mp_conf_lavc.h" -cat > mp_conf_lavc.h << EOF -#ifndef __MP_CONF_LAVC_H_INCLUDED__ -#define __MP_CONF_LAVC_H_INCLUDED__ 1 +echo "Creating mpxp_conf_lavc.h" +cat > mpxp_conf_lavc.h << EOF +#ifndef __MPXP_CONF_LAVC_H_INCLUDED__ +#define __MPXP_CONF_LAVC_H_INCLUDED__ 1 #include <stdint.h> #ifdef __cplusplus Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/dump.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* @@ -11,14 +11,14 @@ #include <math.h> #include "xmpcore/sig_hand.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "input2/input.h" #include "mplayerxp.h" #include "libmpdemux/muxer.h" #include "libmpstream2/stream.h" #include "libmpstream2/mrl.h" #define MSGT_CLASS MSGT_GLOBAL -#include "mp_msg.h" +#include "mpxp_msg.h" #include "dump.h" namespace mpxp { Modified: mplayerxp/input2/Makefile =================================================================== --- mplayerxp/input2/Makefile 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/Makefile 2012-12-19 08:57:43 UTC (rev 576) @@ -1,5 +1,5 @@ -include ../mp_config.mak +include ../mpxp_config.mak LIBNAME = libinput2.a Modified: mplayerxp/input2/in_msg.h =================================================================== --- mplayerxp/input2/in_msg.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/in_msg.h 2012-12-19 08:57:43 UTC (rev 576) @@ -2,6 +2,6 @@ #define IN_MSG_H #define MSGT_CLASS MSGT_INPUT -#include "mp_msg.h" +#include "mpxp_msg.h" #endif Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/input.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdlib.h> Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/input.h 2012-12-19 08:57:43 UTC (rev 576) @@ -1,6 +1,6 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; Modified: mplayerxp/input2/joystick.cpp =================================================================== --- mplayerxp/input2/joystick.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/joystick.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; Modified: mplayerxp/input2/lirc.cpp =================================================================== --- mplayerxp/input2/lirc.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/input2/lirc.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; @@ -13,7 +13,7 @@ #include <sys/time.h> #include <stdlib.h> -#include "help_mp.h" +#include "mpxp_help.h" #include "input.h" #include "in_msg.h" Modified: mplayerxp/libao3/Makefile =================================================================== --- mplayerxp/libao3/Makefile 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/Makefile 2012-12-19 08:57:43 UTC (rev 576) @@ -1,5 +1,5 @@ -include ../mp_config.mak +include ../mpxp_config.mak LIBNAME = libao3.a Modified: mplayerxp/libao3/afmt.cpp =================================================================== --- mplayerxp/libao3/afmt.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/afmt.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include "afmt.h" Modified: mplayerxp/libao3/afmt.h =================================================================== --- mplayerxp/libao3/afmt.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/afmt.h 2012-12-19 08:57:43 UTC (rev 576) @@ -9,7 +9,7 @@ #include <soundcard.h> /* OpenBSD have this instead of <sys/soundcard> */ #endif #endif -#include "mp_config.h" +#include "mpxp_config.h" /* standard, old OSS audio formats */ #ifndef AFMT_MU_LAW Modified: mplayerxp/libao3/ao_alsa.cpp =================================================================== --- mplayerxp/libao3/ao_alsa.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_alsa.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_arts.cpp =================================================================== --- mplayerxp/libao3/ao_arts.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_arts.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_esd.cpp =================================================================== --- mplayerxp/libao3/ao_esd.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_esd.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_jack.cpp =================================================================== --- mplayerxp/libao3/ao_jack.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_jack.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* @@ -36,7 +36,7 @@ #include "osdep/timer.h" #include "ao_msg.h" -#include "mp_conf_lavc.h" +#include "mpxp_conf_lavc.h" #include <jack/jack.h> namespace mpxp { Modified: mplayerxp/libao3/ao_msg.h =================================================================== --- mplayerxp/libao3/ao_msg.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_msg.h 2012-12-19 08:57:43 UTC (rev 576) @@ -2,6 +2,6 @@ #define AO_MSG_H #define MSGT_CLASS MSGT_AO -#include "mp_msg.h" +#include "mpxp_msg.h" #endif Modified: mplayerxp/libao3/ao_nas.cpp =================================================================== --- mplayerxp/libao3/ao_nas.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_nas.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_null.cpp =================================================================== --- mplayerxp/libao3/ao_null.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_null.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdint.h> Modified: mplayerxp/libao3/ao_openal.cpp =================================================================== --- mplayerxp/libao3/ao_openal.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_openal.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_oss.cpp =================================================================== --- mplayerxp/libao3/ao_oss.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_oss.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -261,7 +261,7 @@ int _r=0; MSG_WARN("OSS-CONF: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n"); if(::ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &_r)==-1){ - MSG_V("OSS-CONF: %d bytes/frag (mp_config.h)\n",_outburst); + MSG_V("OSS-CONF: %d bytes/frag (mpxp_config.h)\n",_outburst); } else { _outburst=r; MSG_V("OSS-CONF: %d bytes/frag (GETBLKSIZE)\n",_outburst); @@ -291,7 +291,7 @@ delete data; if(_buffersize==0){ MSG_ERR("\n *** OSS-CONF: Your audio driver DOES NOT support select() ***\n" - "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mp_config.h !\n\n"); + "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mpxp_config.h !\n\n"); return MPXP_False; } #endif Modified: mplayerxp/libao3/ao_sdl.cpp =================================================================== --- mplayerxp/libao3/ao_sdl.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_sdl.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libao3/ao_wav.cpp =================================================================== --- mplayerxp/libao3/ao_wav.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/ao_wav.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* @@ -31,7 +31,7 @@ #include "audio_out.h" #include "audio_out_internal.h" #include "libvo2/video_out.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "ao_msg.h" #ifdef __MINGW32__ Modified: mplayerxp/libao3/audio_out.cpp =================================================================== --- mplayerxp/libao3/audio_out.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/audio_out.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libao3/audio_out.h =================================================================== --- mplayerxp/libao3/audio_out.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/audio_out.h 2012-12-19 08:57:43 UTC (rev 576) @@ -1,6 +1,6 @@ #ifndef __AUDIO_OUT_H #define __AUDIO_OUT_H 1 -#include "mp_config.h" +#include "mpxp_config.h" #include "xmpcore/xmp_enums.h" #include <string> Modified: mplayerxp/libao3/audio_out_internal.h =================================================================== --- mplayerxp/libao3/audio_out_internal.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libao3/audio_out_internal.h 2012-12-19 08:57:43 UTC (rev 576) @@ -1,6 +1,6 @@ #ifndef __AO_INTERNAL_H_INCLUDED #define __AO_INTERNAL_H_INCLUDED 1 -#include "mp_config.h" +#include "mpxp_config.h" #include <string> Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/Makefile 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -include ../mp_config.mak +include ../mpxp_config.mak LIBNAME = libmpcodecs.a SUBDIRS = libnuppelvideo liba52 libdca Modified: mplayerxp/libmpcodecs/ad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -11,7 +11,7 @@ #include "codecs_ld.h" #include "mplayerxp.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "osdep/cpudetect.h" #include "osdep/bswap.h" Modified: mplayerxp/libmpcodecs/ad_acm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -11,7 +11,7 @@ #include "loader/wineacm.h" #include "libmpdemux/aviprint.h" #include "libao3/afmt.h" -#include "help_mp.h" +#include "mpxp_help.h" static const ad_info_t info = { "Win32/ACM decoders", Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -11,7 +11,7 @@ #include "codecs_ld.h" #include "mplayerxp.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "osdep/cpudetect.h" #include "libdca/dca.h" Modified: mplayerxp/libmpcodecs/ad_dmo.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -9,7 +9,7 @@ #include "codecs_ld.h" #include "mplayerxp.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "ad_internal.h" #include "ad_msg.h" Modified: mplayerxp/libmpcodecs/ad_dshow.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -6,7 +6,7 @@ #include <unistd.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "loader/dshow/DS_AudioDecoder.h" #include "codecs_ld.h" Modified: mplayerxp/libmpcodecs/ad_dvdpcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/ad_faad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* ad_faad.c - MPlayer AAC decoder using libfaad2 @@ -11,7 +11,7 @@ #include <unistd.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ -#include "help_mp.h" +#include "mpxp_help.h" #include "osdep/bswap.h" #include "codecs_ld.h" #include "ad_internal.h" Modified: mplayerxp/libmpcodecs/ad_hwac3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -10,7 +10,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "codecs_ld.h" #include "osdep/cpudetect.h" #include "osdep/bswap.h" Modified: mplayerxp/libmpcodecs/ad_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -11,11 +11,11 @@ #include "libao3/afmt.h" #include "ad_internal.h" -#include "help_mp.h" +#include "mpxp_help.h" #include "osdep/bswap.h" #include "libmpconf/codec-cfg.h" -#include "mp_conf_lavc.h" +#include "mpxp_conf_lavc.h" #include "codecs_ld.h" struct ad_private_t { Modified: mplayerxp/libmpcodecs/ad_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -8,7 +8,7 @@ #include <unistd.h> #include <math.h> -#include "help_mp.h" +#include "mpxp_help.h" #include <libdv/dv.h> #include <libdv/dv_types.h> Modified: mplayerxp/libmpcodecs/ad_mp3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/ad_msg.h =================================================================== --- mplayerxp/libmpcodecs/ad_msg.h 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_msg.h 2012-12-19 08:57:43 UTC (rev 576) @@ -2,6 +2,6 @@ #define AD_MSG_H 1 #define MSGT_CLASS MSGT_DECAUDIO -#include "mp_msg.h" +#include "mpxp_msg.h" #endif Modified: mplayerxp/libmpcodecs/ad_null.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_null.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_null.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/ad_pcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/ad_qtaudio.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/ad_real.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_real.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_real.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; Modified: mplayerxp/libmpcodecs/ad_twin.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> @@ -11,7 +11,7 @@ #include "loader/wine/windef.h" #include "libao3/afmt.h" #include "libmpdemux/aviprint.h" -#include "help_mp.h" +#include "mpxp_help.h" static const ad_info_t info = { "TWinVQ decoder", Modified: mplayerxp/libmpcodecs/ad_vorbis.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; #include <stdio.h> Modified: mplayerxp/libmpcodecs/codecs_ld.cpp =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.cpp 2012-12-18 16:22:42 UTC (rev 575) +++ mplayerxp/libmpcodecs/codecs_ld.cpp 2012-12-19 08:57:43 UTC (rev 576) @@ -1,4 +1,4 @@ -#include "mp_config.h" +#include "mpxp_config.h" #include "osdep/mplib.h" using namespace mpxp; /* @@ -10,9 +10,9 @@ #include <string.h> #include <stdarg.h> #include "codecs_ld.h" -#include "help_mp.h" +#include "mpxp_help.h" #define MSGT_CLASS MSGT_GLOBAL -#include "mp_msg.h" +#include "mpxp_msg.h" any_t* ld_codec(const char *name,const char *url_hint) { Modified: m... [truncated message content] |
From: <nic...@us...> - 2012-12-18 16:22:49
|
Revision: 575 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=575&view=rev Author: nickols_k Date: 2012-12-18 16:22:42 +0000 (Tue, 18 Dec 2012) Log Message: ----------- rename Rtp -> Rtp_Cache Modified Paths: -------------- mplayerxp/libmpstream2/Makefile mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.h mplayerxp/libmpstream2/network_rtp.cpp mplayerxp/libmpstream2/network_rtp.h Added Paths: ----------- mplayerxp/libmpstream2/rtp_cache.cpp mplayerxp/libmpstream2/rtp_cache.h Removed Paths: ------------- mplayerxp/libmpstream2/rtp.cpp mplayerxp/libmpstream2/rtp.h Modified: mplayerxp/libmpstream2/Makefile =================================================================== --- mplayerxp/libmpstream2/Makefile 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/Makefile 2012-12-18 16:22:42 UTC (rev 575) @@ -42,7 +42,7 @@ network_rtp.cpp \ network_rtsp.cpp \ pnm.cpp \ - rtp.cpp \ + rtp_cache.cpp \ tcp.cpp \ udp.cpp CXXSRCS += s_ftp.cpp \ Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-18 16:22:42 UTC (rev 575) @@ -49,7 +49,6 @@ #include "tcp.h" #include "url.h" -#include "rtp.h" #include "rtsp.h" #include "rtsp_rtp.h" #include "rtsp_session.h" @@ -197,7 +196,7 @@ rtsp_session->rtp_session = Rtp_Rtsp_Session::setup_and_play (*rtsp_session->s); tcp=rtsp_session->rtp_session->get_rtp_socket(); - rtsp_session->rtp = new(zeromem) Rtp(tcp); + rtsp_session->rtp = new(zeromem) Rtp_Cache(tcp); /* neither a Real or an RTP server */ if (!rtsp_session->rtp_session) Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-18 16:22:42 UTC (rev 575) @@ -33,7 +33,7 @@ #ifndef HAVE_RTSP_SESSION_H #define HAVE_RTSP_SESSION_H -#include "../rtp.h" +#include "../rtp_cache.h" struct real_rtsp_session_t; namespace mpxp { class Rtp_Rtsp_Session; @@ -51,7 +51,7 @@ Rtsp* s; real_rtsp_session_t*real_session; Rtp_Rtsp_Session* rtp_session; - Rtp* rtp; + Rtp_Cache* rtp; }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/network_rtp.cpp =================================================================== --- mplayerxp/libmpstream2/network_rtp.cpp 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/network_rtp.cpp 2012-12-18 16:22:42 UTC (rev 575) @@ -5,7 +5,6 @@ #include "udp.h" #include "tcp.h" #include "network_rtp.h" -#include "rtp.h" namespace mpxp { int Rtp_Networking::seek(Tcp& tcp, off_t pos) { @@ -31,7 +30,7 @@ rv->prebuffer_size = 64*1024; // KBytes rv->buffering = 0; rv->status = networking_playing_e; - rv->rtp = new(zeromem) Rtp(tcp); + rv->rtp = new(zeromem) Rtp_Cache(tcp); return rv; } Modified: mplayerxp/libmpstream2/network_rtp.h =================================================================== --- mplayerxp/libmpstream2/network_rtp.h 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/network_rtp.h 2012-12-18 16:22:42 UTC (rev 575) @@ -2,7 +2,7 @@ #define __NETWORK_RP_H_INCLUDED #include "network_nop.h" -#include "rtp.h" +#include "rtp_cache.h" namespace mpxp { struct Rtp_Networking : public Nop_Networking { @@ -14,7 +14,7 @@ virtual int seek( Tcp& fd, off_t pos); private: Rtp_Networking(); - Rtp* rtp; + Rtp_Cache* rtp; }; } // namespace mpxp #endif Deleted: mplayerxp/libmpstream2/rtp.cpp =================================================================== --- mplayerxp/libmpstream2/rtp.cpp 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/rtp.cpp 2012-12-18 16:22:42 UTC (rev 575) @@ -1,234 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* Imported from the dvbstream-0.2 project - * - * Modified for use with MPlayer, for details see the changelog at - * http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id: rtp.c,v 1.4 2007/11/17 12:43:37 nickols_k Exp $ - */ - -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <ctype.h> - -#ifndef HAVE_WINSOCK2 -#include <netinet/in.h> -#include <sys/socket.h> -#include <arpa/inet.h> -#define closesocket close -#else -#include <winsock2.h> -#include <ws2tcpip.h> -#endif -#include <errno.h> -#include "stream.h" - -/* MPEG-2 TS RTP stack */ - -#define DEBUG 1 -#include "tcp.h" -#include "rtp.h" -#include "stream_msg.h" - -// RTP reorder routines -// Also handling of repeated UDP packets (a bug of ExtremeNetworks switches firmware) -// rtpreord procedures -// write rtp packets in cache -// get rtp packets reordered - -namespace mpxp { -#define MAXRTPPACKETSIN 32 // The number of max packets being reordered - -struct rtpbits { - unsigned int v:2; /* version: 2 */ - unsigned int p:1; /* is there padding appended: 0 */ - unsigned int x:1; /* number of extension headers: 0 */ - unsigned int cc:4; /* number of CSRC identifiers: 0 */ - unsigned int m:1; /* marker: 0 */ - unsigned int pt:7; /* payload type: 33 for MPEG2 TS - RFC 1890 */ - unsigned int sequence:16; /* sequence number: random */ -}; - -struct rtpheader { /* in network byte order */ - struct rtpbits b; - int timestamp; /* start: random */ - int ssrc; /* random */ -}; - -// RTP Reordering functions -// Algorithm works as follows: -// If next packet is in sequence just copy it to buffer -// Otherwise copy it in cache according to its sequence number -// Cache is a circular array where "rtpbuf.first" points to next sequence slot -// and keeps track of expected sequence - -// Initialize rtp cache -void Rtp::cache_reset(unsigned short seq) { - int i; - - rtp_first = 0; - rtp_seq[0] = ++seq; - - for (i=0; i<MAXRTPPACKETSIN; i++) rtp_len[i] = 0; -} - -// Write in a cache the rtp packet in right rtp sequence order -int Rtp::cache(char *buffer, int length) { - struct rtpheader rh; - int newseq; - char *data; - unsigned short seq; - static int is_first = 1; - - getrtp2(&rh, &data, &length); - if(!length) return 0; - seq = rh.b.sequence; - - newseq = seq - rtp_seq[rtp_first]; - - if ((newseq == 0) || is_first) { - is_first = 0; - - rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; - rtp_seq[rtp_first] = ++seq; - goto feed; - } - - if (newseq > MAXRTPPACKETSIN) { - MSG_DBG2("Overrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); - cache_reset(seq); - goto feed; - } - - if (newseq < 0) { - int i; - - // Is it a stray packet re-sent to network? - for (i=0; i<MAXRTPPACKETSIN; i++) { - if (rtp_seq[i] == seq) { - MSG_ERR("Stray packet (seq[%d]=%d seq=%d, newseq=%d found at %d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq, i); - return 0; // Yes, it is! - } - } - // Some heuristic to decide when to drop packet or to restart everything - if (newseq > -(3 * MAXRTPPACKETSIN)) { - MSG_ERR("Too Old packet (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); - return 0; // Yes, it is! - } - - MSG_ERR("Underrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); - - cache_reset(seq); - goto feed; - } - - MSG_DBG3("Out of Seq (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); - newseq = ( newseq + rtp_first ) % MAXRTPPACKETSIN; - memcpy (rtp_data[newseq], data, length); - rtp_len[newseq] = length; - rtp_seq[newseq] = seq; - - return 0; - -feed: - memcpy (buffer, data, length); - return length; -} - -// Get next packet in cache -// Look in cache to get first packet in sequence -int Rtp::get_next(char *buffer, int length) { - int i; - unsigned short nextseq; - - // If we have empty buffer we loop to fill it - for (i=0; i < MAXRTPPACKETSIN -3; i++) { - if (rtp_len[rtp_first] != 0) break; - - length = cache(buffer, length); - - // returns on first packet in sequence - if (length > 0) return length; - else if (length < 0) break; - // Only if length == 0 loop continues! - } - - i = rtp_first; - while (rtp_len[i] == 0) { - MSG_ERR("Lost packet %hu\n", rtp_seq[i]); - i = ( 1 + i ) % MAXRTPPACKETSIN; - if (rtp_first == i) break; - } - rtp_first = i; - - // Copy next non empty packet from cache - MSG_DBG3( "Getting rtp from cache [%d] %hu\n", rtp_first, rtp_seq[rtp_first]); - memcpy (buffer, rtp_data[rtp_first], rtp_len[rtp_first]); - length = rtp_len[rtp_first]; // can be zero? - - // Reset fisrt slot and go next in cache - rtp_len[rtp_first] = 0; - nextseq = rtp_seq[rtp_first]; - rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; - rtp_seq[rtp_first] = nextseq + 1; - - return length; -} - - -// Read next rtp packet using cache -int Rtp::read_from_server(char *buffer, int length) { - // Following test is ASSERT (i.e. uneuseful if code is correct) - if(buffer==NULL || length<STREAM_BUFFER_SIZE) { - MSG_ERR("RTP buffer invalid; no data return from network\n"); - return 0; - } - - // loop just to skip empty packets - while ((length = get_next(buffer, length)) == 0) { - MSG_ERR("Got empty packet from RTP cache!?\n"); - } - return(length); -} - -int Rtp::getrtp2(struct rtpheader *rh, char** data, int* lengthData) const { - static char buf[1600]; - unsigned int intP; - char* charP = (char*) &intP; - int headerSize; - int lengthPacket; - lengthPacket=tcp.read((uint8_t*)(buf),1590); - if (lengthPacket<0) MSG_ERR("rtp: socket read error\n"); - else if (lengthPacket<12) MSG_ERR("rtp: packet too small (%d) to be an rtp frame (>12bytes)\n", lengthPacket); - if(lengthPacket<12) { - *lengthData = 0; - return 0; - } - rh->b.v = (unsigned int) ((buf[0]>>6)&0x03); - rh->b.p = (unsigned int) ((buf[0]>>5)&0x01); - rh->b.x = (unsigned int) ((buf[0]>>4)&0x01); - rh->b.cc = (unsigned int) ((buf[0]>>0)&0x0f); - rh->b.m = (unsigned int) ((buf[1]>>7)&0x01); - rh->b.pt = (unsigned int) ((buf[1]>>0)&0x7f); - intP = 0; - memcpy(charP+2,&buf[2],2); - rh->b.sequence = ntohl(intP); - intP = 0; - memcpy(charP,&buf[4],4); - rh->timestamp = ntohl(intP); - - headerSize = 12 + 4*rh->b.cc; /* in bytes */ - - *lengthData = lengthPacket - headerSize; - *data = (char*) buf + headerSize; - - return 0; -} -Rtp::Rtp(Tcp& _tcp):tcp(_tcp) {} -Rtp::~Rtp() {} -} // namespace mpxp Deleted: mplayerxp/libmpstream2/rtp.h =================================================================== --- mplayerxp/libmpstream2/rtp.h 2012-12-18 16:07:55 UTC (rev 574) +++ mplayerxp/libmpstream2/rtp.h 2012-12-18 16:22:42 UTC (rev 575) @@ -1,41 +0,0 @@ -/* Imported from the dvbstream project - * - * Modified for use with MPlayer, for details see the changelog at - * http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id: rtp.h,v 1.2 2007/11/17 12:43:37 nickols_k Exp $ - */ -#ifndef __RTP_H_INCLUDED -#define __RTP_H_INCLUDED 1 -#include "network.h" -#include "tcp.h" -#include <stdint.h> - -namespace mpxp { -// RTP reorder routines -// Also handling of repeated UDP packets (a bug of ExtremeNetworks switches firmware) -// rtpreord procedures -// write rtp packets in cache -// get rtp packets reordered - -#define MAXRTPPACKETSIN 32 // The number of max packets being reordered - - class Rtp : public Opaque { - public: - Rtp(Tcp& tcp); - virtual ~Rtp(); - - virtual int read_from_server(char *buffer, int length); - private: - void cache_reset(unsigned short seq); - int cache(char *buffer, int length); - int get_next(char *buffer, int length); - int getrtp2(struct rtpheader *rh, char** data, int* lengthData) const; - - Tcp& tcp; - uint8_t rtp_data[MAXRTPPACKETSIN][STREAM_BUFFER_SIZE]; - uint16_t rtp_seq[MAXRTPPACKETSIN]; - uint16_t rtp_len[MAXRTPPACKETSIN]; - uint16_t rtp_first; - }; -} // namespace mpxp -#endif Copied: mplayerxp/libmpstream2/rtp_cache.cpp (from rev 574, mplayerxp/libmpstream2/rtp.cpp) =================================================================== --- mplayerxp/libmpstream2/rtp_cache.cpp (rev 0) +++ mplayerxp/libmpstream2/rtp_cache.cpp 2012-12-18 16:22:42 UTC (rev 575) @@ -0,0 +1,234 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* Imported from the dvbstream-0.2 project + * + * Modified for use with MPlayer, for details see the changelog at + * http://svn.mplayerhq.hu/mplayer/trunk/ + * $Id: rtp.c,v 1.4 2007/11/17 12:43:37 nickols_k Exp $ + */ + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> +#include <ctype.h> + +#ifndef HAVE_WINSOCK2 +#include <netinet/in.h> +#include <sys/socket.h> +#include <arpa/inet.h> +#define closesocket close +#else +#include <winsock2.h> +#include <ws2tcpip.h> +#endif +#include <errno.h> +#include "stream.h" + +/* MPEG-2 TS RTP stack */ + +#define DEBUG 1 +#include "tcp.h" +#include "rtp_cache.h" +#include "stream_msg.h" + +// RTP reorder routines +// Also handling of repeated UDP packets (a bug of ExtremeNetworks switches firmware) +// rtpreord procedures +// write rtp packets in cache +// get rtp packets reordered + +namespace mpxp { +#define MAXRTPPACKETSIN 32 // The number of max packets being reordered + +struct rtpbits { + unsigned int v:2; /* version: 2 */ + unsigned int p:1; /* is there padding appended: 0 */ + unsigned int x:1; /* number of extension headers: 0 */ + unsigned int cc:4; /* number of CSRC identifiers: 0 */ + unsigned int m:1; /* marker: 0 */ + unsigned int pt:7; /* payload type: 33 for MPEG2 TS - RFC 1890 */ + unsigned int sequence:16; /* sequence number: random */ +}; + +struct rtpheader { /* in network byte order */ + struct rtpbits b; + int timestamp; /* start: random */ + int ssrc; /* random */ +}; + +// RTP Reordering functions +// Algorithm works as follows: +// If next packet is in sequence just copy it to buffer +// Otherwise copy it in cache according to its sequence number +// Cache is a circular array where "rtpbuf.first" points to next sequence slot +// and keeps track of expected sequence + +// Initialize rtp cache +void Rtp_Cache::cache_reset(unsigned short seq) { + int i; + + rtp_first = 0; + rtp_seq[0] = ++seq; + + for (i=0; i<MAXRTPPACKETSIN; i++) rtp_len[i] = 0; +} + +// Write in a cache the rtp packet in right rtp sequence order +int Rtp_Cache::cache(char *buffer, int length) { + struct rtpheader rh; + int newseq; + char *data; + unsigned short seq; + static int is_first = 1; + + getrtp2(&rh, &data, &length); + if(!length) return 0; + seq = rh.b.sequence; + + newseq = seq - rtp_seq[rtp_first]; + + if ((newseq == 0) || is_first) { + is_first = 0; + + rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; + rtp_seq[rtp_first] = ++seq; + goto feed; + } + + if (newseq > MAXRTPPACKETSIN) { + MSG_DBG2("Overrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + cache_reset(seq); + goto feed; + } + + if (newseq < 0) { + int i; + + // Is it a stray packet re-sent to network? + for (i=0; i<MAXRTPPACKETSIN; i++) { + if (rtp_seq[i] == seq) { + MSG_ERR("Stray packet (seq[%d]=%d seq=%d, newseq=%d found at %d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq, i); + return 0; // Yes, it is! + } + } + // Some heuristic to decide when to drop packet or to restart everything + if (newseq > -(3 * MAXRTPPACKETSIN)) { + MSG_ERR("Too Old packet (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + return 0; // Yes, it is! + } + + MSG_ERR("Underrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + + cache_reset(seq); + goto feed; + } + + MSG_DBG3("Out of Seq (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + newseq = ( newseq + rtp_first ) % MAXRTPPACKETSIN; + memcpy (rtp_data[newseq], data, length); + rtp_len[newseq] = length; + rtp_seq[newseq] = seq; + + return 0; + +feed: + memcpy (buffer, data, length); + return length; +} + +// Get next packet in cache +// Look in cache to get first packet in sequence +int Rtp_Cache::get_next(char *buffer, int length) { + int i; + unsigned short nextseq; + + // If we have empty buffer we loop to fill it + for (i=0; i < MAXRTPPACKETSIN -3; i++) { + if (rtp_len[rtp_first] != 0) break; + + length = cache(buffer, length); + + // returns on first packet in sequence + if (length > 0) return length; + else if (length < 0) break; + // Only if length == 0 loop continues! + } + + i = rtp_first; + while (rtp_len[i] == 0) { + MSG_ERR("Lost packet %hu\n", rtp_seq[i]); + i = ( 1 + i ) % MAXRTPPACKETSIN; + if (rtp_first == i) break; + } + rtp_first = i; + + // Copy next non empty packet from cache + MSG_DBG3( "Getting rtp from cache [%d] %hu\n", rtp_first, rtp_seq[rtp_first]); + memcpy (buffer, rtp_data[rtp_first], rtp_len[rtp_first]); + length = rtp_len[rtp_first]; // can be zero? + + // Reset fisrt slot and go next in cache + rtp_len[rtp_first] = 0; + nextseq = rtp_seq[rtp_first]; + rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; + rtp_seq[rtp_first] = nextseq + 1; + + return length; +} + + +// Read next rtp packet using cache +int Rtp_Cache::read_from_server(char *buffer, int length) { + // Following test is ASSERT (i.e. uneuseful if code is correct) + if(buffer==NULL || length<STREAM_BUFFER_SIZE) { + MSG_ERR("RTP buffer invalid; no data return from network\n"); + return 0; + } + + // loop just to skip empty packets + while ((length = get_next(buffer, length)) == 0) { + MSG_ERR("Got empty packet from RTP cache!?\n"); + } + return(length); +} + +int Rtp_Cache::getrtp2(struct rtpheader *rh, char** data, int* lengthData) const { + static char buf[1600]; + unsigned int intP; + char* charP = (char*) &intP; + int headerSize; + int lengthPacket; + lengthPacket=tcp.read((uint8_t*)(buf),1590); + if (lengthPacket<0) MSG_ERR("rtp: socket read error\n"); + else if (lengthPacket<12) MSG_ERR("rtp: packet too small (%d) to be an rtp frame (>12bytes)\n", lengthPacket); + if(lengthPacket<12) { + *lengthData = 0; + return 0; + } + rh->b.v = (unsigned int) ((buf[0]>>6)&0x03); + rh->b.p = (unsigned int) ((buf[0]>>5)&0x01); + rh->b.x = (unsigned int) ((buf[0]>>4)&0x01); + rh->b.cc = (unsigned int) ((buf[0]>>0)&0x0f); + rh->b.m = (unsigned int) ((buf[1]>>7)&0x01); + rh->b.pt = (unsigned int) ((buf[1]>>0)&0x7f); + intP = 0; + memcpy(charP+2,&buf[2],2); + rh->b.sequence = ntohl(intP); + intP = 0; + memcpy(charP,&buf[4],4); + rh->timestamp = ntohl(intP); + + headerSize = 12 + 4*rh->b.cc; /* in bytes */ + + *lengthData = lengthPacket - headerSize; + *data = (char*) buf + headerSize; + + return 0; +} +Rtp_Cache::Rtp_Cache(Tcp& _tcp):tcp(_tcp) {} +Rtp_Cache::~Rtp_Cache() {} +} // namespace mpxp Copied: mplayerxp/libmpstream2/rtp_cache.h (from rev 574, mplayerxp/libmpstream2/rtp.h) =================================================================== --- mplayerxp/libmpstream2/rtp_cache.h (rev 0) +++ mplayerxp/libmpstream2/rtp_cache.h 2012-12-18 16:22:42 UTC (rev 575) @@ -0,0 +1,41 @@ +/* Imported from the dvbstream project + * + * Modified for use with MPlayer, for details see the changelog at + * http://svn.mplayerhq.hu/mplayer/trunk/ + * $Id: rtp.h,v 1.2 2007/11/17 12:43:37 nickols_k Exp $ + */ +#ifndef __RTP_CACHE_H_INCLUDED +#define __RTP_CACHE_H_INCLUDED 1 +#include "network.h" +#include "tcp.h" +#include <stdint.h> + +namespace mpxp { +// RTP reorder routines +// Also handling of repeated UDP packets (a bug of ExtremeNetworks switches firmware) +// rtpreord procedures +// write rtp packets in cache +// get rtp packets reordered + +#define MAXRTPPACKETSIN 32 // The number of max packets being reordered + + class Rtp_Cache : public Opaque { + public: + Rtp_Cache(Tcp& tcp); + virtual ~Rtp_Cache(); + + virtual int read_from_server(char *buffer, int length); + private: + void cache_reset(unsigned short seq); + int cache(char *buffer, int length); + int get_next(char *buffer, int length); + int getrtp2(struct rtpheader *rh, char** data, int* lengthData) const; + + Tcp& tcp; + uint8_t rtp_data[MAXRTPPACKETSIN][STREAM_BUFFER_SIZE]; + uint16_t rtp_seq[MAXRTPPACKETSIN]; + uint16_t rtp_len[MAXRTPPACKETSIN]; + uint16_t rtp_first; + }; +} // namespace mpxp +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-18 16:08:03
|
Revision: 574 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=574&view=rev Author: nickols_k Date: 2012-12-18 16:07:55 +0000 (Tue, 18 Dec 2012) Log Message: ----------- convert static struct rtpbuffer rtpbuf into class Rtp Modified Paths: -------------- mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.h mplayerxp/libmpstream2/network_real_rtsp.cpp mplayerxp/libmpstream2/network_rtp.cpp mplayerxp/libmpstream2/network_rtp.h mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/rtp.cpp mplayerxp/libmpstream2/rtp.h Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-18 16:07:55 UTC (rev 574) @@ -83,10 +83,7 @@ char *mrl_line = NULL; rmff_header_t *h; - rtsp_session = new Rtsp_Session; - rtsp_session->s = NULL; - rtsp_session->real_session = NULL; - rtsp_session->rtp_session = NULL; + rtsp_session = new(zeromem) Rtsp_Session; //connect: *redir = 0; @@ -199,6 +196,8 @@ } rtsp_session->rtp_session = Rtp_Rtsp_Session::setup_and_play (*rtsp_session->s); + tcp=rtsp_session->rtp_session->get_rtp_socket(); + rtsp_session->rtp = new(zeromem) Rtp(tcp); /* neither a Real or an RTP server */ if (!rtsp_session->rtp_session) @@ -216,7 +215,7 @@ return rtsp_session; } -int Rtsp_Session::read(Tcp& tcp,char *data, int len) { +int Rtsp_Session::read(char *data, int len) { if (real_session) { int to_copy=len; @@ -256,9 +255,7 @@ return len; } else if (rtp_session) { int l = 0; - Tcp _tcp(tcp.get_libinput(),rtp_session->get_rtp_socket()); - - l = read_rtp_from_server (_tcp, data, len); + l = rtp->read_from_server (data, len); /* send RTSP and RTCP keepalive */ rtp_session->rtcp_send_rr (*s); if (l == 0) end (); @@ -270,9 +267,11 @@ void Rtsp_Session::end() { s->close(); if (real_session) free_real_rtsp_session (real_session); + real_session = NULL; if (rtp_session) delete rtp_session; + rtp_session = NULL; } Rtsp_Session::Rtsp_Session() {} -Rtsp_Session::~Rtsp_Session() {} -} // namespace mpxp \ No newline at end of file +Rtsp_Session::~Rtsp_Session() { end(); if(rtp) delete rtp; } +} // namespace mpxp Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-18 16:07:55 UTC (rev 574) @@ -33,7 +33,7 @@ #ifndef HAVE_RTSP_SESSION_H #define HAVE_RTSP_SESSION_H - +#include "../rtp.h" struct real_rtsp_session_t; namespace mpxp { class Rtp_Rtsp_Session; @@ -45,12 +45,13 @@ static Rtsp_Session* start(Tcp& tcp, char **mrl, const std::string& path, const std::string& host, int port, int *redir, uint32_t bandwidth, const std::string& user, const std::string& pass); - virtual int read(Tcp& tcp,char *data, int len); + virtual int read(char *data, int len); virtual void end(); private: Rtsp* s; real_rtsp_session_t*real_session; Rtp_Rtsp_Session* rtp_session; + Rtp* rtp; }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/network_real_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/network_real_rtsp.cpp 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/network_real_rtsp.cpp 2012-12-18 16:07:55 UTC (rev 574) @@ -15,7 +15,7 @@ int RealRtsp_Networking::read( Tcp& tcp, char *_buffer, int size) { Rtsp_Session& rtsp=*static_cast<Rtsp_Session*>(data); - return rtsp.read(tcp, _buffer, size); + return rtsp.read(_buffer, size); } Networking* RealRtsp_Networking::start( Tcp& tcp, network_protocol_t& protocol ) { Modified: mplayerxp/libmpstream2/network_rtp.cpp =================================================================== --- mplayerxp/libmpstream2/network_rtp.cpp 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/network_rtp.cpp 2012-12-18 16:07:55 UTC (rev 574) @@ -15,7 +15,7 @@ } int Rtp_Networking::read(Tcp& tcp, char *_buffer, int size) { - return read_rtp_from_server(tcp, _buffer, size ); + return rtp->read_from_server(_buffer, size ); } Networking* Rtp_Networking::start(Tcp& tcp,network_protocol_t& protocol, int raw_udp ) { @@ -31,6 +31,7 @@ rv->prebuffer_size = 64*1024; // KBytes rv->buffering = 0; rv->status = networking_playing_e; + rv->rtp = new(zeromem) Rtp(tcp); return rv; } Modified: mplayerxp/libmpstream2/network_rtp.h =================================================================== --- mplayerxp/libmpstream2/network_rtp.h 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/network_rtp.h 2012-12-18 16:07:55 UTC (rev 574) @@ -2,6 +2,7 @@ #define __NETWORK_RP_H_INCLUDED #include "network_nop.h" +#include "rtp.h" namespace mpxp { struct Rtp_Networking : public Nop_Networking { @@ -13,6 +14,7 @@ virtual int seek( Tcp& fd, off_t pos); private: Rtp_Networking(); + Rtp* rtp; }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/network_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-18 16:07:55 UTC (rev 574) @@ -69,7 +69,7 @@ int Rtsp_Networking::read(Tcp& tcp, char *_buffer, int size) { Rtsp_Session& rtsp = *static_cast<Rtsp_Session*>(data); - return rtsp.read (tcp, buffer, size); + return rtsp.read (buffer, size); } Rtsp_Networking::Rtsp_Networking() {} Modified: mplayerxp/libmpstream2/rtp.cpp =================================================================== --- mplayerxp/libmpstream2/rtp.cpp 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/rtp.cpp 2012-12-18 16:07:55 UTC (rev 574) @@ -41,6 +41,7 @@ // write rtp packets in cache // get rtp packets reordered +namespace mpxp { #define MAXRTPPACKETSIN 32 // The number of max packets being reordered struct rtpbits { @@ -59,17 +60,6 @@ int ssrc; /* random */ }; -struct rtpbuffer -{ - unsigned char data[MAXRTPPACKETSIN][STREAM_BUFFER_SIZE]; - unsigned short seq[MAXRTPPACKETSIN]; - unsigned short len[MAXRTPPACKETSIN]; - unsigned short first; -}; -static struct rtpbuffer rtpbuf; - -static int getrtp2(Tcp& fd, struct rtpheader *rh, char** data, int* lengthData); - // RTP Reordering functions // Algorithm works as follows: // If next packet is in sequence just copy it to buffer @@ -78,178 +68,167 @@ // and keeps track of expected sequence // Initialize rtp cache -static void rtp_cache_reset(unsigned short seq) -{ - int i; +void Rtp::cache_reset(unsigned short seq) { + int i; - rtpbuf.first = 0; - rtpbuf.seq[0] = ++seq; + rtp_first = 0; + rtp_seq[0] = ++seq; - for (i=0; i<MAXRTPPACKETSIN; i++) { - rtpbuf.len[i] = 0; - } + for (i=0; i<MAXRTPPACKETSIN; i++) rtp_len[i] = 0; } // Write in a cache the rtp packet in right rtp sequence order -static int rtp_cache(Tcp& tcp, char *buffer, int length) -{ - struct rtpheader rh; - int newseq; - char *data; - unsigned short seq; - static int is_first = 1; +int Rtp::cache(char *buffer, int length) { + struct rtpheader rh; + int newseq; + char *data; + unsigned short seq; + static int is_first = 1; - getrtp2(tcp, &rh, &data, &length); - if(!length) - return 0; - seq = rh.b.sequence; + getrtp2(&rh, &data, &length); + if(!length) return 0; + seq = rh.b.sequence; - newseq = seq - rtpbuf.seq[rtpbuf.first]; + newseq = seq - rtp_seq[rtp_first]; - if ((newseq == 0) || is_first) - { - is_first = 0; + if ((newseq == 0) || is_first) { + is_first = 0; - rtpbuf.first = ( 1 + rtpbuf.first ) % MAXRTPPACKETSIN; - rtpbuf.seq[rtpbuf.first] = ++seq; - goto feed; - } + rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; + rtp_seq[rtp_first] = ++seq; + goto feed; + } - if (newseq > MAXRTPPACKETSIN) - { - MSG_DBG2("Overrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first], seq, newseq); - rtp_cache_reset(seq); - goto feed; - } + if (newseq > MAXRTPPACKETSIN) { + MSG_DBG2("Overrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + cache_reset(seq); + goto feed; + } - if (newseq < 0) - { - int i; + if (newseq < 0) { + int i; - // Is it a stray packet re-sent to network? - for (i=0; i<MAXRTPPACKETSIN; i++) { - if (rtpbuf.seq[i] == seq) { - MSG_ERR("Stray packet (seq[%d]=%d seq=%d, newseq=%d found at %d)\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first], seq, newseq, i); - return 0; // Yes, it is! - } - } - // Some heuristic to decide when to drop packet or to restart everything - if (newseq > -(3 * MAXRTPPACKETSIN)) { - MSG_ERR("Too Old packet (seq[%d]=%d seq=%d, newseq=%d)\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first], seq, newseq); - return 0; // Yes, it is! - } + // Is it a stray packet re-sent to network? + for (i=0; i<MAXRTPPACKETSIN; i++) { + if (rtp_seq[i] == seq) { + MSG_ERR("Stray packet (seq[%d]=%d seq=%d, newseq=%d found at %d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq, i); + return 0; // Yes, it is! + } + } + // Some heuristic to decide when to drop packet or to restart everything + if (newseq > -(3 * MAXRTPPACKETSIN)) { + MSG_ERR("Too Old packet (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + return 0; // Yes, it is! + } - MSG_ERR("Underrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first], seq, newseq); + MSG_ERR("Underrun(seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); - rtp_cache_reset(seq); - goto feed; - } + cache_reset(seq); + goto feed; + } - MSG_DBG3("Out of Seq (seq[%d]=%d seq=%d, newseq=%d)\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first], seq, newseq); - newseq = ( newseq + rtpbuf.first ) % MAXRTPPACKETSIN; - memcpy (rtpbuf.data[newseq], data, length); - rtpbuf.len[newseq] = length; - rtpbuf.seq[newseq] = seq; + MSG_DBG3("Out of Seq (seq[%d]=%d seq=%d, newseq=%d)\n", rtp_first, rtp_seq[rtp_first], seq, newseq); + newseq = ( newseq + rtp_first ) % MAXRTPPACKETSIN; + memcpy (rtp_data[newseq], data, length); + rtp_len[newseq] = length; + rtp_seq[newseq] = seq; - return 0; + return 0; feed: - memcpy (buffer, data, length); - return length; + memcpy (buffer, data, length); + return length; } // Get next packet in cache // Look in cache to get first packet in sequence -static int rtp_get_next(Tcp& tcp, char *buffer, int length) -{ - int i; - unsigned short nextseq; +int Rtp::get_next(char *buffer, int length) { + int i; + unsigned short nextseq; - // If we have empty buffer we loop to fill it - for (i=0; i < MAXRTPPACKETSIN -3; i++) { - if (rtpbuf.len[rtpbuf.first] != 0) break; + // If we have empty buffer we loop to fill it + for (i=0; i < MAXRTPPACKETSIN -3; i++) { + if (rtp_len[rtp_first] != 0) break; - length = rtp_cache(tcp, buffer, length) ; + length = cache(buffer, length); - // returns on first packet in sequence - if (length > 0) { - return length; - } else if (length < 0) break; + // returns on first packet in sequence + if (length > 0) return length; + else if (length < 0) break; + // Only if length == 0 loop continues! + } - // Only if length == 0 loop continues! - } + i = rtp_first; + while (rtp_len[i] == 0) { + MSG_ERR("Lost packet %hu\n", rtp_seq[i]); + i = ( 1 + i ) % MAXRTPPACKETSIN; + if (rtp_first == i) break; + } + rtp_first = i; - i = rtpbuf.first; - while (rtpbuf.len[i] == 0) { - MSG_ERR("Lost packet %hu\n", rtpbuf.seq[i]); - i = ( 1 + i ) % MAXRTPPACKETSIN; - if (rtpbuf.first == i) break; - } - rtpbuf.first = i; + // Copy next non empty packet from cache + MSG_DBG3( "Getting rtp from cache [%d] %hu\n", rtp_first, rtp_seq[rtp_first]); + memcpy (buffer, rtp_data[rtp_first], rtp_len[rtp_first]); + length = rtp_len[rtp_first]; // can be zero? - // Copy next non empty packet from cache - MSG_DBG3( "Getting rtp from cache [%d] %hu\n", rtpbuf.first, rtpbuf.seq[rtpbuf.first]); - memcpy (buffer, rtpbuf.data[rtpbuf.first], rtpbuf.len[rtpbuf.first]); - length = rtpbuf.len[rtpbuf.first]; // can be zero? + // Reset fisrt slot and go next in cache + rtp_len[rtp_first] = 0; + nextseq = rtp_seq[rtp_first]; + rtp_first = ( 1 + rtp_first ) % MAXRTPPACKETSIN; + rtp_seq[rtp_first] = nextseq + 1; - // Reset fisrt slot and go next in cache - rtpbuf.len[rtpbuf.first] = 0; - nextseq = rtpbuf.seq[rtpbuf.first]; - rtpbuf.first = ( 1 + rtpbuf.first ) % MAXRTPPACKETSIN; - rtpbuf.seq[rtpbuf.first] = nextseq + 1; - - return length; + return length; } // Read next rtp packet using cache -int read_rtp_from_server(Tcp& tcp, char *buffer, int length) { - // Following test is ASSERT (i.e. uneuseful if code is correct) - if(buffer==NULL || length<STREAM_BUFFER_SIZE) { - MSG_ERR("RTP buffer invalid; no data return from network\n"); - return 0; - } +int Rtp::read_from_server(char *buffer, int length) { + // Following test is ASSERT (i.e. uneuseful if code is correct) + if(buffer==NULL || length<STREAM_BUFFER_SIZE) { + MSG_ERR("RTP buffer invalid; no data return from network\n"); + return 0; + } - // loop just to skip empty packets - while ((length = rtp_get_next(tcp, buffer, length)) == 0) { - MSG_ERR("Got empty packet from RTP cache!?\n"); - } - - return(length); + // loop just to skip empty packets + while ((length = get_next(buffer, length)) == 0) { + MSG_ERR("Got empty packet from RTP cache!?\n"); + } + return(length); } -static int getrtp2(Tcp& tcp, struct rtpheader *rh, char** data, int* lengthData) { - static char buf[1600]; - unsigned int intP; - char* charP = (char*) &intP; - int headerSize; - int lengthPacket; - lengthPacket=tcp.read((uint8_t*)(buf),1590); - if (lengthPacket<0) - MSG_ERR("rtp: socket read error\n"); - else if (lengthPacket<12) - MSG_ERR("rtp: packet too small (%d) to be an rtp frame (>12bytes)\n", lengthPacket); - if(lengthPacket<12) { - *lengthData = 0; - return 0; - } - rh->b.v = (unsigned int) ((buf[0]>>6)&0x03); - rh->b.p = (unsigned int) ((buf[0]>>5)&0x01); - rh->b.x = (unsigned int) ((buf[0]>>4)&0x01); - rh->b.cc = (unsigned int) ((buf[0]>>0)&0x0f); - rh->b.m = (unsigned int) ((buf[1]>>7)&0x01); - rh->b.pt = (unsigned int) ((buf[1]>>0)&0x7f); - intP = 0; - memcpy(charP+2,&buf[2],2); - rh->b.sequence = ntohl(intP); - intP = 0; - memcpy(charP,&buf[4],4); - rh->timestamp = ntohl(intP); +int Rtp::getrtp2(struct rtpheader *rh, char** data, int* lengthData) const { + static char buf[1600]; + unsigned int intP; + char* charP = (char*) &intP; + int headerSize; + int lengthPacket; + lengthPacket=tcp.read((uint8_t*)(buf),1590); + if (lengthPacket<0) MSG_ERR("rtp: socket read error\n"); + else if (lengthPacket<12) MSG_ERR("rtp: packet too small (%d) to be an rtp frame (>12bytes)\n", lengthPacket); + if(lengthPacket<12) { + *lengthData = 0; + return 0; + } + rh->b.v = (unsigned int) ((buf[0]>>6)&0x03); + rh->b.p = (unsigned int) ((buf[0]>>5)&0x01); + rh->b.x = (unsigned int) ((buf[0]>>4)&0x01); + rh->b.cc = (unsigned int) ((buf[0]>>0)&0x0f); + rh->b.m = (unsigned int) ((buf[1]>>7)&0x01); + rh->b.pt = (unsigned int) ((buf[1]>>0)&0x7f); + intP = 0; + memcpy(charP+2,&buf[2],2); + rh->b.sequence = ntohl(intP); + intP = 0; + memcpy(charP,&buf[4],4); + rh->timestamp = ntohl(intP); - headerSize = 12 + 4*rh->b.cc; /* in bytes */ + headerSize = 12 + 4*rh->b.cc; /* in bytes */ - *lengthData = lengthPacket - headerSize; - *data = (char*) buf + headerSize; + *lengthData = lengthPacket - headerSize; + *data = (char*) buf + headerSize; - return 0; + return 0; } +Rtp::Rtp(Tcp& _tcp):tcp(_tcp) {} +Rtp::~Rtp() {} +} // namespace mpxp Modified: mplayerxp/libmpstream2/rtp.h =================================================================== --- mplayerxp/libmpstream2/rtp.h 2012-12-18 15:09:54 UTC (rev 573) +++ mplayerxp/libmpstream2/rtp.h 2012-12-18 16:07:55 UTC (rev 574) @@ -4,11 +4,38 @@ * http://svn.mplayerhq.hu/mplayer/trunk/ * $Id: rtp.h,v 1.2 2007/11/17 12:43:37 nickols_k Exp $ */ - -#ifndef RTP_H -#define RTP_H +#ifndef __RTP_H_INCLUDED +#define __RTP_H_INCLUDED 1 #include "network.h" +#include "tcp.h" +#include <stdint.h> -int read_rtp_from_server(Tcp& fd, char *buffer, int length); +namespace mpxp { +// RTP reorder routines +// Also handling of repeated UDP packets (a bug of ExtremeNetworks switches firmware) +// rtpreord procedures +// write rtp packets in cache +// get rtp packets reordered +#define MAXRTPPACKETSIN 32 // The number of max packets being reordered + + class Rtp : public Opaque { + public: + Rtp(Tcp& tcp); + virtual ~Rtp(); + + virtual int read_from_server(char *buffer, int length); + private: + void cache_reset(unsigned short seq); + int cache(char *buffer, int length); + int get_next(char *buffer, int length); + int getrtp2(struct rtpheader *rh, char** data, int* lengthData) const; + + Tcp& tcp; + uint8_t rtp_data[MAXRTPPACKETSIN][STREAM_BUFFER_SIZE]; + uint16_t rtp_seq[MAXRTPPACKETSIN]; + uint16_t rtp_len[MAXRTPPACKETSIN]; + uint16_t rtp_first; + }; +} // namespace mpxp #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-18 15:10:04
|
Revision: 573 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=573&view=rev Author: nickols_k Date: 2012-12-18 15:09:54 +0000 (Tue, 18 Dec 2012) Log Message: ----------- convert librtsp into classes Modified Paths: -------------- mplayerxp/libmpstream2/librtsp/rtsp.cpp mplayerxp/libmpstream2/librtsp/rtsp.h mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp mplayerxp/libmpstream2/librtsp/rtsp_rtp.h mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.h mplayerxp/libmpstream2/network_real_rtsp.cpp mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/realrtsp/real.cpp mplayerxp/libmpstream2/realrtsp/real.h Modified: mplayerxp/libmpstream2/librtsp/rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-18 13:04:29 UTC (rev 572) +++ mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-18 15:09:54 UTC (rev 573) @@ -60,34 +60,14 @@ #include "osdep/timer.h" #include "stream_msg.h" +namespace mpxp { /* #define LOG */ -#define BUF_SIZE 4096 -#define HEADER_SIZE 1024 -#define MAX_FIELDS 256 - -struct rtsp_t { - - Tcp* tcp; - - const char* host; - int port; - const char* path; - const char* param; - char* mrl; - const char* user_agent; - - const char* server; - unsigned server_state; - uint32_t server_caps; - - unsigned cseq; - const char* session; - - char* answers[MAX_FIELDS]; /* data of last message */ - char* scheduled[MAX_FIELDS]; /* will be sent with next message */ +enum { + BUF_SIZE=4096, + HEADER_SIZE=1024 }; /* @@ -97,28 +77,43 @@ #define RTSP_PROTOCOL_VERSION "RTSP/1.0" /* server states */ -#define RTSP_CONNECTED 1 -#define RTSP_INIT 2 -#define RTSP_READY 4 -#define RTSP_PLAYING 8 -#define RTSP_RECORDING 16 +enum { + RTSP_CONNECTED=1, + RTSP_INIT=2, + RTSP_READY=4, + RTSP_PLAYING=8, + RTSP_RECORDING=16 +}; /* server capabilities */ -#define RTSP_OPTIONS 0x001 -#define RTSP_DESCRIBE 0x002 -#define RTSP_ANNOUNCE 0x004 -#define RTSP_SETUP 0x008 -#define RTSP_GET_PARAMETER 0x010 -#define RTSP_SET_PARAMETER 0x020 -#define RTSP_TEARDOWN 0x040 -#define RTSP_PLAY 0x080 -#define RTSP_RECORD 0x100 +enum { + RTSP_OPTIONS=0x001, + RTSP_DESCRIBE=0x002, + RTSP_ANNOUNCE=0x004, + RTSP_SETUP=0x008, + RTSP_GET_PARAMETER=0x010, + RTSP_SET_PARAMETER=0x020, + RTSP_TEARDOWN=0x040, + RTSP_PLAY=0x080, + RTSP_RECORD=0x100 +}; +Rtsp::Rtsp(Tcp& _tcp):tcp(_tcp) {} +Rtsp::~Rtsp() { + if (path) delete path; + if (host) delete host; + if (mrl) delete mrl; + if (session) delete session; + if (user_agent) delete user_agent; + free_answers(); + unschedule_all(); +} + /* * network utilities */ -static int write_stream(Tcp& tcp, const char *buf, int len) { +int Rtsp::write_stream(const char *buf, int len) const { int total, timeout; total = 0; timeout = 30; @@ -144,13 +139,13 @@ return total; } -static ssize_t read_stream(Tcp& tcp, any_t*buf, size_t count) { +ssize_t Rtsp::read_stream(any_t*buf, size_t count) const { ssize_t ret, total; total = 0; - while (total < count) { + while (total < ssize_t(count)) { ret=tcp.read(((uint8_t*)buf)+total, count-total); @@ -171,211 +166,193 @@ * and returns a null terminated string. */ -static char *rtsp_get(rtsp_t *s) { +char* Rtsp::get() const { + int n=1; + char *buffer = new char [BUF_SIZE]; + char *string = NULL; - int n=1; - char *buffer = new char [BUF_SIZE]; - char *string = NULL; + read_stream(buffer, 1); + while (n<BUF_SIZE) { + read_stream(&(buffer[n]), 1); + if ((buffer[n-1]==0x0d)&&(buffer[n]==0x0a)) break; + n++; + } - read_stream(*s->tcp, buffer, 1); - while (n<BUF_SIZE) { - read_stream(*s->tcp, &(buffer[n]), 1); - if ((buffer[n-1]==0x0d)&&(buffer[n]==0x0a)) break; - n++; - } + if (n>=BUF_SIZE) { + MSG_FATAL("librtsp: buffer overflow in rtsp_get\n"); + exit(1); + } + string=new char [n]; + memcpy(string,buffer,n-1); + string[n-1]=0; - if (n>=BUF_SIZE) { - MSG_FATAL("librtsp: buffer overflow in rtsp_get\n"); - exit(1); - } - string=new char [n]; - memcpy(string,buffer,n-1); - string[n-1]=0; - #ifdef LOG - MSG_INFO("librtsp: << '%s'\n", string); + MSG_INFO("librtsp: << '%s'\n", string); #endif - delete buffer; - return string; + delete buffer; + return string; } /* * rtsp_put puts a line on stream */ -static void rtsp_put(rtsp_t *s, const char *string) { +void Rtsp::put(const char *string) const { + int len=strlen(string); + char *buf=new char [len+2]; - int len=strlen(string); - char *buf=new char [len+2]; - #ifdef LOG - MSG_INFO("librtsp: >> '%s'", string); + MSG_INFO("librtsp: >> '%s'", string); #endif - memcpy(buf,string,len); - buf[len]=0x0d; - buf[len+1]=0x0a; + memcpy(buf,string,len); + buf[len]=0x0d; + buf[len+1]=0x0a; - write_stream(*s->tcp, buf, len+2); + write_stream(buf, len+2); #ifdef LOG - MSG_INFO(" done.\n"); + MSG_INFO(" done.\n"); #endif - - delete buf; + delete buf; } /* * extract server status code */ -static int rtsp_get_code(const char *string) { +int Rtsp::get_code(const char *string) const { + char buf[4]; + int code=0; - char buf[4]; - int code=0; - - if (!strncmp(string, RTSP_PROTOCOL_VERSION, strlen(RTSP_PROTOCOL_VERSION))) - { - memcpy(buf, string+strlen(RTSP_PROTOCOL_VERSION)+1, 3); - buf[3]=0; - code=atoi(buf); - } else if (!strncmp(string, RTSP_METHOD_SET_PARAMETER,8)) - { - return RTSP_STATUS_SET_PARAMETER; - } - - if(code != RTSP_STATUS_OK) MSG_INFO("librtsp: server responds: '%s'\n",string); - - return code; + if (!strncmp(string, RTSP_PROTOCOL_VERSION, strlen(RTSP_PROTOCOL_VERSION))) { + memcpy(buf, string+strlen(RTSP_PROTOCOL_VERSION)+1, 3); + buf[3]=0; + code=atoi(buf); + } else if (!strncmp(string, RTSP_METHOD_SET_PARAMETER,8)) { + return RTSP_STATUS_SET_PARAMETER; + } + if(code != RTSP_STATUS_OK) MSG_INFO("librtsp: server responds: '%s'\n",string); + return code; } /* * send a request */ -static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { +void Rtsp::send_request(const char *type, const char *what) { + char *const *payload=scheduled; + char *buf; - char **payload=s->scheduled; - char *buf; + buf = new char [strlen(type)+strlen(what)+strlen(RTSP_PROTOCOL_VERSION)+3]; - buf = new char [strlen(type)+strlen(what)+strlen(RTSP_PROTOCOL_VERSION)+3]; - - sprintf(buf,"%s %s %s",type, what, RTSP_PROTOCOL_VERSION); - rtsp_put(s,buf); - delete buf; - if (payload) - while (*payload) { - rtsp_put(s,*payload); - payload++; - } - rtsp_put(s,""); - rtsp_unschedule_all(s); + sprintf(buf,"%s %s %s",type, what, RTSP_PROTOCOL_VERSION); + put(buf); + delete buf; + if (payload) + while (*payload) { + put(*payload); + payload++; + } + put(""); + unschedule_all(); } /* * schedule standard fields */ -static void rtsp_schedule_standard(rtsp_t *s) { +void Rtsp::schedule_standard() { + char tmp[17]; - char tmp[17]; + snprintf(tmp, 17, "CSeq: %u", cseq); + schedule_field(tmp); - snprintf(tmp, 17, "CSeq: %u", s->cseq); - rtsp_schedule_field(s, tmp); - - if (s->session) { - char *buf; - buf = new char [strlen(s->session)+15]; - sprintf(buf, "Session: %s", s->session); - rtsp_schedule_field(s, buf); - delete buf; - } + if (session) { + char *buf; + buf = new char [strlen(session)+15]; + sprintf(buf, "Session: %s", session); + schedule_field(buf); + delete buf; + } } /* * get the answers, if server responses with something != 200, return NULL */ -static int rtsp_get_answers(rtsp_t *s) { +int Rtsp::get_answers() { + char *answer=NULL; + unsigned int answer_seq; + char **answer_ptr=answers; + int code; + int ans_count = 0; - char *answer=NULL; - unsigned int answer_seq; - char **answer_ptr=s->answers; - int code; - int ans_count = 0; + answer=get(); + if (!answer) return 0; + code=get_code(answer); + delete answer; - answer=rtsp_get(s); - if (!answer) - return 0; - code=rtsp_get_code(answer); - delete answer; + free_answers(); - rtsp_free_answers(s); + do { /* while we get answer lines */ + answer=get(); + if (!answer) return 0; - do { /* while we get answer lines */ - - answer=rtsp_get(s); - if (!answer) - return 0; - - if (!strncasecmp(answer,"CSeq:",5)) { - sscanf(answer,"%*s %u",&answer_seq); - if (s->cseq != answer_seq) { + if (!strncasecmp(answer,"CSeq:",5)) { + sscanf(answer,"%*s %u",&answer_seq); + if (cseq != answer_seq) { #ifdef LOG - MSG_WARN("librtsp: warning: CSeq mismatch. got %u, assumed %u", answer_seq, s->cseq); + MSG_WARN("librtsp: warning: CSeq mismatch. got %u, assumed %u", answer_seq, s->cseq); #endif - s->cseq=answer_seq; - } - } - if (!strncasecmp(answer,"Server:",7)) { - char *buf = new char [strlen(answer)]; - sscanf(answer,"%*s %s",buf); - if (s->server) delete s->server; - s->server=mp_strdup(buf); - delete buf; - } - if (!strncasecmp(answer,"Session:",8)) { - char *buf = new(zeromem) char [strlen(answer)]; - sscanf(answer,"%*s %s",buf); - if (s->session) { - if (strcmp(buf, s->session)) { - MSG_WARN("rtsp: warning: setting NEW session: %s\n", buf); - delete s->session; - s->session=mp_strdup(buf); + cseq=answer_seq; + } } - } else - { + if (!strncasecmp(answer,"Server:",7)) { + char *buf = new char [strlen(answer)]; + sscanf(answer,"%*s %s",buf); + if (server) delete server; + server=mp_strdup(buf); + delete buf; + } + if (!strncasecmp(answer,"Session:",8)) { + char *buf = new(zeromem) char [strlen(answer)]; + sscanf(answer,"%*s %s",buf); + if (session) { + if (strcmp(buf, session)) { + MSG_WARN("rtsp: warning: setting NEW session: %s\n", buf); + delete session; + session=mp_strdup(buf); + } + } else { #ifdef LOG - MSG_INFO("rtsp: setting session id to: %s\n", buf); + MSG_INFO("rtsp: setting session id to: %s\n", buf); #endif - s->session=mp_strdup(buf); - } - delete buf; - } - *answer_ptr=answer; - answer_ptr++; - } while ((strlen(answer)!=0) && (++ans_count < MAX_FIELDS)); - - s->cseq++; - - *answer_ptr=NULL; - rtsp_schedule_standard(s); - - return code; + session=mp_strdup(buf); + } + delete buf; + } + *answer_ptr=answer; + answer_ptr++; + } while ((strlen(answer)!=0) && (++ans_count < RTSP_MAX_FIELDS)); + cseq++; + *answer_ptr=NULL; + schedule_standard(); + return code; } /* * send an ok message */ -int rtsp_send_ok(rtsp_t *s) { - char cseq[16]; +int Rtsp::send_ok() const { + char _cseq[16]; - rtsp_put(s, "RTSP/1.0 200 OK"); - sprintf(cseq,"CSeq: %u", s->cseq); - rtsp_put(s, cseq); - rtsp_put(s, ""); - return 0; + put("RTSP/1.0 200 OK"); + sprintf(_cseq,"CSeq: %u", cseq); + put(_cseq); + put(""); + return 0; } /* @@ -383,174 +360,140 @@ * server status code. */ -int rtsp_request_options(rtsp_t *s, const char *what) { +int Rtsp::request_options(const char *what) { + char *buf; - char *buf; - - if (what) { - buf=mp_strdup(what); - } else - { - buf=new char [strlen(s->host)+16]; - sprintf(buf,"rtsp://%s:%i", s->host, s->port); - } - rtsp_send_request(s,RTSP_METHOD_OPTIONS,buf); - delete buf; - - return rtsp_get_answers(s); + if (what) buf=mp_strdup(what); + else { + buf=new char [strlen(host)+16]; + sprintf(buf,"rtsp://%s:%i", host, port); + } + send_request(RTSP_METHOD_OPTIONS,buf); + delete buf; + return get_answers(); } -int rtsp_request_describe(rtsp_t *s, const char *what) { +int Rtsp::request_describe(const char *what) { + char *buf; - char *buf; - - if (what) { - buf=mp_strdup(what); - } else - { - buf=new char [strlen(s->host)+strlen(s->path)+16]; - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); - } - rtsp_send_request(s,RTSP_METHOD_DESCRIBE,buf); - delete buf; - - return rtsp_get_answers(s); + if (what) buf=mp_strdup(what); + else { + buf=new char [strlen(host)+strlen(path)+16]; + sprintf(buf,"rtsp://%s:%i/%s", host, port, path); + } + send_request(RTSP_METHOD_DESCRIBE,buf); + delete buf; + return get_answers(); } -int rtsp_request_setup(rtsp_t *s, const char *what, char *control) { +int Rtsp::request_setup(const char *what, char *control) { + char *buf = NULL; - char *buf = NULL; - - if (what) - buf = mp_strdup (what); - else - { - int len = strlen (s->host) + strlen (s->path) + 16; - if (control) - len += strlen (control) + 1; - - buf = new char [len]; - sprintf (buf, "rtsp://%s:%i/%s%s%s", s->host, s->port, s->path, + if (what) buf = mp_strdup (what); + else { + int len = strlen (host) + strlen (path) + 16; + if (control) len += strlen (control) + 1; + buf = new char [len]; + sprintf (buf, "rtsp://%s:%i/%s%s%s", host, port, path, control ? "/" : "", control ? control : ""); - } - - rtsp_send_request (s, RTSP_METHOD_SETUP, buf); - delete buf; - return rtsp_get_answers (s); + } + send_request (RTSP_METHOD_SETUP, buf); + delete buf; + return get_answers (); } -int rtsp_request_setparameter(rtsp_t *s, const char *what) { +int Rtsp::request_setparameter(const char *what) { + char *buf; - char *buf; - - if (what) { - buf=mp_strdup(what); - } else - { - buf=new char [strlen(s->host)+strlen(s->path)+16]; - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); - } - rtsp_send_request(s,RTSP_METHOD_SET_PARAMETER,buf); - delete buf; - - return rtsp_get_answers(s); + if (what) buf=mp_strdup(what); + else { + buf=new char [strlen(host)+strlen(path)+16]; + sprintf(buf,"rtsp://%s:%i/%s", host, port, path); + } + send_request(RTSP_METHOD_SET_PARAMETER,buf); + delete buf; + return get_answers(); } -int rtsp_request_play(rtsp_t *s, const char *what) { +int Rtsp::request_play(const char *what) { + char *buf; + int ret; - char *buf; - int ret; + if (what) buf=mp_strdup(what); + else { + buf=new char [strlen(host)+strlen(path)+16]; + sprintf(buf,"rtsp://%s:%i/%s", host, port, path); + } + send_request(RTSP_METHOD_PLAY,buf); + delete buf; - if (what) { - buf=mp_strdup(what); - } else - { - buf=new char [strlen(s->host)+strlen(s->path)+16]; - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); - } - rtsp_send_request(s,RTSP_METHOD_PLAY,buf); - delete buf; - - ret = rtsp_get_answers (s); - if (ret == RTSP_STATUS_OK) - s->server_state = RTSP_PLAYING; - - return ret; + ret = get_answers (); + if (ret == RTSP_STATUS_OK) server_state = RTSP_PLAYING; + return ret; } -int rtsp_request_teardown(rtsp_t *s, const char *what) { +int Rtsp::request_teardown(const char *what) { + char *buf; - char *buf; + if (what) buf = mp_strdup (what); + else { + buf = new char [strlen (host) + strlen (path) + 16]; + sprintf (buf, "rtsp://%s:%i/%s", host, port, path); + } + send_request (RTSP_METHOD_TEARDOWN, buf); + delete buf; - if (what) - buf = mp_strdup (what); - else - { - buf = new char [strlen (s->host) + strlen (s->path) + 16]; - sprintf (buf, "rtsp://%s:%i/%s", s->host, s->port, s->path); - } - rtsp_send_request (s, RTSP_METHOD_TEARDOWN, buf); - delete buf; - - /* after teardown we're done with RTSP streaming, no need to get answer as - reading more will only result to garbage and buffer overflow */ - return RTSP_STATUS_OK; + /* after teardown we're done with RTSP streaming, no need to get answer as + reading more will only result to garbage and buffer overflow */ + return RTSP_STATUS_OK; } /* * read opaque data from stream */ -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { +int Rtsp::read_data(char *buffer, unsigned int size) const { + int i,seq; - int i,seq; - - if (size>=4) { - i=read_stream(*s->tcp, buffer, 4); - if (i<4) return i; - if (((buffer[0]=='S')&&(buffer[1]=='E')&&(buffer[2]=='T')&&(buffer[3]=='_')) || - ((buffer[0]=='O')&&(buffer[1]=='P')&&(buffer[2]=='T')&&(buffer[3]=='I'))) // OPTIONS - { - char *rest=rtsp_get(s); - if (!rest) - return -1; - - seq=-1; - do { - delete rest; - rest=rtsp_get(s); - if (!rest) - return -1; - if (!strncasecmp(rest,"CSeq:",5)) - sscanf(rest,"%*s %u",&seq); - } while (strlen(rest)!=0); - delete rest; - if (seq<0) { + if (size>=4) { + i=read_stream(buffer, 4); + if (i<4) return i; + if (((buffer[0]=='S')&&(buffer[1]=='E')&&(buffer[2]=='T')&&(buffer[3]=='_')) || + ((buffer[0]=='O')&&(buffer[1]=='P')&&(buffer[2]=='T')&&(buffer[3]=='I'))) { // OPTIONS + char *rest=get(); + if (!rest) return -1; + seq=-1; + do { + delete rest; + rest=get(); + if (!rest) return -1; + if (!strncasecmp(rest,"CSeq:",5)) + sscanf(rest,"%*s %u",&seq); + } while (strlen(rest)!=0); + delete rest; + if (seq<0) { #ifdef LOG - MSG_WARN("rtsp: warning: CSeq not recognized!\n"); + MSG_WARN("rtsp: warning: CSeq not recognized!\n"); #endif - seq=1; - } - /* let's make the server happy */ - rtsp_put(s, "RTSP/1.0 451 Parameter Not Understood"); - rest=new char [17]; - sprintf(rest,"CSeq: %u", seq); - rtsp_put(s, rest); - delete rest; - rtsp_put(s, ""); - i=read_stream(*s->tcp, buffer, size); - } else - { - i=read_stream(*s->tcp, buffer+4, size-4); - i+=4; - } - } else - i=read_stream(*s->tcp, buffer, size); + seq=1; + } + /* let's make the server happy */ + put("RTSP/1.0 451 Parameter Not Understood"); + rest=new char [17]; + sprintf(rest,"CSeq: %u", seq); + put(rest); + delete rest; + put(""); + i=read_stream(buffer, size); + } else { + i=read_stream(buffer+4, size-4); + i+=4; + } + } else i=read_stream(buffer, size); #ifdef LOG - MSG_INFO("librtsp: << %d of %d bytes\n", i, size); + MSG_INFO("librtsp: << %d of %d bytes\n", i, size); #endif - - return i; + return i; } /* @@ -558,59 +501,59 @@ */ //rtsp_t *rtsp_connect(const char *mrl, const char *user_agent) { -rtsp_t *rtsp_connect(Tcp& tcp, char* mrl,const char *path,const char *host, int port,const char *user_agent) { +Rtsp* Rtsp::connect(Tcp& tcp, char* mrl,const char *path,const char *host, int port,const char *user_agent) { - rtsp_t *s=new rtsp_t; + Rtsp& s=*new(zeromem) Rtsp(tcp); int i; - for (i=0; i<MAX_FIELDS; i++) { - s->answers[i]=NULL; - s->scheduled[i]=NULL; + for (i=0; i<RTSP_MAX_FIELDS; i++) { + s.answers[i]=NULL; + s.scheduled[i]=NULL; } - s->server=NULL; - s->server_state=0; - s->server_caps=0; + s.server=NULL; + s.server_state=0; + s.server_caps=0; - s->cseq=0; - s->session=NULL; + s.cseq=0; + s.session=NULL; if (user_agent) - s->user_agent=mp_strdup(user_agent); + s.user_agent=mp_strdup(user_agent); else - s->user_agent=mp_strdup("User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)"); + s.user_agent=mp_strdup("User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)"); - s->mrl = mp_strdup(mrl); - s->host = mp_strdup(host); - s->port = port; - s->path = mp_strdup(path); + s.mrl = mp_strdup(mrl); + s.host = mp_strdup(host); + s.port = port; + s.path = mp_strdup(path); while (*path == '/') path++; - if ((s->param = strchr(s->path, '?')) != NULL) - s->param++; - s->tcp = &tcp; + if ((s.param = strchr(s.path, '?')) != NULL) + s.param++; if (!tcp.established()) { - MSG_ERR("rtsp: failed to connect to '%s'\n", s->host); - rtsp_close(s); + MSG_ERR("rtsp: failed to connect to '%s'\n", s.host); + s.close(); + delete &s; return NULL; } - s->server_state=RTSP_CONNECTED; + s.server_state=RTSP_CONNECTED; /* now let's send an options request. */ - rtsp_schedule_field(s, "CSeq: 1"); - rtsp_schedule_field(s, s->user_agent); - rtsp_schedule_field(s, "ClientChallenge: 9e26d33f2984236010ef6253fb1887f7"); - rtsp_schedule_field(s, "PlayerStarttime: [28/03/2003:22:50:23 00:00]"); - rtsp_schedule_field(s, "CompanyID: KnKV4M4I/B2FjJ1TToLycw=="); - rtsp_schedule_field(s, "GUID: 00000000-0000-0000-0000-000000000000"); - rtsp_schedule_field(s, "RegionData: 0"); - rtsp_schedule_field(s, "ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586"); + s.schedule_field("CSeq: 1"); + s.schedule_field(s.user_agent); + s.schedule_field("ClientChallenge: 9e26d33f2984236010ef6253fb1887f7"); + s.schedule_field("PlayerStarttime: [28/03/2003:22:50:23 00:00]"); + s.schedule_field("CompanyID: KnKV4M4I/B2FjJ1TToLycw=="); + s.schedule_field("GUID: 00000000-0000-0000-0000-000000000000"); + s.schedule_field("RegionData: 0"); + s.schedule_field("ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586"); /*rtsp_schedule_field(s, "Pragma: initiate-session");*/ - rtsp_request_options(s, NULL); + s.request_options(NULL); - return s; + return &s; } @@ -618,23 +561,12 @@ * closes an rtsp connection */ -void rtsp_close(rtsp_t *s) { - - if (s->server_state) - { - if (s->server_state == RTSP_PLAYING) - rtsp_request_teardown (s, NULL); - s->tcp->close(); - } - - if (s->path) delete s->path; - if (s->host) delete s->host; - if (s->mrl) delete s->mrl; - if (s->session) delete s->session; - if (s->user_agent) delete s->user_agent; - rtsp_free_answers(s); - rtsp_unschedule_all(s); - delete s; +void Rtsp::close() { + if (server_state) { + if (server_state == RTSP_PLAYING) + request_teardown (NULL); + tcp.close(); + } } /* @@ -642,146 +574,118 @@ * after the first matched tag. returns NULL if no match found. */ -char *rtsp_search_answers(rtsp_t *s, const char *tag) { +char* Rtsp::search_answers(const char *tag) const { + char *const *answer; + char *ptr; - char **answer; - char *ptr; + if (!answers) return NULL; + answer=answers; - if (!s->answers) return NULL; - answer=s->answers; - - while (*answer) { - if (!strncasecmp(*answer,tag,strlen(tag))) { - ptr=strchr(*answer,':'); - if (!ptr) return NULL; - ptr++; - while(*ptr==' ') ptr++; - return ptr; + while (*answer) { + if (!strncasecmp(*answer,tag,strlen(tag))) { + ptr=strchr(*answer,':'); + if (!ptr) return NULL; + ptr++; + while(*ptr==' ') ptr++; + return ptr; + } + answer++; } - answer++; - } - - return NULL; + return NULL; } /* * session id management */ -void rtsp_set_session(rtsp_t *s, const char *id) { - - if (s->session) delete s->session; - - s->session=mp_strdup(id); - +void Rtsp::set_session(const char *id) { + if (session) delete session; + session=mp_strdup(id); } -const char *rtsp_get_session(rtsp_t *s) { +const char* Rtsp::get_session() const { return session; } +char* Rtsp::get_mrl() const { return mrl; } - return s->session; - -} - -char *rtsp_get_mrl(rtsp_t *s) { - - return s->mrl; - -} - -char *rtsp_get_param(rtsp_t *s,const char *p) { - int len; - const char *param; - if (!s->param) - return NULL; - if (!p) - return mp_strdup(s->param); - len = strlen(p); - param = s->param; - while (param && *param) { - const char *nparam = strchr(param, '&'); - if (strncmp(param, p, len) == 0 && param[len] == '=') { - param += len + 1; - len = nparam ? nparam - param : strlen(param); - char* _nparam = new char [len + 1]; - memcpy(_nparam, param, len); - _nparam[len] = 0; - return _nparam; +char* Rtsp::get_param(const char *p) const { + int len; + const char *_param; + if (!param) return NULL; + if (!p) return mp_strdup(param); + len = strlen(p); + _param = param; + while (_param && *_param) { + const char *nparam = strchr(_param, '&'); + if (strncmp(_param, p, len) == 0 && _param[len] == '=') { + _param += len + 1; + len = nparam ? nparam - _param : strlen(_param); + char* _nparam = new char [len + 1]; + memcpy(_nparam, _param, len); + _nparam[len] = 0; + return _nparam; + } + _param = nparam ? nparam + 1 : NULL; } - param = nparam ? nparam + 1 : NULL; - } - return NULL; + return NULL; } /* * schedules a field for transmission */ -void rtsp_schedule_field(rtsp_t *s, const char *string) { - - int i=0; - - if (!string) return; - - while(s->scheduled[i]) { - i++; - } - s->scheduled[i]=mp_strdup(string); +void Rtsp::schedule_field(const char *string) { + int i=0; + if (!string) return; + while(scheduled[i]) i++; + scheduled[i]=mp_strdup(string); } /* * removes the first scheduled field which prefix matches string. */ -void rtsp_unschedule_field(rtsp_t *s, const char *string) { - - char **ptr=s->scheduled; - - if (!string) return; - - while(*ptr) { - if (!strncmp(*ptr, string, strlen(string))) - break; - else - ptr++; - } - if (*ptr) delete *ptr; - ptr++; - do { - *(ptr-1)=*ptr; - } while(*ptr); +void Rtsp::unschedule_field(const char *string) { + char **ptr=scheduled; + if (!string) return; + while(*ptr) { + if (!strncmp(*ptr, string, strlen(string))) break; + else ptr++; + } + if (*ptr) delete *ptr; + ptr++; + do { + *(ptr-1)=*ptr; + } while(*ptr); } /* * unschedule all fields */ -void rtsp_unschedule_all(rtsp_t *s) { +void Rtsp::unschedule_all() { + char **ptr; - char **ptr; + if (!scheduled) return; + ptr=scheduled; - if (!s->scheduled) return; - ptr=s->scheduled; - - while (*ptr) { - delete *ptr; - *ptr=NULL; - ptr++; - } + while (*ptr) { + delete *ptr; + *ptr=NULL; + ptr++; + } } /* * mp_free answers */ -void rtsp_free_answers(rtsp_t *s) { +void Rtsp::free_answers() { + char **answer; - char **answer; - - if (!s->answers) return; - answer=s->answers; - - while (*answer) { - delete *answer; - *answer=NULL; - answer++; - } + if (!answers) return; + answer=answers; + while (*answer) { + delete *answer; + *answer=NULL; + answer++; + } } +} // namespace mpxp Modified: mplayerxp/libmpstream2/librtsp/rtsp.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-18 13:04:29 UTC (rev 572) +++ mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-18 15:09:54 UTC (rev 573) @@ -33,11 +33,13 @@ #define HAVE_RTSP_H #include "libmpstream2/tcp.h" +namespace mpxp { /* some codes returned by rtsp_request_* functions */ -enum { - RTSP_STATUS_SET_PARAMETER =10, - RTSP_STATUS_OK =200 -}; + enum { + RTSP_STATUS_SET_PARAMETER =10, + RTSP_STATUS_OK =200, + RTSP_MAX_FIELDS =256 + }; #define RTSP_METHOD_OPTIONS "OPTIONS" #define RTSP_METHOD_DESCRIBE "DESCRIBE" #define RTSP_METHOD_SETUP "SETUP" @@ -45,40 +47,67 @@ #define RTSP_METHOD_TEARDOWN "TEARDOWN" #define RTSP_METHOD_SET_PARAMETER "SET_PARAMETER" -struct rtsp_t; + class Rtsp : public Opaque { + public: + Rtsp(Tcp& tcp); + virtual ~Rtsp(); -rtsp_t* rtsp_connect (Tcp& tcp, char *mrl, const char *path, const char *host, int port, const char *user_agent); + static Rtsp* connect (Tcp& tcp, char *mrl, const char *path, const char *host, int port, const char *user_agent); -int rtsp_request_options(rtsp_t *s, const char *what); -int rtsp_request_describe(rtsp_t *s, const char *what); -int rtsp_request_setup(rtsp_t *s, const char *what, char *control); -int rtsp_request_setparameter(rtsp_t *s, const char *what); -int rtsp_request_play(rtsp_t *s, const char *what); -int rtsp_request_teardown(rtsp_t *s, const char *what); + virtual int request_options(const char *what); + virtual int request_describe(const char *what); + virtual int request_setup(const char *what, char *control); + virtual int request_setparameter(const char *what); + virtual int request_play(const char *what); + virtual int request_teardown(const char *what); -int rtsp_send_ok(rtsp_t *s); + virtual int send_ok() const; + virtual int read_data(char *buffer, unsigned int size) const; -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size); + virtual char* search_answers(const char *tag) const; -char* rtsp_search_answers(rtsp_t *s, const char *tag); -void rtsp_add_to_payload(char **payload, const char *string); + virtual void free_answers(); -void rtsp_free_answers(rtsp_t *self); + virtual void close (); -int rtsp_read (rtsp_t *self, char *data, int len); -void rtsp_close (rtsp_t *self); + virtual void set_session(const char *id); + virtual const char* get_session() const; -void rtsp_set_session(rtsp_t *s, const char *id); -const char *rtsp_get_session(rtsp_t *s); + virtual char* get_mrl() const; + virtual char* get_param(const char *param) const; -char *rtsp_get_mrl(rtsp_t *s); -char *rtsp_get_param(rtsp_t *s,const char *param); + virtual void schedule_field(const char *string); + virtual void unschedule_field(const char *string); + virtual void unschedule_all(); + private: + char* get() const; + void put(const char *string) const; + int get_code(const char *string) const; + void send_request(const char *type, const char *what); + void schedule_standard(); + int get_answers(); + int write_stream(const char *buf, int len) const; + ssize_t read_stream(any_t*buf, size_t count) const; -/*int rtsp_peek_header (rtsp_t *self, char *data); */ + Tcp& tcp; -void rtsp_schedule_field(rtsp_t *s, const char *string); -void rtsp_unschedule_field(rtsp_t *s, const char *string); -void rtsp_unschedule_all(rtsp_t *s); + const char* host; + int port; + const char* path; + const char* param; + char* mrl; + const char* user_agent; + const char* server; + unsigned server_state; + uint32_t server_caps; + + unsigned cseq; + const char* session; + + char* answers[RTSP_MAX_FIELDS]; /* data of last message */ + char* scheduled[RTSP_MAX_FIELDS]; /* will be sent with next message */ + }; +} // namespace mpxp #endif Modified: mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp 2012-12-18 13:04:29 UTC (rev 572) +++ mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp 2012-12-18 15:09:54 UTC (rev 573) @@ -48,6 +48,7 @@ #include "freesdp/parser.h" #include "stream_msg.h" +namespace mpxp { #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256 @@ -76,596 +77,467 @@ #define RTCP_RR "\201\311\0\7(.JD\31+\306\343\0\0\0\0\0\0/E\0\0\2&\0\0\0\0\0\0\0\0\201" #define RTCP_SEND_FREQUENCY 1024 -int rtsp_port = 0; -char *rtsp_destination = NULL; - -void -rtcp_send_rr (rtsp_t *s, struct rtp_rtsp_session_t *st) -{ - if (st->rtcp_socket == -1) - return; - +void Rtp_Rtsp_Session::rtcp_send_rr (Rtsp& s) { + if (rtcp_socket == -1) return; /* send RTCP RR every RTCP_SEND_FREQUENCY packets * FIXME : NOT CORRECT, HARDCODED, BUT MAKES SOME SERVERS HAPPY * not rfc compliant * http://www.faqs.org/rfcs/rfc1889.html chapter 6 for RTCP */ + if (count == RTCP_SEND_FREQUENCY) { + char rtcp_content[RTCP_RR_SIZE]; + strcpy (rtcp_content, RTCP_RR); + send (rtcp_socket, rtcp_content, RTCP_RR_SIZE, 0); - if (st->count == RTCP_SEND_FREQUENCY) - { - char rtcp_content[RTCP_RR_SIZE]; - strcpy (rtcp_content, RTCP_RR); - send (st->rtcp_socket, rtcp_content, RTCP_RR_SIZE, 0); - - /* ping RTSP server to keep connection alive. - we use OPTIONS instead of PING as not all servers support it */ - rtsp_request_options (s, "*"); - st->count = 0; - } - else - st->count++; + /* ping RTSP server to keep connection alive. + we use OPTIONS instead of PING as not all servers support it */ + s.request_options ("*"); + count = 0; + } else count++; } -static struct rtp_rtsp_session_t * -rtp_session_new (void) -{ - struct rtp_rtsp_session_t *st = NULL; - - st = new struct rtp_rtsp_session_t; - - st->rtp_socket = -1; - st->rtcp_socket = -1; - st->control_url = NULL; - st->count = 0; - - return st; +Rtp_Rtsp_Session::Rtp_Rtsp_Session() { + rtp_socket = -1; + rtcp_socket = -1; } -void -rtp_session_free (struct rtp_rtsp_session_t *st) -{ - if (!st) - return; - - if (st->rtp_socket != -1) - close (st->rtp_socket); - if (st->rtcp_socket != -1) - close (st->rtcp_socket); - - if (st->control_url) - delete st->control_url; - delete st; +Rtp_Rtsp_Session::~Rtp_Rtsp_Session() { + if (rtp_socket != -1) ::close (rtp_socket); + if (rtcp_socket != -1) ::close (rtcp_socket); + if (control_url) delete control_url; } -static void -rtp_session_set_fd (struct rtp_rtsp_session_t *st, - int rtp_sock, int rtcp_sock) -{ - if (!st) - return; - - st->rtp_socket = rtp_sock; - st->rtcp_socket = rtcp_sock; +void Rtp_Rtsp_Session::set_fd (int rtp_sock, int rtcp_sock) { + rtp_socket = rtp_sock; + rtcp_socket = rtcp_sock; } -static int -parse_port (const char *line, const char *param, - int *rtp_port, int *rtcp_port) -{ - char *parse1; - char *parse2; - char *parse3; +int Rtp_Rtsp_Session::parse_port (const char *line, const char *param, int *rtp_port, int *rtcp_port) const { + char *parse1; + char *parse2; + char *parse3; - char *line_copy = mp_strdup (line); + char *line_copy = mp_strdup (line); - parse1 = strstr (line_copy, param); + parse1 = strstr (line_copy, param); - if (parse1) - { - parse2 = strstr (parse1, "-"); - - if (parse2) - { - parse3 = strstr (parse2, ";"); - - if (parse3) - parse3[0] = 0; - - parse2[0] = 0; + if (parse1) { + parse2 = strstr (parse1, "-"); + if (parse2) { + parse3 = strstr (parse2, ";"); + if (parse3) parse3[0] = 0; + parse2[0] = 0; + } else { + delete line_copy; + return 0; + } + } else { + delete line_copy; + return 0; } - else - { - delete line_copy; - return 0; - } - } - else - { + *rtp_port = atoi (parse1 + strlen (param)); + *rtcp_port = atoi (parse2 + 1); delete line_copy; - return 0; - } - - *rtp_port = atoi (parse1 + strlen (param)); - *rtcp_port = atoi (parse2 + 1); - - delete line_copy; - - return 1; + return 1; } -static char * -parse_destination (const char *line) -{ - char *parse1; - char *parse2; +char* Rtp_Rtsp_Session::parse_destination (const char *line) const { + char *parse1; + char *parse2; - char *dest = NULL; - char *line_copy = mp_strdup (line); - int len; + char *dest = NULL; + char *line_copy = mp_strdup (line); + int len; - parse1 = strstr (line_copy, RTSP_SETUP_DESTINATION); - if (!parse1) - { + parse1 = strstr (line_copy, RTSP_SETUP_DESTINATION); + if (!parse1) { + delete line_copy; + return NULL; + } + parse2 = strstr (parse1, ";"); + if (!parse2) { + delete line_copy; + return NULL; + } + len = strlen(parse1)-strlen (parse2)-strlen(RTSP_SETUP_DESTINATION)+1; + dest = new char [len + 1]; + snprintf (dest, len, parse1 + strlen (RTSP_SETUP_DESTINATION)); delete line_copy; - return NULL; - } - - parse2 = strstr (parse1, ";"); - if (!parse2) - { - delete line_copy; - return NULL; - } - - len = strlen (parse1) - strlen (parse2) - - strlen (RTSP_SETUP_DESTINATION) + 1; - dest = (char *) mp_malloc (len + 1); - snprintf (dest, len, parse1 + strlen (RTSP_SETUP_DESTINATION)); - delete line_copy; - - return dest; + return dest; } -static int -rtcp_connect (int client_port, int server_port, const char* server_hostname) -{ - struct sockaddr_in sin; - struct hostent *hp; - int s; +int Rtp_Rtsp_Session::rtcp_connect(int client_port, int server_port, const char* server_hostname) const { + struct sockaddr_in sin; + struct hostent *hp; + int s; - if (client_port <= 1023) - return -1; + if (client_port <= 1023) return -1; - s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s == -1) - return -1; + s = ::socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (s == -1) return -1; - hp = gethostbyname (server_hostname); - if (!hp) - { - close (s); - return -1; - } + hp = gethostbyname (server_hostname); + if (!hp) { + ::close (s); + return -1; + } - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - sin.sin_port = htons (client_port); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = INADDR_ANY; + sin.sin_port = htons (client_port); - if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) - { + if (::bind (s, (struct sockaddr *) &sin, sizeof (sin))) { #ifndef HAVE_WINSOCK2 - if (errno != EINPROGRESS) + if (errno != EINPROGRESS) #else - if (WSAGetLastError() != WSAEINPROGRESS) + if (WSAGetLastError() != WSAEINPROGRESS) #endif - { - close (s); - return -1; + { + ::close (s); + return -1; + } } - } - sin.sin_family = AF_INET; - memcpy (&(sin.sin_addr.s_addr), hp->h_addr, sizeof (hp->h_addr)); - sin.sin_port = htons (server_port); + sin.sin_family = AF_INET; + memcpy (&(sin.sin_addr.s_addr), hp->h_addr, sizeof (hp->h_addr)); + sin.sin_port = htons (server_port); /* datagram socket */ - if (connect (s, (struct sockaddr *) &sin, sizeof (sin)) < 0) - { - close (s); - return -1; - } - - return s; + if (::connect (s, (struct sockaddr *) &sin, sizeof (sin)) < 0) { + ::close (s); + return -1; + } + return s; } -static int -rtp_connect (char *hostname, int port) -{ - struct sockaddr_in sin; - struct timeval tv; - int err, err_len; - int rxsockbufsz; - int s; - fd_set set; +int Rtp_Rtsp_Session::rtp_connect (const char *hostname, int port) const { + struct sockaddr_in sin; + struct timeval tv; + int err, err_len; + int rxsockbufsz; + int s; + fd_set set; - if (port <= 1023) - return -1; + if (port <= 1023) return -1; - s = socket (PF_INET, SOCK_DGRAM, 0); - if (s == -1) - return -1; + s = ::socket (PF_INET, SOCK_DGRAM, 0); + if (s == -1) return -1; - sin.sin_family = AF_INET; - if (!hostname || !strcmp (hostname, "0.0.0.0")) - sin.sin_addr.s_addr = htonl (INADDR_ANY); - else + sin.sin_family = AF_INET; + if (!hostname || !strcmp (hostname, "0.0.0.0")) + sin.sin_addr.s_addr = htonl (INADDR_ANY); + else #ifndef HAVE_WINSOCK2 #ifdef USE_ATON - inet_aton (hostname, &sin.sin_addr); + ::inet_aton (hostname, &sin.sin_addr); #else - inet_pton (AF_INET, hostname, &sin.sin_addr); + ::inet_pton (AF_INET, hostname, &sin.sin_addr); #endif #else - sin.sin_addr.s_addr = htonl (INADDR_ANY); + sin.sin_addr.s_addr = ::htonl (INADDR_ANY); #endif - sin.sin_port = htons (port); + sin.sin_port = htons (port); - /* Increase the socket rx buffer size to maximum -- this is UDP */ - rxsockbufsz = 240 * 1024; - if (setsockopt (s, SOL_SOCKET, SO_RCVBUF, - &rxsockbufsz, sizeof (rxsockbufsz))) - MSG_ERR("Couldn't set receive socket buffer size\n"); + /* Increase the socket rx buffer size to maximum -- this is UDP */ + rxsockbufsz = 240 * 1024; + if (::setsockopt (s, SOL_SOCKET, SO_RCVBUF, &rxsockbufsz, sizeof (rxsockbufsz))) + MSG_ERR("Couldn't set receive socket buffer size\n"); - /* if multicast address, add membership */ - if ((ntohl (sin.sin_addr.s_addr) >> 28) == 0xe) - { - struct ip_mreq mcast; - mcast.imr_multiaddr.s_addr = sin.sin_addr.s_addr; - mcast.imr_interface.s_addr = 0; + /* if multicast address, add membership */ + if ((::ntohl (sin.sin_addr.s_addr) >> 28) == 0xe) { + struct ip_mreq mcast; + mcast.imr_multiaddr.s_addr = sin.sin_addr.s_addr; + mcast.imr_interface.s_addr = 0; - if (setsockopt (s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mcast, sizeof (mcast))) - { - MSG_ERR("IP_ADD_MEMBERSHIP failed\n"); - close (s); - return -1; + if (::setsockopt (s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mcast, sizeof (mcast))) { + MSG_ERR("IP_ADD_MEMBERSHIP failed\n"); + ::close (s); + return -1; + } } - } - /* datagram socket */ - if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) - { + /* datagram socket */ + if (::bind (s, (struct sockaddr *) &sin, sizeof (sin))) { #ifndef HAVE_WINSOCK2 - if (errno != EINPROGRESS) + if (errno != EINPROGRESS) #else - if (WSAGetLastError() != WSAEINPROGRESS) + if (WSAGetLastError() != WSAEINPROGRESS) #endif - { - MSG_ERR("bind: %s\n", strerror (errno)); - close (s); - return -1; + { + MSG_ERR("bind: %s\n", strerror (errno)); + ::close (s); + return -1; + } } - } - tv.tv_sec = 0; - tv.tv_usec = (1 * 1000000); /* 1 second timeout */ + tv.tv_sec = 0; + tv.tv_usec = (1 * 1000000); /* 1 second timeout */ - FD_ZERO (&set); - FD_SET (s, &set); + FD_ZERO (&set); + FD_SET (s, &set); - err = select (s + 1, &set, NULL, NULL, &tv); - if (err < 0) - { - MSG_ERR("Select failed: %s\n", strerror (errno)); - close (s); - return -1; - } - else if (err == 0) - { - MSG_ERR("Timeout! No data from host %s\n", hostname); - close (s); - return -1; - } + err = ::select (s + 1, &set, NULL, NULL, &tv); + if (err < 0) { + MSG_ERR("Select failed: %s\n", strerror (errno)); + ::close (s); + return -1; + } else if (err == 0) { + MSG_ERR("Timeout! No data from host %s\n", hostname); + ::close (s); + return -1; + } - err_len = sizeof (err); - getsockopt (s, SOL_SOCKET, SO_ERROR, &err, (socklen_t *) &err_len); - if (err) - { - MSG_ERR("Socket error: %d\n", err); - close (s); - return -1; - } - - return s; + err_len = sizeof (err); + ::getsockopt (s, SOL_SOCKET, SO_ERROR, &err, (socklen_t *) &err_len); + if (err) { + MSG_ERR("Socket error: %d\n", err); + ::close (s); + return -1; + } + return s; } -static int -is_multicast_address (char *addr) -{ - struct sockaddr_in sin; +int Rtp_Rtsp_Session::is_multicast_address (const char *addr) const { + struct sockaddr_in sin; - if (!addr) - return -1; + if (!addr) return -1; + sin.sin_family = AF_INET; - sin.sin_family = AF_INET; - #ifndef HAVE_WINSOCK2 #ifdef USE_ATON - inet_aton (addr, &sin.sin_addr); + ::inet_aton (addr, &sin.sin_addr); #else - inet_pton (AF_INET, addr, &sin.sin_addr); + ::inet_pton (AF_INET, addr, &sin.sin_addr); #endif #else sin.sin_addr.s_addr = htonl (INADDR_ANY); #endif - - if ((ntohl (sin.sin_addr.s_addr) >> 28) == 0xe) - return 1; - - return 0; + if ((::ntohl (sin.sin_addr.s_addr) >> 28) == 0xe) return 1; + return 0; } -struct rtp_rtsp_session_t * -rtp_setup_and_play (rtsp_t *rtsp_session) -{ - struct rtp_rtsp_session_t* rtp_session = NULL; - const fsdp_media_description_t *med_dsc = NULL; - char temp_buf[MAX_LENGTH + 1]; - char npt[256]; +Rtp_Rtsp_Session* Rtp_Rtsp_Session::setup_and_play (Rtsp& rtsp) { + struct Rtp_Rtsp_Session* rtp_session = NULL; + const fsdp_media_description_t *med_dsc = NULL; + char temp_buf[MAX_LENGTH + 1]; + char npt[256]; - char* answer; - char* sdp; - char *server_addr = NULL; - char *destination = NULL; + char* answer; + char* sdp; + char *server_addr = NULL; + char *destination = NULL; - int statut; - int content_length = 0; - int is_multicast = 0; + int statut; + int content_length = 0; + int is_multicast = 0; - fsdp_description_t *dsc = NULL; - fsdp_error_t result; + fsdp_description_t *dsc = NULL; + fsdp_error_t result; - int client_rtp_port = -1; - int client_rtcp_port = -1; - int server_rtp_port = -1; - int server_rtcp_port = -1; - int rtp_sock = -1; - int rtcp_sock = -1; + int client_rtp_port = -1; + int client_rtcp_port = -1; + int server_rtp_port = -1; + int server_rtcp_port = -1; + int rtp_sock = -1; + int rtcp_sock = -1; /* 1. send a RTSP DESCRIBE request to server */ - rtsp_schedule_field (rtsp_session, RTSP_ACCEPT_SDP); - statut = rtsp_request_describe (rtsp_session, NULL); - if (statut < 200 || statut > 299) - return NULL; + rtsp.schedule_field (RTSP_ACCEPT_SDP); + statut = rtsp.request_describe (NULL); + if (statut < 200 || statut > 299) return NULL; - answer = rtsp_search_answers (rtsp_session, RTSP_CONTENT_LENGTH); - if (answer) - content_length = atoi (answer); - else - return NULL; + answer = rtsp.search_answers (RTSP_CONTENT_LENGTH); + if (answer) content_length = atoi (answer); + else return NULL; - answer = rtsp_search_answers (rtsp_session, RTSP_CONTENT_TYPE); - if (!answer || !strstr (answer, RTSP_APPLICATION_SDP)) - return NULL; + answer = rtsp.search_answers (RTSP_CONTENT_TYPE); + if (!answer || !strstr (answer, RTSP_APPLICATION_SDP)) return NULL; - /* 2. read SDP message from server */ - sdp = (char *) mp_malloc (content_length + 1); - if (rtsp_read_data (rtsp_session, sdp, content_length) <= 0) - { - delete sdp; - return NULL; - } - sdp[content_length] = 0; + /* 2. read SDP message from server */ + sdp = (char *) mp_malloc (content_length + 1); + if (rtsp.read_data (sdp, content_length) <= 0) { + delete sdp; + return NULL; + } + sdp[content_length] = 0; - /* 3. parse SDP message */ - dsc = fsdp_description_new (); - result = fsdp_parse (sdp, dsc); - if (result != FSDPE_OK) - { + /* 3. parse SDP message */ + dsc = fsdp_description_new (); + result = fsdp_parse (sdp, dsc); + if (result != FSDPE_OK) { + delete sdp; + fsdp_description_delete (dsc); + return NULL; + } + MSG_V("SDP:\n%s\n", sdp); delete sdp; - fsdp_description_delete (dsc); - return NULL; - } - MSG_V("SDP:\n%s\n", sdp); - delete sdp; - /* 4. check for number of media streams: only one is supported */ - if (fsdp_get_media_count (dsc) != 1) - { - MSG_ERR("A single media stream only is supported atm.\n"); - fsdp_description_delete (dsc); - return NULL; - } + /* 4. check for number of media streams: only one is supported */ + if (fsdp_get_media_count (dsc) != 1) { + MSG_ERR("A single media stream only is supported atm.\n"); + fsdp_description_delete (dsc); + return NULL; + } - /* 5. set the Normal Play Time parameter - * use range provided by server in SDP or start now if empty */ - sprintf (npt, RTSP_RANGE); - if (fsdp_get_range (dsc)) - strcat (npt, fsdp_get_range (dsc)); - else - strcat (npt, RTSP_NPT_NOW); + /* 5. set the Normal Play Time parameter + * use range provided by server in SDP or start now if empty */ + sprintf (npt, RTSP_RANGE); + if (fsdp_get_range (dsc)) strcat (npt, fsdp_get_range (dsc)); + else strcat (npt, RTSP_NPT_NOW); - /* 5. check for a valid media stream */ - med_dsc = fsdp_get_media (dsc, 0); - if (!med_dsc) - { - fsdp_description_delete (dsc); - return NULL; - } + /* 5. check for a valid media stream */ + med_dsc = fsdp_get_media (dsc, 0); + if (!med_dsc) { + fsdp_description_delete (dsc); + return NULL; + } + /* 6. parse the `m=<media> <port> <transport> <fmt list>' line */ + /* check for an A/V media */ + if (fsdp_get_media_type (med_dsc) != FSDP_MEDIA_VIDEO && + fsdp_get_media_type (med_dsc) != FSDP_MEDIA_AUDIO) { + fsdp_description_delete (dsc); + return NULL; + } - /* 6. parse the `m=<media> <port> <transport> <fmt list>' line */ + /* only RTP/AVP transport method is supported right now */ + if (fsdp_get_media_transport_protocol (med_dsc) != FSDP_TP_RTP_AVP) { + fsdp_description_delete (dsc); + return NULL; + } - /* check for an A/V media */ - if (fsdp_get_media_type (med_dsc) != FSDP_MEDIA_VIDEO && - fsdp_get_media_type (med_dsc) != FSDP_MEDIA_AUDIO) - { - fsdp_description_delete (dsc); - return NULL; - } + /* only MPEG-TS is supported at the moment */ + if (!strstr (fsdp_get_media_format (med_dsc, 0), + RTSP_MEDIA_CONTAINER_MPEG_TS)) { + fsdp_description_delete (dsc); + return NULL; + } - /* only RTP/AVP transport method is supported right now */ - if (fsdp_get_media_transport_protocol (med_dsc) != FSDP_TP_RTP_AVP) - { - fsdp_description_delete (dsc); - return NULL; - } + /* get client port (if any) advised by server */ + client_rtp_port = fsdp_get_media_port (med_dsc); + if (client_rtp_port == -1) { + fsdp_description_delete (dsc); + return NULL; + } - /* only MPEG-TS is supported at the moment */ - if (!strstr (fsdp_get_media_format (med_dsc, 0), - RTSP_MEDIA_CONTAINER_MPEG_TS)) - { - fsdp_description_delete (dsc); - return NULL; - } + /* if client_rtp_port = 0 => let client randomly pick one */ + if (client_rtp_port == 0) { + /* TODO: we should check if the port is in use first */ + if (rtp_session->rtsp_port) client_rtp_port = rtp_session->rtsp_port; + else client_rtp_port = RTSP_DEFAULT_PORT; + } - /* get client port (if any) advised by server */ - client_rtp_port = fsdp_get_media_port (med_dsc); - if (client_rtp_port == -1) - { - fsdp_description_delete (dsc); - return NULL; - } + /* RTCP port generally is RTP port + 1 */ + client_rtcp_port = client_rtp_port + 1; - /* if client_rtp_port = 0 => let client randomly pick one */ - if (client_rtp_port == 0) - { - /* TODO: we should check if the port is in use first */ - if (rtsp_port) - client_rtp_port = rtsp_port; - else - client_rtp_port = RTSP_DEFAULT_PORT; - } + MSG_V("RTP Port from SDP appears to be: %d\n", client_rtp_port); + MSG_V("RTCP Port from SDP appears to be: %d\n", client_rtcp_port); - /* RTCP port generally is RTP port + 1 */ - client_rtcp_port = client_rtp_port + 1; + /* 7. parse the `c=<network type> <addr type> <connection address>' line */ + /* check for a valid media network type (inet) */ + if (fsdp_get_media_network_type (med_dsc) != FSDP_NETWORK_TYPE_INET) { + /* no control for media: try global one instead */ + if (fsdp_get_global_conn_network_type (dsc) != FSDP_NETWORK_TYPE_INET) { + fsdp_description_delete (dsc); + return NULL; + } + } - MSG_V("RTP Port from SDP appears to be: %d\n", client_rtp_port); - MSG_V("RTCP Port from SDP appears to be: %d\n", client_rtcp_port); + /* only IPv4 is supported atm. */ + if (fsdp_get_media_address_type (med_dsc) != FSDP_ADDRESS_TYPE_IPV4) { + /* no control for media: try global one instead */ + if (fsdp_get_global_conn_address_type (dsc) != FSDP_ADDRESS_TYPE_IPV4) { + fsdp_description_delete (dsc); + return NULL; + } + } - /* 7. parse the `c=<network type> <addr type> <connection address>' line */ - - /* check for a valid media network type (inet) */ - if (fsdp_get_media_network_type (med_dsc) != FSDP_NETWORK_TYPE_INET) - { - /* no control for media: try global one instead */ - if (fsdp_get_global_conn_network_type (dsc) != FSDP_NETWORK_TYPE_INET) - { - fsdp_description_delete (dsc); - return NULL; + /* get the media server address to connect to */ + if (fsdp_get_media_address (med_dsc)) server_addr = mp_strdup (fsdp_get_media_address (med_dsc)); + else if (fsdp_get_global_conn_address (dsc)) { + /* no control for media: try global one instead */ + server_addr = mp_strdup (fsdp_get_global_conn_address (dsc)); } - } - /* only IPv4 is supported atm. */ - if (fsdp_get_media_address_type (med_dsc) != FSDP_ADDRESS_TYPE_IPV4) - { - /* no control for media: try global one instead */ - if (fsdp_get_global_conn_address_type (dsc) != FSDP_ADDRESS_TYPE_IPV4) - { - fsdp_description_delete (dsc); - return NULL; + if (!server_addr) { + fsdp_description_delete (dsc); + return NULL; } - } - /* get the media server address to connect to */ - if (fsdp_get_media_address (med_dsc)) - server_addr = mp_strdup (fsdp_get_media_address (med_dsc)); - else if (fsdp_get_global_conn_address (dsc)) - { - /* no control for media: try global one instead */ - server_addr = mp_strdup (fsdp_get_global_conn_address (dsc)); - } + /* check for a UNICAST or MULTICAST address to connect to */ + is_multicast = rtp_session->is_multicast_address (server_addr); - if (!server_addr) - { - fsdp_description_delete (dsc); - return NULL; - } + /* 8. initiate an RTP session */ + rtp_session = new(zeromem) Rtp_Rtsp_Session; + if (!rtp_session) { + delete server_addr; + fsdp_description_delete (dsc); + return NULL; + } - /* check for a UNICAST or MULTICAST address to connect to */ - is_multicast = is_multicast_address (server_addr); - - /* 8. initiate an RTP session */ - rtp_session = rtp_session_new (); - if (!rtp_session) - { - delete server_addr; + /* get the media control URL */ + if (fsdp_get_media_control (med_dsc, 0)) + rtp_session->control_url = mp_strdup (fsdp_get_media_control (med_dsc, 0)); fsdp_description_delete (dsc); - return NULL; - } + if (!rtp_session->control_url) { + delete server_addr; + delete rtp_session; + return NULL; + } - /* get the media control URL */ - if (fsdp_get_media_control (med_dsc, 0)) - rtp_session->control_url = mp_strdup (fsdp_get_media_control (med_dsc, 0)); - fsdp_description_delete (dsc); - if (!rtp_session->control_url) - { - delete server_addr; - rtp_session_free (rtp_session); - return NULL; - } - - /* 9. create the payload for RTSP SETUP request */ - memset (temp_buf, '\0', MAX_LENGTH); - snprintf (temp_buf, MAX_LENGTH, + /* 9. create the payload for RTSP SETUP request */ + memset (temp_buf, '\0', MAX_LENGTH); + snprintf (temp_buf, MAX_LENGTH, RTSP_TRANSPORT_REQUEST, is_multicast ? RTSP_TRANSPORT_MULTICAST : RTSP_TRANSPORT_UNICAST, is_multicast ? RTSP_MULTICAST_PORT : RTSP_UNICAST_CLIENT_PORT, client_rtp_port, client_rtcp_port); - MSG_V("RTSP Transport: %s\n", temp_buf); + MSG_V("RTSP Transport: %s\n", temp_buf); - rtsp_unschedule_field (rtsp_session, RTSP_SESSION); - rtsp_schedule_field (rtsp_session, temp_buf); + rtsp.unschedule_field (RTSP_SESSION); + rtsp.schedule_field (temp_buf); - /* 10. check for the media control URL type and initiate RTSP SETUP */ - if (!strncmp (rtp_session->control_url, "rtsp://", 7)) /* full URL */ - statut = rtsp_request_setup (rtsp_session, - rtp_session->control_url, NULL); - else /* relative URL */ - statut = rtsp_request_setup (rtsp_session, - NULL, rtp_session->control_url); + /* 10. check for the media control URL type and initiate RTSP SETUP */ + if (!strncmp (rtp_session->control_url, "rtsp://", 7)) /* full URL */ + statut = rtsp.request_setup (rtp_session->control_url, NULL); + else /* relative URL */ + statut = rtsp.request_setup (NULL, rtp_session->control_url); - if (statut < 200 || statut > 299) - { - delete server_addr; - rtp_session_free (rtp_session); - return NULL; - } + if (statut < 200 || statut > 299) { + delete server_addr; + delete rtp_session; + return NULL; + } - /* 11. parse RTSP SETUP response: we need it to actually determine - * the real address and port to connect to */ - answer = rtsp_search_answers (rtsp_session, RTSP_TRANSPORT); - if (!answer) - { - delete server_addr; - rtp_session_free (rtp_session); - return NULL; - } + /* 11. parse RTSP SETUP response: we need it to actually determine + * the real address and port to connect to */ + answer = rtsp.search_answers (RTSP_TRANSPORT); + if (!answer) { + delete server_addr; + delete rtp_session; + return NULL; + } - /* check for RTP and RTCP ports to bind according to how request was done */ - is_multicast = 0; - if (strstr (answer, RTSP_TRANSPORT_MULTICAST)) - is_multicast = 1; + /* check for RTP and RTCP ports to bind according to how request was done */ + is_multicast = 0; + if (strstr (answer, RTSP_TRANSPORT_MULTICAST)) is_multicast = 1; - if (is_multicast) - parse_port (answer, RTSP_MULTICAST_PORT, + if (is_multicast) + rtp_session->parse_port (answer, RTSP_MULTICAST_PORT, + &client_rtp_port, &client_rtcp_port); + else { + rtp_session->parse_port (answer, RTSP_UNICAST_CLIENT_PORT, &client_rtp_port, &client_rtcp_port); - else - { - parse_port (answer, RTSP_UNICAST_CLIENT_PORT, - &client_rtp_port, &client_rtcp_port); - parse_port (answer, RTSP_UNICAST_SERVER_PORT, + rtp_session->parse_port (answer, RTSP_UNICAST_SERVER_PORT, &server_rtp_port, &server_rtcp_port); - } + } - /* now check network settings as determined by server */ - if (rtsp_destination) - destination = mp_strdup (rtsp_destination); - else - destination = parse_destination (answer); - if (!destination) - destination = mp_strdup (server_addr); - delete server_addr; + /* now check network settings as determined by server */ + if (rtp_session->rtsp_destination) destination = mp_strdup (rtp_session->rtsp_destination); + else destination = rtp_session->parse_destination (answer); + if (!destination) destination = mp_strdup (server_addr); + delete server_addr; - MSG_V("RTSP Destination: %s\n" + MSG_V("RTSP Destination: %s\n" "Client RTP port : %d\n" "Client RTCP port : %d\n" "Server RTP port : %d\n" @@ -676,29 +548,28 @@ , server_rtp_port , server_rtcp_port); - /* 12. performs RTSP PLAY request */ - rtsp_schedule_field (rtsp_session, npt); - statut = rtsp_request_play (rtsp_session, NULL); - if (statut < 200 || statut > 299) - { + /* 12. performs RTSP PLAY request */ + rtsp.schedule_field (npt); + statut = rtsp.request_play (NULL); + if (statut < 200 || statut > 299) { + delete destination; + delete rtp_session; + return NULL; + } + + /* 13. create RTP and RTCP connections */ + rtp_sock = rtp_session->rtp_connect (destination, client_rtp_port); + rtcp_sock = rtp_session->rtcp_connect (client_rtcp_port, server_rtcp_port, destination); + rtp_session->set_fd (rtp_sock, rtcp_sock); delete destination; - rtp_session_free (rtp_session); - return NULL; - } - /* 13. create RTP and RTCP connections */ - rtp_sock = rtp_connect (destination, client_rtp_port); - rtcp_sock = rtcp_connect (client_rtcp_port, server_rtcp_port, destination); - rtp_session_set_fd (rtp_session, rtp_sock, rtcp_sock); - delete destination; + MSG_V("RTP Sock : %d\nRTCP Sock : %d\n",rtp_session->rtp_socket, rtp_session->rtcp_socket); - MSG_V("RTP Sock : %d\nRTCP Sock : %d\n",rtp_session->rtp_socket, rtp_session->rtcp_socket); - - if (rtp_session->rtp_socket == -1) - { - rtp_session_free (rtp_session); - return NULL; - } - - return rtp_session; + if (rtp_session->rtp_socket == -1) { + delete rtp_session; + return NULL; + } + return rtp_session; } +int Rtp_Rtsp_Session::get_rtp_socket() const { return rtp_socket; } +} // namespace mpxp Modified: mplayerxp/libmpstream2/librtsp/rtsp_rtp.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_rtp.h 2012-12-18 13:04:29 UTC (rev 572) +++ mplayerxp/libmpstream2/librtsp/rtsp_rtp.h 2012-12-18 15:09:54 UTC (rev 573) @@ -23,19 +23,31 @@ #include "rtsp.h" +namespace mpxp { #define MAX_PREVIEW_SIZE 4096 + class Rtp_Rtsp_Session : public Opaque { + public: + Rtp_Rtsp_Session(); + virtual ~Rtp_Rtsp_Session(); -struct rtp_rtsp_session_t { - int rtp_socket; - int rtcp_socket; - char *control_url; - int count; -}; + static Rtp_Rtsp_Session* setup_and_play(Rtsp& rtsp_session); + virtual void rtcp_send_rr (Rtsp& s); + virtual int get_rtp_socket() const; + private: + void set_fd (int rtp_sock, int rtcp_sock); + int parse_port (const char *line, const char *param, int *rtp_port, int *rtcp_port) const; + char* parse_destination (const char *line) const; + int rtcp_connect (int client_port, int server_port, const char* server_hostname) const; + int rtp_connect (const char *hostname, int port) const; + int is_multicast_address (const char *addr) const; -struct rtp_rtsp_session_t *rtp_setup_and_play (rtsp_t* rtsp_session); -off_t rtp_read (struct rtp_rtsp_session_t* st, char *buf, off_t length); -void rtp_session_free (struct rtp_rtsp_session_t *st); -void rtcp_send_rr (rtsp_t *s, struct rtp_rtsp_session_t *st); - + int rtp_socket; + int rtcp_socket; + char* control_url; + int count; + int rtsp_port; + char* rtsp_destination; + }; +} // names... [truncated message content] |
From: <nic...@us...> - 2012-12-18 13:04:39
|
Revision: 572 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=572&view=rev Author: nickols_k Date: 2012-12-18 13:04:29 +0000 (Tue, 18 Dec 2012) Log Message: ----------- make class URL full-featured and use references on it + constantization Modified Paths: -------------- mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/http.cpp mplayerxp/libmpstream2/http.h mplayerxp/libmpstream2/librtsp/rtsp.cpp mplayerxp/libmpstream2/librtsp/rtsp.h mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.h mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/network_nop.cpp mplayerxp/libmpstream2/network_pnm.cpp mplayerxp/libmpstream2/network_real_rtsp.cpp mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/network_rtsp.h mplayerxp/libmpstream2/realrtsp/real.cpp mplayerxp/libmpstream2/realrtsp/real.h mplayerxp/libmpstream2/s_ftp.cpp mplayerxp/libmpstream2/s_network.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/tcp.cpp mplayerxp/libmpstream2/tcp.h mplayerxp/libmpstream2/udp.cpp mplayerxp/libmpstream2/udp.h mplayerxp/libmpstream2/url.cpp mplayerxp/libmpstream2/url.h Modified: mplayerxp/libmpstream2/cddb.cpp =================================================================== --- mplayerxp/libmpstream2/cddb.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/cddb.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -145,16 +145,15 @@ char request[4096]; int ret = 0; Tcp tcp(cddb_data->libinput,-1); - URL *url; + URL& url=*new(zeromem) URL(""); if( reply_parser==NULL || command==NULL || cddb_data==NULL ) return -1; sprintf( request, "http://%s/~cddb/cddb.cgi?cmd=%s%s&proto=%d", cddb_data->freedb_server, command, cddb_data->cddb_hello.c_str(), cddb_data->freedb_proto_level ); MSG_V("Request[%s]\n", request ); - url = url_new(request); - if( url==NULL ) { - MSG_ERR("Not a valid URL\n"); + if(url.redirect(request)!=MPXP_Ok) { + MSG_ERR("Not valid URL: '%s'\n",request); return -1; } @@ -183,7 +182,7 @@ } delete http_hdr; - delete url; + delete &url; return ret; } Modified: mplayerxp/libmpstream2/http.cpp =================================================================== --- mplayerxp/libmpstream2/http.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/http.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -302,54 +302,32 @@ MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); } -int HTTP_Header::authenticate(URL *url, int *auth_retry) { +int HTTP_Header::authenticate(URL& url, int *auth_retry) { const char *aut; - if( *auth_retry==1 ) { - MSG_ERR(MSGTR_ConnAuthFailed); - return -1; - } - if( *auth_retry>0 ) { - if( url->username ) { - delete url->username ; - url->username = NULL; - } - if( url->password ) { - delete url->password ; - url->password = NULL; - } - } + if( *auth_retry==1 ) { + MSG_ERR(MSGTR_ConnAuthFailed); + return -1; + } + if( *auth_retry>0 ) url.clear_login(); - aut = get_field("WWW-Authenticate"); - if( aut!=NULL ) { - const char *aut_space; - aut_space = strstr(aut, "realm="); - if( aut_space!=NULL ) aut_space += 6; - MSG_INFO("Authentication required for %s\n", aut_space); - } else { - MSG_INFO("Authentication required\n"); - } - if( net_conf.username ) { - url->username = mp_strdup(net_conf.username); - if( url->username==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return -1; - } - } else { - MSG_ERR(MSGTR_ConnAuthFailed); - return -1; - } - if( net_conf.password ) { - url->password = mp_strdup(net_conf.password); - if( url->password==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return -1; - } - } else { - MSG_INFO("No password provided, trying blank password\n"); - } - (*auth_retry)++; - return 0; + aut = get_field("WWW-Authenticate"); + if( aut!=NULL ) { + const char *aut_space; + aut_space = strstr(aut, "realm="); + if( aut_space!=NULL ) aut_space += 6; + MSG_INFO("Authentication required for %s\n", aut_space); + } else { + MSG_INFO("Authentication required\n"); + } + if( !net_conf.username ) { + MSG_ERR(MSGTR_ConnAuthFailed); + return -1; + } + if( !net_conf.password ) MSG_INFO("No password provided, trying blank password\n"); + url.set_login(net_conf.username,net_conf.password?net_conf.password:""); + (*auth_retry)++; + return 0; } Modified: mplayerxp/libmpstream2/http.h =================================================================== --- mplayerxp/libmpstream2/http.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/http.h 2012-12-18 13:04:29 UTC (rev 572) @@ -30,7 +30,7 @@ virtual void set_method(const std::string& method ); virtual void set_uri(const std::string& uri ); virtual int add_basic_authentication(const std::string& username, const std::string& password ); - virtual int authenticate(URL *url, int *auth_retry); + virtual int authenticate(URL& url, int *auth_retry); virtual void debug_hdr(); virtual void cookies_set(const std::string& hostname, const std::string& url); Modified: mplayerxp/libmpstream2/librtsp/rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -70,24 +70,24 @@ struct rtsp_t { - Tcp* tcp; + Tcp* tcp; - char *host; - int port; - char *path; - char *param; - char *mrl; - char *user_agent; + const char* host; + int port; + const char* path; + const char* param; + char* mrl; + const char* user_agent; - char *server; - unsigned int server_state; - uint32_t server_caps; + const char* server; + unsigned server_state; + uint32_t server_caps; - unsigned int cseq; - char *session; + unsigned cseq; + const char* session; - char *answers[MAX_FIELDS]; /* data of last message */ - char *scheduled[MAX_FIELDS]; /* will be sent with next message */ + char* answers[MAX_FIELDS]; /* data of last message */ + char* scheduled[MAX_FIELDS]; /* will be sent with next message */ }; /* @@ -558,7 +558,7 @@ */ //rtsp_t *rtsp_connect(const char *mrl, const char *user_agent) { -rtsp_t *rtsp_connect(Tcp& tcp, char* mrl, char *path, char *host, int port, char *user_agent) { +rtsp_t *rtsp_connect(Tcp& tcp, char* mrl,const char *path,const char *host, int port,const char *user_agent) { rtsp_t *s=new rtsp_t; int i; @@ -676,7 +676,7 @@ } -char *rtsp_get_session(rtsp_t *s) { +const char *rtsp_get_session(rtsp_t *s) { return s->session; @@ -688,9 +688,9 @@ } -char *rtsp_get_param(rtsp_t *s, const char *p) { +char *rtsp_get_param(rtsp_t *s,const char *p) { int len; - char *param; + const char *param; if (!s->param) return NULL; if (!p) @@ -698,14 +698,14 @@ len = strlen(p); param = s->param; while (param && *param) { - char *nparam = strchr(param, '&'); + const char *nparam = strchr(param, '&'); if (strncmp(param, p, len) == 0 && param[len] == '=') { param += len + 1; len = nparam ? nparam - param : strlen(param); - nparam = new char [len + 1]; - memcpy(nparam, param, len); - nparam[len] = 0; - return nparam; + char* _nparam = new char [len + 1]; + memcpy(_nparam, param, len); + _nparam[len] = 0; + return _nparam; } param = nparam ? nparam + 1 : NULL; } Modified: mplayerxp/libmpstream2/librtsp/rtsp.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-18 13:04:29 UTC (rev 572) @@ -47,7 +47,7 @@ struct rtsp_t; -rtsp_t* rtsp_connect (Tcp& tcp, char *mrl, char *path, char *host, int port, char *user_agent); +rtsp_t* rtsp_connect (Tcp& tcp, char *mrl, const char *path, const char *host, int port, const char *user_agent); int rtsp_request_options(rtsp_t *s, const char *what); int rtsp_request_describe(rtsp_t *s, const char *what); @@ -69,10 +69,10 @@ void rtsp_close (rtsp_t *self); void rtsp_set_session(rtsp_t *s, const char *id); -char *rtsp_get_session(rtsp_t *s); +const char *rtsp_get_session(rtsp_t *s); char *rtsp_get_mrl(rtsp_t *s); -char *rtsp_get_param(rtsp_t *s, const char *param); +char *rtsp_get_param(rtsp_t *s,const char *param); /*int rtsp_peek_header (rtsp_t *self, char *data); */ Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -73,8 +73,10 @@ #define RTSP_SERVER_TYPE_UNKNOWN "unknown" //Rtsp_Session *rtsp_session_start(char *mrl) { -Rtsp_Session *rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, - int port, int *redir, uint32_t bandwidth, char *user, char *pass) { +Rtsp_Session *rtsp_session_start(Tcp& tcp, char **mrl, const std::string& path, + const std::string& host, + int port, int *redir, uint32_t bandwidth, + const std::string& user, const std::string& pass) { Rtsp_Session *rtsp_session = NULL; char *server; @@ -90,10 +92,10 @@ *redir = 0; /* connect to server */ - rtsp_session->s=rtsp_connect(tcp,*mrl,path,host,port,NULL); + rtsp_session->s=rtsp_connect(tcp,*mrl,path.c_str(),host.c_str(),port,NULL); if (!rtsp_session->s) { - MSG_ERR("rtsp_session: failed to connect to server %s\n", path); + MSG_ERR("rtsp_session: failed to connect to server %s\n", path.c_str()); delete rtsp_session; return NULL; } @@ -111,7 +113,7 @@ { /* we are talking to a real server ... */ - h=real_setup_and_get_header(rtsp_session->s, bandwidth, user, pass); + h=real_setup_and_get_header(rtsp_session->s, bandwidth, user.c_str(), pass.c_str()); if (!h) { /* got an redirect? */ if (rtsp_search_answers(rtsp_session->s, RTSP_OPTIONS_LOCATION)) Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.h 2012-12-18 13:04:29 UTC (rev 572) @@ -51,7 +51,7 @@ rtp_rtsp_session_t* rtp_session; }; - Rtsp_Session* rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, - int port, int *redir, uint32_t bandwidth, char *user, char *pass); + Rtsp_Session* rtsp_session_start(Tcp& tcp, char **mrl, const std::string& path, const std::string& host, + int port, int *redir, uint32_t bandwidth, const std::string& user, const std::string& pass); } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -62,131 +62,72 @@ net_config_t::~net_config_t() {} net_config_t net_conf; -URL* -check4proxies( URL *url ) { - URL *url_out = NULL; - if( url==NULL ) return NULL; - url_out = url_new( url->url ); - if( !strcasecmp(url->protocol, "http_proxy") ) { - MSG_V("Using HTTP proxy: http://%s:%d\n", url->hostname, url->port ); - return url_out; - } - // Check if the http_proxy environment variable is set. - if( !strcasecmp(url->protocol, "http") ) { - char *proxy; - proxy = getenv("http_proxy"); - if( proxy!=NULL ) { - // We got a proxy, build the URL to use it - int len; - char *new_url; - URL *tmp_url; - URL *proxy_url = url_new( proxy ); +MPXP_Rc http_send_request(Tcp& tcp, URL& url, off_t pos ) { + HTTP_Header& http_hdr = *new(zeromem) HTTP_Header; + URL server_url(""); + char str[256]; + int ret; + int proxy = 0; // Boolean - if( proxy_url==NULL ) { - MSG_WARN("Invalid proxy setting...Trying without proxy.\n"); - return url_out; - } - -#ifdef HAVE_AF_INET6 - if (net_conf.ipv4_only_proxy && (gethostbyname(url->hostname)==NULL)) { - MSG_WARN( - "Could not find resolve remote hostname for AF_INET. Trying without proxy.\n"); - return url_out; - } -#endif - - MSG_V("Using HTTP proxy: %s\n", proxy_url->url ); - len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port - new_url = new char [len+1]; - if( new_url==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return url_out; - } - sprintf(new_url, "http_proxy://%s:%d/%s", proxy_url->hostname, proxy_url->port, url->url ); - tmp_url = url_new( new_url ); - if( tmp_url==NULL ) { - return url_out; - } - delete url_out; - url_out = tmp_url; - delete new_url ; - delete proxy_url; - } - } - return url_out; -} - -MPXP_Rc http_send_request(Tcp& tcp, URL *url, off_t pos ) { - HTTP_Header& http_hdr = *new(zeromem) HTTP_Header; - URL *server_url; - char str[256]; - int ret; - int proxy = 0; // Boolean - - if( !strcasecmp(url->protocol, "http_proxy") ) { - proxy = 1; - server_url = url_new( (url->file)+1 ); - http_hdr.set_uri(server_url->url ); - } else { - server_url = url; - http_hdr.set_uri( server_url->file ); - } - if (server_url->port && server_url->port != 80) - snprintf(str, 256, "Host: %s:%d", server_url->hostname, server_url->port ); - else - snprintf(str, 256, "Host: %s", server_url->hostname ); + if( url.protocol2lower()=="http_proxy") { + proxy = 1; + server_url.redirect(url.file()); + http_hdr.set_uri(server_url.url()); + } else { + server_url = url; + http_hdr.set_uri( server_url.file()); + } + if (server_url.port() && server_url.port() != 80) + snprintf(str, 256, "Host: %s:%d", server_url.host().c_str(), server_url.port()); + else + snprintf(str, 256, "Host: %s", server_url.host().c_str()); + http_hdr.set_field(str); + if (net_conf.useragent) { + snprintf(str, 256, "User-Agent: %s", net_conf.useragent); http_hdr.set_field(str); - if (net_conf.useragent) - { - snprintf(str, 256, "User-Agent: %s", net_conf.useragent); - http_hdr.set_field(str); - } - else - http_hdr.set_field("User-Agent: MPlayerXP/"VERSION); + } + else + http_hdr.set_field("User-Agent: MPlayerXP/"VERSION); - http_hdr.set_field("Icy-MetaData: 1"); + http_hdr.set_field("Icy-MetaData: 1"); - if(pos>0) { + if(pos>0) { // Extend http_send_request with possibility to do partial content retrieval - snprintf(str, 256, "Range: bytes=%d-", (int)pos); - http_hdr.set_field(str); - } + snprintf(str, 256, "Range: bytes=%d-", (int)pos); + http_hdr.set_field(str); + } - if (net_conf.cookies_enabled) http_hdr.cookies_set( server_url->hostname, server_url->url ); + if (net_conf.cookies_enabled) http_hdr.cookies_set( server_url.host(), server_url.url()); - http_hdr.set_field( "Connection: closed"); - http_hdr.add_basic_authentication( url->username?url->username:"", url->password?url->password:""); - if( http_hdr.build_request( )==NULL ) { - goto err_out; - } + http_hdr.set_field( "Connection: closed"); + http_hdr.add_basic_authentication( url.user(), url.password()); + if( http_hdr.build_request( )==NULL ) { + goto err_out; + } - if( proxy ) { - if( url->port==0 ) url->port = 8080; // Default port for the proxy server - tcp.close(); - tcp.open(url->hostname, url->port, Tcp::IP4); - delete server_url; - server_url = NULL; - } else { - if( server_url->port==0 ) server_url->port = 80; // Default port for the web server - tcp.close(); - tcp.open(server_url->hostname, server_url->port, Tcp::IP4); - } - if(!tcp.established()) { MSG_ERR("Cannot establish connection\n"); goto err_out; } - MSG_DBG2("Request: [%s]\n", http_hdr.get_buffer() ); + if( proxy ) { + tcp.close(); + url.assign_port(8080); + tcp.open(url, Tcp::IP4); + } else { + tcp.close(); + server_url.assign_port(80); + tcp.open(server_url, Tcp::IP4); + } + if(!tcp.established()) { MSG_ERR("Cannot establish connection\n"); goto err_out; } + MSG_DBG2("Request: [%s]\n", http_hdr.get_buffer() ); - ret = tcp.write((uint8_t*)(http_hdr.get_buffer()), http_hdr.get_buffer_size()); - if( ret!=(int)http_hdr.get_buffer_size() ) { - MSG_ERR("Error while sending HTTP request: didn't sent all the request\n"); - goto err_out; - } + ret = tcp.write((uint8_t*)(http_hdr.get_buffer()), http_hdr.get_buffer_size()); + if( ret!=(int)http_hdr.get_buffer_size() ) { + MSG_ERR("Error while sending HTTP request: didn't sent all the request\n"); + goto err_out; + } - delete &http_hdr; - - return MPXP_Ok; + delete &http_hdr; + return MPXP_Ok; err_out: - delete &http_hdr; - if (proxy && server_url) delete server_url; - return MPXP_False; + delete &http_hdr; + return MPXP_False; } HTTP_Header* http_read_response( Tcp& tcp ) { @@ -247,10 +188,10 @@ } Networking::Networking() - :mime("application/octet-stream") {} + :mime("application/octet-stream"), + url("") {} Networking::~Networking() { - if( url ) delete url; if( buffer ) delete buffer; if( data ) delete data; } @@ -266,7 +207,7 @@ const char *content_type; const char *next_url; - URL *url = networking.url; + URL& url = networking.url; do { next_url = NULL; @@ -274,16 +215,12 @@ content_type = NULL; redirect = 0; - if( url==NULL ) { - goto err_out; - } - #ifndef STREAMING_LIVE_DOT_COM // Old, hacked RTP support, which works for MPEG Program Streams // RTP streams only: // Checking for RTP - if( !strcasecmp(url->protocol, "rtp") ) { - if( url->port==0 ) { + if( url.protocol2lower()=="rtp") { + if( url.port()==0 ) { MSG_ERR("You must enter a port number for RTP streams!\n"); goto err_out; } @@ -291,7 +228,7 @@ } #endif // HTTP based protocol - if( !strcasecmp(url->protocol, "http") || !strcasecmp(url->protocol, "http_proxy") ) { + if( url.protocol2lower()=="http" || url.protocol2lower()=="http_proxy") { http_send_request(tcp, url, 0 ); if(!tcp.established()) goto err_out; @@ -366,10 +303,10 @@ // TODO: RFC 2616, recommand to detect infinite redirection loops next_url = http_hdr->get_field("Location" ); if( next_url!=NULL ) { - networking.url = url = url_redirect( &url, next_url ); - if (!strcasecmp(url->protocol, "mms")) goto err_out; - if (strcasecmp(url->protocol, "http")) { - MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->get_status(), url->protocol); + url.redirect(next_url); + if (url.protocol2lower()=="mms") goto err_out; + if (url.protocol2lower()=="http") { + MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->get_status(), url.protocol().c_str()); goto err_out; } redirect = 1; @@ -384,7 +321,7 @@ goto err_out; } } else { - MSG_ERR("Unknown protocol '%s'\n", url->protocol ); + MSG_ERR("Unknown protocol '%s'\n", url.protocol().c_str()); goto err_out; } } while( redirect ); @@ -418,29 +355,28 @@ } } -Networking* Networking::start(Tcp& tcp, URL *_url) { +Networking* Networking::start(Tcp& tcp, const URL& _url) { Networking* rc; network_protocol_t net_protocol; - URL* url = check4proxies( _url ); + net_protocol.url=_url; + net_protocol.url.check4proxies(); - net_protocol.url=url; - if( autodetectProtocol(net_protocol,tcp)!=MPXP_Ok ) return NULL; rc = NULL; - url=net_protocol.url; + URL url=net_protocol.url; // For RTP streams, we usually don't know the stream type until we open it. - if( !strcasecmp( url->protocol, "rtp")) { + if( url.protocol2lower()=="rtp") { if(tcp.established()) tcp.close(); rc = Rtp_Networking::start(tcp, net_protocol, 0); - } else if( !strcasecmp( url->protocol, "pnm")) { + } else if( url.protocol2lower()=="pnm") { tcp.close(); rc = Pnm_Networking::start(tcp, net_protocol); if (!rc) { MSG_INFO("Can't connect with pnm, retrying with http.\n"); return NULL; } - } else if( !strcasecmp( url->protocol, "rtsp")) { + } else if( url.protocol2lower()=="rtsp") { if ((rc = RealRtsp_Networking::start( tcp, net_protocol )) == NULL) { MSG_INFO("Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); #ifdef STREAMING_LIVE_DOT_COM @@ -452,16 +388,16 @@ return NULL; #endif } - } else if(!strcasecmp( url->protocol, "udp")) { + } else if(url.protocol2lower()=="udp") { tcp.close(); rc = Rtp_Networking::start(tcp, net_protocol, 1); if(!rc) { MSG_ERR("rtp_networking_start(udp) failed\n"); return NULL; } - } else if(!strncasecmp(url->protocol, "mms", 3) || - !strncasecmp(url->protocol, "mmst", 4) || - !strncasecmp(url->protocol, "mmsu", 4)) { + } else if(url.protocol2lower()=="mms" || + url.protocol2lower()=="mmst" || + url.protocol2lower()=="mmsu") { rc=Asf_Mmst_Networking::start(tcp,net_protocol); if(!rc) { MSG_ERR("asf_mmst_networking_start() failed\n"); @@ -477,7 +413,7 @@ if( !rc ) { //sometimes a file is just on a webserver and it is not streamed. //try loading them default method as last resort for http protocol - if ( !strcasecmp(url->protocol, "http") ) { + if (url.protocol2lower()=="http") { MSG_STATUS("Trying default networking for http protocol\n "); //reset stream tcp.close(); Modified: mplayerxp/libmpstream2/network.h =================================================================== --- mplayerxp/libmpstream2/network.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network.h 2012-12-18 13:04:29 UTC (rev 572) @@ -57,16 +57,16 @@ }; struct network_protocol_t { - URL* url; - Opaque* data; + URL url; std::string mime; + Opaque* data; }; struct Networking : public Opaque { public: virtual ~Networking(); - static Networking* start(Tcp& tcp, URL *url); + static Networking* start(Tcp& tcp,const URL& url); virtual int stop(); virtual void fixup_cache(); virtual int bufferize(unsigned char *buffer, int size); @@ -75,7 +75,7 @@ virtual int seek( Tcp& fd, off_t pos) = 0; std::string mime; - URL* url; + URL url; networking_status status; unsigned int bandwidth; // The downstream available protected: @@ -90,9 +90,7 @@ static MPXP_Rc autodetectProtocol(network_protocol_t& protocol,Tcp& tcp); }; - extern URL* check4proxies( URL* url ); - - MPXP_Rc http_send_request(Tcp& tcp,URL* url, off_t pos); + MPXP_Rc http_send_request(Tcp& tcp,URL& url, off_t pos); HTTP_Header* http_read_response(Tcp& fd); /* Modified: mplayerxp/libmpstream2/network_asf.cpp =================================================================== --- mplayerxp/libmpstream2/network_asf.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_asf.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -1,6 +1,7 @@ #include "mp_config.h" #include "osdep/mplib.h" using namespace mpxp; +#include <algorithm> #include <limits> #include <stdio.h> @@ -152,7 +153,7 @@ return MPXP_False; } // audit: do not overflow buffer_size - if (size > std::numeric_limits<size_t>::max() - _buffer_size) return MPXP_False; + if (unsigned(size) > std::numeric_limits<size_t>::max() - _buffer_size) return MPXP_False; _buffer = (char*) mp_malloc(size+_buffer_size); if(_buffer == NULL) { MSG_FATAL("Error can't allocate %d bytes buffer\n",size+_buffer_size); @@ -436,219 +437,201 @@ static ASF_StreamType_e asf_http_networking_type(const char *content_type,const char *features, HTTP_Header& http_hdr ) { - if( content_type==NULL ) return ASF_Unknown_e; - if( !strcasecmp(content_type, "application/octet-stream") || - !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request - !strcasecmp(content_type, "application/x-mms-framed") || // New in Corana, second request - !strcasecmp(content_type, "video/x-ms-asf")) { + if(content_type==NULL ) return ASF_Unknown_e; + if(!strcasecmp(content_type, "application/octet-stream") || + !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request + !strcasecmp(content_type, "application/x-mms-framed") || // New in Corana, second request + !strcasecmp(content_type, "video/x-ms-asf")) { - if( strstr(features, "broadcast") ) { - MSG_V("=====> ASF Live stream\n"); - return ASF_Live_e; - } else { - MSG_V("=====> ASF Prerecorded\n"); - return ASF_Prerecorded_e; - } + if( strstr(features, "broadcast") ) { + MSG_V("=====> ASF Live stream\n"); + return ASF_Live_e; } else { - // Ok in a perfect world, web servers should be well configured - // so we could used mime type to know the stream type, - // but guess what? All of them are not well configured. - // So we have to check for an asf header :(, but it works :p - if( http_hdr.get_body_size()>sizeof(ASF_obj_header_t) ) { - if( asf_header_check( http_hdr )==0 ) { - MSG_V("=====> ASF Plain text\n"); - return ASF_PlainText_e; - } else if( (!strcasecmp(content_type, "text/html")) ) { - MSG_V("=====> HTML, mplayer is not a browser...yet!\n"); - return ASF_Unknown_e; - } else { - MSG_V("=====> ASF Redirector\n"); - return ASF_Redirector_e; - } - } else { - if( (!strcasecmp(content_type, "audio/x-ms-wax")) || - (!strcasecmp(content_type, "audio/x-ms-wma")) || - (!strcasecmp(content_type, "video/x-ms-asf")) || - (!strcasecmp(content_type, "video/x-ms-afs")) || - (!strcasecmp(content_type, "video/x-ms-wvx")) || - (!strcasecmp(content_type, "video/x-ms-wmv")) || - (!strcasecmp(content_type, "video/x-ms-wma")) ) { - MSG_ERR("=====> ASF Redirector\n"); - return ASF_Redirector_e; - } else if( !strcasecmp(content_type, "text/plain") ) { - MSG_V("=====> ASF Plain text\n"); - return ASF_PlainText_e; - } else { - MSG_V("=====> ASF unknown content-type: %s\n", content_type ); - return ASF_Unknown_e; - } - } + MSG_V("=====> ASF Prerecorded\n"); + return ASF_Prerecorded_e; } - return ASF_Unknown_e; + } else { + // Ok in a perfect world, web servers should be well configured + // so we could used mime type to know the stream type, + // but guess what? All of them are not well configured. + // So we have to check for an asf header :(, but it works :p + if( http_hdr.get_body_size()>sizeof(ASF_obj_header_t) ) { + if( asf_header_check( http_hdr )==0 ) { + MSG_V("=====> ASF Plain text\n"); + return ASF_PlainText_e; + } else if( (!strcasecmp(content_type, "text/html")) ) { + MSG_V("=====> HTML, mplayer is not a browser...yet!\n"); + return ASF_Unknown_e; + } else { + MSG_V("=====> ASF Redirector\n"); + return ASF_Redirector_e; + } + } else { + if((!strcasecmp(content_type, "audio/x-ms-wax")) || + (!strcasecmp(content_type, "audio/x-ms-wma")) || + (!strcasecmp(content_type, "video/x-ms-asf")) || + (!strcasecmp(content_type, "video/x-ms-afs")) || + (!strcasecmp(content_type, "video/x-ms-wvx")) || + (!strcasecmp(content_type, "video/x-ms-wmv")) || + (!strcasecmp(content_type, "video/x-ms-wma")) ) { + MSG_ERR("=====> ASF Redirector\n"); + return ASF_Redirector_e; + } else if( !strcasecmp(content_type, "text/plain") ) { + MSG_V("=====> ASF Plain text\n"); + return ASF_PlainText_e; + } else { + MSG_V("=====> ASF unknown content-type: %s\n", content_type ); + return ASF_Unknown_e; + } + } + } + return ASF_Unknown_e; } HTTP_Header* Asf_Networking::http_request() const { - HTTP_Header* http_hdr = new(zeromem) HTTP_Header; + HTTP_Header* http_hdr = new(zeromem) HTTP_Header; // URL *url = NULL; - URL *server_url = NULL; - char str[250]; - char *ptr; - int i, enable; + URL server_url; + char str[250]; + char *ptr; + int i, enable; - int offset_hi=0, offset_lo=0, length=0; - int asf_nb_stream=0, stream_id; + int offset_hi=0, offset_lo=0, length=0; + int asf_nb_stream=0, stream_id; - // Sanity check - if( url==NULL ) return NULL; + // Common header for all requests. + http_hdr->set_field("Accept: */*" ); + http_hdr->set_field("User-Agent: NSPlayer/4.1.0.3856" ); + http_hdr->add_basic_authentication(url.user(), url.password()); - // Common header for all requests. - http_hdr->set_field("Accept: */*" ); - http_hdr->set_field("User-Agent: NSPlayer/4.1.0.3856" ); - http_hdr->add_basic_authentication(url->username?url->username:"", url->password?url->password:"" ); + // Check if we are using a proxy + if( url.protocol2lower()=="http_proxy") { + server_url.redirect(url.file()); + http_hdr->set_uri(server_url.url()); + sprintf( str, "Host: %.220s:%d", server_url.host().c_str(), server_url.port()); + } else { + http_hdr->set_uri(url.file()); + sprintf( str, "Host: %.220s:%d", url.host().c_str(), url.port()); + } - // Check if we are using a proxy - if( !strcasecmp( url->protocol, "http_proxy" ) ) { - server_url = url_new( (url->file)+1 ); - if( server_url==NULL ) { - MSG_ERR("Invalid proxy URL\n"); - delete http_hdr; - return NULL; - } - http_hdr->set_uri(server_url->url ); - sprintf( str, "Host: %.220s:%d", server_url->hostname, server_url->port ); - delete server_url; - } else { - http_hdr->set_uri(url->file ); - sprintf( str, "Host: %.220s:%d", url->hostname, url->port ); - } - - http_hdr->set_field(str ); - http_hdr->set_field("Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); - sprintf(str, - "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u", + http_hdr->set_field(str ); + http_hdr->set_field("Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); + sprintf(str,"Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u", offset_hi, offset_lo, request, length ); - http_hdr->set_field( str ); + http_hdr->set_field( str ); - switch( networking_type ) { - case ASF_Live_e: - case ASF_Prerecorded_e: - http_hdr->set_field("Pragma: xPlayStrm=1" ); - ptr = str; - ptr += sprintf( ptr, "Pragma: stream-switch-entry="); - if(n_audio > 0) { - for( i=0; i<n_audio ; i++ ) { - stream_id = audio_streams[i]; - if(stream_id == audio_id) { - enable = 0; - } else { - enable = 2; - continue; - } - asf_nb_stream++; - ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); - } - } - if(n_video > 0) { - for( i=0; i<n_video ; i++ ) { - stream_id = video_streams[i]; - if(stream_id == video_id) { - enable = 0; - } else { - enable = 2; - continue; - } - asf_nb_stream++; - ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); - } - } - http_hdr->set_field(str ); - sprintf( str, "Pragma: stream-switch-count=%d", asf_nb_stream ); - http_hdr->set_field( str ); - break; - case ASF_Redirector_e: - break; - case ASF_Unknown_e: - // First request goes here. - break; - default: - MSG_ERR("Unknown asf stream type\n"); - } + switch( networking_type ) { + case ASF_Live_e: + case ASF_Prerecorded_e: + http_hdr->set_field("Pragma: xPlayStrm=1" ); + ptr = str; + ptr += sprintf( ptr, "Pragma: stream-switch-entry="); + if(n_audio > 0) { + for( i=0; i<n_audio ; i++ ) { + stream_id = audio_streams[i]; + if(stream_id == audio_id) enable = 0; + else { + enable = 2; + continue; + } + asf_nb_stream++; + ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); + } + } + if(n_video > 0) { + for( i=0; i<n_video ; i++ ) { + stream_id = video_streams[i]; + if(stream_id == video_id) enable = 0; + else { + enable = 2; + continue; + } + asf_nb_stream++; + ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); + } + } + http_hdr->set_field(str ); + sprintf( str, "Pragma: stream-switch-count=%d", asf_nb_stream ); + http_hdr->set_field( str ); + break; + case ASF_Redirector_e: break; + case ASF_Unknown_e: // First request goes here. + break; + default: + MSG_ERR("Unknown asf stream type\n"); + } - http_hdr->set_field("Connection: Close" ); - http_hdr->build_request( ); + http_hdr->set_field("Connection: Close" ); + http_hdr->build_request( ); - return http_hdr; + return http_hdr; } int Asf_Networking::parse_response(HTTP_Header& http_hdr ) { - const char *content_type, *pragma; - char features[64] = "\0"; - size_t len; - if( http_hdr.response_parse()<0 ) { - MSG_ERR("Failed to parse HTTP response\n"); - return -1; - } - switch( http_hdr.get_status()) { - case 200: - break; - case 401: // Authentication required - return ASF_Authenticate_e; - default: - MSG_ERR("Server return %d:%s\n", http_hdr.get_status(), http_hdr.get_reason_phrase()); - return -1; - } + const char *content_type, *pragma; + char features[64] = "\0"; + size_t len; + if( http_hdr.response_parse()<0 ) { + MSG_ERR("Failed to parse HTTP response\n"); + return -1; + } + switch( http_hdr.get_status()) { + case 200: + break; + case 401: // Authentication required + return ASF_Authenticate_e; + default: + MSG_ERR("Server return %d:%s\n", http_hdr.get_status(), http_hdr.get_reason_phrase()); + return -1; + } - content_type = http_hdr.get_field("Content-Type"); + content_type = http_hdr.get_field("Content-Type"); - pragma = http_hdr.get_field("Pragma"); - while( pragma!=NULL ) { - const char *comma_ptr=NULL; - const char *end; - // The pragma line can get severals attributes - // separeted with a comma ','. - do { - if( !strncasecmp( pragma, "features=", 9) ) { - pragma += 9; - end = strstr( pragma, "," ); - if( end==NULL ) { - size_t s = strlen(pragma); - if(s > sizeof(features)) { - MSG_WARN("ASF HTTP PARSE WARNING : Pragma %s cuted from %d bytes to %d\n",pragma,s,sizeof(features)); - len = sizeof(features); - } else { - len = s; - } - } else { - len = MIN((unsigned int)(end-pragma),sizeof(features)); - } - strncpy( features, pragma, len ); - features[len]='\0'; - break; - } - comma_ptr = strstr( pragma, "," ); - if( comma_ptr!=NULL ) { - pragma = comma_ptr+1; - if( pragma[0]==' ' ) pragma++; - } - } while( comma_ptr!=NULL ); - pragma = http_hdr.get_next_field(); - } - networking_type = asf_http_networking_type( content_type, features, http_hdr ); - return 0; + pragma = http_hdr.get_field("Pragma"); + while( pragma!=NULL ) { + const char *comma_ptr=NULL; + const char *end; + // The pragma line can get severals attributes + // separeted with a comma ','. + do { + if( !strncasecmp( pragma, "features=", 9) ) { + pragma += 9; + end = strstr( pragma, "," ); + if( end==NULL ) { + size_t s = strlen(pragma); + if(s > sizeof(features)) { + MSG_WARN("ASF HTTP PARSE WARNING : Pragma %s cuted from %d bytes to %d\n",pragma,s,sizeof(features)); + len = sizeof(features); + } else len = s; + } else len = std::min((unsigned long)(end-pragma),sizeof(features)); + strncpy( features, pragma, len ); + features[len]='\0'; + break; + } + comma_ptr = strstr( pragma, "," ); + if( comma_ptr!=NULL ) { + pragma = comma_ptr+1; + if( pragma[0]==' ' ) pragma++; + } + } while( comma_ptr!=NULL ); + pragma = http_hdr.get_next_field(); + } + networking_type = asf_http_networking_type( content_type, features, http_hdr ); + return 0; } Networking* Asf_Networking::start(Tcp& tcp, network_protocol_t& protocol) { HTTP_Header *http_hdr=NULL; - URL *url = protocol.url; + URL& url = protocol.url; uint8_t buffer[BUFFER_SIZE]; int i, ret; int done; int auth_retry = 0; - const char *proto = protocol.url->protocol; + const char *proto = protocol.url.protocol().c_str(); // sanity check - if (!(!strncasecmp(proto, "http_proxy", 10) || - !strncasecmp(proto, "http", 4))) { + if (!(protocol.url.protocol2lower()=="http_proxy" || + protocol.url.protocol2lower()=="http")) { MSG_ERR("Unknown protocol: %s\n", proto ); return NULL; } @@ -668,12 +651,9 @@ done = 1; tcp.close(); - if( !strcasecmp( url->protocol, "http_proxy" ) ) { - if( url->port==0 ) url->port = 8080; - } else { - if( url->port==0 ) url->port = 80; - } - tcp.open(url->hostname, url->port, Tcp::IP4); + if( url.protocol2lower()=="http_proxy") url.assign_port(8080); + else url.assign_port(80); + tcp.open(url, Tcp::IP4); if( !tcp.established()) { delete rv; return NULL; @@ -778,7 +758,6 @@ return Nop_Networking::start(tcp,protocol); } else rv->buffering = 1; rv->status = networking_playing_e; - rv->url->port=protocol.url->port; delete http_hdr; return rv; Modified: mplayerxp/libmpstream2/network_asf_mmst.cpp =================================================================== --- mplayerxp/libmpstream2/network_asf_mmst.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_asf_mmst.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -362,7 +362,7 @@ int Asf_Mmst_Networking::get_media_packet (Tcp& tcp, int padding) { unsigned char pre_header[8]; - unsigned char data[BUF_SIZE]; + unsigned char _data[BUF_SIZE]; if (!get_data (tcp, pre_header, 8)) { MSG_ERR ("pre-header read failed\n"); @@ -386,12 +386,12 @@ return 0; } - if (!get_data (tcp, data, packet_len)) { + if (!get_data (tcp, _data, packet_len)) { MSG_ERR ("media data read failed\n"); return 0; } - bufferize(data, padding); + bufferize(_data, padding); } else { @@ -410,7 +410,7 @@ return 0; } - if (!get_data (tcp, data, packet_len)) { + if (!get_data (tcp, _data, packet_len)) { MSG_ERR ("command data read failed\n"); return 0; } @@ -422,12 +422,12 @@ return -1; } - command = get_32 (data, 24) & 0xFFFF; + command = get_32 (_data, 24) & 0xFFFF; // printf ("\ncommand packet detected, len=%d cmd=0x%X\n", packet_len, command); if (command == 0x1b) - send_command (tcp, 0x1b, 0, 0, 0, data); + send_command (tcp, 0x1b, 0, 0, 0, _data); else if (command == 0x1e) { MSG_OK ("everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n"); return 0; @@ -490,19 +490,20 @@ uint8_t asf_header[HDR_BUF_SIZE]; int asf_header_len; int len, i, packet_length; - char* path, *unescpath; - URL* url1 = protocol.url; - const char *proto = protocol.url->protocol; + const char* path; + char* unescpath; + URL url1 = protocol.url; // Is protocol even valid mms,mmsu,mmst,http,http_proxy? - if (!(!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mmsu", 4) || - !strncasecmp(proto, "mms", 3))) { - MSG_ERR("Unknown protocol: %s\n", proto ); + if (!(protocol.url.protocol2lower()=="mmst" || + protocol.url.protocol2lower()=="mmsu" || + protocol.url.protocol2lower()=="mms")) { + MSG_ERR("Unknown protocol: %s\n", protocol.url.protocol().c_str() ); return NULL; } // Is protocol mms or mmsu? - if (!strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "mms", 3)) { + if (protocol.url.protocol2lower()=="mmsu" || protocol.url.protocol2lower()=="mms") { MSG_V("Trying ASF/UDP...\n"); //fd = asf_mmsu_networking_start( stream ); //mmsu support is not implemented yet - using this code @@ -513,7 +514,7 @@ tcp.close(); /* parse url */ - path = strchr(url1->file,'/') + 1; + path = strchr(url1.file().c_str(),'/') + 1; /* mmst filename are not url_escaped by MS MediaPlayer and are expected as * "plain text" by the server, so need to decode it here @@ -526,8 +527,8 @@ url2string(unescpath,path); path=unescpath; - if( url1->port==0 ) url1->port=1755; - tcp.open(url1->hostname, url1->port, Tcp::IP4); + url1.assign_port(1755); + tcp.open(url1, Tcp::IP4); if( !tcp.established()) { delete path; return NULL; @@ -551,7 +552,7 @@ #endif #endif - snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname); + snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1.host().c_str()); string_utf16 (data, str, strlen(str)); // send_command(s, commandno ....) send_command (tcp, 1, 0, 0x0004000b, strlen(str) * 2+2, data); @@ -649,7 +650,6 @@ rv->buffering = 1; rv->status = networking_playing_e; - rv->url->port=protocol.url->port; packet_length1 = packet_length; MSG_V("mmst packet_length = %d\n",packet_length); Modified: mplayerxp/libmpstream2/network_nop.cpp =================================================================== --- mplayerxp/libmpstream2/network_nop.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_nop.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -50,7 +50,7 @@ Networking* Nop_Networking::start(Tcp& tcp,network_protocol_t& protocol) { HTTP_Header *http_hdr = NULL; const char *next_url=NULL; - URL *rd_url=NULL; + URL& rd_url=protocol.url; Nop_Networking* rv = new(zeromem) Nop_Networking; if( !tcp.established() ) { @@ -82,12 +82,9 @@ case 302: // Temporarily next_url = http_hdr->get_field("Location" ); - if (next_url != NULL) - rd_url=url_new(next_url); - - if (next_url != NULL && rd_url != NULL) { + if (next_url != NULL && rd_url.redirect(next_url)==MPXP_Ok) { MSG_STATUS("Redirected: Using this url instead %s\n",next_url); - protocol.url=check4proxies(rd_url); + rd_url.check4proxies(); delete rv; rv=static_cast<Nop_Networking*>(Nop_Networking::start(tcp,protocol)); //recursively get networking started } else { Modified: mplayerxp/libmpstream2/network_pnm.cpp =================================================================== --- mplayerxp/libmpstream2/network_pnm.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_pnm.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -22,11 +22,11 @@ Networking* Pnm_Networking::start(Tcp& tcp,network_protocol_t& protocol ) { Pnm* pnm = new(zeromem) Pnm(tcp); - tcp.open(protocol.url->hostname, - protocol.url->port ? protocol.url->port : 7070); + protocol.url.assign_port(7070); + tcp.open(protocol.url); if(!tcp.established()) return NULL; - if(pnm->connect(protocol.url->file)!=MPXP_Ok) { + if(pnm->connect(protocol.url.file())!=MPXP_Ok) { delete pnm; return NULL; } Modified: mplayerxp/libmpstream2/network_real_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/network_real_rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_real_rtsp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -21,33 +21,33 @@ Networking* RealRtsp_Networking::start( Tcp& tcp, network_protocol_t& protocol ) { Rtsp_Session* rtsp; char *mrl; - char *file; - int port; + const char *file; int redirected, temp; temp = 5; // counter so we don't get caught in infinite redirections (you never know) do { redirected = 0; - port = protocol.url->port ? protocol.url->port : 554; + protocol.url.assign_port(554); tcp.close(); - tcp.open( protocol.url->hostname, port, Tcp::IP4); - if(!tcp.established() && !protocol.url->port) - tcp.open( protocol.url->hostname,port = 7070, Tcp::IP4); + tcp.open( protocol.url, Tcp::IP4); + if(!tcp.established() && !protocol.url.port()) { + protocol.url.assign_port(7070); + tcp.open( protocol.url, Tcp::IP4); + } if(!tcp.established()) return NULL; - file = protocol.url->file; + file = protocol.url.file().c_str(); if (file[0] == '/') file++; - mrl = new char [strlen(protocol.url->hostname)+strlen(file)+16]; - sprintf(mrl,"rtsp://%s:%i/%s",protocol.url->hostname,port,file); + mrl = new char [protocol.url.host().length()+strlen(file)+16]; + sprintf(mrl,"rtsp://%s:%i/%s",protocol.url.host().c_str(),protocol.url.port(),file); rtsp = rtsp_session_start(tcp,&mrl, file, - protocol.url->hostname, port, &redirected, - net_conf.bandwidth,protocol.url->username, - protocol.url->password); + protocol.url.host(), protocol.url.port(), &redirected, + net_conf.bandwidth,protocol.url.user(), + protocol.url.password()); if ( redirected == 1 ) { - delete protocol.url; - protocol.url = url_new(mrl); + protocol.url.redirect(mrl); tcp.close(); } delete mrl; Modified: mplayerxp/libmpstream2/network_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -7,13 +7,11 @@ #include "librtsp/rtsp_session.h" namespace mpxp { -#define RTSP_DEFAULT_PORT 554 -Networking* Rtsp_Networking::start(Tcp& tcp, URL* url,unsigned bandwidth) +Networking* Rtsp_Networking::start(Tcp& tcp, URL& url,unsigned bandwidth) { Rtsp_Session *rtsp; char *mrl; - char *file; - int port; + const char *file; int redirected, temp; /* counter so we don't get caught in infinite redirections */ @@ -22,30 +20,28 @@ do { redirected = 0; - tcp.open(url->hostname, - port = (url->port ? - url->port : - RTSP_DEFAULT_PORT)); - if (!tcp.established() && !url->port) - tcp.open(url->hostname, - port = 7070); + url.assign_port(554); + tcp.open(url); + if (!tcp.established()) { + url.assign_port(7070); + tcp.open(url); + } if (!tcp.established()) return NULL; - file = url->file; + file = url.file().c_str(); if (file[0] == '/') file++; - mrl = new char [strlen (url->hostname) + strlen (file) + 16]; + mrl = new char [url.host().length() + strlen (file) + 16]; - sprintf (mrl, "rtsp://%s:%i/%s",url->hostname, port, file); + sprintf (mrl, "rtsp://%s:%i/%s",url.host().c_str(), url.port(), file); rtsp = rtsp_session_start (tcp, &mrl, file, - url->hostname, - port, &redirected, + url.host(), + url.port(), &redirected, bandwidth, - url->username, - url->password); + url.user(), + url.password()); if (redirected == 1) { - delete url; - url = url_new (mrl); + url.redirect(mrl); tcp.close(); } delete mrl; Modified: mplayerxp/libmpstream2/network_rtsp.h =================================================================== --- mplayerxp/libmpstream2/network_rtsp.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/network_rtsp.h 2012-12-18 13:04:29 UTC (rev 572) @@ -8,7 +8,7 @@ public: virtual ~Rtsp_Networking(); - static Networking* start(Tcp& tcp, URL* url,unsigned bandwidth); + static Networking* start(Tcp& tcp, URL& url,unsigned bandwidth); virtual int read( Tcp& fd, char *buffer, int buffer_size); virtual int seek( Tcp& fd, off_t pos); private: Modified: mplayerxp/libmpstream2/realrtsp/real.cpp =================================================================== --- mplayerxp/libmpstream2/realrtsp/real.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/realrtsp/real.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -428,7 +428,7 @@ //! maximum size of the rtsp description, must be < INT_MAX #define MAX_DESC_BUF (20 * 1024 * 1024) rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwidth, - char *username, char *password) { + const char *username, const char *password) { char *description=NULL; char *session_id=NULL; Modified: mplayerxp/libmpstream2/realrtsp/real.h =================================================================== --- mplayerxp/libmpstream2/realrtsp/real.h 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/realrtsp/real.h 2012-12-18 13:04:29 UTC (rev 572) @@ -53,7 +53,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char **buffer, int rdt_rawdata); rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwidth, - char *username, char *password); + const char *username, const char *password); struct real_rtsp_session_t *init_real_rtsp_session (void); void free_real_rtsp_session (struct real_rtsp_session_t* real_session); Modified: mplayerxp/libmpstream2/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream2/s_ftp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/s_ftp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -47,12 +47,7 @@ int OpenData(size_t newpos); int SendCmd(const std::string& cmd,char* rsp); - const char* user; - const char* pass; - const char* host; - int port; - const char* filename; - URL* url; + URL url; char* cput,*cget; Tcp tcp; @@ -196,7 +191,6 @@ int Ftp_Stream_Interface::OpenPort() { int resp; - net_fd_t fd; char rsp_txt[256]; char* par,str[128]; int num[6]; @@ -212,10 +206,11 @@ return 0; } sscanf(par+1,"%u,%u,%u,%u,%u,%u",&num[0],&num[1],&num[2],&num[3],&num[4],&num[5]); - snprintf(str,127,"%d.%d.%d.%d",num[0],num[1],num[2],num[3]); - tcp.open(str,(num[4]<<8)+num[5]); + snprintf(str,127,"ftp://%d.%d.%d.%d:%d",num[0],num[1],num[2],num[3],(num[4]<<8)+num[5]); + url.redirect(str); + tcp.open(url); - if(fd < 0) MSG_ERR("[ftp] failed to create data connection\n"); + if(!tcp.established()) MSG_ERR("[ftp] failed to create data connection\n"); return 1; } @@ -237,7 +232,7 @@ } } // Get the file - snprintf(str,255,"RETR %s",filename); + snprintf(str,255,"RETR %s",url.file().c_str()); resp = SendCmd(str,rsp_txt); if(resp != 1) { @@ -323,51 +318,46 @@ UNUSED(flags); uname=std::string("ftp://")+_filename; - if(!(url=url_new(uname))) goto bad_url; + if(url.redirect(uname)!=MPXP_Ok) goto bad_url; // url = check4proxies (rurl); - if(!(url->hostname && url->file)) { + if(url.host().empty() && !url.file().empty()) { bad_url: MSG_ERR("[ftp] Bad url\n"); return MPXP_False; } - user=url->username?url->username:"anonymous"; - pass=url->password?url->password:"no@spam"; - host=url->hostname; - port=url->port?url->port:21; - filename=url->file; - MSG_V("FTP: Opening ~%s :%s @%s :%i %s\n",user,pass,host,port,filename); + if(url.user().empty()) url.set_login("anonymous","no@spam"); + url.assign_port(21); + MSG_V("FTP: Opening ~%s :%s @%s :%i %s\n" + ,url.user().c_str(),url.password().c_str(),url.host().c_str(), + url.port(),url.file().c_str()); // Open the control connection - tcp.open(host,port); + tcp.open(url); if(!tcp.established()) { - delete url; return MPXP_False; } // We got a connection, let's start serious things buf = new char [BUFSIZE]; if (readresp(NULL) == 0) { close(); - delete url; return MPXP_False; } // Login - snprintf(str,255,"USER %s",user); + snprintf(str,255,"USER %s",url.user().c_str()); resp = SendCmd(str,rsp_txt); // password needed if(resp == 3) { - snprintf(str,255,"PASS %s",pass); + snprintf(str,255,"PASS %s",url.password().c_str()); resp = SendCmd(str,rsp_txt); if(resp != 2) { MSG_ERR("[ftp] command '%s' failed: %s\n",str,rsp_txt); close(); - delete url; return MPXP_False; } } else if(resp != 2) { MSG_ERR("[ftp] command '%s' failed: %s\n",str,rsp_txt); close(); - delete url; return MPXP_False; } @@ -376,7 +366,6 @@ if(resp != 2) { MSG_ERR("[ftp] command 'TYPE I' failed: %s\n",rsp_txt); close(); - delete url; return MPXP_False; } @@ -385,7 +374,6 @@ if(resp != 2) { MSG_ERR("[ftp] command 'SYST' failed: %s\n",rsp_txt); close(); - delete url; return MPXP_False; } MSG_INFO("[ftp] System: %s\n",rsp_txt); @@ -393,13 +381,12 @@ if(resp != 2) { MSG_ERR("[ftp] command 'STAT' failed: %s\n",rsp_txt); close(); - delete url; return MPXP_False; } file_len=0; // Get the filesize - snprintf(str,255,"SIZE %s",filename); + snprintf(str,255,"SIZE %s",url.file().c_str()); resp = SendCmd(str,rsp_txt); if(resp != 2) { MSG_WARN("[ftp] command '%s' failed: %s\n",str,rsp_txt); @@ -414,7 +401,6 @@ // because the connection would stay open in the main process, // preventing correct abort with many servers. - delete url; return MPXP_Ok; } Stream::type_e Ftp_Stream_Interface::type() const { return file_len?Stream::Type_Seekable:Stream::Type_Stream; } Modified: mplayerxp/libmpstream2/s_network.cpp =================================================================== --- mplayerxp/libmpstream2/s_network.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/s_network.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -37,7 +37,7 @@ virtual off_t sector_size() const; virtual std::string mime_type() const; private: - URL* url; + URL url; off_t spos; Tcp tcp; Networking* networking; @@ -46,22 +46,17 @@ Network_Stream_Interface::Network_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), tcp(libinput,-1) {} -Network_Stream_Interface::~Network_Stream_Interface() { - if(url) delete url; -} +Network_Stream_Interface::~Network_Stream_Interface() {} MPXP_Rc Network_Stream_Interface::open(const std::string& filename,unsigned flags) { UNUSED(flags); - url = url_new(filename); - if(url) { + if(url.redirect(filename)==MPXP_Ok) { if((networking=Networking::start(tcp,url))==NULL){ MSG_ERR(MSGTR_UnableOpenURL, filename.c_str()); - delete url; - url=NULL; return MPXP_False; } - MSG_INFO(MSGTR_ConnToServer, url->hostname); + MSG_INFO(MSGTR_ConnToServer, url.host().c_str()); spos = 0; return MPXP_Ok; } Modified: mplayerxp/libmpstream2/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -76,14 +76,14 @@ MPXP_Rc Rtsp_Stream_Interface::open(const std::string& filename,unsigned flags) { - URL *url; + URL url; UNUSED(flags); if(filename.substr(0,7)!="rtsp://") return MPXP_False; MSG_V("STREAM_RTSP, URL: %s\n", filename.c_str()); - url = url_new (filename); - url = check4proxies (url); + url.redirect (filename); + url.check4proxies (); tcp.close(); if ((networking=Rtsp_Networking::start(tcp,url,net_conf.bandwidth)) == NULL) { Modified: mplayerxp/libmpstream2/s_udp.cpp =================================================================== --- mplayerxp/libmpstream2/s_udp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/s_udp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -43,9 +43,9 @@ virtual off_t sector_size() const; virtual std::string mime_type() const; private: - MPXP_Rc start (URL*,unsigned); + MPXP_Rc start (const URL&,unsigned); - Networking* networking; + Networking* networking; Udp udp; Tcp tcp; }; @@ -77,7 +77,7 @@ networking=NULL; } -MPXP_Rc Udp_Stream_Interface::start (URL* url,unsigned bandwidth) +MPXP_Rc Udp_Stream_Interface::start (const URL& url,unsigned bandwidth) { if (!udp.established()) { udp.open(networking->url); @@ -95,13 +95,13 @@ MPXP_Rc Udp_Stream_Interface::open(const std::string& filename,unsigned flags) { - URL *url; + URL url; UNUSED(flags); MSG_V("STREAM_UDP, URL: %s\n", filename.c_str()); - url = url_new (filename); - url = check4proxies (url); - if (url->port == 0) { + url.redirect(filename); + url.check4proxies (); + if (url.port() == 0) { MSG_ERR("You must enter a port number for UDP streams!\n"); return MPXP_False; } Modified: mplayerxp/libmpstream2/tcp.cpp =================================================================== --- mplayerxp/libmpstream2/tcp.cpp 2012-12-17 17:36:01 UTC (rev 571) +++ mplayerxp/libmpstream2/tcp.cpp 2012-12-18 13:04:29 UTC (rev 572) @@ -51,7 +51,7 @@ // return -2 for fatal error, like unable to resolve name, connection timeout... // return -1 is unable to connect to a particular port -void Tcp::open(const std::string& host, int port, tcp_af_e af) { +void Tcp::open(const URL& __url, tcp_af_e af) { socklen_t err_len; int ret,count = 0; fd_set set; @@ -64,6 +64,7 @@ any_t*our_s_addr; // Pointer to sin_addr or sin6_addr struct hostent *hp=NULL; char buf[255]; + _url=__url; #ifdef HAVE_WINSOCK2 u_long val; @@ -73,7 +74,7 @@ #endif buf[0]=0; - MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host.c_str()); + MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), _url.host().c_str()); _fd = ::socket(af==Tcp::IP4?AF_INET:AF_INET6, SOCK_STREAM, 0); if( _fd==-1 ) { @@ -104,26 +105,26 @@ memset(&server_address, 0, sizeof(server_address)); - MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), host.c_str()); + MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), _url.host().c_str()); #ifndef HAVE_WINSOCK2 #ifdef USE_ATON - if (::inet_aton(host.c_str(), our_s_addr)!=1) + if (::inet_aton(_url.host().c_str(), our_s_addr)!=1) #else - if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, host.c_str(), our_s_addr)!=1) + if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, _url.host().c_str(), our_s_addr)!=1) #endif #else - if (::inet_addr(host.c_str())==INADDR_NONE ) + if (::inet_addr(_url.host().c_str())==INADDR_NONE ) #endif { - MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), host.c_str()); + MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), _url.host().c_str()); #ifdef HAVE_GETHOSTBYNAME2 - hp=(struct hostent*)::gethostbyname2( host.c_str(), af==Tcp::IP4?AF_INET:AF_INET6 ); + hp=(struct hostent*)::gethostbyname2( _url.host().c_str(), af==Tcp::IP4?AF_INET:AF_INET6 ); #else - hp=(struct hostent*)::gethostbyname( host.c_str() ); + hp=(struct hostent*)::gethostbyname( _url.host().c_str() ); #endif if( hp==NULL ) { - MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), host.c_str()); + MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), _url.host().c_str()); _error=Tcp::Err_Fatal; return; } @@ -132,7 +133,7 @@ } #ifdef HAVE_WINSOCK2 else { - unsigned long addr = inet_addr(host.c_str()); + unsigned long addr = inet_addr(_url.host().c_str()); memcpy( our_s_addr, (any_t*)&addr, sizeof(addr) ); } #endif @@ -140,12 +141,12 @@ switch (af) { case Tcp::IP4: server_address.four.sin_family=AF_INET; - server_address.four.sin_port=htons(port); + server_address.four.sin_port=htons(_url.port()); server_address_size = sizeof(server_address.four); break; case Tcp::IP6: server_address.six.sin6_family=AF_INET6; - server_address.six.sin6_port=htons(port); + server_address.six.sin6_port=htons(_url.port()); server_address_size = sizeof(server_address.six); break; default: @@ -159,7 +160,7 @@ #else ::inet_ntop(af==Tcp::IP4?AF_INET:AF_INET6, our_s_addr, buf, 255); #endif - MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),host.c_str(),buf,port); + MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),_url.host().c_str(),buf,_url.port()); // Turn the socket as non blocking so we can timeout on the connection #ifndef HAVE_WINSOCK2 @@ -174,7 +175,7 @@ #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { #endif - MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),host.c_str()); + MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),_url.host().c_str()); ::closesocket(_fd); _fd=-1; _error=Tcp::Err_Port; @@ -225,12 +226,12 @@ } } -Tcp::Tcp(libinput_t& _libinput,const std::string& host,int port,tcp_af_e af) +Tcp::Tcp(libinput_t... [truncated message content] |
From: <nic...@us...> - 2012-12-17 17:36:08
|
Revision: 571 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=571&view=rev Author: nickols_k Date: 2012-12-17 17:36:01 +0000 (Mon, 17 Dec 2012) Log Message: ----------- add ASF MMST autodetection Modified Paths: -------------- mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/network_asf_mmst.h mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_udp.cpp Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/network.cpp 2012-12-17 17:36:01 UTC (rev 571) @@ -241,10 +241,7 @@ tcp.close(); } - if( http_hdr ) { - delete http_hdr; - networking.data = NULL; - } + if( http_hdr ) delete http_hdr; return pos; } @@ -254,8 +251,8 @@ Networking::~Networking() { if( url ) delete url; - if( buffer ) delete buffer ; - if( data ) delete data ; + if( buffer ) delete buffer; + if( data ) delete data; } // By using the protocol, the extension of the file or the content-type @@ -443,8 +440,7 @@ MSG_INFO("Can't connect with pnm, retrying with http.\n"); return NULL; } - } - else if( !strcasecmp( url->protocol, "rtsp")) { + } else if( !strcasecmp( url->protocol, "rtsp")) { if ((rc = RealRtsp_Networking::start( tcp, net_protocol )) == NULL) { MSG_INFO("Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); #ifdef STREAMING_LIVE_DOT_COM @@ -456,14 +452,21 @@ return NULL; #endif } - } - else if(!strcasecmp( url->protocol, "udp")) { + } else if(!strcasecmp( url->protocol, "udp")) { tcp.close(); rc = Rtp_Networking::start(tcp, net_protocol, 1); if(!rc) { MSG_ERR("rtp_networking_start(udp) failed\n"); return NULL; } + } else if(!strncasecmp(url->protocol, "mms", 3) || + !strncasecmp(url->protocol, "mmst", 4) || + !strncasecmp(url->protocol, "mmsu", 4)) { + rc=Asf_Mmst_Networking::start(tcp,net_protocol); + if(!rc) { + MSG_ERR("asf_mmst_networking_start() failed\n"); + return NULL; + } } else { // Send the appropriate HTTP request // Need to filter the network stream. Modified: mplayerxp/libmpstream2/network.h =================================================================== --- mplayerxp/libmpstream2/network.h 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/network.h 2012-12-17 17:36:01 UTC (rev 571) @@ -71,22 +71,23 @@ virtual void fixup_cache(); virtual int bufferize(unsigned char *buffer, int size); - URL *url; - std::string mime; - networking_status status; - int buffering; // boolean - unsigned int prebuffer_size; - char *buffer; - unsigned int buffer_size; - unsigned int buffer_pos; - unsigned int bandwidth; // The downstream available virtual int read( Tcp& fd, char *buffer, int buffer_size) = 0; virtual int seek( Tcp& fd, off_t pos) = 0; - Opaque* data; + + std::string mime; + URL* url; + networking_status status; + unsigned int bandwidth; // The downstream available protected: Networking(); + unsigned int prebuffer_size; + int buffering; // boolean + char* buffer; + unsigned int buffer_size; + unsigned int buffer_pos; + Opaque* data; private: - static MPXP_Rc autodetectProtocol(network_protocol_t& protocol,Tcp& tcp); + static MPXP_Rc autodetectProtocol(network_protocol_t& protocol,Tcp& tcp); }; extern URL* check4proxies( URL* url ); Modified: mplayerxp/libmpstream2/network_asf_mmst.cpp =================================================================== --- mplayerxp/libmpstream2/network_asf_mmst.cpp 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/network_asf_mmst.cpp 2012-12-17 17:36:01 UTC (rev 571) @@ -360,8 +360,7 @@ } - -static int get_media_packet (Tcp& tcp, int padding, Networking& stream_ctrl) { +int Asf_Mmst_Networking::get_media_packet (Tcp& tcp, int padding) { unsigned char pre_header[8]; unsigned char data[BUF_SIZE]; @@ -392,7 +391,7 @@ return 0; } - stream_ctrl.bufferize(data, padding); + bufferize(data, padding); } else { @@ -452,39 +451,35 @@ static int packet_length1; -static int asf_mmst_networking_read(Tcp& tcp, char *buffer, int size, Networking& stream_ctrl ) +int Asf_Mmst_Networking::read(Tcp& tcp, char *_buffer, int size) { - int len; + int len; - while( stream_ctrl.buffer_size==0 ) { - // buffer is empty - fill it! - int ret = get_media_packet(tcp, packet_length1, stream_ctrl); - if( ret<0 ) { - MSG_ERR("get_media_packet error : %s\n",strerror(errno)); - return -1; - } else if (ret==0) //EOF? - return ret; - } - - len = stream_ctrl.buffer_size-stream_ctrl.buffer_pos; - if(len>size) len=size; - memcpy( buffer, (stream_ctrl.buffer)+(stream_ctrl.buffer_pos), len ); - stream_ctrl.buffer_pos += len; - if( stream_ctrl.buffer_pos>=stream_ctrl.buffer_size ) { - delete stream_ctrl.buffer ; - stream_ctrl.buffer = NULL; - stream_ctrl.buffer_size = 0; - stream_ctrl.buffer_pos = 0; - } - return len; - + while( buffer_size==0 ) { + // buffer is empty - fill it! + int ret = get_media_packet(tcp, packet_length1); + if( ret<0 ) { + MSG_ERR("get_media_packet error : %s\n",strerror(errno)); + return -1; + } else if (ret==0) return ret; // EOF? + } + len = buffer_size-buffer_pos; + if(len>size) len=size; + memcpy( _buffer, buffer+buffer_pos, len ); + buffer_pos += len; + if( buffer_pos>=buffer_size ) { + delete buffer ; + buffer = NULL; + buffer_size = 0; + buffer_pos = 0; + } + return len; } -static int asf_mmst_networking_seek(Tcp& tcp, off_t pos, Networking& networking ) +int Asf_Mmst_Networking::seek(Tcp& tcp, off_t pos) { UNUSED(tcp); UNUSED(pos); - UNUSED(networking); return -1; } @@ -664,4 +659,6 @@ #endif return rv; } +Asf_Mmst_Networking::Asf_Mmst_Networking() {} +Asf_Mmst_Networking::~Asf_Mmst_Networking() {} } // namespace mpxp Modified: mplayerxp/libmpstream2/network_asf_mmst.h =================================================================== --- mplayerxp/libmpstream2/network_asf_mmst.h 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/network_asf_mmst.h 2012-12-17 17:36:01 UTC (rev 571) @@ -14,6 +14,7 @@ private: Asf_Mmst_Networking(); int get_header (Tcp& tcp, uint8_t *header); + int get_media_packet (Tcp& tcp, int padding); }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/network_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/network_rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) @@ -77,5 +77,8 @@ } Rtsp_Networking::Rtsp_Networking() {} -Rtsp_Networking::~Rtsp_Networking() {} +Rtsp_Networking::~Rtsp_Networking() { + Rtsp_Session* rtsp = static_cast<Rtsp_Session*>(data); + if (rtsp) rtsp->end(); +} } // namespace mpxp Modified: mplayerxp/libmpstream2/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-17 17:36:01 UTC (rev 571) @@ -70,8 +70,6 @@ void Rtsp_Stream_Interface::close() { - Rtsp_Session* rtsp = static_cast<Rtsp_Session*>(networking->data); - if (rtsp) rtsp->end (); delete networking; networking=NULL; } Modified: mplayerxp/libmpstream2/s_udp.cpp =================================================================== --- mplayerxp/libmpstream2/s_udp.cpp 2012-12-17 17:03:47 UTC (rev 570) +++ mplayerxp/libmpstream2/s_udp.cpp 2012-12-17 17:36:01 UTC (rev 571) @@ -43,7 +43,7 @@ virtual off_t sector_size() const; virtual std::string mime_type() const; private: - MPXP_Rc start (unsigned); + MPXP_Rc start (URL*,unsigned); Networking* networking; Udp udp; @@ -77,18 +77,19 @@ networking=NULL; } -MPXP_Rc Udp_Stream_Interface::start (unsigned bandwidth) +MPXP_Rc Udp_Stream_Interface::start (URL* url,unsigned bandwidth) { if (!udp.established()) { udp.open(networking->url); if (!udp.established()) return MPXP_False; } tcp=udp.socket(); + network_protocol_t net_protocol; + net_protocol.url=url; + net_protocol.mime="application/octet-stream"; Nop_Networking* rv = new(zeromem) Nop_Networking; + rv->start(tcp,net_protocol); rv->bandwidth = bandwidth; - rv->prebuffer_size = 64 * 1024; /* 64 KBytes */ - rv->buffering = 0; - rv->status = networking_playing_e; return MPXP_Ok; } @@ -104,7 +105,7 @@ MSG_ERR("You must enter a port number for UDP streams!\n"); return MPXP_False; } - if (start(net_conf.bandwidth) != MPXP_Ok) { + if (start(url,net_conf.bandwidth) != MPXP_Ok) { MSG_ERR("udp_networking_start failed\n"); return MPXP_False; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-17 17:03:58
|
Revision: 570 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=570&view=rev Author: nickols_k Date: 2012-12-17 17:03:47 +0000 (Mon, 17 Dec 2012) Log Message: ----------- on respone.404 segfault--: convert networking into classes Modified Paths: -------------- mplayerxp/libmpstream2/Makefile mplayerxp/libmpstream2/http.cpp mplayerxp/libmpstream2/http.h mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/s_network.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/udp.h Added Paths: ----------- mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/network_asf.h mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/network_asf_mmst.h mplayerxp/libmpstream2/network_nop.cpp mplayerxp/libmpstream2/network_nop.h mplayerxp/libmpstream2/network_pnm.cpp mplayerxp/libmpstream2/network_pnm.h mplayerxp/libmpstream2/network_real_rtsp.cpp mplayerxp/libmpstream2/network_real_rtsp.h mplayerxp/libmpstream2/network_rtp.cpp mplayerxp/libmpstream2/network_rtp.h mplayerxp/libmpstream2/network_rtsp.cpp mplayerxp/libmpstream2/network_rtsp.h Removed Paths: ------------- mplayerxp/libmpstream2/asf_mmst_streaming.cpp mplayerxp/libmpstream2/asf_streaming.cpp mplayerxp/libmpstream2/asf_streaming.h Modified: mplayerxp/libmpstream2/Makefile =================================================================== --- mplayerxp/libmpstream2/Makefile 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/Makefile 2012-12-17 17:03:47 UTC (rev 570) @@ -31,11 +31,16 @@ SUBDIRS = tvi ifeq ($(HAVE_STREAMING),yes) SUBDIRS += freesdp librtsp realrtsp -CXXSRCS += asf_streaming.cpp \ - asf_mmst_streaming.cpp \ - cookies.cpp \ +CXXSRCS += cookies.cpp \ http.cpp \ network.cpp \ + network_asf.cpp \ + network_asf_mmst.cpp \ + network_nop.cpp \ + network_pnm.cpp \ + network_real_rtsp.cpp \ + network_rtp.cpp \ + network_rtsp.cpp \ pnm.cpp \ rtp.cpp \ tcp.cpp \ Deleted: mplayerxp/libmpstream2/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream2/asf_mmst_streaming.cpp 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/asf_mmst_streaming.cpp 2012-12-17 17:03:47 UTC (rev 570) @@ -1,649 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -// mmst implementation taken from the xine-mms plugin made by majormms (http://geocities.com/majormms/) -// -// ported to mplayer by Abhijeet Phatak <abh...@ya...> -// date : 16 April 2002 -// -// information about the mms protocol can be find at http://get.to/sdp -// - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <inttypes.h> - -#include "mplayerxp.h" -#include "tcp.h" -#include "url.h" -#include "stream.h" - -#include "network.h" - -#ifndef HAVE_WINSOCK2 -#define closesocket close -#else -#include <winsock2.h> -#endif -#ifndef USE_SETLOCALE -#undef USE_ICONV -#endif - -#ifdef USE_ICONV -#ifdef HAVE_GICONV -#include <giconv.h> -#else -#include <iconv.h> -#endif -#ifdef USE_LANGINFO -#include <langinfo.h> -#endif -#endif -#include "stream_msg.h" - -#define BUF_SIZE 102400 -#define HDR_BUF_SIZE 8192 -#define MAX_STREAMS 20 - -typedef struct -{ - uint8_t buf[BUF_SIZE]; - int num_bytes; - -} command_t; - -static int seq_num; -static int num_stream_ids; -static int stream_ids[MAX_STREAMS]; - -static int get_data (Tcp& s,unsigned char *buf, size_t count); - -static void put_32 (command_t *cmd, uint32_t value) -{ - cmd->buf[cmd->num_bytes ] = value % 256; - value = value >> 8; - cmd->buf[cmd->num_bytes+1] = value % 256 ; - value = value >> 8; - cmd->buf[cmd->num_bytes+2] = value % 256 ; - value = value >> 8; - cmd->buf[cmd->num_bytes+3] = value % 256 ; - - cmd->num_bytes += 4; -} - -static uint32_t get_32 (unsigned char *cmd, int offset) -{ - uint32_t ret; - - ret = cmd[offset] ; - ret |= cmd[offset+1]<<8 ; - ret |= cmd[offset+2]<<16 ; - ret |= cmd[offset+3]<<24 ; - - return ret; -} - -static void send_command (Tcp& tcp, int command, uint32_t switches, - uint32_t extra, int length, - unsigned char *data) -{ - command_t cmd; - int len8; - - len8 = (length + 7) / 8; - - cmd.num_bytes = 0; - - put_32 (&cmd, 0x00000001); /* start sequence */ - put_32 (&cmd, 0xB00BFACE); /* #-)) */ - put_32 (&cmd, len8*8 + 32); - put_32 (&cmd, 0x20534d4d); /* protocol type "MMS " */ - put_32 (&cmd, len8 + 4); - put_32 (&cmd, seq_num); - seq_num++; - put_32 (&cmd, 0x0); /* unknown */ - put_32 (&cmd, 0x0); - put_32 (&cmd, len8+2); - put_32 (&cmd, 0x00030000 | command); /* dir | command */ - put_32 (&cmd, switches); - put_32 (&cmd, extra); - - memcpy (&cmd.buf[48], data, length); - if (length & 7) - memset(&cmd.buf[48 + length], 0, 8 - (length & 7)); - - if (tcp.write (cmd.buf, len8*8+48) != (len8*8+48)) { - MSG_ERR ("write error\n"); - } -} - -#ifdef USE_ICONV -static iconv_t url_conv; -#endif - -static void string_utf16(unsigned char *dest,const char *src, int len) -{ - int i; -#ifdef USE_ICONV - size_t len1, len2; - char *ip, *op; - - if (url_conv != (iconv_t)(-1)) - { - memset(dest, 0, 1000); - len1 = len; len2 = 1000; - ip = src; op = dest; - - iconv(url_conv, &ip, &len1, &op, &len2); - } - else - { -#endif - if (len > 499) len = 499; - for (i=0; i<len; i++) { - dest[i*2] = src[i]; - dest[i*2+1] = 0; - } - /* trailing zeroes */ - dest[i*2] = 0; - dest[i*2+1] = 0; -#ifdef USE_ICONV - } -#endif -} - -static void get_answer (Tcp& tcp) -{ - unsigned char data[BUF_SIZE]; - int command = 0x1b; - - while (command == 0x1b) { - int len; - - len = tcp.read(data, BUF_SIZE); - if (!len) { - MSG_ERR ("\nalert! eof\n"); - return; - } - - command = get_32 (data, 36) & 0xFFFF; - - if (command == 0x1b) - send_command (tcp, 0x1b, 0, 0, 0, data); - } -} - -static int get_data (Tcp& tcp,unsigned char *buf, size_t count) -{ - ssize_t len; - size_t total = 0; - - while (total < count) { - - len = tcp.read(&buf[total], count-total); - - if (len<=0) { - MSG_ERR ("read error:"); - return 0; - } - - total += len; - - if (len != 0) { -// printf ("[%d/%d]", total, count); - fflush (stdout); - } - - } - - return 1; - -} - -static int get_header (Tcp& tcp, uint8_t *header, networking_t& networking) -{ - unsigned char pre_header[8]; - int header_len; - - header_len = 0; - - while (1) { - if (!get_data (tcp, pre_header, 8)) { - MSG_ERR ("pre-header read failed\n"); - return 0; - } - if (pre_header[4] == 0x02) { - - int packet_len; - - packet_len = (pre_header[7] << 8 | pre_header[6]) - 8; - -// printf ("asf header packet detected, len=%d\n", packet_len); - - if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) { - MSG_FATAL("Invalid header size, giving up\n"); - return 0; - } - - if (!get_data (tcp, &header[header_len], packet_len)) { - MSG_ERR("header data read failed\n"); - return 0; - } - - header_len += packet_len; - - if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) { - - - if( networking_bufferize( networking, header, header_len )<0 ) { - return -1; - } - - // printf ("get header packet finished\n"); - - return (header_len); - - } - - } else { - - int32_t packet_len; - int command; - unsigned char data[BUF_SIZE]; - - if (!get_data (tcp, (unsigned char*)&packet_len, 4)) { - MSG_ERR ("packet_len read failed\n"); - return 0; - } - - packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4; - -// printf ("command packet detected, len=%d\n", packet_len); - - if (packet_len < 0 || packet_len > BUF_SIZE) { - MSG_FATAL("Invalid rtsp packet size, giving up\n"); - return 0; - } - - if (!get_data (tcp, data, packet_len)) { - MSG_ERR ("command data read failed\n"); - return 0; - } - - command = get_32 (data, 24) & 0xFFFF; - -// printf ("command: %02x\n", command); - - if (command == 0x1b) - send_command (tcp, 0x1b, 0, 0, 0, data); - - } - -// printf ("get header packet succ\n"); - } -} - -static int interp_header (uint8_t *header, int header_len) -{ - int i; - int packet_length=-1; - - /* - * parse header - */ - - i = 30; - while (i<header_len) { - - uint64_t guid_1, guid_2, length; - - guid_2 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) - | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) - | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) - | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); - i += 8; - - guid_1 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) - | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) - | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) - | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); - i += 8; - -// printf ("guid found: %016llx%016llx\n", guid_1, guid_2); - - length = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) - | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) - | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) - | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); - - i += 8; - - if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) { - MSG_V ("header object\n"); - } else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) { - MSG_V ("data object\n"); - } else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) { - - packet_length = get_32(header, i+92-24); - - MSG_V ("file object, packet length = %d (%d)\n", - packet_length, get_32(header, i+96-24)); - - - } else if ((guid_1 == 0x6553200cc000e68eULL) && (guid_2 == 0x11cfa9b7b7dc0791ULL)) { - - int stream_id = header[i+48] | header[i+49] << 8; - - MSG_V ("stream object, stream id: %d\n", stream_id); - - if (num_stream_ids < MAX_STREAMS) { - stream_ids[num_stream_ids] = stream_id; - num_stream_ids++; - } else { - MSG_ERR("asf_mmst: too many id, stream skipped"); - } - - } else { - MSG_V ("unknown object\n"); - } - -// printf ("length : %lld\n", length); - - i += length-24; - - } - - return packet_length; - -} - - -static int get_media_packet (Tcp& tcp, int padding, networking_t& stream_ctrl) { - unsigned char pre_header[8]; - unsigned char data[BUF_SIZE]; - - if (!get_data (tcp, pre_header, 8)) { - MSG_ERR ("pre-header read failed\n"); - return 0; - } - -// for (i=0; i<8; i++) -// printf ("pre_header[%d] = %02x (%d)\n", -// i, pre_header[i], pre_header[i]); - - if (pre_header[4] == 0x04) { - - int packet_len; - - packet_len = (pre_header[7] << 8 | pre_header[6]) - 8; - -// printf ("asf media packet detected, len=%d\n", packet_len); - - if (packet_len < 0 || packet_len > BUF_SIZE) { - MSG_FATAL("Invalid rtsp packet size, giving up\n"); - return 0; - } - - if (!get_data (tcp, data, packet_len)) { - MSG_ERR ("media data read failed\n"); - return 0; - } - - networking_bufferize(stream_ctrl, data, padding); - - } else { - - int32_t packet_len; - int command; - - if (!get_data (tcp, (unsigned char*)&packet_len, 4)) { - MSG_ERR ("packet_len read failed\n"); - return 0; - } - - packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4; - - if (packet_len < 0 || packet_len > BUF_SIZE) { - MSG_FATAL("Invalid rtsp packet size, giving up\n"); - return 0; - } - - if (!get_data (tcp, data, packet_len)) { - MSG_ERR ("command data read failed\n"); - return 0; - } - - if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b) - || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) { - - MSG_ERR ("missing signature\n"); - return -1; - } - - command = get_32 (data, 24) & 0xFFFF; - -// printf ("\ncommand packet detected, len=%d cmd=0x%X\n", packet_len, command); - - if (command == 0x1b) - send_command (tcp, 0x1b, 0, 0, 0, data); - else if (command == 0x1e) { - MSG_OK ("everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n"); - return 0; - } - else if (command == 0x21 ) { - // Looks like it's new in WMS9 - // Unknown command, but ignoring it seems to work. - return 0; - } - else if (command != 0x05) { - MSG_ERR ("unknown command %02x\n", command); - return -1; - } - } - -// printf ("get media packet succ\n"); - - return 1; -} - - -static int packet_length1; - -static int asf_mmst_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) -{ - int len; - - while( stream_ctrl.buffer_size==0 ) { - // buffer is empty - fill it! - int ret = get_media_packet(tcp, packet_length1, stream_ctrl); - if( ret<0 ) { - MSG_ERR("get_media_packet error : %s\n",strerror(errno)); - return -1; - } else if (ret==0) //EOF? - return ret; - } - - len = stream_ctrl.buffer_size-stream_ctrl.buffer_pos; - if(len>size) len=size; - memcpy( buffer, (stream_ctrl.buffer)+(stream_ctrl.buffer_pos), len ); - stream_ctrl.buffer_pos += len; - if( stream_ctrl.buffer_pos>=stream_ctrl.buffer_size ) { - delete stream_ctrl.buffer ; - stream_ctrl.buffer = NULL; - stream_ctrl.buffer_size = 0; - stream_ctrl.buffer_pos = 0; - } - return len; - -} - -static int asf_mmst_networking_seek(Tcp& tcp, off_t pos, networking_t& networking ) -{ - UNUSED(tcp); - UNUSED(pos); - UNUSED(networking); - return -1; -} - -MPXP_Rc asf_mmst_networking_start(Tcp& tcp, networking_t& networking) -{ - char str[1024]; - uint8_t data[BUF_SIZE]; - uint8_t asf_header[HDR_BUF_SIZE]; - int asf_header_len; - int len, i, packet_length; - char* path, *unescpath; - URL* url1 = networking.url; - - tcp.close(); - - /* parse url */ - path = strchr(url1->file,'/') + 1; - - /* mmst filename are not url_escaped by MS MediaPlayer and are expected as - * "plain text" by the server, so need to decode it here - */ - unescpath=new char [strlen(path)+1]; - if (!unescpath) { - MSG_FATAL("Memory allocation failed!\n"); - return MPXP_False; - } - url2string(unescpath,path); - path=unescpath; - - if( url1->port==0 ) url1->port=1755; - tcp.open(url1->hostname, url1->port, Tcp::IP4); - if( !tcp.established()) { - delete path; - return MPXP_False; - } - MSG_INFO ("connected\n"); - - seq_num=0; - - /* - * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to. - * This command is sent at the very start of protocol initiation. It sends local information to the serve - * cmd 1 0x01 - * */ - - /* prepare for the url encoding conversion */ -#ifdef USE_ICONV -#ifdef USE_LANGINFO - url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET)); -#else - url_conv = iconv_open("UTF-16LE", NULL); -#endif -#endif - - snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname); - string_utf16 (data, str, strlen(str)); -// send_command(s, commandno ....) - send_command (tcp, 1, 0, 0x0004000b, strlen(str) * 2+2, data); - - len = tcp.read (data, BUF_SIZE); - - /*This sends details of the local machine IP address to a Funnel system at the server. - * Also, the TCP or UDP transport selection is sent. - * - * here 192.168.0.129 is local ip address TCP/UDP states the tronsport we r using - * and 1037 is the local TCP or UDP socket number - * cmd 2 0x02 - * */ - - string_utf16 (&data[8], "\002\000\\\\192.168.0.1\\TCP\\1037", 24); - memset (data, 0, 8); - send_command (tcp, 2, 0, 0, 24*2+10, data); - - len = tcp.read(data, BUF_SIZE); - - /* This command sends file path (at server) and file name request to the server. - * 0x5 */ - - string_utf16 (&data[8], path, strlen(path)); - memset (data, 0, 8); - send_command (tcp, 5, 0, 0, strlen(path)*2+10, data); - delete path; - - get_answer (tcp); - - /* The ASF header chunk request. Includes ?session' variable for pre header value. - * After this command is sent, - * the server replies with 0x11 command and then the header chunk with header data follows. - * 0x15 */ - - memset (data, 0, 40); - data[32] = 2; - - send_command (tcp, 0x15, 1, 0, 40, data); - - num_stream_ids = 0; - /* get_headers(s, asf_header); */ - - asf_header_len = get_header (tcp, asf_header, networking); -// printf("---------------------------------- asf_header %d\n",asf_header); - if (asf_header_len==0) { //error reading header - tcp.close(); - return MPXP_False; - } - packet_length = interp_header (asf_header, asf_header_len); - - /* - * This command is the media stream MBR selector. Switches are always 6 bytes in length. - * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02]. - * Where: - * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files. - * It is not yet understood what all this means. - * And the last [02] byte is probably the header ?session' value. - * - * 0x33 */ - - memset (data, 0, 40); - - if (mp_conf.audio_id > 0) { - data[2] = 0xFF; - data[3] = 0xFF; - data[4] = mp_conf.audio_id; - send_command(tcp, 0x33, num_stream_ids, 0xFFFF | mp_conf.audio_id << 16, 8, data); - } else { - for (i=1; i<num_stream_ids; i++) { - data [ (i-1) * 6 + 2 ] = 0xFF; - data [ (i-1) * 6 + 3 ] = 0xFF; - data [ (i-1) * 6 + 4 ] = stream_ids[i]; - data [ (i-1) * 6 + 5 ] = 0x00; - } - send_command (tcp, 0x33, num_stream_ids, 0xFFFF | stream_ids[0] << 16, (num_stream_ids-1)*6+2 , data); - } - - get_answer (tcp); - - /* Start sending file from packet xx. - * This command is also used for resume downloads or requesting a lost packet. - * Also used for seeking by sending a play point value which seeks to the media time point. - * Includes ?session' value in pre header and the maximum media stream time. - * 0x07 */ - - memset (data, 0, 40); - - for (i=8; i<16; i++) data[i] = 0xFF; - data[20] = 0x04; - - send_command (tcp, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data); - - networking.networking_read = asf_mmst_networking_read; - networking.networking_seek = asf_mmst_networking_seek; - networking.buffering = 1; - networking.status = networking_playing_e; - - packet_length1 = packet_length; - MSG_V("mmst packet_length = %d\n",packet_length); - -#ifdef USE_ICONV - if (url_conv != (iconv_t)(-1)) iconv_close(url_conv); -#endif - return MPXP_Ok; -} Deleted: mplayerxp/libmpstream2/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-17 17:03:47 UTC (rev 570) @@ -1,845 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <limits> - -#include <stdio.h> -#include <limits.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include "mplayerxp.h" -#ifndef HAVE_WINSOCK2 -#define closesocket close -#else -#include <winsock2.h> -#endif - -#include "url.h" -#include "tcp.h" -#include "http.h" - -#include "stream.h" -#include "asf_streaming.h" -#include "libmpdemux/asf.h" -#include "network.h" -#include "stream_msg.h" - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -static inline uint32_t ASF_LOAD_GUID_PREFIX(uint8_t* guid) { return *(uint32_t*)guid; } -#else -static inline uint32_t ASF_LOAD_GUID_PREFIX(uint8_t* guid) { return bswap_32(*(uint32_t*)guid); } -#endif - -// ASF networking support several network protocol. -// One use UDP, not known, yet! -// Another is HTTP, this one is known. -// So for now, we use the HTTP protocol. -// -// We can try several protocol for asf networking -// * first the UDP protcol, if there is a firewall, UDP -// packets will not come back, so the mmsu will failed. -// * Then we can try TCP, but if there is a proxy for -// internet connection, the TCP connection will not get -// through -// * Then we can try HTTP. -// -// Note: MMS/HTTP support is now a "well known" support protocol, -// it has been tested for while, not like MMST support. -// WMP sequence is MMSU then MMST and then HTTP. -// In MPlayer case since HTTP support is more reliable, -// we are doing HTTP first then we try MMST if HTTP fail. -static MPXP_Rc asf_http_networking_start(Tcp& fd, networking_t& networking ); - -/* - ASF networking support several network protocol. - One use UDP, not known, yet! - Another is HTTP, this one is known. - So for now, we use the HTTP protocol. - - We can try several protocol for asf networking - * first the UDP protcol, if there is a firewall, UDP - packets will not come back, so the mmsu will failed. - * Then we can try TCP, but if there is a proxy for - internet connection, the TCP connection will not get - through - * Then we can try HTTP. - - Note: MMS/HTTP support is now a "well known" support protocol, - it has been tested for while, not like MMST support. - WMP sequence is MMSU then MMST and then HTTP. - In MPlayer case since HTTP support is more reliable, - we are doing HTTP first then we try MMST if HTTP fail. -*/ -MPXP_Rc asf_networking_start(Tcp& tcp,networking_t& networking) { - char *proto = networking.url->protocol; - int port = networking.url->port; - MPXP_Rc rc; - - // Is protocol even valid mms,mmsu,mmst,http,http_proxy? - if (!(!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mmsu", 4) || - !strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "mms", 3) || - !strncasecmp(proto, "http", 4))) { - MSG_ERR("Unknown protocol: %s\n", proto ); - return MPXP_False; - } - - // Is protocol mms or mmsu? - if (!strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "mms", 3)) { - MSG_V("Trying ASF/UDP...\n"); - //fd = asf_mmsu_networking_start( stream ); - //mmsu support is not implemented yet - using this code - MSG_V(" ===> ASF/UDP failed\n"); - return MPXP_False; - } - - //Is protocol mms or mmst? - if (!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mms", 3)) { - MSG_V("Trying ASF/TCP...\n"); - rc = asf_mmst_networking_start(tcp,networking); - networking.url->port = port; - if( rc==MPXP_Ok ) return MPXP_Ok; - MSG_V(" ===> ASF/TCP failed\n"); - return MPXP_False; - } - - //Is protocol http, http_proxy, or mms? - if (!strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "http", 4) || - !strncasecmp(proto, "mms", 3)) { - MSG_V("Trying ASF/HTTP...\n"); - rc = asf_http_networking_start(tcp,networking); - networking.url->port = port; - if( rc==MPXP_Ok ) return MPXP_Ok; - MSG_V(" ===> ASF/HTTP failed\n"); - return MPXP_False; - } - //everything failed - return MPXP_False; -} - -static int -asf_networking(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) { - if( drop_packet!=NULL ) *drop_packet = 0; - - if( stream_chunck->size<8 ) { - MSG_ERR("Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size); - return -1; - } - if( stream_chunck->size!=stream_chunck->size_confirm ) { - MSG_ERR("size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm); - return -1; - } - switch(stream_chunck->type) { - case ASF_STREAMING_CLEAR: // $C Clear ASF configuration - MSG_V("=====> Clearing ASF stream configuration!\n"); - if( drop_packet!=NULL ) *drop_packet = 1; - return stream_chunck->size; - break; - case ASF_STREAMING_DATA: // $D Data follows - break; - case ASF_STREAMING_END_TRANS: // $E Transfer complete - MSG_V("=====> Transfer complete\n"); - if( drop_packet!=NULL ) *drop_packet = 1; - return stream_chunck->size; - break; - case ASF_STREAMING_HEADER: // $H ASF header chunk follows - MSG_V("=====> ASF header chunk follows\n"); - break; - default: - MSG_V("=====> Unknown stream type 0x%x\n", stream_chunck->type ); - } - return stream_chunck->size+4; -} - -static const char asf_stream_header_guid[16] = {0x91, 0x07, 0xdc, 0xb7, - 0xb7, 0xa9, 0xcf, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}; -static const char asf_file_header_guid[16] = {0xa1, 0xdc, 0xab, 0x8c, - 0x47, 0xa9, 0xcf, 0x11, 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}; -static const char asf_content_desc_guid[16] = {0x33, 0x26, 0xb2, 0x75, - 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}; -static const char asf_stream_group_guid[16] = {0xce, 0x75, 0xf8, 0x7b, - 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}; -static const char asf_data_chunk_guid[16] = {0x36, 0x26, 0xb2, 0x75, - 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}; -static int find_asf_guid(char *buf, const char *guid, int cur_pos, int buf_len) -{ - int i; - for (i = cur_pos; i < buf_len - 19; i++) { - if (memcmp(&buf[i], guid, 16) == 0) - return i + 16 + 8; // point after guid + length - } - return -1; -} - -static int max_idx(int s_count, int *s_rates, int bound) { - int i, best = -1, rate = -1; - for (i = 0; i < s_count; i++) { - if (s_rates[i] > rate && s_rates[i] <= bound) { - rate = s_rates[i]; - best = i; - } - } - return best; -} - -static MPXP_Rc -asf_networking_parse_header(Tcp& tcp, networking_t& networking) { - ASF_header_t asfh; - ASF_stream_chunck_t chunk; - asf_http_networking_t* asf_ctrl = (asf_http_networking_t*) networking.data; - char* buffer=NULL, *chunk_buffer=NULL; - int i,r,size,pos = 0; - int start; - int buffer_size = 0; - int chunk_size2read = 0; - int bw = networking.bandwidth; - int *v_rates = NULL, *a_rates = NULL; - int v_rate = 0, a_rate = 0, a_idx = -1, v_idx = -1; - - if(asf_ctrl == NULL) return MPXP_False; - - // The ASF header can be in several network chunks. For example if the content description - // is big, the ASF header will be split in 2 network chunk. - // So we need to retrieve all the chunk before starting to parse the header. - do { - for( r=0; r < (int)sizeof(ASF_stream_chunck_t) ; ) { - i = nop_networking_read(tcp,((char*)&chunk)+r,sizeof(ASF_stream_chunck_t) - r,networking); - if(i <= 0) return MPXP_False; - r += i; - } - // Endian handling of the stream chunk - le2me_ASF_stream_chunck_t(&chunk); - size = asf_networking( &chunk, &r) - sizeof(ASF_stream_chunck_t); - if(r) MSG_WARN("Warning : drop header ????\n"); - if(size < 0){ - MSG_ERR("Error while parsing chunk header\n"); - return MPXP_False; - } - if (chunk.type != ASF_STREAMING_HEADER) { - MSG_ERR("Don't got a header as first chunk !!!!\n"); - return MPXP_False; - } - // audit: do not overflow buffer_size - if (size > std::numeric_limits<size_t>::max() - buffer_size) return MPXP_False; - buffer = (char*) mp_malloc(size+buffer_size); - if(buffer == NULL) { - MSG_FATAL("Error can't allocate %d bytes buffer\n",size+buffer_size); - return MPXP_False; - } - if( chunk_buffer!=NULL ) { - memcpy( buffer, chunk_buffer, buffer_size ); - delete chunk_buffer ; - } - chunk_buffer = buffer; - buffer += buffer_size; - buffer_size += size; - - for(r = 0; r < size;) { - i = nop_networking_read(tcp,buffer+r,size-r,networking); - if(i < 0) { - MSG_ERR("Error while reading network stream\n"); - return MPXP_False; - } - r += i; - } - - if( chunk_size2read==0 ) { - if(size < (int)sizeof(asfh)) { - MSG_ERR("Error chunk is too small\n"); - return MPXP_False; - } else MSG_DBG2("Got chunk\n"); - memcpy(&asfh,buffer,sizeof(asfh)); - le2me_ASF_header_t(&asfh); - chunk_size2read = asfh.objh.size; - MSG_DBG2("Size 2 read=%d\n", chunk_size2read); - } - } while( buffer_size<chunk_size2read); - buffer = chunk_buffer; - size = buffer_size; - - if(asfh.cno > 256) { - MSG_ERR("Error sub chunks number is invalid\n"); - return MPXP_False; - } - - start = sizeof(asfh); - - pos = find_asf_guid(buffer, asf_file_header_guid, start, size); - if (pos >= 0) { - ASF_file_header_t *fileh = (ASF_file_header_t *) &buffer[pos]; - pos += sizeof(ASF_file_header_t); - if (pos > size) goto len_err_out; - le2me_ASF_file_header_t(fileh); - asf_ctrl->packet_size = fileh->max_packet_size; - // before playing. - // preroll: time in ms to bufferize before playing - networking.prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); - } - - pos = start; - while ((pos = find_asf_guid(buffer, asf_stream_header_guid, pos, size)) >= 0) { - ASF_stream_header_t *streamh = (ASF_stream_header_t *)&buffer[pos]; - pos += sizeof(ASF_stream_header_t); - if (pos > size) goto len_err_out; - le2me_ASF_stream_header_t(streamh); - switch(ASF_LOAD_GUID_PREFIX(streamh->type)) { - case 0xF8699E40 : // audio stream - if(asf_ctrl->audio_streams == NULL){ - asf_ctrl->audio_streams = (int*)mp_malloc(sizeof(int)); - asf_ctrl->n_audio = 1; - } else { - asf_ctrl->n_audio++; - asf_ctrl->audio_streams = (int*)mp_realloc(asf_ctrl->audio_streams, - asf_ctrl->n_audio*sizeof(int)); - } - asf_ctrl->audio_streams[asf_ctrl->n_audio-1] = streamh->stream_no; - break; - case 0xBC19EFC0 : // video stream - if(asf_ctrl->video_streams == NULL){ - asf_ctrl->video_streams = (int*)mp_malloc(sizeof(int)); - asf_ctrl->n_video = 1; - } else { - asf_ctrl->n_video++; - asf_ctrl->video_streams = (int*)mp_realloc(asf_ctrl->video_streams, - asf_ctrl->n_video*sizeof(int)); - } - asf_ctrl->video_streams[asf_ctrl->n_video-1] = streamh->stream_no; - break; - } - } - - // always allocate to avoid lots of ifs later - v_rates =new(zeromem) int [asf_ctrl->n_video]; - a_rates =new(zeromem) int [asf_ctrl->n_audio]; - - pos = find_asf_guid(buffer, asf_stream_group_guid, start, size); - if (pos >= 0) { - // stream bitrate properties object - int stream_count; - char *ptr = &buffer[pos]; - - MSG_V("Stream bitrate properties object\n"); - stream_count = le2me_16(*(uint16_t*)ptr); - ptr += sizeof(uint16_t); - if (ptr > &buffer[size]) goto len_err_out; - MSG_V(" stream count=[0x%x][%u]\n",stream_count, stream_count ); - for( i=0 ; i<stream_count ; i++ ) { - uint32_t rate; - int id; - int j; - id = le2me_16(*(uint16_t*)ptr); - ptr += sizeof(uint16_t); - if (ptr > &buffer[size]) goto len_err_out; - memcpy(&rate, ptr, sizeof(uint32_t));// workaround unaligment bug on sparc - ptr += sizeof(uint32_t); - if (ptr > &buffer[size]) goto len_err_out; - rate = le2me_32(rate); - MSG_V(" stream id=[0x%x][%u]\n", id, id); - MSG_V(" max bitrate=[0x%x][%u]\n", rate, rate); - for (j = 0; j < asf_ctrl->n_video; j++) { - if (id == asf_ctrl->video_streams[j]) { - MSG_V(" is video stream\n"); - v_rates[j] = rate; - break; - } - } - for (j = 0; j < asf_ctrl->n_audio; j++) { - if (id == asf_ctrl->audio_streams[j]) { - MSG_V( " is audio stream\n"); - a_rates[j] = rate; - break; - } - } - } - } - delete buffer; - - // automatic stream selection based on bandwidth - if (bw == 0) bw = INT_MAX; - MSG_V( "Max bandwidth set to %d\n", bw); - - if (asf_ctrl->n_audio) { - // find lowest-bitrate audio stream - a_rate = a_rates[0]; - a_idx = 0; - for (i = 0; i < asf_ctrl->n_audio; i++) { - if (a_rates[i] < a_rate) { - a_rate = a_rates[i]; - a_idx = i; - } - } - if (max_idx(asf_ctrl->n_video, v_rates, bw - a_rate) < 0) { - // both audio and video are not possible, try video only next - a_idx = -1; - a_rate = 0; - } - } - // find best video stream - v_idx = max_idx(asf_ctrl->n_video, v_rates, bw - a_rate); - if (v_idx >= 0) v_rate = v_rates[v_idx]; - // find best audio stream - a_idx = max_idx(asf_ctrl->n_audio, a_rates, bw - v_rate); - - delete v_rates; - delete a_rates; - - if (a_idx < 0 && v_idx < 0) { - MSG_FATAL( "bandwidth too small, file cannot be played!\n"); - return MPXP_False; - } - - // a audio stream was forced - if (mp_conf.audio_id > 0) asf_ctrl->audio_id = mp_conf.audio_id; - else if (a_idx >= 0) asf_ctrl->audio_id = asf_ctrl->audio_streams[a_idx]; - else if (asf_ctrl->n_audio) { - MSG_WARN( "bandwidth too small, deselected audio stream\n"); - mp_conf.audio_id = -2; - } - - // a video stream was forced - if (mp_conf.video_id > 0) asf_ctrl->video_id = mp_conf.video_id; - else if (v_idx >= 0) asf_ctrl->video_id = asf_ctrl->video_streams[v_idx]; - else if (asf_ctrl->n_video) { - MSG_WARN( "bandwidth too small, deselected video stream\n"); - mp_conf.video_id = -2; - } - return MPXP_Ok; - -len_err_out: - MSG_FATAL( "Invalid length in ASF header!\n"); - if (buffer) delete buffer; - if (v_rates) delete v_rates; - if (a_rates) delete a_rates; - return MPXP_False; -} - -static int -asf_http_networking_read( Tcp& tcp, char *buffer, int size, networking_t& networking ) { - static ASF_stream_chunck_t chunk; - int read,chunk_size = 0; - static int rest = 0, drop_chunk = 0, waiting = 0; - asf_http_networking_t* asf_http_ctrl = (asf_http_networking_t*)networking.data; - - while(1) { - if (rest == 0 && waiting == 0) { - read = 0; - while(read < (int)sizeof(ASF_stream_chunck_t)){ - int r = nop_networking_read( tcp, ((char*)&chunk) + read, - sizeof(ASF_stream_chunck_t)-read, - networking ); - if(r <= 0){ - if( r < 0) - MSG_ERR("Error while reading chunk header\n"); - return -1; - } - read += r; - } - - // Endian handling of the stream chunk - le2me_ASF_stream_chunck_t(&chunk); - chunk_size = asf_networking( &chunk, &drop_chunk ); - if(chunk_size < 0) { - MSG_ERR("Error while parsing chunk header\n"); - return -1; - } - chunk_size -= sizeof(ASF_stream_chunck_t); - - if(chunk.type != ASF_STREAMING_HEADER && (!drop_chunk)) { - if (asf_http_ctrl->packet_size < chunk_size) { - MSG_ERR("Error chunk_size > packet_size\n"); - return -1; - } - waiting = asf_http_ctrl->packet_size; - } else { - waiting = chunk_size; - } - - } else if (rest){ - chunk_size = rest; - rest = 0; - } - - read = 0; - if ( waiting >= chunk_size) { - if (chunk_size > size){ - rest = chunk_size - size; - chunk_size = size; - } - while(read < chunk_size) { - int got = nop_networking_read( tcp,buffer+read,chunk_size-read,networking ); - if(got <= 0) { - if(got < 0) - MSG_ERR("Error while reading chunk\n"); - return -1; - } - read += got; - } - waiting -= read; - if (drop_chunk) continue; - } - if (rest == 0 && waiting > 0 && size-read > 0) { - int s = MIN(waiting,size-read); - memset(buffer+read,0,s); - waiting -= s; - read += s; - } - break; - } - - return read; -} - -static int -asf_http_networking_seek( Tcp& tcp, off_t pos, networking_t& networking ) { - UNUSED(tcp); - UNUSED(pos); - UNUSED(networking); - return -1; -} - -static int -asf_header_check( HTTP_Header& http_hdr ) { - ASF_obj_header_t *objh; - if( http_hdr.get_body()==NULL || http_hdr.get_body_size()<sizeof(ASF_obj_header_t) ) return -1; - - objh = (ASF_obj_header_t*)http_hdr.get_body(); - if( ASF_LOAD_GUID_PREFIX(objh->guid)==0x75B22630 ) return 0; - return -1; -} - -static ASF_StreamType_e -asf_http_networking_type(const char *content_type,const char *features, HTTP_Header& http_hdr ) { - if( content_type==NULL ) return ASF_Unknown_e; - if( !strcasecmp(content_type, "application/octet-stream") || - !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request - !strcasecmp(content_type, "application/x-mms-framed") || // New in Corana, second request - !strcasecmp(content_type, "video/x-ms-asf")) { - - if( strstr(features, "broadcast") ) { - MSG_V("=====> ASF Live stream\n"); - return ASF_Live_e; - } else { - MSG_V("=====> ASF Prerecorded\n"); - return ASF_Prerecorded_e; - } - } else { - // Ok in a perfect world, web servers should be well configured - // so we could used mime type to know the stream type, - // but guess what? All of them are not well configured. - // So we have to check for an asf header :(, but it works :p - if( http_hdr.get_body_size()>sizeof(ASF_obj_header_t) ) { - if( asf_header_check( http_hdr )==0 ) { - MSG_V("=====> ASF Plain text\n"); - return ASF_PlainText_e; - } else if( (!strcasecmp(content_type, "text/html")) ) { - MSG_V("=====> HTML, mplayer is not a browser...yet!\n"); - return ASF_Unknown_e; - } else { - MSG_V("=====> ASF Redirector\n"); - return ASF_Redirector_e; - } - } else { - if( (!strcasecmp(content_type, "audio/x-ms-wax")) || - (!strcasecmp(content_type, "audio/x-ms-wma")) || - (!strcasecmp(content_type, "video/x-ms-asf")) || - (!strcasecmp(content_type, "video/x-ms-afs")) || - (!strcasecmp(content_type, "video/x-ms-wvx")) || - (!strcasecmp(content_type, "video/x-ms-wmv")) || - (!strcasecmp(content_type, "video/x-ms-wma")) ) { - MSG_ERR("=====> ASF Redirector\n"); - return ASF_Redirector_e; - } else if( !strcasecmp(content_type, "text/plain") ) { - MSG_V("=====> ASF Plain text\n"); - return ASF_PlainText_e; - } else { - MSG_V("=====> ASF unknown content-type: %s\n", content_type ); - return ASF_Unknown_e; - } - } - } - return ASF_Unknown_e; -} - -static HTTP_Header* asf_http_request(networking_t& networking) { - HTTP_Header* http_hdr = new(zeromem) HTTP_Header; - URL *url = NULL; - URL *server_url = NULL; - asf_http_networking_t* asf_http_ctrl; - char str[250]; - char *ptr; - int i, enable; - - int offset_hi=0, offset_lo=0, length=0; - int asf_nb_stream=0, stream_id; - - // Sanity check - url = networking.url; - asf_http_ctrl = (asf_http_networking_t*)networking.data; - if( url==NULL || asf_http_ctrl==NULL ) return NULL; - - // Common header for all requests. - http_hdr->set_field("Accept: */*" ); - http_hdr->set_field("User-Agent: NSPlayer/4.1.0.3856" ); - http_hdr->add_basic_authentication(url->username?url->username:"", url->password?url->password:"" ); - - // Check if we are using a proxy - if( !strcasecmp( url->protocol, "http_proxy" ) ) { - server_url = url_new( (url->file)+1 ); - if( server_url==NULL ) { - MSG_ERR("Invalid proxy URL\n"); - delete http_hdr; - return NULL; - } - http_hdr->set_uri(server_url->url ); - sprintf( str, "Host: %.220s:%d", server_url->hostname, server_url->port ); - delete server_url; - } else { - http_hdr->set_uri(url->file ); - sprintf( str, "Host: %.220s:%d", url->hostname, url->port ); - } - - http_hdr->set_field(str ); - http_hdr->set_field("Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); - sprintf(str, - "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u", - offset_hi, offset_lo, asf_http_ctrl->request, length ); - http_hdr->set_field( str ); - - switch( asf_http_ctrl->networking_type ) { - case ASF_Live_e: - case ASF_Prerecorded_e: - http_hdr->set_field("Pragma: xPlayStrm=1" ); - ptr = str; - ptr += sprintf( ptr, "Pragma: stream-switch-entry="); - if(asf_http_ctrl->n_audio > 0) { - for( i=0; i<asf_http_ctrl->n_audio ; i++ ) { - stream_id = asf_http_ctrl->audio_streams[i]; - if(stream_id == asf_http_ctrl->audio_id) { - enable = 0; - } else { - enable = 2; - continue; - } - asf_nb_stream++; - ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); - } - } - if(asf_http_ctrl->n_video > 0) { - for( i=0; i<asf_http_ctrl->n_video ; i++ ) { - stream_id = asf_http_ctrl->video_streams[i]; - if(stream_id == asf_http_ctrl->video_id) { - enable = 0; - } else { - enable = 2; - continue; - } - asf_nb_stream++; - ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); - } - } - http_hdr->set_field(str ); - sprintf( str, "Pragma: stream-switch-count=%d", asf_nb_stream ); - http_hdr->set_field( str ); - break; - case ASF_Redirector_e: - break; - case ASF_Unknown_e: - // First request goes here. - break; - default: - MSG_ERR("Unknown asf stream type\n"); - } - - http_hdr->set_field("Connection: Close" ); - http_hdr->build_request( ); - - return http_hdr; -} - -static int -asf_http_parse_response(asf_http_networking_t& asf_http_ctrl, HTTP_Header& http_hdr ) { - const char *content_type, *pragma; - char features[64] = "\0"; - size_t len; - if( http_hdr.response_parse()<0 ) { - MSG_ERR("Failed to parse HTTP response\n"); - return -1; - } - switch( http_hdr.get_status()) { - case 200: - break; - case 401: // Authentication required - return ASF_Authenticate_e; - default: - MSG_ERR("Server return %d:%s\n", http_hdr.get_status(), http_hdr.get_reason_phrase()); - return -1; - } - - content_type = http_hdr.get_field("Content-Type"); - - pragma = http_hdr.get_field("Pragma"); - while( pragma!=NULL ) { - const char *comma_ptr=NULL; - const char *end; - // The pragma line can get severals attributes - // separeted with a comma ','. - do { - if( !strncasecmp( pragma, "features=", 9) ) { - pragma += 9; - end = strstr( pragma, "," ); - if( end==NULL ) { - size_t s = strlen(pragma); - if(s > sizeof(features)) { - MSG_WARN("ASF HTTP PARSE WARNING : Pragma %s cuted from %d bytes to %d\n",pragma,s,sizeof(features)); - len = sizeof(features); - } else { - len = s; - } - } else { - len = MIN((unsigned int)(end-pragma),sizeof(features)); - } - strncpy( features, pragma, len ); - features[len]='\0'; - break; - } - comma_ptr = strstr( pragma, "," ); - if( comma_ptr!=NULL ) { - pragma = comma_ptr+1; - if( pragma[0]==' ' ) pragma++; - } - } while( comma_ptr!=NULL ); - pragma = http_hdr.get_next_field(); - } - asf_http_ctrl.networking_type = asf_http_networking_type( content_type, features, http_hdr ); - return 0; -} - -static MPXP_Rc asf_http_networking_start(Tcp& tcp, networking_t& networking) { - HTTP_Header *http_hdr=NULL; - URL *url = networking.url; - asf_http_networking_t* asf_http_ctrl; - uint8_t buffer[BUFFER_SIZE]; - int i, ret; - int done; - int auth_retry = 0; - - asf_http_ctrl = new(zeromem) asf_http_networking_t; - if( asf_http_ctrl==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return MPXP_False; - } - asf_http_ctrl->networking_type = ASF_Unknown_e; - asf_http_ctrl->request = 1; - asf_http_ctrl->audio_streams = asf_http_ctrl->video_streams = NULL; - asf_http_ctrl->n_audio = asf_http_ctrl->n_video = 0; - networking.data = asf_http_ctrl; - - do { - done = 1; - tcp.close(); - - if( !strcasecmp( url->protocol, "http_proxy" ) ) { - if( url->port==0 ) url->port = 8080; - } else { - if( url->port==0 ) url->port = 80; - } - tcp.open(url->hostname, url->port, Tcp::IP4); - if( !tcp.established()) return MPXP_False; - - http_hdr = asf_http_request( networking ); - MSG_DBG2("Request [%s]\n", http_hdr->get_buffer() ); - for(i=0; i < (int)http_hdr->get_buffer_size() ; ) { - int r = tcp.write((uint8_t*)(http_hdr->get_buffer()+i), http_hdr->get_buffer_size()-i); - if(r<0) { - MSG_ERR("Socket write error : %s\n",strerror(errno)); - return MPXP_False; - } - i += r; - } - delete http_hdr; - http_hdr = new(zeromem) HTTP_Header; - do { - i = tcp.read(buffer, BUFFER_SIZE); - if( i<=0 ) { - perror("read"); - delete http_hdr; - return MPXP_False; - } - http_hdr->response_append(buffer,i); - } while( !http_hdr->is_header_entire()); - if( mp_conf.verbose>0 ) { - MSG_DBG2("Response [%s]\n", http_hdr->get_buffer() ); - } - ret = asf_http_parse_response(*asf_http_ctrl, *http_hdr); - if( ret<0 ) { - MSG_ERR("Failed to parse header\n"); - delete http_hdr; - return MPXP_False; - } - switch( asf_http_ctrl->networking_type ) { - case ASF_Live_e: - case ASF_Prerecorded_e: - case ASF_PlainText_e: - if( http_hdr->get_body_size()>0 ) { - if( networking_bufferize( networking, (unsigned char *)(http_hdr->get_body()), http_hdr->get_body_size())<0 ) { - delete http_hdr; - return MPXP_False; - } - } - if( asf_http_ctrl->request==1 ) { - if( asf_http_ctrl->networking_type!=ASF_PlainText_e ) { - // First request, we only got the ASF header. - ret = asf_networking_parse_header(tcp,networking); - if(ret < 0) return MPXP_False; - if(asf_http_ctrl->n_audio == 0 && asf_http_ctrl->n_video == 0) { - MSG_ERR("No stream found\n"); - return MPXP_False; - } - asf_http_ctrl->request++; - done = 0; - } else done = 1; - } - break; - case ASF_Redirector_e: - if( http_hdr->get_body_size()>0 ) { - if( networking_bufferize( networking, (unsigned char*)http_hdr->get_body(), http_hdr->get_body_size())<0 ) { - delete http_hdr; - return MPXP_False; - } - } -// type |= STREAMTYPE_TEXT; - done = 1; - break; - case ASF_Authenticate_e: - if( http_authenticate( *http_hdr, url, &auth_retry)<0 ) return MPXP_False; - asf_http_ctrl->networking_type = ASF_Unknown_e; - done = 0; - break; - case ASF_Unknown_e: - default: - MSG_ERR("Unknown ASF networking type\n"); - tcp.close(); - delete http_hdr; - return MPXP_False; - } - // Check if we got a redirect. - } while(!done); - - if( asf_http_ctrl->networking_type==ASF_PlainText_e || asf_http_ctrl->networking_type==ASF_Redirector_e ) { - networking.networking_read = nop_networking_read; - networking.networking_seek = nop_networking_seek; - } else { - networking.networking_read = asf_http_networking_read; - networking.networking_seek = asf_http_networking_seek; - networking.buffering = 1; - } - networking.status = networking_playing_e; - - delete http_hdr; - return MPXP_Ok; -} - -asf_http_networking_t::asf_http_networking_t() {} -asf_http_networking_t::~asf_http_networking_t() {} \ No newline at end of file Deleted: mplayerxp/libmpstream2/asf_streaming.h =================================================================== --- mplayerxp/libmpstream2/asf_streaming.h 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/asf_streaming.h 2012-12-17 17:03:47 UTC (rev 570) @@ -1,39 +0,0 @@ -#ifndef __ASF_STEAMING_H_INCLUDED -#define __ASF_STEAMING_H_INCLUDED 1 -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; - -#include "stream.h" - -struct networking_t; -namespace mpxp { - class Tcp; -} - -// Definition of the differents type of ASF streaming -enum ASF_StreamType_e { - ASF_Unknown_e, - ASF_Live_e, - ASF_Prerecorded_e, - ASF_Redirector_e, - ASF_PlainText_e, - ASF_Authenticate_e -}; - -struct asf_http_networking_t : public Opaque { - public: - asf_http_networking_t(); - virtual ~asf_http_networking_t(); - - ASF_StreamType_e networking_type; - int request; - int packet_size; - int *audio_streams,n_audio,*video_streams,n_video; - int audio_id, video_id; -}; - -extern MPXP_Rc asf_networking_start(Tcp& fd, networking_t& networking); -extern MPXP_Rc asf_mmst_networking_start(Tcp& fd, networking_t& networking); - -#endif Modified: mplayerxp/libmpstream2/http.cpp =================================================================== --- mplayerxp/libmpstream2/http.cpp 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/http.cpp 2012-12-17 17:03:47 UTC (rev 570) @@ -16,7 +16,9 @@ #include "http.h" #include "url.h" +#include "help_mp.h" #include "stream_msg.h" +#include "network.h" namespace mpxp { HTTP_Header::HTTP_Header() {} @@ -300,6 +302,57 @@ MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); } +int HTTP_Header::authenticate(URL *url, int *auth_retry) { + const char *aut; + + if( *auth_retry==1 ) { + MSG_ERR(MSGTR_ConnAuthFailed); + return -1; + } + if( *auth_retry>0 ) { + if( url->username ) { + delete url->username ; + url->username = NULL; + } + if( url->password ) { + delete url->password ; + url->password = NULL; + } + } + + aut = get_field("WWW-Authenticate"); + if( aut!=NULL ) { + const char *aut_space; + aut_space = strstr(aut, "realm="); + if( aut_space!=NULL ) aut_space += 6; + MSG_INFO("Authentication required for %s\n", aut_space); + } else { + MSG_INFO("Authentication required\n"); + } + if( net_conf.username ) { + url->username = mp_strdup(net_conf.username); + if( url->username==NULL ) { + MSG_FATAL(MSGTR_OutOfMemory); + return -1; + } + } else { + MSG_ERR(MSGTR_ConnAuthFailed); + return -1; + } + if( net_conf.password ) { + url->password = mp_strdup(net_conf.password); + if( url->password==NULL ) { + MSG_FATAL(MSGTR_OutOfMemory); + return -1; + } + } else { + MSG_INFO("No password provided, trying blank password\n"); + } + (*auth_retry)++; + return 0; +} + + int base64_encode(const any_t*enc, int encLen, char *out, int outMax) { static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; Modified: mplayerxp/libmpstream2/http.h =================================================================== --- mplayerxp/libmpstream2/http.h 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/http.h 2012-12-17 17:03:47 UTC (rev 570) @@ -12,6 +12,8 @@ #include <vector> #include <stdint.h> +#include "url.h" + namespace mpxp { class HTTP_Header : public Opaque { public: @@ -28,6 +30,7 @@ virtual void set_method(const std::string& method ); virtual void set_uri(const std::string& uri ); virtual int add_basic_authentication(const std::string& username, const std::string& password ); + virtual int authenticate(URL *url, int *auth_retry); virtual void debug_hdr(); virtual void cookies_set(const std::string& hostname, const std::string& url); Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-17 12:05:45 UTC (rev 569) +++ mplayerxp/libmpstream2/network.cpp 2012-12-17 17:03:47 UTC (rev 570) @@ -19,7 +19,13 @@ #include <ctype.h> #include "mplayerxp.h" -#include "asf_streaming.h" +#include "network_asf.h" +#include "network_asf_mmst.h" +#include "network_nop.h" +#include "network_pnm.h" +#include "network_real_rtsp.h" +#include "network_rtp.h" +#include "network_rtsp.h" #ifndef HAVE_WINSOCK2 #define closesocket close #else @@ -27,8 +33,8 @@ #include <ws2tcpip.h> #endif -#include "stream.h" #include "libmpconf/cfgparser.h" +#include "stream.h" #include "help_mp.h" #include "tcp.h" @@ -37,14 +43,10 @@ #include "cookies.h" #include "url.h" #include "udp.h" -#include "pnm.h" -#ifndef STREAMING_LIVE_DOT_COM -#include "rtp.h" -#endif -#include "librtsp/rtsp_session.h" #include "version.h" #include "stream_msg.h" +namespace mpxp { /* Variables for the command line option -user, -passwd & -bandwidth */ net_config_t::net_config_t() :username(NULL), @@ -60,19 +62,6 @@ net_config_t::~net_config_t() {} net_config_t net_conf; -networking_t* new_networking() { - networking_t* networking = new(zeromem) networking_t; - networking->mime="application/octet-stream"; - return networking; -} - -void free_networking( networking_t& networking ) { - if( networking.url ) delete networking.url; - if( networking.buffer ) delete networking.buffer ; - if( networking.data ) delete networking.data ; - delete &networking; -} - URL* check4proxies( URL *url ) { URL *url_out = NULL; @@ -225,58 +214,7 @@ return http_hdr; } -int -http_authenticate(HTTP_Header& http_hdr, URL *url, int *auth_retry) { - const char *aut; - - if( *auth_retry==1 ) { - MSG_ERR(MSGTR_ConnAuthFailed); - return -1; - } - if( *auth_retry>0 ) { - if( url->username ) { - delete url->username ; - url->username = NULL; - } - if( url->password ) { - delete url->password ; - url->password = NULL; - } - } - - aut = http_hdr.get_field("WWW-Authenticate"); - if( aut!=NULL ) { - const char *aut_space; - aut_space = strstr(aut, "realm="); - if( aut_space!=NULL ) aut_space += 6; - MSG_INFO("Authentication required for %s\n", aut_space); - } else { - MSG_INFO("Authentication required\n"); - } - if( net_conf.username ) { - url->username = mp_strdup(net_conf.username); - if( url->username==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return -1; - } - } else { - MSG_ERR(MSGTR_ConnAuthFailed); - return -1; - } - if( net_conf.password ) { - url->password = mp_strdup(net_conf.password); - if( url->password==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return -1; - } - } else { - MSG_INFO("No password provided, trying blank password\n"); - } - (*auth_retry)++; - return 0; -} - -off_t http_seek(Tcp& tcp, networking_t& networking, off_t pos ) { +off_t http_seek(Tcp& tcp, Networking& networking, off_t pos ) { HTTP_Header* http_hdr = NULL; tcp.close(); @@ -292,7 +230,7 @@ MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); if( http_hdr->get_body_size()>0 ) { - if( networking_bufferize( networking, (unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { + if( networking.bufferize((unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; return 0; } @@ -311,9 +249,18 @@ return pos; } +Networking::Networking() + :mime("application/octet-stream") {} + +Networking::~Networking() { + if( url ) delete url; + if( buffer ) delete buffer ; + if( data ) delete data ; +} + // By using the protocol, the extension of the file or the content-type // we might be able to guess the networking type. -static MPXP_Rc autodetectProtocol(networking_t& networking, Tcp& tcp) { +MPXP_Rc Networking::autodetectProtocol(network_protocol_t& networking, Tcp& tcp) { HTTP_Header *http_hdr=NULL; int redirect; int auth_retry=0; @@ -432,7 +379,7 @@ } break; case 401: // Authentication required - if( http_authenticate(*http_hdr,url, &auth_retry)<0 ) goto err_out; + if( http_hdr->authenticate(url, &auth_retry)<0 ) goto err_out; redirect = 1; break; default: @@ -450,301 +397,72 @@ return MPXP_False; } -int -networking_bufferize( networking_t& networking,unsigned char *buffer, int size) { +int Networking::bufferize(unsigned char *_buffer, int size) { //printf("networking_bufferize\n"); - networking.buffer = new char [size]; - if( networking.buffer==NULL ) { + buffer = new char [size]; + if( buffer==NULL ) { MSG_FATAL(MSGTR_OutOfMemory); return -1; } - memcpy( networking.buffer, buffer, size ); - networking.buffer_size = size; + memcpy( buffer, _buffer, size ); + buffer_size = size; return size; } -int -nop_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) { - int len=0; -//printf("nop_networking_read\n"); - if( stream_ctrl.buffer_size!=0 ) { - int buffer_len = stream_ctrl.buffer_size-stream_ctrl.buffer_pos; -//printf("%d bytes in buffer\n", stream_ctrl.buffer_size); - len = (size<buffer_len)?size:buffer_len; - memcpy( buffer, (stream_ctrl.buffer)+(stream_ctrl.buffer_pos), len ); - stream_ctrl.buffer_pos += len; -//printf("buffer_pos = %d\n", stream_ctrl.buffer_pos ); - if( stream_ctrl.buffer_pos>=stream_ctrl.buffer_size ) { - delete stream_ctrl.buffer ; - stream_ctrl.buffer = NULL; - stream_ctrl.buffer_size = 0; - stream_ctrl.buffer_pos = 0; -//printf("buffer cleaned\n"); - } -//printf("read %d bytes from buffer\n", len ); - } - if( len<size ) { - int ret; - ret = tcp.read((uint8_t*)(buffer+len), size-len); - if( ret<0 ) { - MSG_ERR("nop_networking_read error : %s\n",strerror(errno)); - } - len += ret; -//printf("read %d bytes from network\n", len ); - } - return len; -} - -int -nop_networking_seek(Tcp& tcp, off_t pos, networking_t& n ) { - UNUSED(tcp); - UNUSED(pos); - UNUSED(n); - return -1; -} - -MPXP_Rc nop_networking_start(Tcp& tcp,networking_t& networking ) { - HTTP_Header *http_hdr = NULL; - const char *next_url=NULL; - URL *rd_url=NULL; - MPXP_Rc ret; - - if( !tcp.established() ) { - http_send_request(tcp, networking.url,0); - if( !tcp.established() ) return MPXP_False; - http_hdr = http_read_response(tcp); - if( http_hdr==NULL ) return MPXP_False; - - switch( http_hdr->get_status() ) { - case 200: // OK - MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); - MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); - if( http_hdr->get_body_size()>0 ) { - if( networking_bufferize( networking, (unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { - delete http_hdr; - return MPXP_False; - } - } - break; - // Redirect - case 301: // Permanently - case 302: // Temporarily - ret=MPXP_False; - next_url = http_hdr->get_field("Location" ); - - if (next_url != NULL) - rd_url=url_new(next_url); - - if (next_url != NULL && rd_url != NULL) { - MSG_STATUS("Redirected: Using this url instead %s\n",next_url); - networking.url=check4proxies(rd_url); - ret=nop_networking_start(tcp,networking); //recursively get networking started - } else { - MSG_ERR("Redirection failed\n"); - tcp.close(); - } - return ret; - break; - case 401: //Authorization required - case 403: //Forbidden - case 404: //Not found - case 500: //Server Error - default: - MSG_ERR("Server return %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); - tcp.close(); - return MPXP_False; - break; - } - } else { - http_hdr = (HTTP_Header*)networking.data; - if( http_hdr->get_body_size()>0 ) { - if( networking_bufferize( networking, (unsigned char*)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { - delete http_hdr; - networking.data = NULL; - return MPXP_False; - } - } - } - - if( http_hdr ) { - delete http_hdr; - networking.data = NULL; - } - - networking.networking_read = nop_networking_read; - networking.networking_seek = nop_networking_seek; - networking.prebuffer_size = 64*1024; // KBytes - networking.buffering = 1; - networking.status = networking_playing_e; - return MPXP_Ok; -} - -void fixup_network_stream_cache(networking_t& networking) { - if(networking.buffering) { +void Networking::fixup_cache() { + if(buffering) { if(mp_conf.s_cache_size<0) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. - mp_conf.s_cache_size = (networking.prebuffer_size/1024)*5; + mp_conf.s_cache_size = (prebuffer_size/1024)*5; if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } MSG_INFO("[network] cache size set to: %i\n", mp_conf.s_cache_size); } } -int -pnm_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) { - Pnm& pnm=*static_cast<Pnm*>(stream_ctrl.data); - UNUSED(tcp); - return pnm.read(buffer, size); -} +Networking* Networking::start(Tcp& tcp, URL *_url) { + Networking* rc; + network_protocol_t net_protocol; + URL* url = check4proxies( _url ); -MPXP_Rc pnm_networking_start(Tcp& tcp,networking_t& networking ) { - Pnm* pnm = new(zeromem) Pnm(tcp); + net_protocol.url=url; - tcp.open(networking.url->hostname, - networking.url->port ? networking.url->port : 7070); - if(!tcp.established()) return MPXP_False; + if( autodetectProtocol(net_protocol,tcp)!=MPXP_Ok ) return NULL; + rc = NULL; + url=net_protocol.url; - if(pnm->connect(networking.url->file)!=MPXP_Ok) { - delete pnm; - return MPXP_NA; - } - networking.data=pnm; - networking.networking_read = pnm_networking_read; - networking.prebuffer_size = 8*1024; // 8 KBytes - networking.buffering = 1; - networking.status = networking_playing_e; - return MPXP_Ok; -} - -int -realrts... [truncated message content] |
From: <nic...@us...> - 2012-12-17 12:05:54
|
Revision: 569 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=569&view=rev Author: nickols_k Date: 2012-12-17 12:05:45 +0000 (Mon, 17 Dec 2012) Log Message: ----------- use references instead of pointers Modified Paths: -------------- mplayerxp/libmpstream2/asf_mmst_streaming.cpp mplayerxp/libmpstream2/asf_streaming.cpp mplayerxp/libmpstream2/asf_streaming.h mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/s_network.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/stream.h Modified: mplayerxp/libmpstream2/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream2/asf_mmst_streaming.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/asf_mmst_streaming.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -204,7 +204,7 @@ } -static int get_header (Tcp& tcp, uint8_t *header, networking_t *networking) +static int get_header (Tcp& tcp, uint8_t *header, networking_t& networking) { unsigned char pre_header[8]; int header_len; @@ -362,7 +362,7 @@ } -static int get_media_packet (Tcp& tcp, int padding, networking_t *stream_ctrl) { +static int get_media_packet (Tcp& tcp, int padding, networking_t& stream_ctrl) { unsigned char pre_header[8]; unsigned char data[BUF_SIZE]; @@ -453,11 +453,11 @@ static int packet_length1; -static int asf_mmst_networking_read(Tcp& tcp, char *buffer, int size, networking_t *stream_ctrl ) +static int asf_mmst_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) { int len; - while( stream_ctrl->buffer_size==0 ) { + while( stream_ctrl.buffer_size==0 ) { // buffer is empty - fill it! int ret = get_media_packet(tcp, packet_length1, stream_ctrl); if( ret<0 ) { @@ -467,21 +467,21 @@ return ret; } - len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos; + len = stream_ctrl.buffer_size-stream_ctrl.buffer_pos; if(len>size) len=size; - memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len ); - stream_ctrl->buffer_pos += len; - if( stream_ctrl->buffer_pos>=stream_ctrl->buffer_size ) { - delete stream_ctrl->buffer ; - stream_ctrl->buffer = NULL; - stream_ctrl->buffer_size = 0; - stream_ctrl->buffer_pos = 0; + memcpy( buffer, (stream_ctrl.buffer)+(stream_ctrl.buffer_pos), len ); + stream_ctrl.buffer_pos += len; + if( stream_ctrl.buffer_pos>=stream_ctrl.buffer_size ) { + delete stream_ctrl.buffer ; + stream_ctrl.buffer = NULL; + stream_ctrl.buffer_size = 0; + stream_ctrl.buffer_pos = 0; } return len; } -static int asf_mmst_networking_seek(Tcp& tcp, off_t pos, networking_t *networking ) +static int asf_mmst_networking_seek(Tcp& tcp, off_t pos, networking_t& networking ) { UNUSED(tcp); UNUSED(pos); @@ -489,7 +489,7 @@ return -1; } -MPXP_Rc asf_mmst_networking_start(Tcp& tcp, networking_t *networking) +MPXP_Rc asf_mmst_networking_start(Tcp& tcp, networking_t& networking) { char str[1024]; uint8_t data[BUF_SIZE]; @@ -497,7 +497,7 @@ int asf_header_len; int len, i, packet_length; char* path, *unescpath; - URL* url1 = networking->url; + URL* url1 = networking.url; tcp.close(); @@ -634,10 +634,10 @@ send_command (tcp, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data); - networking->networking_read = asf_mmst_networking_read; - networking->networking_seek = asf_mmst_networking_seek; - networking->buffering = 1; - networking->status = networking_playing_e; + networking.networking_read = asf_mmst_networking_read; + networking.networking_seek = asf_mmst_networking_seek; + networking.buffering = 1; + networking.status = networking_playing_e; packet_length1 = packet_length; MSG_V("mmst packet_length = %d\n",packet_length); Modified: mplayerxp/libmpstream2/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -51,7 +51,7 @@ // WMP sequence is MMSU then MMST and then HTTP. // In MPlayer case since HTTP support is more reliable, // we are doing HTTP first then we try MMST if HTTP fail. -static MPXP_Rc asf_http_networking_start(Tcp& fd, networking_t *networking ); +static MPXP_Rc asf_http_networking_start(Tcp& fd, networking_t& networking ); /* ASF networking support several network protocol. @@ -73,9 +73,9 @@ In MPlayer case since HTTP support is more reliable, we are doing HTTP first then we try MMST if HTTP fail. */ -MPXP_Rc asf_networking_start(Tcp& tcp, networking_t *networking) { - char *proto = networking->url->protocol; - int port = networking->url->port; +MPXP_Rc asf_networking_start(Tcp& tcp,networking_t& networking) { + char *proto = networking.url->protocol; + int port = networking.url->port; MPXP_Rc rc; // Is protocol even valid mms,mmsu,mmst,http,http_proxy? @@ -99,7 +99,7 @@ if (!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mms", 3)) { MSG_V("Trying ASF/TCP...\n"); rc = asf_mmst_networking_start(tcp,networking); - networking->url->port = port; + networking.url->port = port; if( rc==MPXP_Ok ) return MPXP_Ok; MSG_V(" ===> ASF/TCP failed\n"); return MPXP_False; @@ -110,7 +110,7 @@ !strncasecmp(proto, "mms", 3)) { MSG_V("Trying ASF/HTTP...\n"); rc = asf_http_networking_start(tcp,networking); - networking->url->port = port; + networking.url->port = port; if( rc==MPXP_Ok ) return MPXP_Ok; MSG_V(" ===> ASF/HTTP failed\n"); return MPXP_False; @@ -185,16 +185,16 @@ } static MPXP_Rc -asf_networking_parse_header(Tcp& tcp, networking_t* networking) { +asf_networking_parse_header(Tcp& tcp, networking_t& networking) { ASF_header_t asfh; ASF_stream_chunck_t chunk; - asf_http_networking_t* asf_ctrl = (asf_http_networking_t*) networking->data; + asf_http_networking_t* asf_ctrl = (asf_http_networking_t*) networking.data; char* buffer=NULL, *chunk_buffer=NULL; int i,r,size,pos = 0; int start; int buffer_size = 0; int chunk_size2read = 0; - int bw = networking->bandwidth; + int bw = networking.bandwidth; int *v_rates = NULL, *a_rates = NULL; int v_rate = 0, a_rate = 0, a_idx = -1, v_idx = -1; @@ -275,7 +275,7 @@ asf_ctrl->packet_size = fileh->max_packet_size; // before playing. // preroll: time in ms to bufferize before playing - networking->prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); + networking.prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); } pos = start; @@ -416,11 +416,11 @@ } static int -asf_http_networking_read( Tcp& tcp, char *buffer, int size, networking_t *networking ) { +asf_http_networking_read( Tcp& tcp, char *buffer, int size, networking_t& networking ) { static ASF_stream_chunck_t chunk; int read,chunk_size = 0; static int rest = 0, drop_chunk = 0, waiting = 0; - asf_http_networking_t *asf_http_ctrl = (asf_http_networking_t*)networking->data; + asf_http_networking_t* asf_http_ctrl = (asf_http_networking_t*)networking.data; while(1) { if (rest == 0 && waiting == 0) { @@ -492,7 +492,7 @@ } static int -asf_http_networking_seek( Tcp& tcp, off_t pos, networking_t *networking ) { +asf_http_networking_seek( Tcp& tcp, off_t pos, networking_t& networking ) { UNUSED(tcp); UNUSED(pos); UNUSED(networking); @@ -562,11 +562,11 @@ return ASF_Unknown_e; } -static HTTP_Header* asf_http_request(networking_t *networking) { +static HTTP_Header* asf_http_request(networking_t& networking) { HTTP_Header* http_hdr = new(zeromem) HTTP_Header; URL *url = NULL; URL *server_url = NULL; - asf_http_networking_t *asf_http_ctrl; + asf_http_networking_t* asf_http_ctrl; char str[250]; char *ptr; int i, enable; @@ -575,9 +575,8 @@ int asf_nb_stream=0, stream_id; // Sanity check - if( networking==NULL ) return NULL; - url = networking->url; - asf_http_ctrl = (asf_http_networking_t*)networking->data; + url = networking.url; + asf_http_ctrl = (asf_http_networking_t*)networking.data; if( url==NULL || asf_http_ctrl==NULL ) return NULL; // Common header for all requests. @@ -660,7 +659,7 @@ } static int -asf_http_parse_response(asf_http_networking_t *asf_http_ctrl, HTTP_Header& http_hdr ) { +asf_http_parse_response(asf_http_networking_t& asf_http_ctrl, HTTP_Header& http_hdr ) { const char *content_type, *pragma; char features[64] = "\0"; size_t len; @@ -713,14 +712,14 @@ } while( comma_ptr!=NULL ); pragma = http_hdr.get_next_field(); } - asf_http_ctrl->networking_type = asf_http_networking_type( content_type, features, http_hdr ); + asf_http_ctrl.networking_type = asf_http_networking_type( content_type, features, http_hdr ); return 0; } -static MPXP_Rc asf_http_networking_start(Tcp& tcp, networking_t *networking) { +static MPXP_Rc asf_http_networking_start(Tcp& tcp, networking_t& networking) { HTTP_Header *http_hdr=NULL; - URL *url = networking->url; - asf_http_networking_t *asf_http_ctrl; + URL *url = networking.url; + asf_http_networking_t* asf_http_ctrl; uint8_t buffer[BUFFER_SIZE]; int i, ret; int done; @@ -735,7 +734,7 @@ asf_http_ctrl->request = 1; asf_http_ctrl->audio_streams = asf_http_ctrl->video_streams = NULL; asf_http_ctrl->n_audio = asf_http_ctrl->n_video = 0; - networking->data = asf_http_ctrl; + networking.data = asf_http_ctrl; do { done = 1; @@ -773,7 +772,7 @@ if( mp_conf.verbose>0 ) { MSG_DBG2("Response [%s]\n", http_hdr->get_buffer() ); } - ret = asf_http_parse_response(asf_http_ctrl, *http_hdr); + ret = asf_http_parse_response(*asf_http_ctrl, *http_hdr); if( ret<0 ) { MSG_ERR("Failed to parse header\n"); delete http_hdr; @@ -829,14 +828,14 @@ } while(!done); if( asf_http_ctrl->networking_type==ASF_PlainText_e || asf_http_ctrl->networking_type==ASF_Redirector_e ) { - networking->networking_read = nop_networking_read; - networking->networking_seek = nop_networking_seek; + networking.networking_read = nop_networking_read; + networking.networking_seek = nop_networking_seek; } else { - networking->networking_read = asf_http_networking_read; - networking->networking_seek = asf_http_networking_seek; - networking->buffering = 1; + networking.networking_read = asf_http_networking_read; + networking.networking_seek = asf_http_networking_seek; + networking.buffering = 1; } - networking->status = networking_playing_e; + networking.status = networking_playing_e; delete http_hdr; return MPXP_Ok; Modified: mplayerxp/libmpstream2/asf_streaming.h =================================================================== --- mplayerxp/libmpstream2/asf_streaming.h 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/asf_streaming.h 2012-12-17 12:05:45 UTC (rev 569) @@ -6,6 +6,7 @@ #include "stream.h" +struct networking_t; namespace mpxp { class Tcp; } @@ -32,7 +33,7 @@ int audio_id, video_id; }; -extern MPXP_Rc asf_networking_start(Tcp& fd, networking_t *networking); -extern MPXP_Rc asf_mmst_networking_start(Tcp& fd, networking_t *networking); +extern MPXP_Rc asf_networking_start(Tcp& fd, networking_t& networking); +extern MPXP_Rc asf_mmst_networking_start(Tcp& fd, networking_t& networking); #endif Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/network.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -61,21 +61,16 @@ net_config_t net_conf; networking_t* new_networking() { - networking_t *networking = new(zeromem) networking_t; - if( networking==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); - return NULL; - } + networking_t* networking = new(zeromem) networking_t; networking->mime="application/octet-stream"; return networking; } -void free_networking( networking_t *networking ) { - if( networking==NULL ) return; - if( networking->url ) delete networking->url; - if( networking->buffer ) delete networking->buffer ; - if( networking->data ) delete networking->data ; - delete networking; +void free_networking( networking_t& networking ) { + if( networking.url ) delete networking.url; + if( networking.buffer ) delete networking.buffer ; + if( networking.data ) delete networking.data ; + delete &networking; } URL* @@ -281,11 +276,11 @@ return 0; } -off_t http_seek(Tcp& tcp, networking_t *networking, off_t pos ) { +off_t http_seek(Tcp& tcp, networking_t& networking, off_t pos ) { HTTP_Header* http_hdr = NULL; tcp.close(); - if(http_send_request(tcp,networking->url, pos)==MPXP_Ok) return 0; + if(http_send_request(tcp,networking.url, pos)==MPXP_Ok) return 0; http_hdr = http_read_response(tcp); @@ -310,7 +305,7 @@ if( http_hdr ) { delete http_hdr; - networking->data = NULL; + networking.data = NULL; } return pos; @@ -318,7 +313,7 @@ // By using the protocol, the extension of the file or the content-type // we might be able to guess the networking type. -static MPXP_Rc autodetectProtocol(networking_t *networking, Tcp& tcp) { +static MPXP_Rc autodetectProtocol(networking_t& networking, Tcp& tcp) { HTTP_Header *http_hdr=NULL; int redirect; int auth_retry=0; @@ -327,7 +322,7 @@ const char *content_type; const char *next_url; - URL *url = networking->url; + URL *url = networking.url; do { next_url = NULL; @@ -359,7 +354,7 @@ http_hdr = http_read_response(tcp); if( http_hdr==NULL ) goto err_out; if( mp_conf.verbose ) http_hdr->debug_hdr(); - networking->data = http_hdr; + networking.data = http_hdr; // Check if we can make partial content requests and thus seek in http-streams if( http_hdr->get_status()==200 ) { @@ -386,7 +381,7 @@ if( (field_data = http_hdr->get_field("icy-br")) != NULL ) MSG_INFO("Bitrate: %skbit/s\n", field_data); field_data = NULL; if ( (field_data = http_hdr->get_field("content-type")) != NULL ) - networking->mime = field_data; + networking.mime = field_data; return MPXP_Ok; } case 400: // Server Full @@ -427,7 +422,7 @@ // TODO: RFC 2616, recommand to detect infinite redirection loops next_url = http_hdr->get_field("Location" ); if( next_url!=NULL ) { - networking->url = url = url_redirect( &url, next_url ); + networking.url = url = url_redirect( &url, next_url ); if (!strcasecmp(url->protocol, "mms")) goto err_out; if (strcasecmp(url->protocol, "http")) { MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->get_status(), url->protocol); @@ -456,34 +451,34 @@ } int -networking_bufferize( networking_t *networking,unsigned char *buffer, int size) { +networking_bufferize( networking_t& networking,unsigned char *buffer, int size) { //printf("networking_bufferize\n"); - networking->buffer = new char [size]; - if( networking->buffer==NULL ) { + networking.buffer = new char [size]; + if( networking.buffer==NULL ) { MSG_FATAL(MSGTR_OutOfMemory); return -1; } - memcpy( networking->buffer, buffer, size ); - networking->buffer_size = size; + memcpy( networking.buffer, buffer, size ); + networking.buffer_size = size; return size; } int -nop_networking_read(Tcp& tcp, char *buffer, int size, networking_t *stream_ctrl ) { +nop_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) { int len=0; //printf("nop_networking_read\n"); - if( stream_ctrl->buffer_size!=0 ) { - int buffer_len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos; -//printf("%d bytes in buffer\n", stream_ctrl->buffer_size); + if( stream_ctrl.buffer_size!=0 ) { + int buffer_len = stream_ctrl.buffer_size-stream_ctrl.buffer_pos; +//printf("%d bytes in buffer\n", stream_ctrl.buffer_size); len = (size<buffer_len)?size:buffer_len; - memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len ); - stream_ctrl->buffer_pos += len; -//printf("buffer_pos = %d\n", stream_ctrl->buffer_pos ); - if( stream_ctrl->buffer_pos>=stream_ctrl->buffer_size ) { - delete stream_ctrl->buffer ; - stream_ctrl->buffer = NULL; - stream_ctrl->buffer_size = 0; - stream_ctrl->buffer_pos = 0; + memcpy( buffer, (stream_ctrl.buffer)+(stream_ctrl.buffer_pos), len ); + stream_ctrl.buffer_pos += len; +//printf("buffer_pos = %d\n", stream_ctrl.buffer_pos ); + if( stream_ctrl.buffer_pos>=stream_ctrl.buffer_size ) { + delete stream_ctrl.buffer ; + stream_ctrl.buffer = NULL; + stream_ctrl.buffer_size = 0; + stream_ctrl.buffer_pos = 0; //printf("buffer cleaned\n"); } //printf("read %d bytes from buffer\n", len ); @@ -501,21 +496,21 @@ } int -nop_networking_seek(Tcp& tcp, off_t pos, networking_t *n ) { +nop_networking_seek(Tcp& tcp, off_t pos, networking_t& n ) { UNUSED(tcp); UNUSED(pos); UNUSED(n); return -1; } -MPXP_Rc nop_networking_start(Tcp& tcp,networking_t* networking ) { +MPXP_Rc nop_networking_start(Tcp& tcp,networking_t& networking ) { HTTP_Header *http_hdr = NULL; const char *next_url=NULL; URL *rd_url=NULL; MPXP_Rc ret; if( !tcp.established() ) { - http_send_request(tcp, networking->url,0); + http_send_request(tcp, networking.url,0); if( !tcp.established() ) return MPXP_False; http_hdr = http_read_response(tcp); if( http_hdr==NULL ) return MPXP_False; @@ -542,7 +537,7 @@ if (next_url != NULL && rd_url != NULL) { MSG_STATUS("Redirected: Using this url instead %s\n",next_url); - networking->url=check4proxies(rd_url); + networking.url=check4proxies(rd_url); ret=nop_networking_start(tcp,networking); //recursively get networking started } else { MSG_ERR("Redirection failed\n"); @@ -561,11 +556,11 @@ break; } } else { - http_hdr = (HTTP_Header*)networking->data; + http_hdr = (HTTP_Header*)networking.data; if( http_hdr->get_body_size()>0 ) { if( networking_bufferize( networking, (unsigned char*)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; - networking->data = NULL; + networking.data = NULL; return MPXP_False; } } @@ -573,23 +568,23 @@ if( http_hdr ) { delete http_hdr; - networking->data = NULL; + networking.data = NULL; } - networking->networking_read = nop_networking_read; - networking->networking_seek = nop_networking_seek; - networking->prebuffer_size = 64*1024; // KBytes - networking->buffering = 1; - networking->status = networking_playing_e; + networking.networking_read = nop_networking_read; + networking.networking_seek = nop_networking_seek; + networking.prebuffer_size = 64*1024; // KBytes + networking.buffering = 1; + networking.status = networking_playing_e; return MPXP_Ok; } -void fixup_network_stream_cache(networking_t *networking) { - if(networking->buffering) { +void fixup_network_stream_cache(networking_t& networking) { + if(networking.buffering) { if(mp_conf.s_cache_size<0) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. - mp_conf.s_cache_size = (networking->prebuffer_size/1024)*5; + mp_conf.s_cache_size = (networking.prebuffer_size/1024)*5; if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } MSG_INFO("[network] cache size set to: %i\n", mp_conf.s_cache_size); @@ -597,38 +592,38 @@ } int -pnm_networking_read(Tcp& tcp, char *buffer, int size, networking_t *stream_ctrl ) { - Pnm& pnm=*static_cast<Pnm*>(stream_ctrl->data); +pnm_networking_read(Tcp& tcp, char *buffer, int size, networking_t& stream_ctrl ) { + Pnm& pnm=*static_cast<Pnm*>(stream_ctrl.data); UNUSED(tcp); return pnm.read(buffer, size); } -MPXP_Rc pnm_networking_start(Tcp& tcp,networking_t *networking ) { +MPXP_Rc pnm_networking_start(Tcp& tcp,networking_t& networking ) { Pnm* pnm = new(zeromem) Pnm(tcp); - tcp.open(networking->url->hostname, - networking->url->port ? networking->url->port : 7070); + tcp.open(networking.url->hostname, + networking.url->port ? networking.url->port : 7070); if(!tcp.established()) return MPXP_False; - if(pnm->connect(networking->url->file)!=MPXP_Ok) { + if(pnm->connect(networking.url->file)!=MPXP_Ok) { delete pnm; return MPXP_NA; } - networking->data=pnm; - networking->networking_read = pnm_networking_read; - networking->prebuffer_size = 8*1024; // 8 KBytes - networking->buffering = 1; - networking->status = networking_playing_e; + networking.data=pnm; + networking.networking_read = pnm_networking_read; + networking.prebuffer_size = 8*1024; // 8 KBytes + networking.buffering = 1; + networking.status = networking_playing_e; return MPXP_Ok; } int -realrtsp_networking_read( Tcp& tcp, char *buffer, int size, networking_t *networking ) { - Rtsp_Session& rtsp=*static_cast<Rtsp_Session*>(networking->data); +realrtsp_networking_read( Tcp& tcp, char *buffer, int size, networking_t& networking ) { + Rtsp_Session& rtsp=*static_cast<Rtsp_Session*>(networking.data); return rtsp.read(tcp, buffer, size); } -MPXP_Rc realrtsp_networking_start( Tcp& tcp, networking_t *networking ) { +MPXP_Rc realrtsp_networking_start( Tcp& tcp, networking_t& networking ) { Rtsp_Session* rtsp; char *mrl; char *file; @@ -639,25 +634,25 @@ do { redirected = 0; - port = networking->url->port ? networking->url->port : 554; + port = networking.url->port ? networking.url->port : 554; tcp.close(); - tcp.open( networking->url->hostname, port, Tcp::IP4); - if(!tcp.established() && !networking->url->port) - tcp.open( networking->url->hostname,port = 7070, Tcp::IP4); + tcp.open( networking.url->hostname, port, Tcp::IP4); + if(!tcp.established() && !networking.url->port) + tcp.open( networking.url->hostname,port = 7070, Tcp::IP4); if(!tcp.established()) return MPXP_False; - file = networking->url->file; + file = networking.url->file; if (file[0] == '/') file++; - mrl = new char [strlen(networking->url->hostname)+strlen(file)+16]; - sprintf(mrl,"rtsp://%s:%i/%s",networking->url->hostname,port,file); + mrl = new char [strlen(networking.url->hostname)+strlen(file)+16]; + sprintf(mrl,"rtsp://%s:%i/%s",networking.url->hostname,port,file); rtsp = rtsp_session_start(tcp,&mrl, file, - networking->url->hostname, port, &redirected, - net_conf.bandwidth,networking->url->username, - networking->url->password); + networking.url->hostname, port, &redirected, + net_conf.bandwidth,networking.url->username, + networking.url->password); if ( redirected == 1 ) { - delete networking->url; - networking->url = url_new(mrl); + delete networking.url; + networking.url = url_new(mrl); tcp.close(); } delete mrl; @@ -667,12 +662,12 @@ if(!rtsp) return MPXP_False; - networking->data=rtsp; + networking.data=rtsp; - networking->networking_read = realrtsp_networking_read; - networking->prebuffer_size = 128*1024; // 8 KBytes - networking->buffering = 1; - networking->status = networking_playing_e; + networking.networking_read = realrtsp_networking_read; + networking.prebuffer_size = 128*1024; // 8 KBytes + networking.buffering = 1; + networking.status = networking_playing_e; return MPXP_Ok; } @@ -680,36 +675,36 @@ #ifndef STREAMING_LIVE_DOT_COM static int -rtp_networking_read(Tcp& tcp, char *buffer, int size, networking_t *networking ) { +rtp_networking_read(Tcp& tcp, char *buffer, int size, networking_t& networking ) { UNUSED(networking); return read_rtp_from_server(tcp, buffer, size ); } -static MPXP_Rc rtp_networking_start(Tcp& tcp,networking_t* networking, int raw_udp ) { +static MPXP_Rc rtp_networking_start(Tcp& tcp,networking_t& networking, int raw_udp ) { if( !tcp.established() ) { - Udp* udp(new(zeromem) Udp(networking->url)); + Udp* udp(new(zeromem) Udp(networking.url)); tcp = udp->socket(); if( !tcp.established()) return MPXP_False; } if(raw_udp) - networking->networking_read = nop_networking_read; + networking.networking_read = nop_networking_read; else - networking->networking_read = rtp_networking_read; - networking->networking_read = rtp_networking_read; - networking->networking_seek = nop_networking_seek; - networking->prebuffer_size = 64*1024; // KBytes - networking->buffering = 0; - networking->status = networking_playing_e; + networking.networking_read = rtp_networking_read; + networking.networking_read = rtp_networking_read; + networking.networking_seek = nop_networking_seek; + networking.prebuffer_size = 64*1024; // KBytes + networking.buffering = 0; + networking.status = networking_playing_e; return MPXP_Ok; } #endif -MPXP_Rc networking_start(Tcp& tcp,networking_t* networking, URL *url) { +MPXP_Rc networking_start(Tcp& tcp,networking_t& networking, URL *url) { MPXP_Rc rc; - networking->url = check4proxies( url ); + networking.url = check4proxies( url ); rc = autodetectProtocol( networking, tcp); @@ -717,13 +712,13 @@ rc = MPXP_False; // Get the bandwidth available - networking->bandwidth = net_conf.bandwidth; + networking.bandwidth = net_conf.bandwidth; // For RTP streams, we usually don't know the stream type until we open it. - if( !strcasecmp( networking->url->protocol, "rtp")) { + if( !strcasecmp( networking.url->protocol, "rtp")) { if(tcp.established()) tcp.close(); rc = rtp_networking_start(tcp, networking, 0); - } else if( !strcasecmp( networking->url->protocol, "pnm")) { + } else if( !strcasecmp( networking.url->protocol, "pnm")) { tcp.close(); rc = pnm_networking_start(tcp, networking); if (rc == MPXP_False) { @@ -731,7 +726,7 @@ return MPXP_False; } } - else if( !strcasecmp( networking->url->protocol, "rtsp")) { + else if( !strcasecmp( networking.url->protocol, "rtsp")) { if ((rc = realrtsp_networking_start( tcp, networking )) < 0) { MSG_INFO("Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); #ifdef STREAMING_LIVE_DOT_COM @@ -744,7 +739,7 @@ #endif } } - else if(!strcasecmp( networking->url->protocol, "udp")) { + else if(!strcasecmp( networking.url->protocol, "udp")) { tcp.close(); rc = rtp_networking_start(tcp, networking, 1); if(rc==MPXP_False) { @@ -761,7 +756,7 @@ if( rc==MPXP_False ) { //sometimes a file is just on a webserver and it is not streamed. //try loading them default method as last resort for http protocol - if ( !strcasecmp(networking->url->protocol, "http") ) { + if ( !strcasecmp(networking.url->protocol, "http") ) { MSG_STATUS("Trying default networking for http protocol\n "); //reset stream tcp.close(); @@ -774,11 +769,11 @@ } } if( rc==MPXP_False ) ; - else if( networking->buffering ) { + else if( networking.buffering ) { if(mp_conf.s_cache_size<0) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. - mp_conf.s_cache_size = (networking->prebuffer_size/1024)*5; + mp_conf.s_cache_size = (networking.prebuffer_size/1024)*5; if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } MSG_INFO("Cache size set to %d KBytes\n", mp_conf.s_cache_size); @@ -787,7 +782,7 @@ } int -networking_stop( networking_t *networking) { - networking->status = networking_stopped_e; +networking_stop( networking_t& networking) { + networking.status = networking_stopped_e; return 0; } Modified: mplayerxp/libmpstream2/network.h =================================================================== --- mplayerxp/libmpstream2/network.h 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/network.h 2012-12-17 12:05:45 UTC (rev 569) @@ -67,20 +67,20 @@ unsigned int buffer_size; unsigned int buffer_pos; unsigned int bandwidth; // The downstream available - int (*networking_read)( Tcp& fd, char *buffer, int buffer_size, networking_t *stream_ctrl ); - int (*networking_seek)( Tcp& fd, off_t pos, networking_t *stream_ctrl ); + int (*networking_read)( Tcp& fd, char *buffer, int buffer_size, networking_t& stream_ctrl ); + int (*networking_seek)( Tcp& fd, off_t pos, networking_t& stream_ctrl ); Opaque* data; }; -extern void fixup_network_stream_cache(networking_t *s); -extern MPXP_Rc networking_start(Tcp& fd,networking_t *n, URL *url); -extern int networking_bufferize(networking_t *networking,unsigned char *buffer, int size); -extern networking_t *new_networking(); -extern void free_networking( networking_t *networking ); +extern void fixup_network_stream_cache(networking_t& s); +extern MPXP_Rc networking_start(Tcp& fd,networking_t& n, URL *url); +extern int networking_bufferize(networking_t& networking,unsigned char *buffer, int size); +extern networking_t* new_networking(); +extern void free_networking( networking_t& networking ); extern URL* check4proxies( URL* url ); -int nop_networking_read(Tcp& fd, char *buffer, int size, networking_t *stream_ctrl ); -int nop_networking_seek(Tcp& fd, off_t pos, networking_t *stream_ctrl ); +int nop_networking_read(Tcp& fd, char *buffer, int size, networking_t& stream_ctrl ); +int nop_networking_seek(Tcp& fd, off_t pos, networking_t& stream_ctrl ); MPXP_Rc http_send_request(Tcp& tcp,URL* url, off_t pos); HTTP_Header* http_read_response(Tcp& fd); Modified: mplayerxp/libmpstream2/s_network.cpp =================================================================== --- mplayerxp/libmpstream2/s_network.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/s_network.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -56,11 +56,11 @@ url = url_new(filename); if(url) { networking=new_networking(); - if(networking_start(tcp,networking,url)!=MPXP_Ok){ + if(networking_start(tcp,*networking,url)!=MPXP_Ok){ MSG_ERR(MSGTR_UnableOpenURL, filename.c_str()); delete url; url=NULL; - free_networking(networking); + free_networking(*networking); networking=NULL; return MPXP_False; } @@ -78,7 +78,7 @@ int Network_Stream_Interface::read(stream_packet_t*sp) { sp->type=0; - if(networking!=NULL)sp->len=networking->networking_read(tcp,sp->buf,STREAM_BUFFER_SIZE, networking); + if(networking!=NULL)sp->len=networking->networking_read(tcp,sp->buf,STREAM_BUFFER_SIZE, *networking); else sp->len=TEMP_FAILURE_RETRY(tcp.read((uint8_t*)sp->buf,STREAM_BUFFER_SIZE)); spos += sp->len; return sp->len; @@ -88,7 +88,7 @@ { off_t newpos=0; if(networking!=NULL) { - newpos=networking->networking_seek(tcp, pos, networking ); + newpos=networking->networking_seek(tcp, pos, *networking ); if( newpos<0 ) { MSG_WARN("Stream not seekable!\n"); return 1; Modified: mplayerxp/libmpstream2/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -78,7 +78,7 @@ Rtsp_Session* rtsp = static_cast<Rtsp_Session*>(networking->data); if (rtsp) rtsp->end (); delete networking->url; - free_networking(networking); + free_networking(*networking); networking=NULL; } @@ -155,12 +155,12 @@ tcp.close(); index_mode = -1; /* prevent most RTSP streams from locking due to -idx */ if (start() != MPXP_Ok) { - free_networking(networking); + free_networking(*networking); networking = NULL; return MPXP_False; } - fixup_network_stream_cache (networking); + fixup_network_stream_cache (*networking); return MPXP_Ok; } Stream::type_e Rtsp_Stream_Interface::type() const { return Stream::Type_Stream; } Modified: mplayerxp/libmpstream2/s_udp.cpp =================================================================== --- mplayerxp/libmpstream2/s_udp.cpp 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/s_udp.cpp 2012-12-17 12:05:45 UTC (rev 569) @@ -58,7 +58,7 @@ int Udp_Stream_Interface::read(stream_packet_t*sp) { - return nop_networking_read(tcp,sp->buf,sp->len,networking); + return nop_networking_read(tcp,sp->buf,sp->len,*networking); } off_t Udp_Stream_Interface::seek(off_t newpos) { return newpos; } @@ -73,7 +73,7 @@ void Udp_Stream_Interface::close() { - free_networking(networking); + free_networking(*networking); networking=NULL; } @@ -105,17 +105,17 @@ networking->url = check4proxies (url); if (url->port == 0) { MSG_ERR("You must enter a port number for UDP streams!\n"); - free_networking (networking); + free_networking (*networking); networking = NULL; return MPXP_False; } if (start () !=MPXP_Ok) { MSG_ERR("udp_networking_start failed\n"); - free_networking (networking); + free_networking (*networking); networking = NULL; return MPXP_False; } - fixup_network_stream_cache (networking); + fixup_network_stream_cache (*networking); return MPXP_Ok; } Stream::type_e Udp_Stream_Interface::type() const { return Stream::Type_Stream; } Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-17 10:31:40 UTC (rev 568) +++ mplayerxp/libmpstream2/stream.h 2012-12-17 12:05:45 UTC (rev 569) @@ -11,7 +11,6 @@ #include "xmpcore/xmp_enums.h" -struct networking_t; namespace mpxp { struct libinput_t; enum { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-17 10:31:50
|
Revision: 568 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=568&view=rev Author: nickols_k Date: 2012-12-17 10:31:40 +0000 (Mon, 17 Dec 2012) Log Message: ----------- use references instead of pointers Modified Paths: -------------- mplayerxp/libao3/audio_out.cpp mplayerxp/libao3/audio_out.h mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h Modified: mplayerxp/libao3/audio_out.cpp =================================================================== --- mplayerxp/libao3/audio_out.cpp 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libao3/audio_out.cpp 2012-12-17 10:31:40 UTC (rev 568) @@ -183,20 +183,15 @@ } Audio_Output::Audio_Output(const char* _subdevice) - :subdevice(mp_strdup(_subdevice)) -{ - priv_t* priv=new(zeromem) priv_t; - opaque=priv; - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&opaque)-reinterpret_cast<long>(&antiviral_hole)); - priv->driver=NULL; -} + :subdevice(mp_strdup(_subdevice)), + opaque(*new(zeromem) priv_t){} Audio_Output::~Audio_Output() { - priv_t* priv=static_cast<priv_t*>(opaque); - delete priv->driver; + priv_t& priv=static_cast<priv_t&>(opaque); + delete priv.driver; if(subdevice) delete subdevice; - delete priv; + delete &priv; } void Audio_Output::print_help() const { @@ -211,111 +206,111 @@ } MPXP_Rc Audio_Output::_register(const char *driver_name,unsigned flags) const { - priv_t* priv=static_cast<priv_t*>(opaque); + priv_t& priv=static_cast<priv_t&>(opaque); unsigned i; if(!driver_name) { - priv->info=audio_out_drivers[0]; - priv->driver=audio_out_drivers[0]->query_interface(subdevice?subdevice:""); + priv.info=audio_out_drivers[0]; + priv.driver=audio_out_drivers[0]->query_interface(subdevice?subdevice:""); } else for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { const ao_info_t *info = audio_out_drivers[i]; if(strcmp(info->short_name,driver_name) == 0){ - priv->info = audio_out_drivers[i]; - priv->driver = audio_out_drivers[i]->query_interface(subdevice?subdevice:""); + priv.info = audio_out_drivers[i]; + priv.driver = audio_out_drivers[i]->query_interface(subdevice?subdevice:""); break; } } - if(priv->driver->open(flags)==MPXP_Ok) return MPXP_Ok; + if(priv.driver->open(flags)==MPXP_Ok) return MPXP_Ok; return MPXP_False; } const ao_info_t* Audio_Output::get_info() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->info; + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.info; } MPXP_Rc Audio_Output::configure(unsigned r,unsigned c,unsigned f) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->configure(r,c,f); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->configure(r,c,f); } unsigned Audio_Output::channels() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->channels(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->channels(); } unsigned Audio_Output::samplerate() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->samplerate(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->samplerate(); } unsigned Audio_Output::format() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->format(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->format(); } MPXP_Rc Audio_Output::test_channels(unsigned c) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->test_channels(c); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->test_channels(c); } MPXP_Rc Audio_Output::test_rate(unsigned s) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->test_rate(s); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->test_rate(s); } MPXP_Rc Audio_Output::test_format(unsigned f) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->test_format(f); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->test_format(f); } unsigned Audio_Output::bps() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->channels()* - priv->driver->samplerate()* - afmt2bps(priv->driver->format()); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->channels()* + priv.driver->samplerate()* + afmt2bps(priv.driver->format()); } unsigned Audio_Output::buffersize() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->buffersize(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->buffersize(); } unsigned Audio_Output::outburst() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->outburst(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->outburst(); } void Audio_Output::reset() const { - priv_t* priv=static_cast<priv_t*>(opaque); - priv->driver->reset(); + priv_t& priv=static_cast<priv_t&>(opaque); + priv.driver->reset(); } unsigned Audio_Output::get_space() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->get_space(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->get_space(); } float Audio_Output::get_delay() const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->get_delay(); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->get_delay(); } unsigned Audio_Output::play(const any_t* data,unsigned len,unsigned flags) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->play(data,len,flags); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->play(data,len,flags); } void Audio_Output::pause() const { - priv_t* priv=static_cast<priv_t*>(opaque); - priv->driver->pause(); + priv_t& priv=static_cast<priv_t&>(opaque); + priv.driver->pause(); } void Audio_Output::resume() const { - priv_t* priv=static_cast<priv_t*>(opaque); - priv->driver->resume(); + priv_t& priv=static_cast<priv_t&>(opaque); + priv.driver->resume(); } MPXP_Rc Audio_Output::ctrl(int cmd,long arg) const { - priv_t* priv=static_cast<priv_t*>(opaque); - return priv->driver->ctrl(cmd,arg); + priv_t& priv=static_cast<priv_t&>(opaque); + return priv.driver->ctrl(cmd,arg); } void Audio_Output::mixer_getvolume(float *l,float *r) const { @@ -361,12 +356,12 @@ } void Audio_Output::mixer_mute() const { - priv_t* priv=static_cast<priv_t*>(opaque); - if ( priv->muted ) { mixer_setvolume(priv->mute_l,priv->mute_r ); priv->muted=0; } + priv_t& priv=static_cast<priv_t&>(opaque); + if ( priv.muted ) { mixer_setvolume(priv.mute_l,priv.mute_r ); priv.muted=0; } else { - mixer_getvolume(&priv->mute_l,&priv->mute_r ); + mixer_getvolume(&priv.mute_l,&priv.mute_r ); mixer_setvolume(0,0); - priv->muted=1; + priv.muted=1; } } -} // namespace mpxp \ No newline at end of file +} // namespace mpxp Modified: mplayerxp/libao3/audio_out.h =================================================================== --- mplayerxp/libao3/audio_out.h 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libao3/audio_out.h 2012-12-17 10:31:40 UTC (rev 568) @@ -67,8 +67,7 @@ char* subdevice; float pts; /**< PTS of audio buffer */ private: - char antiviral_hole[RND_CHAR2]; - any_t* opaque; /**< for internal use */ + Opaque& opaque; /**< for internal use */ }; /* prototypes */ extern const char * __FASTCALL__ ao_format_name(int format); Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libmpstream2/stream.cpp 2012-12-17 10:31:40 UTC (rev 568) @@ -92,7 +92,7 @@ Stream::Stream(Stream::type_e t) :_type(t) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole[0])); pin=STREAM_PIN; reset(); } Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libmpstream2/stream.h 2012-12-17 10:31:40 UTC (rev 568) @@ -92,7 +92,6 @@ private: int read(stream_packet_t* sp); Stream_Interface* driver; /**< low-level stream driver */ - Opaque* priv; /**< private data used by stream driver */ type_e _type; int _eof; /**< indicates EOF */ }; Modified: mplayerxp/libvo2/video_out.cpp =================================================================== --- mplayerxp/libvo2/video_out.cpp 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libvo2/video_out.cpp 2012-12-17 10:31:40 UTC (rev 568) @@ -134,22 +134,20 @@ delete vo_iface; } -Video_Output::Video_Output() { +Video_Output::Video_Output() + :vo_priv(*new(zeromem) vo_priv_t) { inited=0; osd_progbar_type=-1; osd_progbar_value=100; // 0..256 - vo_priv_t* priv; - priv=new(zeromem) vo_priv_t; - vo_priv=priv; - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole[0])); } Video_Output::~Video_Output() { - vo_priv_t* priv=static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_uninit\n"); inited--; - delete priv; + delete &priv; } void Video_Output::print_help() const @@ -166,7 +164,7 @@ const vo_info_t* Video_Output::get_info() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); return priv.video_out; } @@ -180,7 +178,7 @@ offset=drv_name.find(':'); if(offset!=std::string::npos) subdev = drv_name.substr(offset+1); } - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; if(drv_name.empty()) priv.video_out=vo_infos[0]; else @@ -200,7 +198,7 @@ void Video_Output::dri_config(uint32_t fourcc) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); priv.dri.is_planar = vo_describe_fourcc(fourcc,&priv.vod); priv.dri.bpp=priv.vod.bpp; if(!priv.dri.bpp) priv.dri.has_dri=0; /*unknown fourcc*/ @@ -212,7 +210,7 @@ void Video_Output::ps_tune(unsigned width,unsigned height) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); int src_is_planar; unsigned src_stride,ps_x,ps_y; vo_format_desc vd; @@ -238,7 +236,7 @@ void Video_Output::dri_tune(unsigned width,unsigned height) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); priv.dri.sstride=priv.dri.is_planar?width:width*((priv.dri.bpp+7)/8); priv.dri.off[0] = priv.dri.off[1] = priv.dri.off[2] = priv.dri.off[3] = 0; if(!priv.dri.is_planar) { @@ -292,7 +290,7 @@ void Video_Output::dri_reconfig(int is_resize ) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); priv.dri.has_dri = 1; priv.vo_iface->get_surface_caps(&priv.dri.cap); dri_config(priv.dri.cap.fourcc); @@ -315,7 +313,7 @@ uint32_t d_height, vo_flags_e _fullscreen, const std::string& title, uint32_t format) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); priv.parent=s; MPXP_Rc retval; unsigned dest_fourcc,w,d_w,h,d_h; @@ -374,7 +372,7 @@ /* if vo_driver doesn't support dri then it won't work with this logic */ uint32_t Video_Output::query_format(uint32_t* fourcc, unsigned src_w, unsigned src_h) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); uint32_t dri_forced_fourcc; vo_query_fourcc_t qfourcc; MSG_DBG3("dri_vo_dbg: vo_query_format(%08lX)\n",*fourcc); @@ -390,14 +388,14 @@ MPXP_Rc Video_Output::reset() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_reset\n"); return priv.vo_iface->reset(); } MPXP_Rc Video_Output::screenshot(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); char buf[256]; MSG_DBG3("dri_vo_dbg: vo_screenshot\n"); sprintf(buf,"%llu",priv.frame_counter); @@ -409,27 +407,27 @@ MPXP_Rc Video_Output::pause() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_pause\n"); return priv.vo_iface->pause(); } MPXP_Rc Video_Output::resume() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_resume\n"); return priv.vo_iface->resume(); } MPXP_Rc Video_Output::get_surface_caps(dri_surface_cap_t*caps) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); priv.vo_iface->get_surface_caps(caps); return MPXP_Ok; } MPXP_Rc Video_Output::get_surface(mp_image_t* mpi) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); int width_less_stride; MSG_DBG2("dri_vo_dbg: vo_get_surface type=%X flg=%X\n",mpi->type,mpi->flags); width_less_stride = 0; @@ -483,7 +481,7 @@ int Video_Output::adjust_size(unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: adjust_size was called %u %u %u %u\n",cw,ch,*nw,*nh); if((priv.dri.flags & VOFLAG_SWSCALE) && (cw != *nw || ch != *nh) && !(priv.dri.flags & VOFLAG_FULLSCREEN)) { @@ -514,7 +512,7 @@ int Video_Output::check_events() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); uint32_t retval; int need_repaint; vo_resize_t vrest; @@ -536,7 +534,7 @@ MPXP_Rc Video_Output::fullscreen() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MPXP_Rc retval; MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); retval = priv.vo_iface->toggle_fullscreen(); @@ -547,13 +545,13 @@ } unsigned Video_Output::get_num_frames() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); return priv.dri.num_xp_frames; } MPXP_Rc Video_Output::draw_slice(const mp_image_t *mpi) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i,_w[4],_h[4],x,y; MSG_DBG3("dri_vo_dbg: vo_draw_slice xywh=%i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h); if(priv.dri.has_dri) { @@ -591,14 +589,14 @@ void Video_Output::select_frame(unsigned play_idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); priv.vo_iface->select_frame(play_idx); } void Video_Output::flush_page(unsigned decoder_idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_flush_pages [idx=%u]\n",decoder_idx); priv.frame_counter++; if((priv.dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) @@ -608,7 +606,7 @@ /* DRAW OSD */ void Video_Output::clear_rect(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -619,7 +617,7 @@ void Video_Output::clear_rect2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; unsigned _y1 = priv.dri.cap.y/2; unsigned _y2 = (priv.dri.cap.y+priv.dri.cap.h)/2; @@ -632,7 +630,7 @@ void Video_Output::clear_rect4(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; unsigned _y1 = priv.dri.cap.y/4; unsigned _y2 = (priv.dri.cap.y+priv.dri.cap.h)/4; @@ -645,7 +643,7 @@ void Video_Output::clear_rect_rgb(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -656,7 +654,7 @@ void Video_Output::clear_rect_yuy2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -677,7 +675,7 @@ void Video_Output::dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); dri_surface_t surf; surf.idx=idx; priv.vo_iface->get_surface(&surf); @@ -732,7 +730,7 @@ void Video_Output::dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); int finalize=is_final(); if(unsigned(x0+w)<=priv.dri.cap.width&&unsigned(_y0+h)<=priv.dri.cap.height) { @@ -757,7 +755,7 @@ void Video_Output::draw_osd(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_draw_osd\n"); if(priv.dri.has_dri && !(priv.dri.cap.caps & DRI_CAP_HWOSD)) { @@ -770,7 +768,7 @@ void Video_Output::draw_spudec_direct(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_draw_osd\n"); if(priv.dri.has_dri && !(priv.dri.cap.caps & DRI_CAP_HWOSD)) { @@ -785,14 +783,14 @@ MPXP_Rc Video_Output::ctrl(uint32_t request, any_t*data) const { MPXP_Rc rval; - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); rval=priv.vo_iface->ctrl(request,data); MSG_DBG3("dri_vo_dbg: %u=vo_control( %u, %p )\n",rval,request,data); return rval; } int Video_Output::is_final() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); int mmaped=priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED; int busmaster=priv.dri.cap.caps&DRI_CAP_BUSMASTERING; return mmaped||busmaster||(priv.dri.num_xp_frames>1); Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2012-12-17 08:47:00 UTC (rev 567) +++ mplayerxp/libvo2/video_out.h 2012-12-17 10:31:40 UTC (rev 568) @@ -148,7 +148,7 @@ }; struct vf_stream_t; - class Video_Output { + class Video_Output : public Opaque { public: Video_Output(); virtual ~Video_Output(); @@ -222,8 +222,8 @@ void clear_rect_rgb(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const; void clear_rect_yuy2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const; + video_private& vo_priv;/* private data of vo structure */ int inited; - video_private* vo_priv;/* private data of vo structure */ }; /** Notification event when windowed output has been resized (as data of VOCTRL_CHECK_EVENT) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-17 08:47:09
|
Revision: 567 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=567&view=rev Author: nickols_k Date: 2012-12-17 08:47:00 +0000 (Mon, 17 Dec 2012) Log Message: ----------- rename libao2 ->libao3 (TRANSACTION END) Note about subfolders renaming: It seems that between the computer where i perform development and SVN server (sourceforge.net) exist intermediate computer (or server) which holds copy of project's sources. When i'm renaming folders then i free sources of my project from control of malefactor(s). To confirm that it's enough to study shangesets of project, exactly changeset.542: Date: 2012-12-11 16:18:22 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libvo -> libvo2 (TRANSACTION BEGIN) Added Paths: ----------- mplayerxp/libvo2/ mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_fbdev.cpp Removed Paths: ------------- mplayerxp/libvo/Makefile mplayerxp/libvo/aspect.cpp mplayerxp/libvo/aspect.h mplayerxp/libvo/dri_vo.h mplayerxp/libvo/font_load.cpp mplayerxp/libvo/font_load.h mplayerxp/libvo/img_format.cpp mplayerxp/libvo/img_format.h mplayerxp/libvo/jpeg_enc.cpp mplayerxp/libvo/jpeg_enc.h ... It's clear that computer of malefactor(s) gave 2 files from own repository. Furthermore, everytime when i' trying to rename some folder, i got the error: $svn ci -m "renaming oldfodlername -> newfoldername" SVN: deleting 'oldfoldername' SVN: item 'oldfoldername' is out of date $svn --version svn, version 1.6.19 (r1383947) compiled Dec 4 2012, 10:30:48 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.apache.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). Revision Links: -------------- http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=1383947&view=rev Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao3/Makefile mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_oss.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_acm.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_dvdpcm.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/ad_hwac3.cpp mplayerxp/libmpcodecs/ad_lavc.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/libmpcodecs/ad_pcm.cpp mplayerxp/libmpcodecs/ad_qtaudio.cpp mplayerxp/libmpcodecs/ad_real.cpp mplayerxp/libmpcodecs/ad_twin.cpp mplayerxp/libmpcodecs/ad_vorbis.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mp3.cpp mplayerxp/libmpdemux/demux_musepack.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_snd_au.cpp mplayerxp/libmpdemux/demux_voc.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_wav.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpstream2/s_oss.cpp mplayerxp/libmpstream2/s_tv.cpp mplayerxp/libmpstream2/tvi/tvi_v4l.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/Makefile mplayerxp/postproc/af.cpp mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/postproc/af_ao3.cpp Removed Paths: ------------- mplayerxp/postproc/af_ao2.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/Makefile 2012-12-17 08:47:00 UTC (rev 567) @@ -11,7 +11,7 @@ TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo2 xmpcore +SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao3 osdep postproc input2 nls libvo2 xmpcore ifeq ($(ENABLE_WIN32LOADER),yes) SUBDIRS+=loader endif @@ -37,7 +37,7 @@ libmpcodecs/libmpcodecs.a \ libmpsub/libmpsub.a \ libplaytree/libplaytree.a \ - libao2/libao2.a \ + libao3/libao3.a \ postproc/libpostproc.a \ input2/libinput2.a \ libvo2/libvo2.a \ Modified: mplayerxp/libao3/Makefile =================================================================== --- mplayerxp/libao3/Makefile 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libao3/Makefile 2012-12-17 08:47:00 UTC (rev 567) @@ -1,7 +1,7 @@ include ../mp_config.mak -LIBNAME = libao2.a +LIBNAME = libao3.a # TODO: moveout ao_sdl.c so it's only used when SDL is detected CXXSRCS=audio_out.cpp afmt.cpp Modified: mplayerxp/libao3/ao_nas.cpp =================================================================== --- mplayerxp/libao3/ao_nas.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libao3/ao_nas.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -457,7 +457,7 @@ _outburst = NAS_FRAG_SIZE; buffer_size = bps(); /* buffer 1 second */ - MSG_V("ao2: %d Hz %d chans %s\n",r,c,afmt2str(f)); + MSG_V("ao3: %d Hz %d chans %s\n",r,c,afmt2str(f)); /* * round up to multiple of NAS_FRAG_SIZE Modified: mplayerxp/libao3/ao_oss.cpp =================================================================== --- mplayerxp/libao3/ao_oss.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libao3/ao_oss.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -209,7 +209,7 @@ MPXP_Rc Oss_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { - MSG_V("ao2: %d Hz %d chans %s\n",r,c,ao_format_name(f)); + MSG_V("ao3: %d Hz %d chans %s\n",r,c,ao_format_name(f)); if(f == AFMT_AC3) { _samplerate=r; Modified: mplayerxp/libao3/ao_sdl.cpp =================================================================== --- mplayerxp/libao3/ao_sdl.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libao3/ao_sdl.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -2,7 +2,7 @@ #include "osdep/mplib.h" using namespace mpxp; /* - * ao_sdl.c - libao2 SDLlib Audio Output Driver for MPlayer + * ao_sdl.c - libao3 SDLlib Audio Output Driver for MPlayer * * This driver is under the same license as MPlayer. * (http://mplayer.sf.net) Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad.h 2012-12-17 08:47:00 UTC (rev 567) @@ -6,7 +6,7 @@ #include "libmpconf/cfgparser.h" #include "xmpcore/xmp_enums.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" struct ad_info_t { const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,8 +18,8 @@ #include "osdep/mm_accel.h" #include "mplayerxp.h" #include "liba52/a52.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "postproc/af.h" struct ad_private_t { Modified: mplayerxp/libmpcodecs/ad_acm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -10,7 +10,7 @@ #include "codecs_ld.h" #include "loader/wineacm.h" #include "libmpdemux/aviprint.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "help_mp.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,8 +18,8 @@ #include "osdep/mm_accel.h" #include "mplayerxp.h" #include "osdep/bswap.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "postproc/af.h" #define MAX_AC5_FRAME 4096 Modified: mplayerxp/libmpcodecs/ad_dvdpcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -6,7 +6,7 @@ #include <unistd.h> #include "ad_internal.h" #include "osdep/bswap.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" struct ad_private_t { sh_audio_t* sh; Modified: mplayerxp/libmpcodecs/ad_faad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,8 +18,8 @@ #include "mplayerxp.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "postproc/af.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_hwac3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -14,7 +14,7 @@ #include "codecs_ld.h" #include "osdep/cpudetect.h" #include "osdep/bswap.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #define IEC61937_DATA_TYPE_AC3 1 Modified: mplayerxp/libmpcodecs/ad_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -8,7 +8,7 @@ #include <unistd.h> #include <assert.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "ad_internal.h" #include "help_mp.h" Modified: mplayerxp/libmpcodecs/ad_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "osdep/bswap.h" #include "ad_internal.h" Modified: mplayerxp/libmpcodecs/ad_mp3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -12,8 +12,8 @@ #include "osdep/fastmemcpy.h" #include "osdep/bswap.h" #include "codecs_ld.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "postproc/af.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_pcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -5,7 +5,7 @@ #include <stdlib.h> #include <unistd.h> #include "ad_internal.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "osdep/bswap.h" struct ad_private_t { Modified: mplayerxp/libmpcodecs/ad_qtaudio.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -11,7 +11,7 @@ #include "osdep/bswap.h" #include "codecs_ld.h" #include "mplayerxp.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #ifdef WIN32_LOADER #include "loader/ldt_keeper.h" #endif Modified: mplayerxp/libmpcodecs/ad_real.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_real.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_real.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -13,7 +13,7 @@ #include "codecs_ld.h" #include "ad_msg.h" #include "osdep/bswap.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" static const ad_info_t info = { "RealAudio decoder", Modified: mplayerxp/libmpcodecs/ad_twin.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -9,7 +9,7 @@ #include "codecs_ld.h" #include "loader/ldt_keeper.h" #include "loader/wine/windef.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "libmpdemux/aviprint.h" #include "help_mp.h" Modified: mplayerxp/libmpcodecs/ad_vorbis.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -12,8 +12,8 @@ #include "osdep/bswap.h" #include "codecs_ld.h" #include "ad_internal.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "postproc/af.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,8 +18,8 @@ #include "libmpconf/codec-cfg.h" #include "dec_audio.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "mplayerxp.h" #include "libmpdemux/demuxer_r.h" #include "postproc/af.h" Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -993,7 +993,7 @@ NULL }; -#include "libao2/afmt.h" +#include "libao3/afmt.h" /* FIXME: sync with af_format.h */ static struct { Modified: mplayerxp/libmpdemux/demux_ac3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -11,7 +11,7 @@ #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_dca.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dca.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_dca.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_flac.cpp =================================================================== --- mplayerxp/libmpdemux/demux_flac.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_flac.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -32,7 +32,7 @@ #include "libmpcodecs/codecs_ld.h" #include "libmpconf/cfgparser.h" #include "aviprint.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #define PROBE_BUF_SIZE 2048 Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -38,7 +38,7 @@ #include "libvo2/sub.h" #include "libmpcodecs/codecs_ld.h" #include "libmpcodecs/libnuppelvideo/minilzo.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #include "loader/qtx/qtxsdk/components.h" Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -41,7 +41,7 @@ #include "loader/qtx/qtxsdk/components.h" #include "demux_msg.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #ifdef HAVE_ZLIB #include <zlib.h> Modified: mplayerxp/libmpdemux/demux_mp3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -17,7 +17,7 @@ #include "stheader.h" #include "genres.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_musepack.cpp =================================================================== --- mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -26,7 +26,7 @@ #include "libmpcodecs/codecs_ld.h" #include "libmpcodecs/dec_audio.h" #include "libvo2/video_out.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #define BLOCK_SIZE 4096 Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -11,7 +11,7 @@ #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" int use_rawaudio = 0; Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -35,7 +35,7 @@ #include "osdep/bswap.h" #include "aviprint.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #define MKTAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,7 +18,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_snd_au.cpp =================================================================== --- mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_voc.cpp =================================================================== --- mplayerxp/libmpdemux/demux_voc.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_voc.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -13,7 +13,7 @@ #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #define KEYWORD_BYTES 4 Modified: mplayerxp/libmpdemux/demux_wav.cpp =================================================================== --- mplayerxp/libmpdemux/demux_wav.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demux_wav.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -16,7 +16,7 @@ #include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "aviprint.h" #include "osdep/bswap.h" #include "mp3_hdr.h" Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -18,7 +18,7 @@ #include "input2/input.h" #include "osdep/fastmemcpy.h" #include "libvo2/sub.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "demux_msg.h" #include "demuxer.h" Modified: mplayerxp/libmpstream2/s_oss.cpp =================================================================== --- mplayerxp/libmpstream2/s_oss.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpstream2/s_oss.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -19,8 +19,8 @@ #include "mplayerxp.h" #include "xmpcore/mp_aframe.h" #include "postproc/af.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "loader/wine/mmreg.h" #include "stream.h" #include "stream_internal.h" Modified: mplayerxp/libmpstream2/s_tv.cpp =================================================================== --- mplayerxp/libmpstream2/s_tv.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpstream2/s_tv.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -20,7 +20,7 @@ #include "stream.h" #include "stream_internal.h" #include "input2/input.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "mrl.h" #include "tvi/tv.h" @@ -32,10 +32,9 @@ #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" -#include "libao2/afmt.h" #include "libvo2/img_format.h" #include "osdep/fastmemcpy.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream2/tvi/tvi_v4l.cpp =================================================================== --- mplayerxp/libmpstream2/tvi/tvi_v4l.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/libmpstream2/tvi/tvi_v4l.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -27,8 +27,8 @@ #include <stdlib.h> #include <string.h> -#include "libao2/afmt.h" -#include "libao2/audio_out.h" +#include "libao3/afmt.h" +#include "libao3/audio_out.h" #include "libvo2/img_format.h" #include "tv.h" Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/mplayerxp.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -46,9 +46,6 @@ #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" -#include "libvo2/video_out.h" -#include "libao2/audio_out.h" - #include "osdep/get_path.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/mplayerxp.h 2012-12-17 08:47:00 UTC (rev 567) @@ -12,7 +12,7 @@ #include "xmpcore/xmp_enums.h" #include "libmpconf/cfgparser.h" #include "libmpsub/subreader.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "libvo2/video_out.h" struct audio_decoder_t; Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/postproc/Makefile 2012-12-17 08:47:00 UTC (rev 567) @@ -8,7 +8,7 @@ CXXSRCS=af.cpp aflib.cpp vf.cpp postprocess.cpp swscale.cpp -CXXSRCS+=af_ao2.cpp \ +CXXSRCS+=af_ao3.cpp \ af_channels.cpp \ af_crystality.cpp \ af_delay.cpp \ Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/postproc/af.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -8,7 +8,7 @@ #include "af.h" #include "af_internal.h" #include "help_mp.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "pp_msg.h" // Static list of filters @@ -359,7 +359,7 @@ if(!s->first){ // Add all filters in the list (if there are any) if(!s->cfg.list){ // To make automatic format conversion work - if(!af_append(s,s->first,"ao2")) + if(!af_append(s,s->first,"ao3")) return MPXP_False; } else{ @@ -373,7 +373,7 @@ } } } - if(strcmp(s->last->info->name,"ao2")!=0) if(!af_append(s,s->last,"ao2")) return MPXP_False; + if(strcmp(s->last->info->name,"ao3")!=0) if(!af_append(s,s->last,"ao3")) return MPXP_False; // Init filters if(MPXP_Ok != af_reinit(s,s->first)) @@ -575,8 +575,8 @@ MPXP_Rc __FASTCALL__ af_query_fmt (const af_stream_t* s,mpaf_format_e fmt) { af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_format(mpaf2afmt(fmt)); + const char *filt_name=filt?filt->info->name:"ao3"; + if(strcmp(filt_name,"ao3")==0) return mpxp_context().audio().output->test_format(mpaf2afmt(fmt)); else if(afmt2mpaf(fmt)==filt->conf.format) return MPXP_True; return MPXP_False; } @@ -584,8 +584,8 @@ MPXP_Rc __FASTCALL__ af_query_rate (const af_stream_t* s,unsigned rate) { af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_rate(rate); + const char *filt_name=filt?filt->info->name:"ao3"; + if(strcmp(filt_name,"ao3")==0) return mpxp_context().audio().output->test_rate(rate); else if(rate==filt->conf.rate) return MPXP_True; return MPXP_False; } @@ -593,8 +593,8 @@ MPXP_Rc __FASTCALL__ af_query_channels (const af_stream_t* s,unsigned nch) { af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_channels(nch); + const char *filt_name=filt?filt->info->name:"ao3"; + if(strcmp(filt_name,"ao3")==0) return mpxp_context().audio().output->test_channels(nch); else if(nch==filt->conf.nch) return MPXP_True; return MPXP_False; } Deleted: mplayerxp/postproc/af_ao2.cpp =================================================================== --- mplayerxp/postproc/af_ao2.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/postproc/af_ao2.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -1,178 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* The name speaks for itself this filter is a dummy and will not blow - up regardless of what you do with it. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "libao2/audio_out.h" -#include "libao2/afmt.h" - -#include "af.h" -#include "af_internal.h" -#include "pp_msg.h" - -static unsigned rates[] = -{ 4000, 5512, 8000, 9600, 11025, 16000, 19200, 22050, 24000, 32000, 38400, 44100, 48000, 64000, 76800, 88200, 96000, 128000, 153600, 176400, 192000 }; - -static unsigned __FASTCALL__ find_best_rate(unsigned irate) -{ - unsigned i,ii; - MPXP_Rc rval; - rval=mpxp_context().audio().output->test_rate(irate); - if(rval == MPXP_True) return irate; - for(i=0;i<sizeof(rates)/sizeof(unsigned)-1;i++) { - if(irate >= rates[i] && irate < rates[i+1]) break; - } - ii=i; - for(;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=mpxp_context().audio().output->test_rate(rates[i]); - if(rval == MPXP_True) return rates[i]; - } - i=ii; - for(;i<sizeof(rates)/sizeof(unsigned);i--) { - rval=mpxp_context().audio().output->test_rate(rates[i]); - if(rval == MPXP_True) return rates[i]; - } - for(i=0;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=mpxp_context().audio().output->test_rate(rates[i]); - if(rval == MPXP_True) return rates[i]; - } - return 44100; -} - -static unsigned __FASTCALL__ find_best_ch(unsigned ich) -{ - unsigned i; - MPXP_Rc rval; - rval=mpxp_context().audio().output->test_channels(ich); - if(rval == MPXP_True) return ich; - for(i=ich>1?ich:1;i<AF_NCH;i++) { - rval=mpxp_context().audio().output->test_channels(i); - if(rval == MPXP_True) return i; - } - for(i=1;i<AF_NCH;i++) { - rval=mpxp_context().audio().output->test_channels(i); - if(rval == MPXP_True) return i; - } - return 2; -} - -struct fmt_cvt_t { - unsigned base_fourcc; - unsigned cvt_fourcc[20]; -}; - -static fmt_cvt_t cvt_list[] = -{ - { AFMT_FLOAT32, { AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_U32_BE, { AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U24_BE, AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_U32_LE, { AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_S32_BE, { AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S24_BE, AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_S32_LE, { AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_U24_BE, { AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U16_BE, AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_U24_LE, { AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_S24_BE, { AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S16_BE, AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_S24_LE, { AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_U16_BE, { AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_U16_LE, { AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U8, AFMT_S8, 0 }}, - { AFMT_S16_BE, { AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_S16_LE, { AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S8, AFMT_U8, 0 }}, - { AFMT_U8, { AFMT_S8, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, 0 }}, - { AFMT_S8, { AFMT_U8, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, 0 }}, -}; - -static unsigned __FASTCALL__ find_best_fmt(unsigned ifmt) -{ - unsigned i,j,idx; - MPXP_Rc rval; - rval=mpxp_context().audio().output->test_format(ifmt); - if(rval == MPXP_True) return ifmt; - idx=-1; - for(i=0;i<sizeof(cvt_list)/sizeof(fmt_cvt_t);i++) { - if(ifmt==cvt_list[i].base_fourcc) { idx=i; break; } - } - if(idx==-1) return 0; /* unknown format */ - i=idx; - for(j=0;j<20;j++) { - if(cvt_list[i].cvt_fourcc[j]==0) break; - rval=mpxp_context().audio().output->test_format(cvt_list[i].cvt_fourcc[j]); - if(rval == MPXP_True) return cvt_list[i].cvt_fourcc[j]; - } - return AFMT_S16_LE; -} - -struct af_ao2_t{ - unsigned rate; - unsigned nch; - mpaf_format_e format; -}; - -// Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af, const af_conf_t* arg) -{ - af_ao2_t* s = reinterpret_cast<af_ao2_t*>(af->setup); - /* Sanity check */ - if(!arg) return MPXP_Error; - s->rate = af->conf.rate = find_best_rate(arg->rate); - s->nch = af->conf.nch = find_best_ch(arg->nch); - s->format = af->conf.format = afmt2mpaf(find_best_fmt(mpaf2afmt(arg->format))); - return af_test_output(af,arg); -} - -static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) -{ - af_ao2_t* s = reinterpret_cast<af_ao2_t*>(af->setup); - UNUSED(arg); - switch(cmd){ - case AF_CONTROL_SHOWCONF: { - char sbuf[256]; - const ao_info_t*info=mpxp_context().audio().output->get_info(); - MSG_INFO("AO-CONF: [%s] %uHz nch=%u %s (%3.1f-kbit)\n" - ,info->short_name,s->rate,s->nch,mpaf_fmt2str(s->format,sbuf,sizeof(sbuf)) - ,(s->rate*s->nch*(s->format&MPAF_BPS_MASK)*8)*0.001f); - return MPXP_Ok; - } - default: break; - } - return MPXP_Unknown; -} - -// Deallocate memory -static void __FASTCALL__ uninit(af_instance_t* af) -{ - if(af->setup) delete af->setup; -} - -// Filter data through filter -static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* data) -{ - // Do something necessary to get rid of annoying warning during compile - if(!af) MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); - return const_cast<mp_aframe_t*>(data); -} - -// Allocate memory and set function pointers -static MPXP_Rc __FASTCALL__ af_open(af_instance_t* af){ - af->config_af=config_af; - af->control_af=control_af; - af->uninit=uninit; - af->play=play; - af->mul.d=1; - af->mul.n=1; - af->setup=mp_calloc(1,sizeof(af_ao2_t)); - if(af->setup == NULL) return MPXP_Error; - check_pin("afilter",af->pin,AF_PIN); - return MPXP_Ok; -} - -// Description of this filter -extern const af_info_t af_info_ao = { - "libao wrapper", - "ao2", - "Nickols_K", - "", - AF_FLAGS_REENTRANT, - af_open -}; Copied: mplayerxp/postproc/af_ao3.cpp (from rev 566, mplayerxp/postproc/af_ao2.cpp) =================================================================== --- mplayerxp/postproc/af_ao3.cpp (rev 0) +++ mplayerxp/postproc/af_ao3.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -0,0 +1,178 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* The name speaks for itself this filter is a dummy and will not blow + up regardless of what you do with it. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "libao3/audio_out.h" +#include "libao3/afmt.h" + +#include "af.h" +#include "af_internal.h" +#include "pp_msg.h" + +static unsigned rates[] = +{ 4000, 5512, 8000, 9600, 11025, 16000, 19200, 22050, 24000, 32000, 38400, 44100, 48000, 64000, 76800, 88200, 96000, 128000, 153600, 176400, 192000 }; + +static unsigned __FASTCALL__ find_best_rate(unsigned irate) +{ + unsigned i,ii; + MPXP_Rc rval; + rval=mpxp_context().audio().output->test_rate(irate); + if(rval == MPXP_True) return irate; + for(i=0;i<sizeof(rates)/sizeof(unsigned)-1;i++) { + if(irate >= rates[i] && irate < rates[i+1]) break; + } + ii=i; + for(;i<sizeof(rates)/sizeof(unsigned);i++) { + rval=mpxp_context().audio().output->test_rate(rates[i]); + if(rval == MPXP_True) return rates[i]; + } + i=ii; + for(;i<sizeof(rates)/sizeof(unsigned);i--) { + rval=mpxp_context().audio().output->test_rate(rates[i]); + if(rval == MPXP_True) return rates[i]; + } + for(i=0;i<sizeof(rates)/sizeof(unsigned);i++) { + rval=mpxp_context().audio().output->test_rate(rates[i]); + if(rval == MPXP_True) return rates[i]; + } + return 44100; +} + +static unsigned __FASTCALL__ find_best_ch(unsigned ich) +{ + unsigned i; + MPXP_Rc rval; + rval=mpxp_context().audio().output->test_channels(ich); + if(rval == MPXP_True) return ich; + for(i=ich>1?ich:1;i<AF_NCH;i++) { + rval=mpxp_context().audio().output->test_channels(i); + if(rval == MPXP_True) return i; + } + for(i=1;i<AF_NCH;i++) { + rval=mpxp_context().audio().output->test_channels(i); + if(rval == MPXP_True) return i; + } + return 2; +} + +struct fmt_cvt_t { + unsigned base_fourcc; + unsigned cvt_fourcc[20]; +}; + +static fmt_cvt_t cvt_list[] = +{ + { AFMT_FLOAT32, { AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_U32_BE, { AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U24_BE, AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_U32_LE, { AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_S32_BE, { AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S24_BE, AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_S32_LE, { AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_U24_BE, { AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U16_BE, AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_U24_LE, { AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_S24_BE, { AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S16_BE, AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_S24_LE, { AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_U16_BE, { AFMT_U16_LE, AFMT_S16_BE, AFMT_S16_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_FLOAT32, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_U16_LE, { AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, AFMT_U8, AFMT_S8, 0 }}, + { AFMT_S16_BE, { AFMT_S16_LE, AFMT_U16_BE, AFMT_U16_LE, AFMT_S24_BE, AFMT_S24_LE, AFMT_U24_BE, AFMT_U24_LE, AFMT_S32_BE, AFMT_S32_LE, AFMT_U32_BE, AFMT_U32_LE, AFMT_FLOAT32, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_S16_LE, { AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, AFMT_S8, AFMT_U8, 0 }}, + { AFMT_U8, { AFMT_S8, AFMT_U16_LE, AFMT_U16_BE, AFMT_S16_LE, AFMT_S16_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_FLOAT32, 0 }}, + { AFMT_S8, { AFMT_U8, AFMT_S16_LE, AFMT_S16_BE, AFMT_U16_LE, AFMT_U16_BE, AFMT_S24_LE, AFMT_S24_BE, AFMT_U24_LE, AFMT_U24_BE, AFMT_S32_LE, AFMT_S32_BE, AFMT_U32_LE, AFMT_U32_BE, AFMT_FLOAT32, 0 }}, +}; + +static unsigned __FASTCALL__ find_best_fmt(unsigned ifmt) +{ + unsigned i,j,idx; + MPXP_Rc rval; + rval=mpxp_context().audio().output->test_format(ifmt); + if(rval == MPXP_True) return ifmt; + idx=-1; + for(i=0;i<sizeof(cvt_list)/sizeof(fmt_cvt_t);i++) { + if(ifmt==cvt_list[i].base_fourcc) { idx=i; break; } + } + if(idx==-1) return 0; /* unknown format */ + i=idx; + for(j=0;j<20;j++) { + if(cvt_list[i].cvt_fourcc[j]==0) break; + rval=mpxp_context().audio().output->test_format(cvt_list[i].cvt_fourcc[j]); + if(rval == MPXP_True) return cvt_list[i].cvt_fourcc[j]; + } + return AFMT_S16_LE; +} + +struct af_ao3_t{ + unsigned rate; + unsigned nch; + mpaf_format_e format; +}; + +// Initialization and runtime control_af +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af, const af_conf_t* arg) +{ + af_ao3_t* s = reinterpret_cast<af_ao3_t*>(af->setup); + /* Sanity check */ + if(!arg) return MPXP_Error; + s->rate = af->conf.rate = find_best_rate(arg->rate); + s->nch = af->conf.nch = find_best_ch(arg->nch); + s->format = af->conf.format = afmt2mpaf(find_best_fmt(mpaf2afmt(arg->format))); + return af_test_output(af,arg); +} + +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) +{ + af_ao3_t* s = reinterpret_cast<af_ao3_t*>(af->setup); + UNUSED(arg); + switch(cmd){ + case AF_CONTROL_SHOWCONF: { + char sbuf[256]; + const ao_info_t*info=mpxp_context().audio().output->get_info(); + MSG_INFO("AO-CONF: [%s] %uHz nch=%u %s (%3.1f-kbit)\n" + ,info->short_name,s->rate,s->nch,mpaf_fmt2str(s->format,sbuf,sizeof(sbuf)) + ,(s->rate*s->nch*(s->format&MPAF_BPS_MASK)*8)*0.001f); + return MPXP_Ok; + } + default: break; + } + return MPXP_Unknown; +} + +// Deallocate memory +static void __FASTCALL__ uninit(af_instance_t* af) +{ + if(af->setup) delete af->setup; +} + +// Filter data through filter +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* data) +{ + // Do something necessary to get rid of annoying warning during compile + if(!af) MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); + return const_cast<mp_aframe_t*>(data); +} + +// Allocate memory and set function pointers +static MPXP_Rc __FASTCALL__ af_open(af_instance_t* af){ + af->config_af=config_af; + af->control_af=control_af; + af->uninit=uninit; + af->play=play; + af->mul.d=1; + af->mul.n=1; + af->setup=mp_calloc(1,sizeof(af_ao3_t)); + if(af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); + return MPXP_Ok; +} + +// Description of this filter +extern const af_info_t af_info_ao = { + "libao wrapper", + "ao3", + "Nickols_K", + "", + AF_FLAGS_REENTRANT, + af_open +}; Modified: mplayerxp/xmpcore/mp_aframe.cpp =================================================================== --- mplayerxp/xmpcore/mp_aframe.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/xmpcore/mp_aframe.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -5,7 +5,7 @@ #include <stdio.h> #include "mp_aframe.h" -#include "libao2/afmt.h" +#include "libao3/afmt.h" #include "loader/wine/mmreg.h" #include "mp_msg.h" Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -14,7 +14,7 @@ #include "libmpdemux/demuxer.h" #include "libmpcodecs/dec_audio.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "osdep/timer.h" #include "xmp_core.h" Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -19,7 +19,7 @@ #include <sys/time.h> #include "xmp_core.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "libvo2/video_out.h" #include "libmpcodecs/dec_video.h" Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-17 08:02:17 UTC (rev 566) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-17 08:47:00 UTC (rev 567) @@ -8,7 +8,7 @@ #include "mp_msg.h" #include "sig_hand.h" -#include "libao2/audio_out.h" +#include "libao3/audio_out.h" #include "libvo2/video_out.h" #include "libmpdemux/demuxer_r.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-17 08:02:29
|
Revision: 566 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=566&view=rev Author: nickols_k Date: 2012-12-17 08:02:17 +0000 (Mon, 17 Dec 2012) Log Message: ----------- rename libao2 ->libao3 (TRANSACTION BEGIN) Added Paths: ----------- mplayerxp/libao3/ mplayerxp/libao3/Makefile mplayerxp/libao3/ao_alsa.cpp mplayerxp/libao3/ao_arts.cpp mplayerxp/libao3/ao_esd.cpp mplayerxp/libao3/ao_jack.cpp mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_openal.cpp mplayerxp/libao3/ao_oss.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libao3/ao_wav.cpp mplayerxp/libao3/audio_out.cpp mplayerxp/libao3/audio_out.h Removed Paths: ------------- mplayerxp/libao2/ mplayerxp/libao3/Makefile mplayerxp/libao3/ao_alsa9.cpp mplayerxp/libao3/ao_arts.cpp mplayerxp/libao3/ao_esd.cpp mplayerxp/libao3/ao_jack.cpp mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_openal.cpp mplayerxp/libao3/ao_oss.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libao3/ao_wav.cpp mplayerxp/libao3/audio_out.cpp mplayerxp/libao3/audio_out.h mplayerxp/libao3/mixer.cpp mplayerxp/libao3/mixer.h Deleted: mplayerxp/libao3/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-12-15 13:09:33 UTC (rev 563) +++ mplayerxp/libao3/Makefile 2012-12-17 08:02:17 UTC (rev 566) @@ -1,71 +0,0 @@ - -include ../mp_config.mak - -LIBNAME = libao2.a - -# TODO: moveout ao_sdl.c so it's only used when SDL is detected -CXXSRCS=audio_out.cpp mixer.cpp afmt.cpp -CXXSRCS+=ao_null.cpp ao_wav.cpp -ifeq ($(HAVE_SDL),yes) -CXXSRCS+=ao_sdl.cpp -endif -ifeq ($(USE_OSS_AUDIO),yes) -CXXSRCS+=ao_oss.cpp -endif -ifeq ($(HAVE_ALSA),yes) -CXXSRCS+=ao_alsa9.cpp -endif -ifeq ($(HAVE_ARTS),yes) -CXXSRCS+=ao_arts.cpp -endif -ifeq ($(HAVE_ESD),yes) -CXXSRCS+=ao_esd.cpp -endif -ifeq ($(HAVE_OPENAL),yes) -CXXSRCS+=ao_openal.cpp -endif -ifeq ($(HAVE_NAS),yes) -CXXSRCS+=ao_nas.cpp -endif -ifeq ($(HAVE_JACK),yes) -CXXSRCS+=ao_jack.cpp -endif - -OBJS=$(SRCS:.c=.o) -CXXOBJS=$(CXXSRCS:.cpp=.o) - -CFLAGS = $(OPTFLAGS) -I. -I.. -Wall -CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall - -.SUFFIXES: .c .o - -# .PHONY: all clean - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $< -.cpp.o: - $(CXX) -c $(CXXFLAGS) -o $@ $< - -$(LIBNAME): $(OBJS) $(CXXOBJS) - $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) - -all: dep $(LIBNAME) - -clean: - rm -f *.o *.a *~ - -distclean: - rm -f Makefile.bak *.o *.a *~ .depend - -dep: .depend - -.depend: $(SRCS) $(CXXSRCS) - $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend - -# -# include dependency files if they exist -# -ifneq ($(wildcard .depend),) -include .depend -endif - Copied: mplayerxp/libao3/Makefile (from rev 564, mplayerxp/libao2/Makefile) =================================================================== --- mplayerxp/libao3/Makefile (rev 0) +++ mplayerxp/libao3/Makefile 2012-12-17 08:02:17 UTC (rev 566) @@ -0,0 +1,71 @@ + +include ../mp_config.mak + +LIBNAME = libao2.a + +# TODO: moveout ao_sdl.c so it's only used when SDL is detected +CXXSRCS=audio_out.cpp afmt.cpp +CXXSRCS+=ao_null.cpp ao_wav.cpp +ifeq ($(HAVE_SDL),yes) +CXXSRCS+=ao_sdl.cpp +endif +ifeq ($(USE_OSS_AUDIO),yes) +CXXSRCS+=ao_oss.cpp +endif +ifeq ($(HAVE_ALSA),yes) +CXXSRCS+=ao_alsa.cpp +endif +ifeq ($(HAVE_ARTS),yes) +CXXSRCS+=ao_arts.cpp +endif +ifeq ($(HAVE_ESD),yes) +CXXSRCS+=ao_esd.cpp +endif +ifeq ($(HAVE_OPENAL),yes) +CXXSRCS+=ao_openal.cpp +endif +ifeq ($(HAVE_NAS),yes) +CXXSRCS+=ao_nas.cpp +endif +ifeq ($(HAVE_JACK),yes) +CXXSRCS+=ao_jack.cpp +endif + +OBJS=$(SRCS:.c=.o) +CXXOBJS=$(CXXSRCS:.cpp=.o) + +CFLAGS = $(OPTFLAGS) -I. -I.. -Wall +CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall + +.SUFFIXES: .c .o + +# .PHONY: all clean + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< +.cpp.o: + $(CXX) -c $(CXXFLAGS) -o $@ $< + +$(LIBNAME): $(OBJS) $(CXXOBJS) + $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) + +all: dep $(LIBNAME) + +clean: + rm -f *.o *.a *~ + +distclean: + rm -f Makefile.bak *.o *.a *~ .depend + +dep: .depend + +.depend: $(SRCS) $(CXXSRCS) + $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif + Copied: mplayerxp/libao3/ao_alsa.cpp (from rev 564, mplayerxp/libao2/ao_alsa.cpp) =================================================================== --- mplayerxp/libao3/ao_alsa.cpp (rev 0) +++ mplayerxp/libao3/ao_alsa.cpp 2012-12-17 08:02:17 UTC (rev 566) @@ -0,0 +1,1024 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* + ao_alsa9 - ALSA-0.9.x output plugin for MPlayer + + (C) Alex Beregszaszi <al...@na...> + + modified for real alsa-0.9.0-support by Joy Winter <jo...@pi...> + additional AC3 passthrough support by Andy Lo A Foe <an...@al...> + 08/22/2002 iec958-init rewritten and merged with common init, joy + + Any bugreports regarding to this driver are welcome. +*/ + +#include <errno.h> +#include <sys/time.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <sys/poll.h> + +#include "mplayerxp.h" +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API +#include <alsa/asoundlib.h> + +#include "audio_out.h" +#include "audio_out_internal.h" +#include "afmt.h" +#include "ao_msg.h" +#include "libmpstream2/mrl.h" + +namespace mpxp { +typedef struct priv_conf_s { + int mmap; + int noblock; +}priv_conf_t; +static priv_conf_t priv_conf; +static const mrl_config_t alsaconf[]={ + { "mmap", &priv_conf.mmap, MRL_TYPE_BOOL, 0, 1 }, + { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, + { NULL, NULL, 0, 0, 0 } +}; +class Alsa_AO_Interface : public AO_Interface { + public: + Alsa_AO_Interface(const std::string& subdevice); + virtual ~Alsa_AO_Interface(); + + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + void show_caps(unsigned device) const; + int xrun(const char *str_mode) const; + unsigned play_normal(const any_t* data, unsigned len); + unsigned play_mmap(const any_t* data, unsigned len); + snd_pcm_format_t fmt2alsa(unsigned format) const; + + snd_pcm_t* handler; + snd_pcm_format_t snd_format; + snd_pcm_hw_params_t* hwparams; + snd_pcm_sw_params_t* swparams; + size_t bytes_per_sample; + int first; +}; + +Alsa_AO_Interface::Alsa_AO_Interface(const std::string& _subdevice) + :AO_Interface(_subdevice) {} +Alsa_AO_Interface::~Alsa_AO_Interface() { + int err; + if(!handler) { + MSG_ERR("alsa-uninit: no handler defined!\n"); + return; + } + if (!priv_conf.noblock) { + if ((err = snd_pcm_drain(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); + return; + } + } + if ((err = snd_pcm_close(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + return; + } else { + handler = NULL; + MSG_V("alsa-uninit: pcm closed\n"); + } + snd_pcm_hw_params_free(hwparams); + snd_pcm_sw_params_free(swparams); +} + +#define ALSA_DEVICE_SIZE 48 + +#define BUFFERTIME // else SET_CHUNK_SIZE +#undef USE_POLL + +snd_pcm_format_t Alsa_AO_Interface::fmt2alsa(unsigned f) const { + switch (f) + { + case AFMT_S8: + return SND_PCM_FORMAT_S8; + break; + case AFMT_U8: + return SND_PCM_FORMAT_U8; + break; + case AFMT_U16_LE: + return SND_PCM_FORMAT_U16_LE; + break; + case AFMT_U16_BE: + return SND_PCM_FORMAT_U16_BE; + break; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif + case AFMT_S16_LE: + return SND_PCM_FORMAT_S16_LE; + break; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif + case AFMT_S16_BE: + return SND_PCM_FORMAT_S16_BE; + break; + case AFMT_S32_LE: + return SND_PCM_FORMAT_S32_LE; + break; + case AFMT_S32_BE: + return SND_PCM_FORMAT_S32_BE; + break; + case AFMT_U32_LE: + return SND_PCM_FORMAT_U32_LE; + break; + case AFMT_U32_BE: + return SND_PCM_FORMAT_U32_BE; + break; + case AFMT_S24_LE: + return SND_PCM_FORMAT_S24_LE; + break; + case AFMT_S24_BE: + return SND_PCM_FORMAT_S24_BE; + break; + case AFMT_U24_LE: + return SND_PCM_FORMAT_U24_LE; + break; + case AFMT_U24_BE: + return SND_PCM_FORMAT_U24_BE; + break; + case AFMT_FLOAT32: +#ifdef WORDS_BIGENDIAN + return SND_PCM_FORMAT_FLOAT_BE; +#else + return SND_PCM_FORMAT_FLOAT_LE; +#endif + break; + default: + return SND_PCM_FORMAT_MPEG; + break; + } +} + +/* to set/get/query special features/parameters */ +MPXP_Rc Alsa_AO_Interface::ctrl(int cmd, long arg) const { + switch(cmd) { + case AOCONTROL_GET_VOLUME: + case AOCONTROL_SET_VOLUME: +#ifndef WORDS_BIGENDIAN + { //seems to be a problem on macs? + ao_control_vol_t *vol = (ao_control_vol_t *)arg; + + int err; + snd_mixer_t *handle; + snd_mixer_elem_t *elem; + snd_mixer_selem_id_t *sid; + + const char *mix_name = "PCM"; + const char *card = "default"; + + long pmin, pmax; + long get_vol, set_vol; + float calc_vol, diff, f_multi; + + if(_format == AFMT_AC3) return MPXP_True; + + //allocate simple id + snd_mixer_selem_id_alloca(&sid); + + //sets simple-mixer index and name + snd_mixer_selem_id_set_index(sid, 0); + snd_mixer_selem_id_set_name(sid, mix_name); + + if ((err = snd_mixer_open(&handle, 0)) < 0) { + MSG_ERR("alsa-control_ao: mixer open error: %s\n", snd_strerror(err)); + return MPXP_Error; + } + + if ((err = snd_mixer_attach(handle, card)) < 0) { + MSG_ERR("alsa-control_ao: mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + + if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) { + MSG_ERR("alsa-control_ao: mixer register error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + if ((err = snd_mixer_load(handle)) < 0) { + MSG_ERR("alsa-control_ao: mixer load error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + + elem = snd_mixer_find_selem(handle, sid); + if (!elem) { + MSG_ERR("alsa-control_ao: unable to find simple control_ao '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + snd_mixer_close(handle); + return MPXP_Error; + } + + snd_mixer_selem_get_playback_volume_range(elem,&pmin,&pmax); + f_multi = (100 / (float)pmax); + + if (cmd == AOCONTROL_SET_VOLUME) { + + diff = (vol->left+vol->right) / 2; + set_vol = rint(diff / f_multi); + + if (set_vol < 0) set_vol = 0; + else if (set_vol > pmax) set_vol = pmax; + + //setting channels + if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(0), set_vol)) < 0) { + MSG_ERR("alsa-control_ao: error setting left channel, %s",snd_strerror(err)); + return MPXP_Error; + } + if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(1), set_vol)) < 0) { + MSG_ERR("alsa-control_ao: error setting right channel, %s",snd_strerror(err)); + return MPXP_Error; + } + } else { + snd_mixer_selem_get_playback_volume(elem, snd_mixer_selem_channel_id_t(0), &get_vol); + calc_vol = get_vol; + calc_vol = rintf(calc_vol * f_multi); + + vol->left = vol->right = (int)calc_vol; + + //printf("get_vol = %i, calc=%i\n",get_vol, calc_vol); + } + snd_mixer_close(handle); + return MPXP_Ok; + } +#else // end big-endian + return MPXP_Unknown; +#endif + } //end witch + return MPXP_Unknown; +} + +void Alsa_AO_Interface::show_caps(unsigned device) const { + snd_pcm_info_t *alsa_info; + snd_pcm_t *pcm; + snd_pcm_hw_params_t *hw_params; + snd_output_t *sout; + int err,cards=-1; + unsigned rmin,rmax; + unsigned j,sdmin,sdmax; + char adevice[ALSA_DEVICE_SIZE]; + if ((err = snd_card_next(&cards)) < 0 || cards < 0) + { + MSG_ERR("AO-INFO: alsa-init: no soundcards found: %s\n", snd_strerror(err)); + return; + } + snd_pcm_info_malloc(&alsa_info); + snd_pcm_info_set_device(alsa_info,device); + sdmin=snd_pcm_info_get_subdevice(alsa_info); + sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); + MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); + for(j=sdmin;j<=sdmax;j++) { + int i; + snd_pcm_info_set_subdevice(alsa_info,j); + sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); + MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); + if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + return; + } + snd_pcm_hw_params_malloc(&hw_params); + if(snd_pcm_hw_params_any(pcm, hw_params)<0) { + MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); + return; + } + MSG_INFO(" AO-INFO: List of access type: "); + for(i=0;i<SND_PCM_ACCESS_LAST;i++) + if(!snd_pcm_hw_params_test_access(pcm,hw_params,snd_pcm_access_t(i))) + MSG_INFO("%s ",snd_pcm_access_name(snd_pcm_access_t(i))); + MSG_INFO("\n"); + MSG_INFO(" AO-INFO: List of supported formats: "); + for(i=0;i<SND_PCM_FORMAT_LAST;i++) + if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) + MSG_INFO("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); + MSG_INFO("\n"); + MSG_INFO(" AO-INFO: List of supported channels: "); + for(i=0;i<64;i++) + if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) + MSG_INFO("%u ",i); + MSG_INFO("\n"); + snd_pcm_hw_params_get_rate_min(hw_params,&rmin,&err); + snd_pcm_hw_params_get_rate_max(hw_params,&rmax,&err); + MSG_INFO(" AO-INFO: Rates range: %u %u\n",rmin,rmax); + snd_output_stdio_attach(&sout, stderr, 0); + snd_pcm_hw_params_dump(hw_params, sout); + if(hw_params) snd_pcm_hw_params_free(hw_params); + if(pcm) snd_pcm_close(pcm); + } + snd_pcm_info_free(alsa_info); +} + +/* + open & setup audio device + return: 1=success 0=fail +*/ +MPXP_Rc Alsa_AO_Interface::open(unsigned flags) { + int err; + int cards = -1; + snd_pcm_info_t *alsa_info; + const char *str_block_mode; + char *alsa_dev=NULL; + char *alsa_port=NULL; + char alsa_device[ALSA_DEVICE_SIZE]; + UNUSED(flags); + first=1; + + handler = NULL; + alsa_device[0]='\0'; + + MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); + + if (!subdevice.empty()) { + const char *param; + char *p; + // example: -ao alsa:hw:0#mmap=1 + param=mrl_parse_line(subdevice,NULL,NULL,&alsa_dev,&alsa_port); + mrl_parse_params(param,alsaconf); + if(alsa_port) { + p=strchr(alsa_port,','); + if(p) { + if(strcmp(p+1,"-1")==0) { + *p='\0'; + show_caps(atoi(alsa_port)); + return MPXP_False; + } + } + if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); + else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); + MSG_V("alsa-init: soundcard set to %s\n", alsa_device); + } //end parsing ao->subdevice + } + + if ((err = snd_card_next(&cards)) < 0 || cards < 0) { + MSG_ERR("alsa-init: no soundcards found: %s\n", snd_strerror(err)); + return MPXP_False; + } + + if (alsa_device[0] == '\0') { + int tmp_device, tmp_subdevice; + + if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { + MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); + return MPXP_False; + } + + if ((tmp_device = snd_pcm_info_get_device(alsa_info)) < 0) { + MSG_ERR("alsa-init: cant get device\n"); + return MPXP_False; + } + + if ((tmp_subdevice = snd_pcm_info_get_subdevice(alsa_info)) < 0) { + MSG_ERR("alsa-init: cant get subdevice\n"); + return MPXP_False; + } + MSG_V("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); + + if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) { + MSG_ERR("alsa-init: cant wrote device-id\n"); + } + snd_pcm_info_free(alsa_info); + } + + MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); + //setting modes for block or nonblock-mode + int open_mode,block_mode; + if (priv_conf.noblock) { + open_mode = SND_PCM_NONBLOCK; + block_mode = 1; + str_block_mode = "nonblock-mode"; + } else { + open_mode = 0; + block_mode = 0; + str_block_mode = "block-mode"; + } + + if (!handler) { + //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { + if (priv_conf.noblock) { + MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + alsa_device[0]='\0'; + return MPXP_False; + } else { + block_mode = 0; + str_block_mode = "block-mode"; + } + } else { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + alsa_device[0]='\0'; + return MPXP_False; + } + } + alsa_device[0]='\0'; + if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { + MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); + } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); + + snd_pcm_hw_params_malloc(&hwparams); + snd_pcm_sw_params_malloc(&swparams); + + // setting hw-parameters + if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { + MSG_ERR("alsa-init: unable to get initial parameters: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_any()\n"); + if (priv_conf.mmap) { + snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); + snd_pcm_access_mask_none(mask); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); + err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); + MSG_ERR("alsa-init: mmap set\n"); + } else { + err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); + MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); + } + if (err < 0) { + MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); + return MPXP_False; + } + } // end switch priv->handler (spdif) + return MPXP_Ok; +} // end init + +MPXP_Rc Alsa_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { + int err,i; + size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; + snd_pcm_uframes_t dummy; + + MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, + c, ao_format_name(f)); + + _samplerate = r; + _format = f; + _channels = c; + _outburst = OUTBURST; + //ao->buffersize = MAX_OUTBURST; // was 16384 + + snd_format=fmt2alsa(_format); + + switch(snd_format) { + case SND_PCM_FORMAT_S16_LE: + case SND_PCM_FORMAT_U16_LE: + case SND_PCM_FORMAT_S16_BE: + case SND_PCM_FORMAT_U16_BE: + case SND_PCM_FORMAT_S32_LE: + case SND_PCM_FORMAT_S32_BE: + case SND_PCM_FORMAT_U32_LE: + case SND_PCM_FORMAT_U32_BE: + case SND_PCM_FORMAT_FLOAT_BE: + case SND_PCM_FORMAT_FLOAT_LE: + case SND_PCM_FORMAT_S24_LE: + case SND_PCM_FORMAT_S24_BE: + case SND_PCM_FORMAT_U24_LE: + case SND_PCM_FORMAT_U24_BE: + break; + case -1: + MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", + ao_format_name(_format)); + return MPXP_False; + default: + break; + } + bytes_per_sample = bps() / _samplerate; + + if ((err = snd_pcm_hw_params_set_format(handler, hwparams, + snd_format)) < 0) { + MSG_ERR("alsa-conf: unable to set format(%s): %s\n", + snd_pcm_format_name(snd_format), + snd_strerror(err)); + MSG_HINT("Please try one of: "); + for(i=0;i<SND_PCM_FORMAT_LAST;i++) + if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) + MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); + MSG_HINT("\n"); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); + + if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { + MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", + _samplerate, + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); + + if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, + _channels)) < 0) { + MSG_ERR("alsa-conf: unable to set %u channels: %s\n", + _channels, + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); +#ifdef BUFFERTIME + { + int dir; + unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ + + if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { + MSG_ERR("alsa-init: unable to set buffer time near: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); + + period_time = alsa_buffer_time/4; + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { + /* original: alsa_buffer_time/ao->bps */ + MSG_ERR("alsa-init: unable to set period time: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_period_time_near(%i)\n",period_time); + MSG_V("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, period_time); + } +#else + { + int dir=0; + unsigned period_time=100000; /* period time in us */ + snd_pcm_uframes_t size; + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { + MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); + + //get chunksize + if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { + MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_get_period_size(%i)\n",size); + chunk_size=size; + } +#endif + // gets buffersize for control_ao + if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { + MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); + return MPXP_False; + } else { + _buffersize = dummy * bytes_per_sample; + MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); + } + MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); + bits_per_sample = snd_pcm_format_physical_width(snd_format); + MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); + bits_per_frame = bits_per_sample * _channels; + chunk_bytes = chunk_size * bits_per_frame / 8; + + MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); + + /* finally install hardware parameters */ + if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { + MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params()\n"); + // setting sw-params (only avail-min) if noblocking mode was choosed + if (priv_conf.noblock) { + if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { + MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); + return MPXP_False; + } + + //set min available frames to consider pcm ready (4) + //increased for nonblock-mode should be set dynamically later + if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { + MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); + return MPXP_False; + } + + if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { + MSG_ERR("alsa-conf: unable to install sw-params\n"); + return MPXP_False; + } + + }//end swparams + + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); + return MPXP_False; + } + // end setting hw-params + MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", + _samplerate, _channels, bytes_per_sample, _buffersize, + snd_pcm_format_description(snd_format)); + return MPXP_Ok; +} // end config_ao + +void Alsa_AO_Interface::pause() { + int err; + + if (!priv_conf.noblock) { + //drain causes error in nonblock-mode! + if ((err = snd_pcm_drain(handler)) < 0) { + MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); + return; + } + } else { + MSG_V("alsa-pause: paused nonblock\n"); + return; + } +} + +void Alsa_AO_Interface::resume() { + int err; + + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); + return; + } +} + +/* stop playing and empty buffers (for seeking/pause) */ +void Alsa_AO_Interface::reset() { + int err; + + if ((err = snd_pcm_drop(handler)) < 0) { + MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); + return; + } + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); + return; + } + return; +} + +#ifdef USE_POLL +static int __FASTCALL__ wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) +{ + unsigned short revents; + + while (1) { + poll(ufds, count, -1); + snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); + if (revents & POLLERR) return -EIO; + if (revents & POLLOUT) return 0; + } +} +#endif + +static void _timersub(const struct timeval*a,const struct timeval* b,struct timeval* result) { + result->tv_sec = a->tv_sec - b->tv_sec; + result->tv_usec = a->tv_usec - b->tv_usec; + if (result->tv_usec < 0) { + --result->tv_sec; + result->tv_usec += 1000000; + } +} + +/* I/O error handler */ +int Alsa_AO_Interface::xrun(const char *str_mode) const { + int err; + snd_pcm_status_t *status; + + snd_pcm_status_alloca(&status); + + if ((err = snd_pcm_status(handler, status))<0) { + MSG_ERR("status error: %s", snd_strerror(err)); + return 0; + } + + if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { + struct timeval now, diff, tstamp; + gettimeofday(&now, 0); + snd_pcm_status_get_trigger_tstamp(status, &tstamp); + _timersub(&now, &tstamp, &diff); + MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", + str_mode, + diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + } + + if ((err = snd_pcm_prepare(handler))<0) { + MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); + return 0; + } + + return 1; /* ok, data should be accepted again */ +} + +unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { + unsigned result; + UNUSED(flags); + MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); + if (priv_conf.mmap) result = play_mmap(data, len); + else result = play_normal(data, len); + return result; +} + +/* + plays 'len' bytes of 'data' + returns: number of bytes played + modified last at 29.06.02 by jp + thanxs for marius <ma...@ro...> for giving us the light ;) +*/ + +unsigned Alsa_AO_Interface::play_normal(const any_t* data, unsigned len) { + unsigned num_frames = len / bytes_per_sample; + const char *output_samples = (const char *)data; + snd_pcm_sframes_t res = 0; + + //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); + + if (!handler) { + MSG_ERR("alsa-play: device configuration error"); + return 0; + } + + while (num_frames > 0) { + res = snd_pcm_writei(handler, (any_t*)output_samples, num_frames); + if (res == -EAGAIN) { + snd_pcm_wait(handler, 1000); + } else if (res == -EPIPE) { /* underrun */ + if (xrun("play") <= 0) { + MSG_ERR("alsa-play: xrun reset error"); + return 0; + } + } else if (res == -ESTRPIPE) { /* suspend */ + MSG_WARN("alsa-play: pcm in suspend mode. trying to resume\n"); + while ((res = snd_pcm_resume(handler)) == -EAGAIN) ::sleep(1); + } else if (res < 0) { + MSG_ERR("alsa-play: unknown status, trying to reset soundcard\n"); + if ((res = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-play: snd prepare error"); + return 0; + break; + } + } + + if (res > 0) { + /* output_samples += ao->channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; + } + } //end while + + if (res < 0) { + MSG_ERR("alsa-play: write error %s", snd_strerror(res)); + return 0; + } + return res < 0 ? 0 : len; +} + +/* mmap-mode mainly based on descriptions by Joshua Haberman <jo...@ha...> + * 'An overview of the ALSA API' http://people.debian.org/~joshua/x66.html + * and some help by Paul Davis <pb...@op...> */ + +unsigned Alsa_AO_Interface::play_mmap(const any_t* data, unsigned len) { + snd_pcm_sframes_t commitres, frames_available; + snd_pcm_uframes_t frames_transmit, size, offset; + const snd_pcm_channel_area_t *area; + any_t* outbuffer; + unsigned result; + +#ifdef USE_POLL //seems not really be needed + struct pollfd *ufds; + int count; + + count = snd_pcm_poll_descriptors_count (handler); + ufds = mp_malloc(sizeof(struct pollfd) * count); + snd_pcm_poll_descriptors(handler, ufds, count); + + //first wait_for_poll + if (err = (wait_for_poll(handler, ufds, count) < 0)) { + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { + xrun("play"); + } + } +#endif + + outbuffer = alloca(_buffersize); + + //don't trust get_space() ;) + frames_available = snd_pcm_avail_update(handler) * bytes_per_sample; + if (frames_available < 0) xrun("play"); + + if (frames_available < 4) { + if (first) { + first = 0; + snd_pcm_start(handler); + } else { //FIXME should break and return 0? + snd_pcm_wait(handler, -1); + first = 1; + } + } + + /* len is simply the available bufferspace got by get_space() + * but real avail_buffer in frames is ab/priv->bytes_per_sample */ + size = len / bytes_per_sample; + + //if (verbose) + //printf("len: %i size %i, f_avail %i, bps %i ...\n", len, size, frames_available, priv->bytes_per_sample); + + frames_transmit = size; + + /* prepare areas and set sw-pointers + * frames_transmit returns the real available buffer-size + * sometimes != frames_available cause of ringbuffer 'emulation' */ + snd_pcm_mmap_begin(handler, &area, &offset, &frames_transmit); + + /* this is specific to interleaved streams (or non-interleaved + * streams with only one channel) */ + outbuffer = ((char *) area->addr + (area->first + area->step * offset) / 8); //8 + + //write data + memcpy(outbuffer, data, (frames_transmit * bytes_per_sample)); + commitres = snd_pcm_mmap_commit(handler, offset, frames_transmit); + + if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames_transmit) { + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { + xrun("play"); + } + } + + //calculate written frames! + result = commitres * bytes_per_sample; + + //mplayer doesn't like -result + if ((int)result < 0) result = 0; + +#ifdef USE_POLL + delete ufds; +#endif + + return result; +} + +typedef enum space_status_e { + GET_SPACE_OPEN, + GET_SPACE_PREPARED, + GET_SPACE_RUNNING, + GET_SPACE_PAUSED, + GET_SPACE_XRUN, + GET_SPACE_UNDEFINED +}space_status; +/* how many byes are mp_free in the buffer */ +unsigned Alsa_AO_Interface::get_space() { + snd_pcm_status_t *status; + int ret,st; + space_status e_status=GET_SPACE_UNDEFINED; + + //snd_pcm_sframes_t avail_frames = 0; + + if ((ret = snd_pcm_status_malloc(&status)) < 0) { + MSG_ERR("alsa-space: memory allocation error: %s\n", snd_strerror(ret)); + return 0; + } + + if ((ret = snd_pcm_status(handler, status)) < 0) { + MSG_ERR("alsa-space: cannot get pcm status: %s\n", snd_strerror(ret)); + return 0; + } + + switch((st=snd_pcm_status_get_state(status))) { + case SND_PCM_STATE_OPEN: + e_status = GET_SPACE_OPEN; + case SND_PCM_STATE_PREPARED: + if (e_status!=GET_SPACE_OPEN) { + e_status = GET_SPACE_PREPARED; + first = 1; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + if (ret == 0) //ugly workaround for hang in mmap-mode + ret = 10; + break; + } + case SND_PCM_STATE_RUNNING: + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + //avail_frames = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; + if (e_status!=GET_SPACE_OPEN && e_status!=GET_SPACE_PREPARED) + e_status = GET_SPACE_RUNNING; + break; + case SND_PCM_STATE_PAUSED: + MSG_V("alsa-space: paused"); + e_status = GET_SPACE_PAUSED; + ret = 0; + break; + case SND_PCM_STATE_XRUN: + xrun("space"); + e_status = GET_SPACE_XRUN; + first = 1; + ret = 0; + break; + default: + e_status = GET_SPACE_UNDEFINED; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + if (ret <= 0) { + xrun("space"); + } + } + + if (e_status!=GET_SPACE_RUNNING) + MSG_V("alsa-space: mp_free space = %i, status=%i, %i --\n", ret, st, e_status); + snd_pcm_status_free(status); + + if (ret < 0) { + MSG_ERR("negative value!!\n"); + ret = 0; + } + + return ret; +} + +/* delay in seconds between first and last sample in buffer */ +float Alsa_AO_Interface::get_delay() +{ + if (handler) { + snd_pcm_status_t *status; + int r; + float ret; + + if ((ret = snd_pcm_status_malloc(&status)) < 0) { + MSG_ERR("alsa-delay: memory allocation error: %s\n", snd_strerror(ret)); + return 0; + } + + if ((ret = snd_pcm_status(handler, status)) < 0) { + MSG_ERR("alsa-delay: cannot get pcm status: %s\n", snd_strerror(ret)); + return 0; + } + + switch(snd_pcm_status_get_state(status)) { + case SND_PCM_STATE_OPEN: + case SND_PCM_STATE_PREPARED: + case SND_PCM_STATE_RUNNING: + r=snd_pcm_status_get_delay(status); + ret = (float)r/(float)_samplerate; + break; + default: + ret = 0; + } + snd_pcm_status_free(status); + + if (ret < 0) ret = 0; + return ret; + } else return 0; +} + +unsigned Alsa_AO_Interface::samplerate() const { return _samplerate; } +unsigned Alsa_AO_Interface::channels() const { return _channels; } +unsigned Alsa_AO_Interface::format() const { return _format; } +unsigned Alsa_AO_Interface::buffersize() const { return _buffersize; } +unsigned Alsa_AO_Interface::outburst() const { return _outburst; } +MPXP_Rc Alsa_AO_Interface::test_channels(unsigned c) const { + return snd_pcm_hw_params_test_channels(handler, hwparams,c)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_rate(unsigned r) const { + return snd_pcm_hw_params_test_rate(handler, hwparams,r,0)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_format(unsigned f) const { + snd_pcm_format_t rval; + rval=fmt2alsa(f); + return snd_pcm_hw_params_test_format(handler, hwparams,snd_pcm_format_t(rval))==0? + MPXP_True:MPXP_False; +} + +static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } + +extern const ao_info_t audio_out_alsa = +{ + "ALSA-1.x audio output", + "alsa", + "Alex Beregszaszi <al...@na...>, Joy Winter <jo...@pi...>", + "under developement", + query_interface +}; +} //namespace mpxp + Deleted: mplayerxp/libao3/ao_alsa9.cpp =================================================================== --- mplayerxp/libao2/ao_alsa9.cpp 2012-12-15 13:09:33 UTC (rev 563) +++ mplayerxp/libao3/ao_alsa9.cpp 2012-12-17 08:02:17 UTC (rev 566) @@ -1,1024 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* - ao_alsa9 - ALSA-0.9.x output plugin for MPlayer - - (C) Alex Beregszaszi <al...@na...> - - modified for real alsa-0.9.0-support by Joy Winter <jo...@pi...> - additional AC3 passthrough support by Andy Lo A Foe <an...@al...> - 08/22/2002 iec958-init rewritten and merged with common init, joy - - Any bugreports regarding to this driver are welcome. -*/ - -#include <errno.h> -#include <sys/time.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> -#include <sys/poll.h> - -#include "mplayerxp.h" -#define ALSA_PCM_NEW_HW_PARAMS_API -#define ALSA_PCM_NEW_SW_PARAMS_API -#include <alsa/asoundlib.h> - -#include "audio_out.h" -#include "audio_out_internal.h" -#include "afmt.h" -#include "ao_msg.h" -#include "libmpstream2/mrl.h" - -namespace mpxp { -typedef struct priv_conf_s { - int mmap; - int noblock; -}priv_conf_t; -static priv_conf_t priv_conf; -static const mrl_config_t alsaconf[]={ - { "mmap", &priv_conf.mmap, MRL_TYPE_BOOL, 0, 1 }, - { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, - { NULL, NULL, 0, 0, 0 } -}; -class Alsa_AO_Interface : public AO_Interface { - public: - Alsa_AO_Interface(const std::string& subdevice); - virtual ~Alsa_AO_Interface(); - - virtual MPXP_Rc open(unsigned flags); - virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); - virtual unsigned samplerate() const; - virtual unsigned channels() const; - virtual unsigned format() const; - virtual unsigned buffersize() const; - virtual unsigned outburst() const; - virtual MPXP_Rc test_rate(unsigned r) const; - virtual MPXP_Rc test_channels(unsigned c) const; - virtual MPXP_Rc test_format(unsigned f) const; - virtual void reset(); - virtual unsigned get_space(); - virtual float get_delay(); - virtual unsigned play(const any_t* data,unsigned len,unsigned flags); - virtual void pause(); - virtual void resume(); - virtual MPXP_Rc ctrl(int cmd,long arg) const; - private: - unsigned _channels,_samplerate,_format; - unsigned _buffersize,_outburst; - unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } - void show_caps(unsigned device) const; - int xrun(const char *str_mode) const; - unsigned play_normal(const any_t* data, unsigned len); - unsigned play_mmap(const any_t* data, unsigned len); - snd_pcm_format_t fmt2alsa(unsigned format) const; - - snd_pcm_t* handler; - snd_pcm_format_t snd_format; - snd_pcm_hw_params_t* hwparams; - snd_pcm_sw_params_t* swparams; - size_t bytes_per_sample; - int first; -}; - -Alsa_AO_Interface::Alsa_AO_Interface(const std::string& _subdevice) - :AO_Interface(_subdevice) {} -Alsa_AO_Interface::~Alsa_AO_Interface() { - int err; - if(!handler) { - MSG_ERR("alsa-uninit: no handler defined!\n"); - return; - } - if (!priv_conf.noblock) { - if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); - return; - } - } - if ((err = snd_pcm_close(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); - return; - } else { - handler = NULL; - MSG_V("alsa-uninit: pcm closed\n"); - } - snd_pcm_hw_params_free(hwparams); - snd_pcm_sw_params_free(swparams); -} - -#define ALSA_DEVICE_SIZE 48 - -#define BUFFERTIME // else SET_CHUNK_SIZE -#undef USE_POLL - -snd_pcm_format_t Alsa_AO_Interface::fmt2alsa(unsigned f) const { - switch (f) - { - case AFMT_S8: - return SND_PCM_FORMAT_S8; - break; - case AFMT_U8: - return SND_PCM_FORMAT_U8; - break; - case AFMT_U16_LE: - return SND_PCM_FORMAT_U16_LE; - break; - case AFMT_U16_BE: - return SND_PCM_FORMAT_U16_BE; - break; -#ifndef WORDS_BIGENDIAN - case AFMT_AC3: -#endif - case AFMT_S16_LE: - return SND_PCM_FORMAT_S16_LE; - break; -#ifdef WORDS_BIGENDIAN - case AFMT_AC3: -#endif - case AFMT_S16_BE: - return SND_PCM_FORMAT_S16_BE; - break; - case AFMT_S32_LE: - return SND_PCM_FORMAT_S32_LE; - break; - case AFMT_S32_BE: - return SND_PCM_FORMAT_S32_BE; - break; - case AFMT_U32_LE: - return SND_PCM_FORMAT_U32_LE; - break; - case AFMT_U32_BE: - return SND_PCM_FORMAT_U32_BE; - break; - case AFMT_S24_LE: - return SND_PCM_FORMAT_S24_LE; - break; - case AFMT_S24_BE: - return SND_PCM_FORMAT_S24_BE; - break; - case AFMT_U24_LE: - return SND_PCM_FORMAT_U24_LE; - break; - case AFMT_U24_BE: - return SND_PCM_FORMAT_U24_BE; - break; - case AFMT_FLOAT32: -#ifdef WORDS_BIGENDIAN - return SND_PCM_FORMAT_FLOAT_BE; -#else - return SND_PCM_FORMAT_FLOAT_LE; -#endif - break; - default: - return SND_PCM_FORMAT_MPEG; - break; - } -} - -/* to set/get/query special features/parameters */ -MPXP_Rc Alsa_AO_Interface::ctrl(int cmd, long arg) const { - switch(cmd) { - case AOCONTROL_GET_VOLUME: - case AOCONTROL_SET_VOLUME: -#ifndef WORDS_BIGENDIAN - { //seems to be a problem on macs? - ao_control_vol_t *vol = (ao_control_vol_t *)arg; - - int err; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - snd_mixer_selem_id_t *sid; - - const char *mix_name = "PCM"; - const char *card = "default"; - - long pmin, pmax; - long get_vol, set_vol; - float calc_vol, diff, f_multi; - - if(_format == AFMT_AC3) return MPXP_True; - - //allocate simple id - snd_mixer_selem_id_alloca(&sid); - - //sets simple-mixer index and name - snd_mixer_selem_id_set_index(sid, 0); - snd_mixer_selem_id_set_name(sid, mix_name); - - if ((err = snd_mixer_open(&handle, 0)) < 0) { - MSG_ERR("alsa-control_ao: mixer open error: %s\n", snd_strerror(err)); - return MPXP_Error; - } - - if ((err = snd_mixer_attach(handle, card)) < 0) { - MSG_ERR("alsa-control_ao: mixer attach %s error: %s", card, snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - - if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) { - MSG_ERR("alsa-control_ao: mixer register error: %s", snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - if ((err = snd_mixer_load(handle)) < 0) { - MSG_ERR("alsa-control_ao: mixer load error: %s", snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - - elem = snd_mixer_find_selem(handle, sid); - if (!elem) { - MSG_ERR("alsa-control_ao: unable to find simple control_ao '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); - snd_mixer_close(handle); - return MPXP_Error; - } - - snd_mixer_selem_get_playback_volume_range(elem,&pmin,&pmax); - f_multi = (100 / (float)pmax); - - if (cmd == AOCONTROL_SET_VOLUME) { - - diff = (vol->left+vol->right) / 2; - set_vol = rint(diff / f_multi); - - if (set_vol < 0) set_vol = 0; - else if (set_vol > pmax) set_vol = pmax; - - //setting channels - if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(0), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting left channel, %s",snd_strerror(err)); - return MPXP_Error; - } - if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(1), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting right channel, %s",snd_strerror(err)); - return MPXP_Error; - } - } else { - snd_mixer_selem_get_playback_volume(elem, snd_mixer_selem_channel_id_t(0), &get_vol); - calc_vol = get_vol; - calc_vol = rintf(calc_vol * f_multi); - - vol->left = vol->right = (int)calc_vol; - - //printf("get_vol = %i, calc=%i\n",get_vol, calc_vol); - } - snd_mixer_close(handle); - return MPXP_Ok; - } -#else // end big-endian - return MPXP_Unknown; -#endif - } //end witch - return MPXP_Unknown; -} - -void Alsa_AO_Interface::show_caps(unsigned device) const { - snd_pcm_info_t *alsa_info; - snd_pcm_t *pcm; - snd_pcm_hw_params_t *hw_params; - snd_output_t *sout; - int err,cards=-1; - unsigned rmin,rmax; - unsigned j,sdmin,sdmax; - char adevice[ALSA_DEVICE_SIZE]; - if ((err = snd_card_next(&cards)) < 0 || cards < 0) - { - MSG_ERR("AO-INFO: alsa-init: no soundcards found: %s\n", snd_strerror(err)); - return; - } - snd_pcm_info_malloc(&alsa_info); - snd_pcm_info_set_device(alsa_info,device); - sdmin=snd_pcm_info_get_subdevice(alsa_info); - sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); - MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); - for(j=sdmin;j<=sdmax;j++) { - int i; - snd_pcm_info_set_subdevice(alsa_info,j); - sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); - MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); - if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - return; - } - snd_pcm_hw_params_malloc(&hw_params); - if(snd_pcm_hw_params_any(pcm, hw_params)<0) { - MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); - return; - } - MSG_INFO(" AO-INFO: List of access type: "); - for(i=0;i<SND_PCM_ACCESS_LAST;i++) - if(!snd_pcm_hw_params_test_access(pcm,hw_params,snd_pcm_access_t(i))) - MSG_INFO("%s ",snd_pcm_access_name(snd_pcm_access_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported formats: "); - for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported channels: "); - for(i=0;i<64;i++) - if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%u ",i); - MSG_INFO("\n"); - snd_pcm_hw_params_get_rate_min(hw_params,&rmin,&err); - snd_pcm_hw_params_get_rate_max(hw_params,&rmax,&err); - MSG_INFO(" AO-INFO: Rates range: %u %u\n",rmin,rmax); - snd_output_stdio_attach(&sout, stderr, 0); - snd_pcm_hw_params_dump(hw_params, sout); - if(hw_params) snd_pcm_hw_params_free(hw_params); - if(pcm) snd_pcm_close(pcm); - } - snd_pcm_info_free(alsa_info); -} - -/* - open & setup audio device - return: 1=success 0=fail -*/ -MPXP_Rc Alsa_AO_Interface::open(unsigned flags) { - int err; - int cards = -1; - snd_pcm_info_t *alsa_info; - const char *str_block_mode; - char *alsa_dev=NULL; - char *alsa_port=NULL; - char alsa_device[ALSA_DEVICE_SIZE]; - UNUSED(flags); - first=1; - - handler = NULL; - alsa_device[0]='\0'; - - MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); - - if (!subdevice.empty()) { - const char *param; - char *p; - // example: -ao alsa:hw:0#mmap=1 - param=mrl_parse_line(subdevice,NULL,NULL,&alsa_dev,&alsa_port); - mrl_parse_params(param,alsaconf); - if(alsa_port) { - p=strchr(alsa_port,','); - if(p) { - if(strcmp(p+1,"-1")==0) { - *p='\0'; - show_caps(atoi(alsa_port)); - return MPXP_False; - } - } - if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); - else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); - MSG_V("alsa-init: soundcard set to %s\n", alsa_device); - } //end parsing ao->subdevice - } - - if ((err = snd_card_next(&cards)) < 0 || cards < 0) { - MSG_ERR("alsa-init: no soundcards found: %s\n", snd_strerror(err)); - return MPXP_False; - } - - if (alsa_device[0] == '\0') { - int tmp_device, tmp_subdevice; - - if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { - MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); - return MPXP_False; - } - - if ((tmp_device = snd_pcm_info_get_device(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get device\n"); - return MPXP_False; - } - - if ((tmp_subdevice = snd_pcm_info_get_subdevice(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get subdevice\n"); - return MPXP_False; - } - MSG_V("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); - - if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) { - MSG_ERR("alsa-init: cant wrote device-id\n"); - } - snd_pcm_info_free(alsa_info); - } - - MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); - //setting modes for block or nonblock-mode - int open_mode,block_mode; - if (priv_conf.noblock) { - open_mode = SND_PCM_NONBLOCK; - block_mode = 1; - str_block_mode = "nonblock-mode"; - } else { - open_mode = 0; - block_mode = 0; - str_block_mode = "block-mode"; - } - - if (!handler) { - //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC - if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { - if (priv_conf.noblock) { - MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); - if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - alsa_device[0]='\0'; - return MPXP_False; - } else { - block_mode = 0; - str_block_mode = "block-mode"; - } - } else { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - alsa_device[0]='\0'; - return MPXP_False; - } - } - alsa_device[0]='\0'; - if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { - MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); - } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); - - snd_pcm_hw_params_malloc(&hwparams); - snd_pcm_sw_params_malloc(&swparams); - - // setting hw-parameters - if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { - MSG_ERR("alsa-init: unable to get initial parameters: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_any()\n"); - if (priv_conf.mmap) { - snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); - snd_pcm_access_mask_none(mask); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); - err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); - MSG_ERR("alsa-init: mmap set\n"); - } else { - err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); - MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); - } - if (err < 0) { - MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); - return MPXP_False; - } - } // end switch priv->handler (spdif) - return MPXP_Ok; -} // end init - -MPXP_Rc Alsa_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { - int err,i; - size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; - snd_pcm_uframes_t dummy; - - MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, - c, ao_format_name(f)); - - _samplerate = r; - _format = f; - _channels = c; - _outburst = OUTBURST; - //ao->buffersize = MAX_OUTBURST; // was 16384 - - snd_format=fmt2alsa(_format); - - switch(snd_format) { - case SND_PCM_FORMAT_S16_LE: - case SND_PCM_FORMAT_U16_LE: - case SND_PCM_FORMAT_S16_BE: - case SND_PCM_FORMAT_U16_BE: - case SND_PCM_FORMAT_S32_LE: - case SND_PCM_FORMAT_S32_BE: - case SND_PCM_FORMAT_U32_LE: - case SND_PCM_FORMAT_U32_BE: - case SND_PCM_FORMAT_FLOAT_BE: - case SND_PCM_FORMAT_FLOAT_LE: - case SND_PCM_FORMAT_S24_LE: - case SND_PCM_FORMAT_S24_BE: - case SND_PCM_FORMAT_U24_LE: - case SND_PCM_FORMAT_U24_BE: - break; - case -1: - MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", - ao_format_name(_format)); - return MPXP_False; - default: - break; - } - bytes_per_sample = bps() / _samplerate; - - if ((err = snd_pcm_hw_params_set_format(handler, hwparams, - snd_format)) < 0) { - MSG_ERR("alsa-conf: unable to set format(%s): %s\n", - snd_pcm_format_name(snd_format), - snd_strerror(err)); - MSG_HINT("Please try one of: "); - for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) - MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_HINT("\n"); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); - - if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { - MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", - _samplerate, - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); - - if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, - _channels)) < 0) { - MSG_ERR("alsa-conf: unable to set %u channels: %s\n", - _channels, - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); -#ifdef BUFFERTIME - { - int dir; - unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ - - if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set buffer time near: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); - - period_time = alsa_buffer_time/4; - if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { - /* original: alsa_buffer_time/ao->bps */ - MSG_ERR("alsa-init: unable to set period time: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_period_time_near(%i)\n",period_time); - MSG_V("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, period_time); - } -#else - { - int dir=0; - unsigned period_time=100000; /* period time in us */ - snd_pcm_uframes_t size; - if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); - - //get chunksize - if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { - MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_get_period_size(%i)\n",size); - chunk_size=size; - } -#endif - // gets buffersize for control_ao - if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { - MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); - return MPXP_False; - } else { - _buffersize = dummy * bytes_per_sample; - MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); - } - MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); - bits_per_sample = snd_pcm_format_physical_width(snd_format); - MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); - bits_per_frame = bits_per_sample * _channels; - chunk_bytes = chunk_size * bits_per_frame / 8; - - MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); - - /* finally install hardware parameters */ - if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { - MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params()\n"); - // setting sw-params (only avail-min) if noblocking mode was choosed - if (priv_conf.noblock) { - if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); - return MPXP_False; - } - - //set min available frames to consider pcm ready (4) - //increased for nonblock-mode should be set dynamically later - if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { - MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); - return MPXP_False; - } - - if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to install sw-params\n"); - return MPXP_False; - } - - }//end swparams - - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); - return MPXP_False; - } - // end setting hw-params - MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", - _samplerate, _channels, bytes_per_sample, _buffersize, - snd_pcm_format_description(snd_format)); - return MPXP_Ok; -} // end config_ao - -void Alsa_AO_Interface::pause() { - int err; - - if (!priv_conf.noblock) { - //drain causes error in nonblock-mode! - if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); - return; - } - } else { - MSG_V("alsa-pause: paused nonblock\n"); - return; - } -} - -void Alsa_AO_Interface::resume() { - int err; - - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); - return; - } -} - -/* stop playing and empty buffers (for seeking/pause) */ -void Alsa_AO_Interface::reset() { - int err; - - if ((err = snd_pcm_drop(handler)) < 0) { - MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); - return; - } - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); - return; - } - return; -} - -#ifdef USE_POLL -static int __FASTCALL__ wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) -{ - unsigned short revents; - - while (1) { - poll(ufds, count, -1); - snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); - if (revents & POLLERR) return -EIO; - if (revents & POLLOUT) return 0; - } -} -#endif - -static void _timersub(const struct timeval*a,const struct timeval* b,struct timeval* result) { - result->tv_sec = a->tv_sec - b->tv_sec; - result->tv_usec = a->tv_usec - b->tv_usec; - if (result->tv_usec < 0) { - --result->tv_sec; - result->tv_usec += 1000000; - } -} - -/* I/O error handler */ -int Alsa_AO_Interface::xrun(const char *str_mode) const { - int err; - snd_pcm_status_t *status; - - snd_pcm_status_alloca(&status); - - if ((err = snd_pcm_status(handler, status))<0) { - MSG_ERR("status error: %s", snd_strerror(err)); - return 0; - } - - if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { - struct timeval now, diff, tstamp; - gettimeofday(&now, 0); - snd_pcm_status_get_trigger_tstamp(status, &tstamp); - _timersub(&now, &tstamp, &diff); - MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", - str_mode, - diff.tv_sec * 1000 + diff.tv_usec / 1000.0); - } - - if ((err = snd_pcm_prepare(handler))<0) { - MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); - return 0; - } - - return 1; /* ok, data should be accepted again */ -} - -unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { - unsigned result; - UNUSED(flags); - MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); - if (priv_conf.mmap) result = play_mmap(data, len); - else result = play_normal(data, len); - return result; -} - -/* - plays 'len' bytes of 'data' - returns: number of bytes pl... [truncated message content] |
From: <nic...@us...> - 2012-12-17 07:55:21
|
Revision: 565 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=565&view=rev Author: nickols_k Date: 2012-12-17 07:55:13 +0000 (Mon, 17 Dec 2012) Log Message: ----------- convert struct ao_data into class Audio_Output! It seems that without intensive using of references my hacked compiler can produce something workable Modified Paths: -------------- mplayerxp/libao2/audio_out.cpp mplayerxp/libao2/audio_out.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/af.cpp mplayerxp/postproc/af_ao2.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libao2/audio_out.cpp =================================================================== --- mplayerxp/libao2/audio_out.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/libao2/audio_out.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -37,7 +37,7 @@ #ifdef HAVE_JACK extern const ao_info_t audio_out_jack; #endif -} // namespace mpxp + static const ao_info_t* audio_out_drivers[] = { #ifdef USE_OSS_AUDIO @@ -69,12 +69,18 @@ NULL }; -typedef struct priv_s { - char antiviral_hole[RND_CHAR5]; - const ao_info_t* info; - AO_Interface* driver; -}priv_t; +struct priv_t : public Opaque { + public: + priv_t() {} + virtual ~priv_t() {} + char antiviral_hole[RND_CHAR5]; + const ao_info_t*info; + AO_Interface* driver; + int muted; + float mute_l,mute_r; +}; + const char * __FASTCALL__ ao_format_name(int format) { switch (format) @@ -176,9 +182,24 @@ return 8; } +Audio_Output::Audio_Output(const char* _subdevice) + :subdevice(mp_strdup(_subdevice)) +{ + priv_t* priv=new(zeromem) priv_t; + opaque=priv; + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&opaque)-reinterpret_cast<long>(&antiviral_hole)); + priv->driver=NULL; +} -void ao_print_help( void ) +Audio_Output::~Audio_Output() { + priv_t* priv=static_cast<priv_t*>(opaque); + delete priv->driver; + if(subdevice) delete subdevice; + delete priv; +} + +void Audio_Output::print_help() const { unsigned i; MSG_INFO("Available audio output drivers:\n"); i=0; @@ -189,20 +210,19 @@ MSG_INFO("\n"); } -MPXP_Rc __FASTCALL__ ao_register(ao_data_t* ao,const char *driver_name,unsigned flags) -{ - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); +MPXP_Rc Audio_Output::_register(const char *driver_name,unsigned flags) const { + priv_t* priv=static_cast<priv_t*>(opaque); unsigned i; if(!driver_name) { priv->info=audio_out_drivers[0]; - priv->driver=audio_out_drivers[0]->query_interface(ao->subdevice); + priv->driver=audio_out_drivers[0]->query_interface(subdevice?subdevice:""); } else for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { const ao_info_t *info = audio_out_drivers[i]; if(strcmp(info->short_name,driver_name) == 0){ priv->info = audio_out_drivers[i]; - priv->driver = audio_out_drivers[i]->query_interface(ao->subdevice?ao->subdevice:""); + priv->driver = audio_out_drivers[i]->query_interface(subdevice?subdevice:""); break; } } @@ -210,225 +230,143 @@ return MPXP_False; } -const ao_info_t* ao_get_info( const ao_data_t* ao ) -{ - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); +const ao_info_t* Audio_Output::get_info() const { + priv_t* priv=static_cast<priv_t*>(opaque); return priv->info; } -ao_data_t* __FASTCALL__ ao_init(const char *subdevice) -{ - ao_data_t* ao; - ao=new(zeromem) ao_data_t; - if(subdevice) ao->subdevice=mp_strdup(subdevice); - priv_t* priv=new(zeromem) priv_t; - ao->opaque=priv; - fill_false_pointers(ao->antiviral_hole,offsetof(ao_data_t,opaque)-offsetof(ao_data_t,antiviral_hole)); - priv->driver=NULL; - return ao; +MPXP_Rc Audio_Output::configure(unsigned r,unsigned c,unsigned f) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->configure(r,c,f); } -MPXP_Rc __FASTCALL__ ao_configure(ao_data_t*ao,unsigned rate,unsigned channels,unsigned format) -{ - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->configure(rate,channels,format); +unsigned Audio_Output::channels() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->channels(); } - -void ao_uninit(ao_data_t*ao) -{ - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - delete priv->driver; - if(ao->subdevice) delete ao->subdevice; - delete priv; - delete ao; - ao=NULL; +unsigned Audio_Output::samplerate() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->samplerate(); } - -unsigned ao_channels(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->channels(); - } - return 0; +unsigned Audio_Output::format() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->format(); } -unsigned ao_samplerate(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->samplerate(); - } - return 0; -} -unsigned ao_format(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->format(); - } - return 0; -} -MPXP_Rc ao_test_channels(ao_data_t* ao,unsigned c) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->test_channels(c); - } - return MPXP_False; +MPXP_Rc Audio_Output::test_channels(unsigned c) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->test_channels(c); } -MPXP_Rc ao_test_rate(ao_data_t* ao,unsigned s) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->test_rate(s); - } - return MPXP_False; +MPXP_Rc Audio_Output::test_rate(unsigned s) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->test_rate(s); } -MPXP_Rc ao_test_format(ao_data_t* ao,unsigned f) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->test_format(f); - } - return MPXP_False; +MPXP_Rc Audio_Output::test_format(unsigned f) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->test_format(f); } -unsigned ao_bps(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->channels()* +unsigned Audio_Output::bps() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->channels()* priv->driver->samplerate()* afmt2bps(priv->driver->format()); - } - return 0; } -unsigned ao_buffersize(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->buffersize(); - } - return 0; +unsigned Audio_Output::buffersize() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->buffersize(); } -unsigned ao_outburst(ao_data_t* ao) { - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->outburst(); - } - return 0; +unsigned Audio_Output::outburst() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->outburst(); } -void ao_reset(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - priv->driver->reset(); - } +void Audio_Output::reset() const { + priv_t* priv=static_cast<priv_t*>(opaque); + priv->driver->reset(); } -unsigned ao_get_space(const ao_data_t*ao) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->get_space(); - } - return 0; +unsigned Audio_Output::get_space() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->get_space(); } -float ao_get_delay(const ao_data_t*ao) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->get_delay(); - } - return 0; +float Audio_Output::get_delay() const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->get_delay(); } -unsigned __FASTCALL__ ao_play(ao_data_t*ao,const any_t* data,unsigned len,unsigned flags) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->play(data,len,flags); - } return 0; +unsigned Audio_Output::play(const any_t* data,unsigned len,unsigned flags) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->play(data,len,flags); } -void ao_pause(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - priv->driver->pause(); - } +void Audio_Output::pause() const { + priv_t* priv=static_cast<priv_t*>(opaque); + priv->driver->pause(); } -void ao_resume(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - priv->driver->resume(); - } +void Audio_Output::resume() const { + priv_t* priv=static_cast<priv_t*>(opaque); + priv->driver->resume(); } -MPXP_Rc __FASTCALL__ ao_control(const ao_data_t*ao,int cmd,long arg) -{ - if(ao) { - priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - return priv->driver->ctrl(cmd,arg); - } - return MPXP_Error; +MPXP_Rc Audio_Output::ctrl(int cmd,long arg) const { + priv_t* priv=static_cast<priv_t*>(opaque); + return priv->driver->ctrl(cmd,arg); } -void mixer_getvolume(const ao_data_t* ao, float *l,float *r ) -{ - ao_control_vol_t vol; - *l=0; *r=0; - if(MPXP_Ok != ao_control(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; - *r=vol.right; - *l=vol.left; +void Audio_Output::mixer_getvolume(float *l,float *r) const { + ao_control_vol_t vol; + *l=0; *r=0; + if(MPXP_Ok != ctrl(AOCONTROL_GET_VOLUME,(long)&vol)) return; + *r=vol.right; + *l=vol.left; } -void mixer_setvolume(const ao_data_t* ao,float l,float r ) -{ - ao_control_vol_t vol; - vol.right=r; vol.left=l; - ao_control(ao,AOCONTROL_SET_VOLUME,(long)&vol); +void Audio_Output::mixer_setvolume(float l,float r) const { + ao_control_vol_t vol; + vol.right=r; vol.left=l; + ctrl(AOCONTROL_SET_VOLUME,(long)&vol); } #define MIXER_CHANGE 3 -void mixer_incvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l += MIXER_CHANGE; - if ( mixer_l > 100 ) mixer_l = 100; - mixer_r += MIXER_CHANGE; - if ( mixer_r > 100 ) mixer_r = 100; - mixer_setvolume(ao, mixer_l,mixer_r ); +void Audio_Output::mixer_incvolume() const { + float mixer_l, mixer_r; + mixer_getvolume(&mixer_l,&mixer_r ); + mixer_l += MIXER_CHANGE; + if ( mixer_l > 100 ) mixer_l = 100; + mixer_r += MIXER_CHANGE; + if ( mixer_r > 100 ) mixer_r = 100; + mixer_setvolume(mixer_l,mixer_r ); } -void mixer_decvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l -= MIXER_CHANGE; - if ( mixer_l < 0 ) mixer_l = 0; - mixer_r -= MIXER_CHANGE; - if ( mixer_r < 0 ) mixer_r = 0; - mixer_setvolume(ao, mixer_l,mixer_r ); +void Audio_Output::mixer_decvolume() const { + float mixer_l, mixer_r; + mixer_getvolume(&mixer_l,&mixer_r ); + mixer_l -= MIXER_CHANGE; + if ( mixer_l < 0 ) mixer_l = 0; + mixer_r -= MIXER_CHANGE; + if ( mixer_r < 0 ) mixer_r = 0; + mixer_setvolume(mixer_l,mixer_r); } -float mixer_getbothvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - return ( mixer_l + mixer_r ) / 2; +float Audio_Output::mixer_getbothvolume() const { + float mixer_l, mixer_r; + mixer_getvolume(&mixer_l,&mixer_r); + return ( mixer_l + mixer_r ) / 2; } -static int muted=0; -static float mute_l,mute_r; -void mixer_mute(const ao_data_t* ao) -{ - if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } - else - { - mixer_getvolume(ao, &mute_l,&mute_r ); - mixer_setvolume(ao, 0,0 ); - muted=1; - } +void Audio_Output::mixer_mute() const { + priv_t* priv=static_cast<priv_t*>(opaque); + if ( priv->muted ) { mixer_setvolume(priv->mute_l,priv->mute_r ); priv->muted=0; } + else { + mixer_getvolume(&priv->mute_l,&priv->mute_r ); + mixer_setvolume(0,0); + priv->muted=1; + } } +} // namespace mpxp \ No newline at end of file Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/libao2/audio_out.h 2012-12-17 07:55:13 UTC (rev 565) @@ -16,64 +16,62 @@ const char *comment;/**< any additional comments */ AO_Interface* (*query_interface)(const std::string& subdevice); }; -} -/** Global data used by mplayerxp and plugins */ -struct ao_data_t -{ - char* subdevice; - char antiviral_hole[RND_CHAR2]; - any_t* opaque; /**< for internal use */ - any_t* priv; - float pts; /**< PTS of audio buffer */ -}; + enum { + AOCONTROL_GET_VOLUME=1, /**< Query volume level */ + AOCONTROL_SET_VOLUME /**< Sets new volume level */ + }; -enum { - AOCONTROL_GET_VOLUME=1, /**< Query volume level */ - AOCONTROL_SET_VOLUME /**< Sets new volume level */ -}; + struct ao_control_vol_t { + float left; + float right; + }; -struct ao_control_vol_t { - float left; - float right; -}; + /** Global data used by mplayerxp and plugins */ + struct Audio_Output : public Opaque { + public: + Audio_Output(const char* subdevice); + virtual ~Audio_Output(); -/* prototypes */ -extern const char * __FASTCALL__ ao_format_name(int format); -extern int __FASTCALL__ ao_format_bits(int format); + virtual void print_help() const; + virtual MPXP_Rc _register(const char *driver_name,unsigned flags) const; + virtual const ao_info_t* get_info() const; + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format) const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual unsigned channels() const; + virtual unsigned samplerate() const; + virtual unsigned format() const; + virtual unsigned bps() const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_rate(unsigned s) const; + virtual MPXP_Rc test_format(unsigned f) const; -extern void ao_print_help( void ); -extern MPXP_Rc __FASTCALL__ ao_register(ao_data_t* ao,const char *driver_name,unsigned flags); -extern const ao_info_t* ao_get_info( const ao_data_t* ao ); -extern ao_data_t* __FASTCALL__ ao_init(const char *subdevice); -extern MPXP_Rc __FASTCALL__ ao_configure(ao_data_t* priv,unsigned rate,unsigned channels,unsigned format); -extern void __FASTCALL__ ao_uninit(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_buffersize(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_outburst(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_channels(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_samplerate(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_format(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_bps(ao_data_t* priv); -extern MPXP_Rc __FASTCALL__ ao_test_channels(ao_data_t* priv,unsigned c); -extern MPXP_Rc __FASTCALL__ ao_test_rate(ao_data_t* priv,unsigned s); -extern MPXP_Rc __FASTCALL__ ao_test_format(ao_data_t* priv,unsigned f); + virtual void reset() const; + virtual unsigned get_space() const; + virtual unsigned play(const any_t* data,unsigned len,unsigned flags) const; + virtual float get_delay() const; + virtual void pause() const; + virtual void resume() const; + virtual MPXP_Rc ctrl(int cmd,long arg) const; -extern void __FASTCALL__ ao_reset(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_get_space(const ao_data_t* priv); -extern unsigned __FASTCALL__ ao_play(ao_data_t* priv,const any_t* data,unsigned len,unsigned flags); -extern float __FASTCALL__ ao_get_delay(const ao_data_t* priv); -extern void __FASTCALL__ ao_pause(ao_data_t* priv); -extern void __FASTCALL__ ao_resume(ao_data_t* priv); -extern MPXP_Rc __FASTCALL__ ao_control(const ao_data_t* priv,int cmd,long arg); + virtual void mixer_getvolume(float *l,float *r ) const; + virtual void mixer_setvolume(float l,float r ) const; + virtual void mixer_incvolume() const; + virtual void mixer_decvolume() const; + virtual float mixer_getbothvolume() const; + void mixer_mute() const; + //virtual void mixer_setbothvolume( int v ); + inline void mixer_setbothvolume(float v) const { mixer_setvolume(v,v); } -extern void mixer_getvolume(const ao_data_t* ao,float *l,float *r ); -extern void mixer_setvolume(const ao_data_t* ao,float l,float r ); -extern void mixer_incvolume(const ao_data_t* ao); -extern void mixer_decvolume(const ao_data_t* ao); -extern float mixer_getbothvolume(const ao_data_t* ao); -void mixer_mute(const ao_data_t* ao); - -//extern void mixer_setbothvolume( int v ); -static inline void mixer_setbothvolume(const ao_data_t* ao, float v ) { mixer_setvolume(ao,v,v); } - + char* subdevice; + float pts; /**< PTS of audio buffer */ + private: + char antiviral_hole[RND_CHAR2]; + any_t* opaque; /**< for internal use */ + }; + /* prototypes */ + extern const char * __FASTCALL__ ao_format_name(int format); + extern int __FASTCALL__ ao_format_bits(int format); +} // namespace mpxp #endif Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/mplayerxp.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -356,7 +356,7 @@ if(mask&INITED_AO){ inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); - ao_uninit(mpxp_context().audio().output); + delete mpxp_context().audio().output; mpxp_context().audio().output=NULL; } @@ -543,7 +543,7 @@ exit(0); } if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { - ao_print_help(); + mpxp_context().audio().output->print_help(); mpxp_uninit_structs(); exit(0); } @@ -608,7 +608,7 @@ mp_input_print_binds(MPXPSys.libinput()); Stream::print_drivers(); mpxp_context().video().output->print_help(); - ao_print_help(); + mpxp_context().audio().output->print_help(); vf_help(); af_help(); vfm_help(); @@ -705,7 +705,7 @@ if(sh_audio){ MP_UNIT("seek_audio_reset"); mpca_resync_stream(mpxp_context().audio().decoder); - ao_reset(mpxp_context().audio().output); // stop audio, throwing away buffered data + mpxp_context().audio().output->reset(); // stop audio, throwing away buffered data } if (mpxp_context().video().output->vobsub) { @@ -801,12 +801,12 @@ sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys.demuxer()->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" - ,sh_audio->timer-ao_get_delay(mpxp_context().audio().output) + ,sh_audio->timer-mpxp_context().audio().output->get_delay() ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 ); else MSG_STATUS("A:%6.1f %4.1f%% B:%4.1f\r" - ,sh_audio->timer-ao_get_delay(mpxp_context().audio().output) + ,sh_audio->timer-mpxp_context().audio().output->get_delay() ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 ,get_delay_audio_buffer() ); @@ -1128,13 +1128,13 @@ d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } else { - if(!(mpxp_context().audio().output=ao_init(ao_subdevice))) { + if(!(mpxp_context().audio().output=new(zeromem) Audio_Output(ao_subdevice?ao_subdevice:""))) { MSG_ERR(MSGTR_CannotInitAO); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) delete ao_subdevice; - ao_inited=ao_register(mpxp_context().audio().output,mp_conf.audio_driver,0); + ao_inited=mpxp_context().audio().output->_register(mp_conf.audio_driver?mp_conf.audio_driver:"",0); if (ao_inited!=MPXP_Ok){ MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); exit_player(MSGTR_Exit_error); @@ -1203,7 +1203,7 @@ sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); Demuxer_Stream *d_audio=_demuxer->audio; int rc=0; - const ao_info_t *info=ao_get_info(mpxp_context().audio().output); + const ao_info_t *info=mpxp_context().audio().output->get_info(); MP_UNIT("setup_audio"); MSG_V("AO: [%s] %iHz %s %s\n", info->short_name, @@ -1242,7 +1242,7 @@ ,sh_audio->audio_out_minsize); } - if(MPXP_Ok!=ao_configure(mpxp_context().audio().output, + if(MPXP_Ok!=mpxp_context().audio().output->configure( samplerate, channels, format)) { @@ -1256,8 +1256,11 @@ if(mpca_init_filters(mpxp_context().audio().decoder, sh_audio->rate, sh_audio->nch, mpaf_format_e(sh_audio->afmt), - ao_samplerate(mpxp_context().audio().output), ao_channels(mpxp_context().audio().output), mpaf_format_e(ao_format(mpxp_context().audio().output)), - ao_outburst(mpxp_context().audio().output)*4, ao_buffersize(mpxp_context().audio().output))!=MPXP_Ok) { + mpxp_context().audio().output->samplerate(), + mpxp_context().audio().output->channels(), + mpaf_format_e(mpxp_context().audio().output->format()), + mpxp_context().audio().output->outburst()*4, + mpxp_context().audio().output->buffersize())!=MPXP_Ok) { MSG_ERR("No matching audio filter found!\n"); } } @@ -1289,7 +1292,7 @@ unsigned ipts,rpts; unsigned char h,m,s,rh,rm,rs; static char ph=0,pm=0,ps=0; - ipts=(unsigned)(sh_audio->timer-ao_get_delay(mpxp_context().audio().output)); + ipts=(unsigned)(sh_audio->timer-mpxp_context().audio().output->get_delay()); rpts=_demuxer->movi_length-ipts; h = ipts/3600; m = (ipts/60)%60; @@ -1348,7 +1351,7 @@ mpxp_context().engine().xp_core->in_pause=1; while( !dec_ahead_can_aseek ) yield_timeslice(); } - ao_pause(mpxp_context().audio().output); // pause audio, keep data if possible + mpxp_context().audio().output->pause(); // pause audio, keep data if possible } while( (cmd = mp_input_get_cmd(_libinput,20,1,1)) == NULL) { @@ -1363,7 +1366,7 @@ if(osd_function==OSD_PAUSE) osd_function=OSD_PLAY; if (ao_inited==MPXP_Ok && sh_audio) { - ao_resume(mpxp_context().audio().output); // resume audio + mpxp_context().audio().output->resume(); // resume audio if(xmp_test_model(XMP_Run_AudioPlayer)) { mpxp_context().engine().xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); @@ -1463,17 +1466,17 @@ } break; case MP_CMD_MUTE: - mixer_mute(mpxp_context().audio().output); + mpxp_context().audio().output->mixer_mute(); break; case MP_CMD_VOLUME : { int v = cmd->args[0].v.i; - if(v > 0) mixer_incvolume(mpxp_context().audio().output); - else mixer_decvolume(mpxp_context().audio().output); + if(v > 0) mpxp_context().audio().output->mixer_incvolume(); + else mpxp_context().audio().output->mixer_decvolume(); #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec mpxp_context().video().output->osd_progbar_type=OSD_VOLUME; - mpxp_context().video().output->osd_progbar_value=(mixer_getbothvolume(mpxp_context().audio().output)*256.0)/100.0; + mpxp_context().video().output->osd_progbar_value=(mpxp_context().audio().output->mixer_getbothvolume()*256.0)/100.0; vo_osd_changed(OSDTYPE_PROGBAR); } #endif Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/mplayerxp.h 2012-12-17 07:55:13 UTC (rev 565) @@ -157,7 +157,7 @@ struct audio_processing_t { audio_decoder_t* decoder; - ao_data_t* output; + Audio_Output* output; }; struct video_processing_t { Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/postproc/af.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -576,7 +576,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_test_format(mpxp_context().audio().output,mpaf2afmt(fmt)); + if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_format(mpaf2afmt(fmt)); else if(afmt2mpaf(fmt)==filt->conf.format) return MPXP_True; return MPXP_False; } @@ -585,7 +585,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_test_rate(mpxp_context().audio().output,rate); + if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_rate(rate); else if(rate==filt->conf.rate) return MPXP_True; return MPXP_False; } @@ -594,7 +594,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_test_channels(mpxp_context().audio().output,nch); + if(strcmp(filt_name,"ao2")==0) return mpxp_context().audio().output->test_channels(nch); else if(nch==filt->conf.nch) return MPXP_True; return MPXP_False; } Modified: mplayerxp/postproc/af_ao2.cpp =================================================================== --- mplayerxp/postproc/af_ao2.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/postproc/af_ao2.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -20,23 +20,23 @@ { unsigned i,ii; MPXP_Rc rval; - rval=ao_test_rate(mpxp_context().audio().output,irate); + rval=mpxp_context().audio().output->test_rate(irate); if(rval == MPXP_True) return irate; for(i=0;i<sizeof(rates)/sizeof(unsigned)-1;i++) { if(irate >= rates[i] && irate < rates[i+1]) break; } ii=i; for(;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_test_rate(mpxp_context().audio().output,rates[i]); + rval=mpxp_context().audio().output->test_rate(rates[i]); if(rval == MPXP_True) return rates[i]; } i=ii; for(;i<sizeof(rates)/sizeof(unsigned);i--) { - rval=ao_test_rate(mpxp_context().audio().output,rates[i]); + rval=mpxp_context().audio().output->test_rate(rates[i]); if(rval == MPXP_True) return rates[i]; } for(i=0;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_test_rate(mpxp_context().audio().output,rates[i]); + rval=mpxp_context().audio().output->test_rate(rates[i]); if(rval == MPXP_True) return rates[i]; } return 44100; @@ -46,14 +46,14 @@ { unsigned i; MPXP_Rc rval; - rval=ao_test_channels(mpxp_context().audio().output,ich); + rval=mpxp_context().audio().output->test_channels(ich); if(rval == MPXP_True) return ich; for(i=ich>1?ich:1;i<AF_NCH;i++) { - rval=ao_test_channels(mpxp_context().audio().output,i); + rval=mpxp_context().audio().output->test_channels(i); if(rval == MPXP_True) return i; } for(i=1;i<AF_NCH;i++) { - rval=ao_test_channels(mpxp_context().audio().output,i); + rval=mpxp_context().audio().output->test_channels(i); if(rval == MPXP_True) return i; } return 2; @@ -87,7 +87,7 @@ { unsigned i,j,idx; MPXP_Rc rval; - rval=ao_test_format(mpxp_context().audio().output,ifmt); + rval=mpxp_context().audio().output->test_format(ifmt); if(rval == MPXP_True) return ifmt; idx=-1; for(i=0;i<sizeof(cvt_list)/sizeof(fmt_cvt_t);i++) { @@ -97,7 +97,7 @@ i=idx; for(j=0;j<20;j++) { if(cvt_list[i].cvt_fourcc[j]==0) break; - rval=ao_test_format(mpxp_context().audio().output,cvt_list[i].cvt_fourcc[j]); + rval=mpxp_context().audio().output->test_format(cvt_list[i].cvt_fourcc[j]); if(rval == MPXP_True) return cvt_list[i].cvt_fourcc[j]; } return AFMT_S16_LE; @@ -128,7 +128,7 @@ switch(cmd){ case AF_CONTROL_SHOWCONF: { char sbuf[256]; - const ao_info_t*info=ao_get_info(mpxp_context().audio().output); + const ao_info_t*info=mpxp_context().audio().output->get_info(); MSG_INFO("AO-CONF: [%s] %uHz nch=%u %s (%3.1f-kbit)\n" ,info->short_name,s->rate,s->nch,mpaf_fmt2str(s->format,sbuf,sizeof(sbuf)) ,(s->rate*s->nch*(s->format&MPAF_BPS_MASK)*8)*0.001f); Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -46,7 +46,7 @@ int ret=0; mpxp_context().audio().output->pts=sh_audio->timer*90000.0; - playsize=ao_get_space(mpxp_context().audio().output); + playsize=mpxp_context().audio().output->get_space(); if(!playsize) { if(sh_video) @@ -88,9 +88,9 @@ } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=ao_get_delay(mpxp_context().audio().output); + if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=mpxp_context().audio().output->get_delay(); - playsize=ao_play(mpxp_context().audio().output,sh_audio->a_buffer,playsize,0); + playsize=mpxp_context().audio().output->play(sh_audio->a_buffer,playsize,0); if(playsize>0){ sh_audio->a_buffer_len-=playsize; @@ -100,7 +100,7 @@ if(mpxp_context().use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; - if(sh_audio->a_pts_pos > -ao_get_delay(mpxp_context().audio().output)*sh_audio->af_bps) { + if(sh_audio->a_pts_pos > mpxp_context().audio().output->get_delay()*sh_audio->af_bps) { sh_audio->timer+=playsize/(float)(sh_audio->af_bps); } else { sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; @@ -143,7 +143,7 @@ int eof = 0; struct timeval now; float d; - const float MAX_AUDIO_TIME = (float)ao_get_space(mpxp_context().audio().output) / sh_audio->af_bps + ao_get_delay(mpxp_context().audio().output); + const float MAX_AUDIO_TIME = (float)mpxp_context().audio().output->get_space() / sh_audio->af_bps + mpxp_context().audio().output->get_delay(); float min_audio_time = MAX_AUDIO_TIME; float min_audio, max_audio; int samples, collect_samples; @@ -231,7 +231,7 @@ } LOCK_AUDIO_PLAY(); - d = ao_get_delay(mpxp_context().audio().output) - min_audio_time; + d = mpxp_context().audio().output->get_delay() - min_audio_time; if( d > 0 ) { gettimeofday(&now,NULL); audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-15 17:27:08 UTC (rev 564) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-17 07:55:13 UTC (rev 565) @@ -41,8 +41,8 @@ } static void show_status_line_no_apts(sh_audio_t* sh_audio,float v_pts) { - if(mp_conf.av_sync_pts && sh_audio && (!mpxp_context().engine().xp_core->audio->eof || ao_get_delay(mpxp_context().audio().output))) { - float a_pts = sh_audio->timer-ao_get_delay(mpxp_context().audio().output); + if(mp_conf.av_sync_pts && sh_audio && (!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay())) { + float a_pts = sh_audio->timer-mpxp_context().audio().output->get_delay(); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts ,v_pts @@ -70,7 +70,7 @@ { if(mpxp_context().use_pts_fix2 && sh_audio) { if(sh_video->chapter_change == -1) { /* First frame after seek */ - while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(mpxp_context().audio().output)==0.0) + while(v_pts < 1.0 && sh_audio->timer==0.0 && mpxp_context().audio().output->get_delay()==0.0) yield_timeslice(); /* Wait for audio to start play */ if(sh_audio->timer > 2.0 && v_pts < 1.0) { MSG_V("Video chapter change detected\n"); @@ -97,9 +97,9 @@ /* FIXME!!! need the same technique to detect mpxp_context().engine().xp_core->audio->eof as for video_eof! often ao_get_delay() never returns 0 :( */ if(mpxp_context().engine().xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; - if((!mpxp_context().engine().xp_core->audio->eof || ao_get_delay(mpxp_context().audio().output)) && + if((!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay()) && (!mpxp_context().use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) - sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(mpxp_context().audio().output)) + sleep_time=screen_pts-((sh_audio->timer-mpxp_context().audio().output->get_delay()) +(mp_conf.av_sync_pts?0:mpxp_context().engine().xp_core->initial_apts)); else if(mpxp_context().use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; @@ -118,11 +118,11 @@ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 if(!mpxp_context().engine().xp_core->audio) sh_audio=NULL; - if(sh_audio && (!mpxp_context().engine().xp_core->audio->eof || ao_get_delay(mpxp_context().audio().output)) && sleep_time>XP_MAX_TIMESLICE) { + if(sh_audio && (!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay()) && sleep_time>XP_MAX_TIMESLICE) { float t; if(xmp_test_model(XMP_Run_AudioPlayback)) { - t=ao_get_delay(mpxp_context().audio().output)-XP_MIN_AUDIOBUFF; + t=mpxp_context().audio().output->get_delay()-XP_MIN_AUDIOBUFF; if(t>XP_MAX_TIMESLICE) t=XP_MAX_TIMESLICE; } else @@ -233,11 +233,11 @@ like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ if(!mpxp_context().engine().xp_core->audio) sh_audio=NULL; - if(sh_audio && (!mpxp_context().engine().xp_core->audio->eof || ao_get_delay(mpxp_context().audio().output)) && !mp_conf.av_sync_pts) { + if(sh_audio && (!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay()) && !mp_conf.av_sync_pts) { float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: - float delay=ao_get_delay(mpxp_context().audio().output)+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; + float delay=mpxp_context().audio().output->get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; if(xmp_test_model(XMP_Run_AudioPlayer)) delay += get_delay_audio_buffer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-15 17:27:18
|
Revision: 564 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=564&view=rev Author: nickols_k Date: 2012-12-15 17:27:08 +0000 (Sat, 15 Dec 2012) Log Message: ----------- small part of last patch. The farewell message! It seems that my copy of gcc compiler was skilfully hacked by malefactor(s). They block uploading of main patch: converting libao2 ->libao3. Therefore, libao2 is most important place of my project for them and for their dark deals. Weel, i need to find out other ways to continue my development, what is impossible right for now. Breakpoint 1, mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) print sd $1 = (const std::string &) @0x18dcff0: {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}} (gdb) s operator new (size=88) at mp_malloc.cpp:574 574 any_t *operator new(size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } (gdb) n x1840952739 (size=88) at mp_malloc.cpp:549 549 any_t* SECURE_NAME1(_mp_mallocz)(size_t size) { (gdb) n 551 ptr = mp_mallocz(size); (gdb) n 552 if(!ptr) { (gdb) n 557 } (gdb) n mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s Alsa_AO_Interface (_subdevice=..., this=<optimized out>) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s AO_Interface (_subdevice=..., this=<optimized out>) at audio_out_internal.h:11 11 AO_Interface(const std::string& _subdevice):subdevice(_subdevice) {} (gdb) print _subdevice $2 = <optimized out> (gdb) s mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s Alsa_AO_Interface (_subdevice=..., this=0x19b6fa8) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) print _subdevice $3 = (const std::string &) @0x18dcff0: {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}} (gdb) s AO_Interface (_subdevice=..., this=0x19b6fa8) at audio_out_internal.h:11 11 AO_Interface(const std::string& _subdevice):subdevice(_subdevice) {} (gdb) s std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (this=0x19b6fb0, __str=...) at /Data/3rdparty.src/gcc/gcc-4.5.4/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:441 441 basic_string(const basic_string& __str); (gdb) print this $4 = ( std::basic_string<char, std::char_traits<char>, std::allocator<char> > * const) 0x19b6fb0 (gdb) print *this $5 = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}} Modified Paths: -------------- mplayerxp/libao2/Makefile mplayerxp/libao2/ao_arts.cpp mplayerxp/libao2/ao_esd.cpp mplayerxp/libao2/ao_jack.cpp mplayerxp/libao2/ao_nas.cpp mplayerxp/libao2/ao_null.cpp mplayerxp/libao2/ao_openal.cpp mplayerxp/libao2/ao_oss.cpp mplayerxp/libao2/ao_sdl.cpp mplayerxp/libao2/ao_wav.cpp mplayerxp/libao2/audio_out.cpp mplayerxp/libao2/audio_out.h mplayerxp/mplayerxp.cpp Added Paths: ----------- mplayerxp/libao2/ao_alsa.cpp Removed Paths: ------------- mplayerxp/libao2/ao_alsa9.cpp mplayerxp/libao2/mixer.cpp mplayerxp/libao2/mixer.h Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-12-15 13:09:33 UTC (rev 563) +++ mplayerxp/libao2/Makefile 2012-12-15 17:27:08 UTC (rev 564) @@ -4,7 +4,7 @@ LIBNAME = libao2.a # TODO: moveout ao_sdl.c so it's only used when SDL is detected -CXXSRCS=audio_out.cpp mixer.cpp afmt.cpp +CXXSRCS=audio_out.cpp afmt.cpp CXXSRCS+=ao_null.cpp ao_wav.cpp ifeq ($(HAVE_SDL),yes) CXXSRCS+=ao_sdl.cpp @@ -13,7 +13,7 @@ CXXSRCS+=ao_oss.cpp endif ifeq ($(HAVE_ALSA),yes) -CXXSRCS+=ao_alsa9.cpp +CXXSRCS+=ao_alsa.cpp endif ifeq ($(HAVE_ARTS),yes) CXXSRCS+=ao_arts.cpp Copied: mplayerxp/libao2/ao_alsa.cpp (from rev 563, mplayerxp/libao2/ao_alsa9.cpp) =================================================================== --- mplayerxp/libao2/ao_alsa.cpp (rev 0) +++ mplayerxp/libao2/ao_alsa.cpp 2012-12-15 17:27:08 UTC (rev 564) @@ -0,0 +1,1024 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* + ao_alsa9 - ALSA-0.9.x output plugin for MPlayer + + (C) Alex Beregszaszi <al...@na...> + + modified for real alsa-0.9.0-support by Joy Winter <jo...@pi...> + additional AC3 passthrough support by Andy Lo A Foe <an...@al...> + 08/22/2002 iec958-init rewritten and merged with common init, joy + + Any bugreports regarding to this driver are welcome. +*/ + +#include <errno.h> +#include <sys/time.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <sys/poll.h> + +#include "mplayerxp.h" +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API +#include <alsa/asoundlib.h> + +#include "audio_out.h" +#include "audio_out_internal.h" +#include "afmt.h" +#include "ao_msg.h" +#include "libmpstream2/mrl.h" + +namespace mpxp { +typedef struct priv_conf_s { + int mmap; + int noblock; +}priv_conf_t; +static priv_conf_t priv_conf; +static const mrl_config_t alsaconf[]={ + { "mmap", &priv_conf.mmap, MRL_TYPE_BOOL, 0, 1 }, + { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, + { NULL, NULL, 0, 0, 0 } +}; +class Alsa_AO_Interface : public AO_Interface { + public: + Alsa_AO_Interface(const std::string& subdevice); + virtual ~Alsa_AO_Interface(); + + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + void show_caps(unsigned device) const; + int xrun(const char *str_mode) const; + unsigned play_normal(const any_t* data, unsigned len); + unsigned play_mmap(const any_t* data, unsigned len); + snd_pcm_format_t fmt2alsa(unsigned format) const; + + snd_pcm_t* handler; + snd_pcm_format_t snd_format; + snd_pcm_hw_params_t* hwparams; + snd_pcm_sw_params_t* swparams; + size_t bytes_per_sample; + int first; +}; + +Alsa_AO_Interface::Alsa_AO_Interface(const std::string& _subdevice) + :AO_Interface(_subdevice) {} +Alsa_AO_Interface::~Alsa_AO_Interface() { + int err; + if(!handler) { + MSG_ERR("alsa-uninit: no handler defined!\n"); + return; + } + if (!priv_conf.noblock) { + if ((err = snd_pcm_drain(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); + return; + } + } + if ((err = snd_pcm_close(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + return; + } else { + handler = NULL; + MSG_V("alsa-uninit: pcm closed\n"); + } + snd_pcm_hw_params_free(hwparams); + snd_pcm_sw_params_free(swparams); +} + +#define ALSA_DEVICE_SIZE 48 + +#define BUFFERTIME // else SET_CHUNK_SIZE +#undef USE_POLL + +snd_pcm_format_t Alsa_AO_Interface::fmt2alsa(unsigned f) const { + switch (f) + { + case AFMT_S8: + return SND_PCM_FORMAT_S8; + break; + case AFMT_U8: + return SND_PCM_FORMAT_U8; + break; + case AFMT_U16_LE: + return SND_PCM_FORMAT_U16_LE; + break; + case AFMT_U16_BE: + return SND_PCM_FORMAT_U16_BE; + break; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif + case AFMT_S16_LE: + return SND_PCM_FORMAT_S16_LE; + break; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif + case AFMT_S16_BE: + return SND_PCM_FORMAT_S16_BE; + break; + case AFMT_S32_LE: + return SND_PCM_FORMAT_S32_LE; + break; + case AFMT_S32_BE: + return SND_PCM_FORMAT_S32_BE; + break; + case AFMT_U32_LE: + return SND_PCM_FORMAT_U32_LE; + break; + case AFMT_U32_BE: + return SND_PCM_FORMAT_U32_BE; + break; + case AFMT_S24_LE: + return SND_PCM_FORMAT_S24_LE; + break; + case AFMT_S24_BE: + return SND_PCM_FORMAT_S24_BE; + break; + case AFMT_U24_LE: + return SND_PCM_FORMAT_U24_LE; + break; + case AFMT_U24_BE: + return SND_PCM_FORMAT_U24_BE; + break; + case AFMT_FLOAT32: +#ifdef WORDS_BIGENDIAN + return SND_PCM_FORMAT_FLOAT_BE; +#else + return SND_PCM_FORMAT_FLOAT_LE; +#endif + break; + default: + return SND_PCM_FORMAT_MPEG; + break; + } +} + +/* to set/get/query special features/parameters */ +MPXP_Rc Alsa_AO_Interface::ctrl(int cmd, long arg) const { + switch(cmd) { + case AOCONTROL_GET_VOLUME: + case AOCONTROL_SET_VOLUME: +#ifndef WORDS_BIGENDIAN + { //seems to be a problem on macs? + ao_control_vol_t *vol = (ao_control_vol_t *)arg; + + int err; + snd_mixer_t *handle; + snd_mixer_elem_t *elem; + snd_mixer_selem_id_t *sid; + + const char *mix_name = "PCM"; + const char *card = "default"; + + long pmin, pmax; + long get_vol, set_vol; + float calc_vol, diff, f_multi; + + if(_format == AFMT_AC3) return MPXP_True; + + //allocate simple id + snd_mixer_selem_id_alloca(&sid); + + //sets simple-mixer index and name + snd_mixer_selem_id_set_index(sid, 0); + snd_mixer_selem_id_set_name(sid, mix_name); + + if ((err = snd_mixer_open(&handle, 0)) < 0) { + MSG_ERR("alsa-control_ao: mixer open error: %s\n", snd_strerror(err)); + return MPXP_Error; + } + + if ((err = snd_mixer_attach(handle, card)) < 0) { + MSG_ERR("alsa-control_ao: mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + + if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) { + MSG_ERR("alsa-control_ao: mixer register error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + if ((err = snd_mixer_load(handle)) < 0) { + MSG_ERR("alsa-control_ao: mixer load error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return MPXP_Error; + } + + elem = snd_mixer_find_selem(handle, sid); + if (!elem) { + MSG_ERR("alsa-control_ao: unable to find simple control_ao '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + snd_mixer_close(handle); + return MPXP_Error; + } + + snd_mixer_selem_get_playback_volume_range(elem,&pmin,&pmax); + f_multi = (100 / (float)pmax); + + if (cmd == AOCONTROL_SET_VOLUME) { + + diff = (vol->left+vol->right) / 2; + set_vol = rint(diff / f_multi); + + if (set_vol < 0) set_vol = 0; + else if (set_vol > pmax) set_vol = pmax; + + //setting channels + if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(0), set_vol)) < 0) { + MSG_ERR("alsa-control_ao: error setting left channel, %s",snd_strerror(err)); + return MPXP_Error; + } + if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(1), set_vol)) < 0) { + MSG_ERR("alsa-control_ao: error setting right channel, %s",snd_strerror(err)); + return MPXP_Error; + } + } else { + snd_mixer_selem_get_playback_volume(elem, snd_mixer_selem_channel_id_t(0), &get_vol); + calc_vol = get_vol; + calc_vol = rintf(calc_vol * f_multi); + + vol->left = vol->right = (int)calc_vol; + + //printf("get_vol = %i, calc=%i\n",get_vol, calc_vol); + } + snd_mixer_close(handle); + return MPXP_Ok; + } +#else // end big-endian + return MPXP_Unknown; +#endif + } //end witch + return MPXP_Unknown; +} + +void Alsa_AO_Interface::show_caps(unsigned device) const { + snd_pcm_info_t *alsa_info; + snd_pcm_t *pcm; + snd_pcm_hw_params_t *hw_params; + snd_output_t *sout; + int err,cards=-1; + unsigned rmin,rmax; + unsigned j,sdmin,sdmax; + char adevice[ALSA_DEVICE_SIZE]; + if ((err = snd_card_next(&cards)) < 0 || cards < 0) + { + MSG_ERR("AO-INFO: alsa-init: no soundcards found: %s\n", snd_strerror(err)); + return; + } + snd_pcm_info_malloc(&alsa_info); + snd_pcm_info_set_device(alsa_info,device); + sdmin=snd_pcm_info_get_subdevice(alsa_info); + sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); + MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); + for(j=sdmin;j<=sdmax;j++) { + int i; + snd_pcm_info_set_subdevice(alsa_info,j); + sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); + MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); + if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + return; + } + snd_pcm_hw_params_malloc(&hw_params); + if(snd_pcm_hw_params_any(pcm, hw_params)<0) { + MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); + return; + } + MSG_INFO(" AO-INFO: List of access type: "); + for(i=0;i<SND_PCM_ACCESS_LAST;i++) + if(!snd_pcm_hw_params_test_access(pcm,hw_params,snd_pcm_access_t(i))) + MSG_INFO("%s ",snd_pcm_access_name(snd_pcm_access_t(i))); + MSG_INFO("\n"); + MSG_INFO(" AO-INFO: List of supported formats: "); + for(i=0;i<SND_PCM_FORMAT_LAST;i++) + if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) + MSG_INFO("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); + MSG_INFO("\n"); + MSG_INFO(" AO-INFO: List of supported channels: "); + for(i=0;i<64;i++) + if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) + MSG_INFO("%u ",i); + MSG_INFO("\n"); + snd_pcm_hw_params_get_rate_min(hw_params,&rmin,&err); + snd_pcm_hw_params_get_rate_max(hw_params,&rmax,&err); + MSG_INFO(" AO-INFO: Rates range: %u %u\n",rmin,rmax); + snd_output_stdio_attach(&sout, stderr, 0); + snd_pcm_hw_params_dump(hw_params, sout); + if(hw_params) snd_pcm_hw_params_free(hw_params); + if(pcm) snd_pcm_close(pcm); + } + snd_pcm_info_free(alsa_info); +} + +/* + open & setup audio device + return: 1=success 0=fail +*/ +MPXP_Rc Alsa_AO_Interface::open(unsigned flags) { + int err; + int cards = -1; + snd_pcm_info_t *alsa_info; + const char *str_block_mode; + char *alsa_dev=NULL; + char *alsa_port=NULL; + char alsa_device[ALSA_DEVICE_SIZE]; + UNUSED(flags); + first=1; + + handler = NULL; + alsa_device[0]='\0'; + + MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); + + if (!subdevice.empty()) { + const char *param; + char *p; + // example: -ao alsa:hw:0#mmap=1 + param=mrl_parse_line(subdevice,NULL,NULL,&alsa_dev,&alsa_port); + mrl_parse_params(param,alsaconf); + if(alsa_port) { + p=strchr(alsa_port,','); + if(p) { + if(strcmp(p+1,"-1")==0) { + *p='\0'; + show_caps(atoi(alsa_port)); + return MPXP_False; + } + } + if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); + else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); + MSG_V("alsa-init: soundcard set to %s\n", alsa_device); + } //end parsing ao->subdevice + } + + if ((err = snd_card_next(&cards)) < 0 || cards < 0) { + MSG_ERR("alsa-init: no soundcards found: %s\n", snd_strerror(err)); + return MPXP_False; + } + + if (alsa_device[0] == '\0') { + int tmp_device, tmp_subdevice; + + if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { + MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); + return MPXP_False; + } + + if ((tmp_device = snd_pcm_info_get_device(alsa_info)) < 0) { + MSG_ERR("alsa-init: cant get device\n"); + return MPXP_False; + } + + if ((tmp_subdevice = snd_pcm_info_get_subdevice(alsa_info)) < 0) { + MSG_ERR("alsa-init: cant get subdevice\n"); + return MPXP_False; + } + MSG_V("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); + + if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) { + MSG_ERR("alsa-init: cant wrote device-id\n"); + } + snd_pcm_info_free(alsa_info); + } + + MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); + //setting modes for block or nonblock-mode + int open_mode,block_mode; + if (priv_conf.noblock) { + open_mode = SND_PCM_NONBLOCK; + block_mode = 1; + str_block_mode = "nonblock-mode"; + } else { + open_mode = 0; + block_mode = 0; + str_block_mode = "block-mode"; + } + + if (!handler) { + //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { + if (priv_conf.noblock) { + MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + alsa_device[0]='\0'; + return MPXP_False; + } else { + block_mode = 0; + str_block_mode = "block-mode"; + } + } else { + MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + alsa_device[0]='\0'; + return MPXP_False; + } + } + alsa_device[0]='\0'; + if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { + MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); + } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); + + snd_pcm_hw_params_malloc(&hwparams); + snd_pcm_sw_params_malloc(&swparams); + + // setting hw-parameters + if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { + MSG_ERR("alsa-init: unable to get initial parameters: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_any()\n"); + if (priv_conf.mmap) { + snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); + snd_pcm_access_mask_none(mask); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); + err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); + MSG_ERR("alsa-init: mmap set\n"); + } else { + err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); + MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); + } + if (err < 0) { + MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); + return MPXP_False; + } + } // end switch priv->handler (spdif) + return MPXP_Ok; +} // end init + +MPXP_Rc Alsa_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { + int err,i; + size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; + snd_pcm_uframes_t dummy; + + MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, + c, ao_format_name(f)); + + _samplerate = r; + _format = f; + _channels = c; + _outburst = OUTBURST; + //ao->buffersize = MAX_OUTBURST; // was 16384 + + snd_format=fmt2alsa(_format); + + switch(snd_format) { + case SND_PCM_FORMAT_S16_LE: + case SND_PCM_FORMAT_U16_LE: + case SND_PCM_FORMAT_S16_BE: + case SND_PCM_FORMAT_U16_BE: + case SND_PCM_FORMAT_S32_LE: + case SND_PCM_FORMAT_S32_BE: + case SND_PCM_FORMAT_U32_LE: + case SND_PCM_FORMAT_U32_BE: + case SND_PCM_FORMAT_FLOAT_BE: + case SND_PCM_FORMAT_FLOAT_LE: + case SND_PCM_FORMAT_S24_LE: + case SND_PCM_FORMAT_S24_BE: + case SND_PCM_FORMAT_U24_LE: + case SND_PCM_FORMAT_U24_BE: + break; + case -1: + MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", + ao_format_name(_format)); + return MPXP_False; + default: + break; + } + bytes_per_sample = bps() / _samplerate; + + if ((err = snd_pcm_hw_params_set_format(handler, hwparams, + snd_format)) < 0) { + MSG_ERR("alsa-conf: unable to set format(%s): %s\n", + snd_pcm_format_name(snd_format), + snd_strerror(err)); + MSG_HINT("Please try one of: "); + for(i=0;i<SND_PCM_FORMAT_LAST;i++) + if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) + MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); + MSG_HINT("\n"); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); + + if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { + MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", + _samplerate, + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); + + if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, + _channels)) < 0) { + MSG_ERR("alsa-conf: unable to set %u channels: %s\n", + _channels, + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); +#ifdef BUFFERTIME + { + int dir; + unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ + + if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { + MSG_ERR("alsa-init: unable to set buffer time near: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); + + period_time = alsa_buffer_time/4; + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { + /* original: alsa_buffer_time/ao->bps */ + MSG_ERR("alsa-init: unable to set period time: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_period_time_near(%i)\n",period_time); + MSG_V("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, period_time); + } +#else + { + int dir=0; + unsigned period_time=100000; /* period time in us */ + snd_pcm_uframes_t size; + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { + MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); + + //get chunksize + if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { + MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_get_period_size(%i)\n",size); + chunk_size=size; + } +#endif + // gets buffersize for control_ao + if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { + MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); + return MPXP_False; + } else { + _buffersize = dummy * bytes_per_sample; + MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); + } + MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); + bits_per_sample = snd_pcm_format_physical_width(snd_format); + MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); + bits_per_frame = bits_per_sample * _channels; + chunk_bytes = chunk_size * bits_per_frame / 8; + + MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); + + /* finally install hardware parameters */ + if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { + MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", + snd_strerror(err)); + return MPXP_False; + } + MSG_DBG2("snd_pcm_hw_params()\n"); + // setting sw-params (only avail-min) if noblocking mode was choosed + if (priv_conf.noblock) { + if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { + MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); + return MPXP_False; + } + + //set min available frames to consider pcm ready (4) + //increased for nonblock-mode should be set dynamically later + if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { + MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); + return MPXP_False; + } + + if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { + MSG_ERR("alsa-conf: unable to install sw-params\n"); + return MPXP_False; + } + + }//end swparams + + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); + return MPXP_False; + } + // end setting hw-params + MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", + _samplerate, _channels, bytes_per_sample, _buffersize, + snd_pcm_format_description(snd_format)); + return MPXP_Ok; +} // end config_ao + +void Alsa_AO_Interface::pause() { + int err; + + if (!priv_conf.noblock) { + //drain causes error in nonblock-mode! + if ((err = snd_pcm_drain(handler)) < 0) { + MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); + return; + } + } else { + MSG_V("alsa-pause: paused nonblock\n"); + return; + } +} + +void Alsa_AO_Interface::resume() { + int err; + + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); + return; + } +} + +/* stop playing and empty buffers (for seeking/pause) */ +void Alsa_AO_Interface::reset() { + int err; + + if ((err = snd_pcm_drop(handler)) < 0) { + MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); + return; + } + if ((err = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); + return; + } + return; +} + +#ifdef USE_POLL +static int __FASTCALL__ wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) +{ + unsigned short revents; + + while (1) { + poll(ufds, count, -1); + snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); + if (revents & POLLERR) return -EIO; + if (revents & POLLOUT) return 0; + } +} +#endif + +static void _timersub(const struct timeval*a,const struct timeval* b,struct timeval* result) { + result->tv_sec = a->tv_sec - b->tv_sec; + result->tv_usec = a->tv_usec - b->tv_usec; + if (result->tv_usec < 0) { + --result->tv_sec; + result->tv_usec += 1000000; + } +} + +/* I/O error handler */ +int Alsa_AO_Interface::xrun(const char *str_mode) const { + int err; + snd_pcm_status_t *status; + + snd_pcm_status_alloca(&status); + + if ((err = snd_pcm_status(handler, status))<0) { + MSG_ERR("status error: %s", snd_strerror(err)); + return 0; + } + + if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { + struct timeval now, diff, tstamp; + gettimeofday(&now, 0); + snd_pcm_status_get_trigger_tstamp(status, &tstamp); + _timersub(&now, &tstamp, &diff); + MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", + str_mode, + diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + } + + if ((err = snd_pcm_prepare(handler))<0) { + MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); + return 0; + } + + return 1; /* ok, data should be accepted again */ +} + +unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { + unsigned result; + UNUSED(flags); + MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); + if (priv_conf.mmap) result = play_mmap(data, len); + else result = play_normal(data, len); + return result; +} + +/* + plays 'len' bytes of 'data' + returns: number of bytes played + modified last at 29.06.02 by jp + thanxs for marius <ma...@ro...> for giving us the light ;) +*/ + +unsigned Alsa_AO_Interface::play_normal(const any_t* data, unsigned len) { + unsigned num_frames = len / bytes_per_sample; + const char *output_samples = (const char *)data; + snd_pcm_sframes_t res = 0; + + //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); + + if (!handler) { + MSG_ERR("alsa-play: device configuration error"); + return 0; + } + + while (num_frames > 0) { + res = snd_pcm_writei(handler, (any_t*)output_samples, num_frames); + if (res == -EAGAIN) { + snd_pcm_wait(handler, 1000); + } else if (res == -EPIPE) { /* underrun */ + if (xrun("play") <= 0) { + MSG_ERR("alsa-play: xrun reset error"); + return 0; + } + } else if (res == -ESTRPIPE) { /* suspend */ + MSG_WARN("alsa-play: pcm in suspend mode. trying to resume\n"); + while ((res = snd_pcm_resume(handler)) == -EAGAIN) ::sleep(1); + } else if (res < 0) { + MSG_ERR("alsa-play: unknown status, trying to reset soundcard\n"); + if ((res = snd_pcm_prepare(handler)) < 0) { + MSG_ERR("alsa-play: snd prepare error"); + return 0; + break; + } + } + + if (res > 0) { + /* output_samples += ao->channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; + } + } //end while + + if (res < 0) { + MSG_ERR("alsa-play: write error %s", snd_strerror(res)); + return 0; + } + return res < 0 ? 0 : len; +} + +/* mmap-mode mainly based on descriptions by Joshua Haberman <jo...@ha...> + * 'An overview of the ALSA API' http://people.debian.org/~joshua/x66.html + * and some help by Paul Davis <pb...@op...> */ + +unsigned Alsa_AO_Interface::play_mmap(const any_t* data, unsigned len) { + snd_pcm_sframes_t commitres, frames_available; + snd_pcm_uframes_t frames_transmit, size, offset; + const snd_pcm_channel_area_t *area; + any_t* outbuffer; + unsigned result; + +#ifdef USE_POLL //seems not really be needed + struct pollfd *ufds; + int count; + + count = snd_pcm_poll_descriptors_count (handler); + ufds = mp_malloc(sizeof(struct pollfd) * count); + snd_pcm_poll_descriptors(handler, ufds, count); + + //first wait_for_poll + if (err = (wait_for_poll(handler, ufds, count) < 0)) { + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { + xrun("play"); + } + } +#endif + + outbuffer = alloca(_buffersize); + + //don't trust get_space() ;) + frames_available = snd_pcm_avail_update(handler) * bytes_per_sample; + if (frames_available < 0) xrun("play"); + + if (frames_available < 4) { + if (first) { + first = 0; + snd_pcm_start(handler); + } else { //FIXME should break and return 0? + snd_pcm_wait(handler, -1); + first = 1; + } + } + + /* len is simply the available bufferspace got by get_space() + * but real avail_buffer in frames is ab/priv->bytes_per_sample */ + size = len / bytes_per_sample; + + //if (verbose) + //printf("len: %i size %i, f_avail %i, bps %i ...\n", len, size, frames_available, priv->bytes_per_sample); + + frames_transmit = size; + + /* prepare areas and set sw-pointers + * frames_transmit returns the real available buffer-size + * sometimes != frames_available cause of ringbuffer 'emulation' */ + snd_pcm_mmap_begin(handler, &area, &offset, &frames_transmit); + + /* this is specific to interleaved streams (or non-interleaved + * streams with only one channel) */ + outbuffer = ((char *) area->addr + (area->first + area->step * offset) / 8); //8 + + //write data + memcpy(outbuffer, data, (frames_transmit * bytes_per_sample)); + commitres = snd_pcm_mmap_commit(handler, offset, frames_transmit); + + if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames_transmit) { + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { + xrun("play"); + } + } + + //calculate written frames! + result = commitres * bytes_per_sample; + + //mplayer doesn't like -result + if ((int)result < 0) result = 0; + +#ifdef USE_POLL + delete ufds; +#endif + + return result; +} + +typedef enum space_status_e { + GET_SPACE_OPEN, + GET_SPACE_PREPARED, + GET_SPACE_RUNNING, + GET_SPACE_PAUSED, + GET_SPACE_XRUN, + GET_SPACE_UNDEFINED +}space_status; +/* how many byes are mp_free in the buffer */ +unsigned Alsa_AO_Interface::get_space() { + snd_pcm_status_t *status; + int ret,st; + space_status e_status=GET_SPACE_UNDEFINED; + + //snd_pcm_sframes_t avail_frames = 0; + + if ((ret = snd_pcm_status_malloc(&status)) < 0) { + MSG_ERR("alsa-space: memory allocation error: %s\n", snd_strerror(ret)); + return 0; + } + + if ((ret = snd_pcm_status(handler, status)) < 0) { + MSG_ERR("alsa-space: cannot get pcm status: %s\n", snd_strerror(ret)); + return 0; + } + + switch((st=snd_pcm_status_get_state(status))) { + case SND_PCM_STATE_OPEN: + e_status = GET_SPACE_OPEN; + case SND_PCM_STATE_PREPARED: + if (e_status!=GET_SPACE_OPEN) { + e_status = GET_SPACE_PREPARED; + first = 1; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + if (ret == 0) //ugly workaround for hang in mmap-mode + ret = 10; + break; + } + case SND_PCM_STATE_RUNNING: + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + //avail_frames = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; + if (e_status!=GET_SPACE_OPEN && e_status!=GET_SPACE_PREPARED) + e_status = GET_SPACE_RUNNING; + break; + case SND_PCM_STATE_PAUSED: + MSG_V("alsa-space: paused"); + e_status = GET_SPACE_PAUSED; + ret = 0; + break; + case SND_PCM_STATE_XRUN: + xrun("space"); + e_status = GET_SPACE_XRUN; + first = 1; + ret = 0; + break; + default: + e_status = GET_SPACE_UNDEFINED; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; + if (ret <= 0) { + xrun("space"); + } + } + + if (e_status!=GET_SPACE_RUNNING) + MSG_V("alsa-space: mp_free space = %i, status=%i, %i --\n", ret, st, e_status); + snd_pcm_status_free(status); + + if (ret < 0) { + MSG_ERR("negative value!!\n"); + ret = 0; + } + + return ret; +} + +/* delay in seconds between first and last sample in buffer */ +float Alsa_AO_Interface::get_delay() +{ + if (handler) { + snd_pcm_status_t *status; + int r; + float ret; + + if ((ret = snd_pcm_status_malloc(&status)) < 0) { + MSG_ERR("alsa-delay: memory allocation error: %s\n", snd_strerror(ret)); + return 0; + } + + if ((ret = snd_pcm_status(handler, status)) < 0) { + MSG_ERR("alsa-delay: cannot get pcm status: %s\n", snd_strerror(ret)); + return 0; + } + + switch(snd_pcm_status_get_state(status)) { + case SND_PCM_STATE_OPEN: + case SND_PCM_STATE_PREPARED: + case SND_PCM_STATE_RUNNING: + r=snd_pcm_status_get_delay(status); + ret = (float)r/(float)_samplerate; + break; + default: + ret = 0; + } + snd_pcm_status_free(status); + + if (ret < 0) ret = 0; + return ret; + } else return 0; +} + +unsigned Alsa_AO_Interface::samplerate() const { return _samplerate; } +unsigned Alsa_AO_Interface::channels() const { return _channels; } +unsigned Alsa_AO_Interface::format() const { return _format; } +unsigned Alsa_AO_Interface::buffersize() const { return _buffersize; } +unsigned Alsa_AO_Interface::outburst() const { return _outburst; } +MPXP_Rc Alsa_AO_Interface::test_channels(unsigned c) const { + return snd_pcm_hw_params_test_channels(handler, hwparams,c)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_rate(unsigned r) const { + return snd_pcm_hw_params_test_rate(handler, hwparams,r,0)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_format(unsigned f) const { + snd_pcm_format_t rval; + rval=fmt2alsa(f); + return snd_pcm_hw_params_test_format(handler, hwparams,snd_pcm_format_t(rval))==0? + MPXP_True:MPXP_False; +} + +static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } + +extern const ao_info_t audio_out_alsa = +{ + "ALSA-1.x audio output", + "alsa", + "Alex Beregszaszi <al...@na...>, Joy Winter <jo...@pi...>", + "under developement", + query_interface +}; +} //namespace mpxp + Deleted: mplayerxp/libao2/ao_alsa9.cpp =================================================================== --- mplayerxp/libao2/ao_alsa9.cpp 2012-12-15 13:09:33 UTC (rev 563) +++ mplayerxp/libao2/ao_alsa9.cpp 2012-12-15 17:27:08 UTC (rev 564) @@ -1,1024 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* - ao_alsa9 - ALSA-0.9.x output plugin for MPlayer - - (C) Alex Beregszaszi <al...@na...> - - modified for real alsa-0.9.0-support by Joy Winter <jo...@pi...> - additional AC3 passthrough support by Andy Lo A Foe <an...@al...> - 08/22/2002 iec958-init rewritten and merged with common init, joy - - Any bugreports regarding to this driver are welcome. -*/ - -#include <errno.h> -#include <sys/time.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> -#include <sys/poll.h> - -#include "mplayerxp.h" -#define ALSA_PCM_NEW_HW_PARAMS_API -#define ALSA_PCM_NEW_SW_PARAMS_API -#include <alsa/asoundlib.h> - -#include "audio_out.h" -#include "audio_out_internal.h" -#include "afmt.h" -#include "ao_msg.h" -#include "libmpstream2/mrl.h" - -namespace mpxp { -typedef struct priv_conf_s { - int mmap; - int noblock; -}priv_conf_t; -static priv_conf_t priv_conf; -static const mrl_config_t alsaconf[]={ - { "mmap", &priv_conf.mmap, MRL_TYPE_BOOL, 0, 1 }, - { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, - { NULL, NULL, 0, 0, 0 } -}; -class Alsa_AO_Interface : public AO_Interface { - public: - Alsa_AO_Interface(const std::string& subdevice); - virtual ~Alsa_AO_Interface(); - - virtual MPXP_Rc open(unsigned flags); - virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); - virtual unsigned samplerate() const; - virtual unsigned channels() const; - virtual unsigned format() const; - virtual unsigned buffersize() const; - virtual unsigned outburst() const; - virtual MPXP_Rc test_rate(unsigned r) const; - virtual MPXP_Rc test_channels(unsigned c) const; - virtual MPXP_Rc test_format(unsigned f) const; - virtual void reset(); - virtual unsigned get_space(); - virtual float get_delay(); - virtual unsigned play(const any_t* data,unsigned len,unsigned flags); - virtual void pause(); - virtual void resume(); - virtual MPXP_Rc ctrl(int cmd,long arg) const; - private: - unsigned _channels,_samplerate,_format; - unsigned _buffersize,_outburst; - unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } - void show_caps(unsigned device) const; - int xrun(const char *str_mode) const; - unsigned play_normal(const any_t* data, unsigned len); - unsigned play_mmap(const any_t* data, unsigned len); - snd_pcm_format_t fmt2alsa(unsigned format) const; - - snd_pcm_t* handler; - snd_pcm_format_t snd_format; - snd_pcm_hw_params_t* hwparams; - snd_pcm_sw_params_t* swparams; - size_t bytes_per_sample; - int first; -}; - -Alsa_AO_Interface::Alsa_AO_Interface(const std::string& _subdevice) - :AO_Interface(_subdevice) {} -Alsa_AO_Interface::~Alsa_AO_Interface() { - int err; - if(!handler) { - MSG_ERR("alsa-uninit: no handler defined!\n"); - return; - } - if (!priv_conf.noblock) { - if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); - return; - } - } - if ((err = snd_pcm_close(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); - return; - } else { - handler = NULL; - MSG_V("alsa-uninit: pcm closed\n"); - } - snd_pcm_hw_params_free(hwparams); - snd_pcm_sw_params_free(swparams); -} - -#define ALSA_DEVICE_SIZE 48 - -#define BUFFERTIME // else SET_CHUNK_SIZE -#undef USE_POLL - -snd_pcm_format_t Alsa_AO_Interface::fmt2alsa(unsigned f) const { - switch (f) - { - case AFMT_S8: - return SND_PCM_FORMAT_S8; - break; - case AFMT_U8: - return SND_PCM_FORMAT_U8; - break; - case AFMT_U16_LE: - return SND_PCM_FORMAT_U16_LE; - break; - case AFMT_U16_BE: - return SND_PCM_FORMAT_U16_BE; - break; -#ifndef WORDS_BIGENDIAN - case AFMT_AC3: -#endif - case AFMT_S16_LE: - return SND_PCM_FORMAT_S16_LE; - break; -#ifdef WORDS_BIGENDIAN - case AFMT_AC3: -#endif - case AFMT_S16_BE: - return SND_PCM_FORMAT_S16_BE; - break; - case AFMT_S32_LE: - return SND_PCM_FORMAT_S32_LE; - break; - case AFMT_S32_BE: - return SND_PCM_FORMAT_S32_BE; - break; - case AFMT_U32_LE: - return SND_PCM_FORMAT_U32_LE; - break; - case AFMT_U32_BE: - return SND_PCM_FORMAT_U32_BE; - break; - case AFMT_S24_LE: - return SND_PCM_FORMAT_S24_LE; - break; - case AFMT_S24_BE: - return SND_PCM_FORMAT_S24_BE; - break; - case AFMT_U24_LE: - return SND_PCM_FORMAT_U24_LE; - break; - case AFMT_U24_BE: - return SND_PCM_FORMAT_U24_BE; - break; - case AFMT_FLOAT32: -#ifdef WORDS_BIGENDIAN - return SND_PCM_FORMAT_FLOAT_BE; -#else - return SND_PCM_FORMAT_FLOAT_LE; -#endif - break; - default: - return SND_PCM_FORMAT_MPEG; - break; - } -} - -/* to set/get/query special features/parameters */ -MPXP_Rc Alsa_AO_Interface::ctrl(int cmd, long arg) const { - switch(cmd) { - case AOCONTROL_GET_VOLUME: - case AOCONTROL_SET_VOLUME: -#ifndef WORDS_BIGENDIAN - { //seems to be a problem on macs? - ao_control_vol_t *vol = (ao_control_vol_t *)arg; - - int err; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - snd_mixer_selem_id_t *sid; - - const char *mix_name = "PCM"; - const char *card = "default"; - - long pmin, pmax; - long get_vol, set_vol; - float calc_vol, diff, f_multi; - - if(_format == AFMT_AC3) return MPXP_True; - - //allocate simple id - snd_mixer_selem_id_alloca(&sid); - - //sets simple-mixer index and name - snd_mixer_selem_id_set_index(sid, 0); - snd_mixer_selem_id_set_name(sid, mix_name); - - if ((err = snd_mixer_open(&handle, 0)) < 0) { - MSG_ERR("alsa-control_ao: mixer open error: %s\n", snd_strerror(err)); - return MPXP_Error; - } - - if ((err = snd_mixer_attach(handle, card)) < 0) { - MSG_ERR("alsa-control_ao: mixer attach %s error: %s", card, snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - - if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) { - MSG_ERR("alsa-control_ao: mixer register error: %s", snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - if ((err = snd_mixer_load(handle)) < 0) { - MSG_ERR("alsa-control_ao: mixer load error: %s", snd_strerror(err)); - snd_mixer_close(handle); - return MPXP_Error; - } - - elem = snd_mixer_find_selem(handle, sid); - if (!elem) { - MSG_ERR("alsa-control_ao: unable to find simple control_ao '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); - snd_mixer_close(handle); - return MPXP_Error; - } - - snd_mixer_selem_get_playback_volume_range(elem,&pmin,&pmax); - f_multi = (100 / (float)pmax); - - if (cmd == AOCONTROL_SET_VOLUME) { - - diff = (vol->left+vol->right) / 2; - set_vol = rint(diff / f_multi); - - if (set_vol < 0) set_vol = 0; - else if (set_vol > pmax) set_vol = pmax; - - //setting channels - if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(0), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting left channel, %s",snd_strerror(err)); - return MPXP_Error; - } - if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(1), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting right channel, %s",snd_strerror(err)); - return MPXP_Error; - } - } else { - snd_mixer_selem_get_playback_volume(elem, snd_mixer_selem_channel_id_t(0), &get_vol); - calc_vol = get_vol; - calc_vol = rintf(calc_vol * f_multi); - - vol->left = vol->right = (int)calc_vol; - - //printf("get_vol = %i, calc=%i\n",get_vol, calc_vol); - } - snd_mixer_close(handle); - return MPXP_Ok; - } -#else // end big-endian - return MPXP_Unknown; -#endif - } //end witch - return MPXP_Unknown; -} - -void Alsa_AO_Interface::show_caps(unsigned device) const { - snd_pcm_info_t *alsa_info; - snd_pcm_t *pcm; - snd_pcm_hw_params_t *hw_params; - snd_output_t *sout; - int err,cards=-1; - unsigned rmin,rmax; - unsigned j,sdmin,sdmax; - char adevice[ALSA_DEVICE_SIZE]; - if ((err = snd_card_next(&cards)) < 0 || cards < 0) - { - MSG_ERR("AO-INFO: alsa-init: no soundcards found: %s\n", snd_strerror(err)); - return; - } - snd_pcm_info_malloc(&alsa_info); - snd_pcm_info_set_device(alsa_info,device); - sdmin=snd_pcm_info_get_subdevice(alsa_info); - sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); - MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); - for(j=sdmin;j<=sdmax;j++) { - int i; - snd_pcm_info_set_subdevice(alsa_info,j); - sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); - MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); - if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - return; - } - snd_pcm_hw_params_malloc(&hw_params); - if(snd_pcm_hw_params_any(pcm, hw_params)<0) { - MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); - return; - } - MSG_INFO(" AO-INFO: List of access type: "); - for(i=0;i<SND_PCM_ACCESS_LAST;i++) - if(!snd_pcm_hw_params_test_access(pcm,hw_params,snd_pcm_access_t(i))) - MSG_INFO("%s ",snd_pcm_access_name(snd_pcm_access_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported formats: "); - for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported channels: "); - for(i=0;i<64;i++) - if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%u ",i); - MSG_INFO("\n"); - snd_pcm_hw_params_get_rate_min(hw_params,&rmin,&err); - snd_pcm_hw_params_get_rate_max(hw_params,&rmax,&err); - MSG_INFO(" AO-INFO: Rates range: %u %u\n",rmin,rmax); - snd_output_stdio_attach(&sout, stderr, 0); - snd_pcm_hw_params_dump(hw_params, sout); - if(hw_params) snd_pcm_hw_params_free(hw_params); - if(pcm) snd_pcm_close(pcm); - } - snd_pcm_info_free(alsa_info); -} - -/* - open & setup audio device - return: 1=success 0=fail -*/ -MPXP_Rc Alsa_AO_Interface::open(unsigned flags) { - int err; - int cards = -1; - snd_pcm_info_t *alsa_info; - const char *str_block_mode; - char *alsa_dev=NULL; - char *alsa_port=NULL; - char alsa_device[ALSA_DEVICE_SIZE]; - UNUSED(flags); - first=1; - - handler = NULL; - alsa_device[0]='\0'; - - MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); - - if (!subdevice.empty()) { - const char *param; - char *p; - // example: -ao alsa:hw:0#mmap=1 - param=mrl_parse_line(subdevice,NULL,NULL,&alsa_dev,&alsa_port); - mrl_parse_params(param,alsaconf); - if(alsa_port) { - p=strchr(alsa_port,','); - if(p) { - if(strcmp(p+1,"-1")==0) { - *p='\0'; - show_caps(atoi(alsa_port)); - return MPXP_False; - } - } - if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); - else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); - MSG_V("alsa-init: soundcard set to %s\n", alsa_device); - } //end parsing ao->subdevice - } - - if ((err = snd_card_next(&cards)) < 0 || cards < 0) { - MSG_ERR("alsa-init: no soundcards found: %s\n", snd_strerror(err)); - return MPXP_False; - } - - if (alsa_device[0] == '\0') { - int tmp_device, tmp_subdevice; - - if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { - MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); - return MPXP_False; - } - - if ((tmp_device = snd_pcm_info_get_device(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get device\n"); - return MPXP_False; - } - - if ((tmp_subdevice = snd_pcm_info_get_subdevice(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get subdevice\n"); - return MPXP_False; - } - MSG_V("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); - - if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) { - MSG_ERR("alsa-init: cant wrote device-id\n"); - } - snd_pcm_info_free(alsa_info); - } - - MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); - //setting modes for block or nonblock-mode - int open_mode,block_mode; - if (priv_conf.noblock) { - open_mode = SND_PCM_NONBLOCK; - block_mode = 1; - str_block_mode = "nonblock-mode"; - } else { - open_mode = 0; - block_mode = 0; - str_block_mode = "block-mode"; - } - - if (!handler) { - //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC - if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { - if (priv_conf.noblock) { - MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); - if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - alsa_device[0]='\0'; - return MPXP_False; - } else { - block_mode = 0; - str_block_mode = "block-mode"; - } - } else { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); - alsa_device[0]='\0'; - return MPXP_False; - } - } - alsa_device[0]='\0'; - if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { - MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); - } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); - - snd_pcm_hw_params_malloc(&hwparams); - snd_pcm_sw_params_malloc(&swparams); - - // setting hw-parameters - if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { - MSG_ERR("alsa-init: unable to get initial parameters: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_any()\n"); - if (priv_conf.mmap) { - snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); - snd_pcm_access_mask_none(mask); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); - err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); - MSG_ERR("alsa-init: mmap set\n"); - } else { - err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); - MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); - } - if (err < 0) { - MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); - return MPXP_False; - } - } // end switch priv->handler (spdif) - return MPXP_Ok; -} // end init - -MPXP_Rc Alsa_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { - int err,i; - size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; - snd_pcm_uframes_t dummy; - - MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, - c, ao_format_name(f)); - - _samplerate = r; - _format = f; - _channels = c; - _outburst = OUTBURST; - //ao->buffersize = MAX_OUTBURST; // was 16384 - - snd_format=fmt2alsa(_format); - - switch(snd_format) { - case SND_PCM_FORMAT_S16_LE: - case SND_PCM_FORMAT_U16_LE: - case SND_PCM_FORMAT_S16_BE: - case SND_PCM_FORMAT_U16_BE: - case SND_PCM_FORMAT_S32_LE: - case SND_PCM_FORMAT_S32_BE: - case SND_PCM_FORMAT_U32_LE: - case SND_PCM_FORMAT_U32_BE: - case SND_PCM_FORMAT_FLOAT_BE: - case SND_PCM_FORMAT_FLOAT_LE: - case SND_PCM_FORMAT_S24_LE: - case SND_PCM_FORMAT_S24_BE: - case SND_PCM_FORMAT_U24_LE: - case SND_PCM_FORMAT_U24_BE: - break; - case -1: - MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", - ao_format_name(_format)); - return MPXP_False; - default: - break; - } - bytes_per_sample = bps() / _samplerate; - - if ((err = snd_pcm_hw_params_set_format(handler, hwparams, - snd_format)) < 0) { - MSG_ERR("alsa-conf: unable to set format(%s): %s\n", - snd_pcm_format_name(snd_format), - snd_strerror(err)); - MSG_HINT("Please try one of: "); - for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) - MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_HINT("\n"); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); - - if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { - MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", - _samplerate, - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); - - if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, - _channels)) < 0) { - MSG_ERR("alsa-conf: unable to set %u channels: %s\n", - _channels, - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); -#ifdef BUFFERTIME - { - int dir; - unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ - - if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set buffer time near: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); - - period_time = alsa_buffer_time/4; - if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { - /* original: alsa_buffer_time/ao->bps */ - MSG_ERR("alsa-init: unable to set period time: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_period_time_near(%i)\n",period_time); - MSG_V("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, period_time); - } -#else - { - int dir=0; - unsigned period_time=100000; /* period time in us */ - snd_pcm_uframes_t size; - if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); - - //get chunksize - if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { - MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_get_period_size(%i)\n",size); - chunk_size=size; - } -#endif - // gets buffersize for control_ao - if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { - MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); - return MPXP_False; - } else { - _buffersize = dummy * bytes_per_sample; - MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); - } - MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); - bits_per_sample = snd_pcm_format_physical_width(snd_format); - MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); - bits_per_frame = bits_per_sample * _channels; - chunk_bytes = chunk_size * bits_per_frame / 8; - - MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); - - /* finally install hardware parameters */ - if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { - MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", - snd_strerror(err)); - return MPXP_False; - } - MSG_DBG2("snd_pcm_hw_params()\n"); - // setting sw-params (only avail-min) if noblocking mode was choosed - if (priv_conf.noblock) { - if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); - return MPXP_False; - } - - //set min available frames to consider pcm ready (4) - //increased for nonblock-mode should be set dynamically later - if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { - MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); - return MPXP_False; - } - - if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to install sw-params\n"); - return MPXP_False; - } - - }//end swparams - - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); - return MPXP_False; - } - // end setting hw-params - MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", - _samplerate, _channels, bytes_per_sample, _buffersize, - snd_pcm_format_description(snd_format)); - return MPXP_Ok; -} // end config_ao - -void Alsa_AO_Interface::pause() { - int err; - - if (!priv_conf.noblock) { - //drain causes error in nonblock-mode! - if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); - return; - } - } else { - MSG_V("alsa-pause: paused nonblock\n"); - return; - } -} - -void Alsa_AO_Interface::resume() { - int err; - - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); - return; - } -} - -/* stop playing and empty buffers (for seeking/pause) */ -void Alsa_AO_Interface::reset() { - int err; - - if ((err = snd_pcm_drop(handler)) < 0) { - MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); - return; - } - if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); - return; - } - return; -} - -#ifdef USE_POLL -static int __FASTCALL__ wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) -{ - unsigned short revents; - - while (1) { - poll(ufds, count, -1); - snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); - if (revents & POLLERR) return -EIO; - if (revents & POLLOUT) return 0; - } -} -#endif - -static void _timersub(const struct timeval*a,const struct timeval* b,struct timeval* result) { - result->tv_sec = a->tv_sec - b->tv_sec; - result->tv_usec = a->tv_usec - b->tv_usec; - if (result->tv_usec < 0) { - --result->tv_sec; - result->tv_usec += 1000000; - } -} - -/* I/O error handler */ -int Alsa_AO_Interface::xrun(const char *str_mode) const { - int err; - snd_pcm_status_t *status; - - snd_pcm_status_alloca(&status); - - if ((err = snd_pcm_status(handler, status))<0) { - MSG_ERR("status error: %s", snd_strerror(err)); - return 0; - } - - if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { - struct timeval now, diff, tstamp; - gettimeofday(&now, 0); - snd_pcm_status_get_trigger_tstamp(status, &tstamp); - _timersub(&now, &tstamp, &diff); - MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", - str_mode, - diff.tv_sec * 1000 + diff.tv_usec / 1000.0); - } - - if ((err = snd_pcm_prepare(handler))<0) { - MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); - return 0; - } - - return 1; /* ok, data should be accepted again */ -} - -unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { - unsigned result; - UNUSED(flags); - MSG_DBG2("[ao_... [truncated message content] |
From: <nic...@us...> - 2012-12-15 13:09:39
|
Revision: 563 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=563&view=rev Author: nickols_k Date: 2012-12-15 13:09:33 +0000 (Sat, 15 Dec 2012) Log Message: ----------- New planes! About illegal patch: why 'this' not first argument??? is it still c++ or is it perfectly other language??? Breakpoint 1, mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s operator new (size=88) at mp_malloc.cpp:574 574 any_t *operator new(size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } (gdb) n x1840952739 (size=88) at mp_malloc.cpp:549 549 any_t* SECURE_NAME1(_mp_mallocz)(size_t size) { (gdb) n 551 ptr = mp_mallocz(size); (gdb) n 552 if(!ptr) { (gdb) n 557 } (gdb) n mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s Alsa_AO_Interface (_subdevice=..., this=<optimized out>) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s AO_Interface (_subdevice=..., this=<optimized out>) at audio_out_internal.h:11 11 AO_Interface(const std::string& _subdevice):subdevice(_subdevice) {} (gdb) print _subdevice $1 = <optimized out> (gdb) s mpxp::query_interface (sd=...) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) print sd $2 = (const std::string &) @0x18dcff0: {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}} (gdb) s Alsa_AO_Interface (_subdevice=..., this=0x19b6fa8) at ao_alsa9.cpp:1013 1013 static AO_Interface* query_interface(const std::string& sd) { return new(zeromem) Alsa_AO_Interface(sd); } (gdb) s AO_Interface (_subdevice=..., this=0x19b6fa8) at audio_out_internal.h:11 11 AO_Interface(const std::string& _subdevice):subdevice(_subdevice) {} (gdb) print _subdevice $3 = (const std::string &) @0x18dcff0: {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}} (gdb) s Program received signal SIGSEGV, Segmentation fault. std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (this=0x19b6fb0, __str=...) at ..../gcc/gcc-4.5.4/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:173 173 __str.get_allocator()) Modified Paths: -------------- TODO Modified: TODO =================================================================== --- TODO 2012-12-15 11:18:09 UTC (rev 562) +++ TODO 2012-12-15 13:09:33 UTC (rev 563) @@ -1,5 +1,16 @@ TODO for mplayerxp: +- Implement libmpdemux3: + class Demuxer_Driver { + Demuxer_Driver(Demuxer& parent); + virtual ~Demuxer_Driver(); + virtual MPXP_Rc probe(int force); + virtual MPXP_Rc open(); + virtual void close(); + virtual MPXP_Rc seek(float secs_from_begin_of_stream); + virtual Demuxer_Packet* read_new_packet(); + }; + driver must not perform demultiplexing - just packet reading. - Implement demux_rawstream.cpp specially for libmpstream/s_tv.cpp - Problem: it seems that demuxer doesn't differ bitmap-based subtitles from Closed Caption (plain ascii-text) ones. Because of this some demuxer's @@ -36,7 +47,3 @@ - implement distributed video playback with using of PVM. (need volunteers) - run filters in independent threads (useful for encoding) - use original wine instead of loader. (adapt DMO_filter.so for wine) -- redesign demux_mkv and other in demux_asf like manner. (will allow to avoid 1 - unnecessary memcpy for input video bandwidth) -- remove DEMUXER_TYPE_* and STREAMTYPE_* (make modules in libmpdemux more - independent ones) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-15 11:18:16
|
Revision: 562 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=562&view=rev Author: nickols_k Date: 2012-12-15 11:18:09 +0000 (Sat, 15 Dec 2012) Log Message: ----------- segfault-- About illegal patch: Breakpoint 1, int16_to_int32_SSE3 (in_data=0x7fffe8000b90, out_data= 0x7fffe8002ba0, inlen=8192, final=0) at ./aflib_accel.h:89 89 unsigned i,insamples = inlen/sizeof(int16_t); (gdb) s 98 i=0; (gdb) print inlen $1 = 8192 (gdb) print insamples $2 = 8192 (gdb) q Modified Paths: -------------- mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/postproc/aflib.cpp mplayerxp/postproc/aflib.h mplayerxp/postproc/aflib_accel.h Modified: mplayerxp/libmpcodecs/ad_mp3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-14 15:13:41 UTC (rev 561) +++ mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-15 11:18:09 UTC (rev 562) @@ -346,11 +346,14 @@ void uninit(ad_private_t *priv) { - mpg123_close(priv->mh); - mpg123_delete(priv->mh); - mpg123_exit(); + if(priv->mh) { + mpg123_close(priv->mh); + mpg123_delete(priv->mh); + mpg123_exit(); + } delete priv; - dlclose(dll_handle); + if(dll_handle) dlclose(dll_handle); + dll_handle=NULL; } MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) Modified: mplayerxp/postproc/aflib.cpp =================================================================== --- mplayerxp/postproc/aflib.cpp 2012-12-14 15:13:41 UTC (rev 561) +++ mplayerxp/postproc/aflib.cpp 2012-12-15 11:18:09 UTC (rev 562) @@ -19,7 +19,7 @@ #define __USE_ISOC99 1 #include <math.h> #ifndef HAVE_LRINTF -#define lrintf(x) ((int)(x)) +template <class T> int lrintf ( T x ) { return (int)x; } #endif #include "aflib.h" Modified: mplayerxp/postproc/aflib.h =================================================================== --- mplayerxp/postproc/aflib.h 2012-12-14 15:13:41 UTC (rev 561) +++ mplayerxp/postproc/aflib.h 2012-12-15 11:18:09 UTC (rev 562) @@ -163,7 +163,9 @@ extern int32_t (* __FASTCALL__ FIR_i16)(const int16_t *x,const int16_t *w); extern float (* __FASTCALL__ FIR_f32)(const float *x,const float *w); -#ifndef SATURATE -#define SATURATE(x,_min,_max) {if((x)<(_min)) (x)=(_min); else if((x)>(_max)) (x)=(_max);} +template <class T> const T& saturate ( T& x, const T& _min, const T& _max ) { + if(x<_min) x=_min; + else if(x>_max) x=_max; + return x; +} #endif -#endif Modified: mplayerxp/postproc/aflib_accel.h =================================================================== --- mplayerxp/postproc/aflib_accel.h 2012-12-14 15:13:41 UTC (rev 561) +++ mplayerxp/postproc/aflib_accel.h 2012-12-15 11:18:09 UTC (rev 562) @@ -346,7 +346,7 @@ if(!_ivec_aligned(out)) for(;i<insamples;i++) { ftmp=in[i]; - SATURATE(ftmp,-0.999998,+0.999998); + saturate(ftmp,-0.999998f,+0.999998f); out[i]=(int32_t)lrintf((std::numeric_limits<int32_t>::max()-1)*ftmp); if(_ivec_aligned(out)) break; } @@ -371,7 +371,7 @@ #endif for(;i<insamples;i++) { ftmp=in[i]; - SATURATE(ftmp,-0.999998,+0.999998); + saturate(ftmp,-0.999998f,+0.999998f); out[i]=(int32_t)lrintf((std::numeric_limits<int32_t>::max()-1)*ftmp); } } @@ -424,7 +424,7 @@ case 1: for(i=0;i<in->len;i++) { ftmp=((float*)in->audio)[i]; - SATURATE(ftmp,-1.0,+1.0); + saturate(ftmp,-1.0f,+1.0f); ((int8_t*)out->audio)[i]=(int8_t)lrintf(std::numeric_limits<int16_t>::max()*ftmp); } break; @@ -439,7 +439,7 @@ #else for(i=0;i<in->len;i++) { ftmp=((float*)in->audio)[i]; - SATURATE(ftmp,-1.0,+1.0); + saturate(ftmp,-1.0f,+1.0f); ((int16_t*)out->audio)[i]=(int16_t)lrintf(std::numeric_limits<int16_t>::max()*ftmp); } #endif @@ -447,7 +447,7 @@ case 3: for(i=0;i<in->len;i++) { ftmp=((float*)in->audio)[i]; - SATURATE(ftmp,-1.0,+1.0); + saturate(ftmp,-1.0f,+1.0f); store24bit(out->audio, i, (int32_t)lrintf((std::numeric_limits<int32_t>::max()-1)*ftmp)); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-14 15:13:48
|
Revision: 561 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=561&view=rev Author: nickols_k Date: 2012-12-14 15:13:41 +0000 (Fri, 14 Dec 2012) Log Message: ----------- fixes Modified Paths: -------------- mplayerxp/libao2/ao_sdl.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/xmpcore/xmp_context.cpp Modified: mplayerxp/libao2/ao_sdl.cpp =================================================================== --- mplayerxp/libao2/ao_sdl.cpp 2012-12-14 14:52:33 UTC (rev 560) +++ mplayerxp/libao2/ao_sdl.cpp 2012-12-14 15:13:41 UTC (rev 561) @@ -67,18 +67,19 @@ unsigned buf_write; unsigned buf_read_pos; unsigned buf_write_pos; - unsigned volume; + unsigned* volume; int full_buffers; int buffered_bytes; }; SDL_AO_Interface::SDL_AO_Interface(const std::string& _subdevice) - :AO_Interface(_subdevice) {} + :AO_Interface(_subdevice),volume(new unsigned) {} SDL_AO_Interface::~SDL_AO_Interface() { MSG_V("SDL: Audio Subsystem shutting down!\n"); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); + delete volume; } int SDL_AO_Interface::write_buffer(const uint8_t* data,int len){ @@ -107,7 +108,7 @@ if(full_buffers==0) break; // no more data buffered! x=std::min(unsigned(len),BUFFSIZE-buf_read_pos); memcpy(data+len2,buffer[buf_read]+buf_read_pos,x); - SDL_MixAudio(data+len2, data+len2, x, volume); + SDL_MixAudio(data+len2, data+len2, x, *volume); len2+=x; len-=x; buffered_bytes-=x; buf_read_pos+=x; if(buf_read_pos>=BUFFSIZE){ @@ -143,15 +144,15 @@ switch (cmd) { case AOCONTROL_GET_VOLUME: { ao_control_vol_t* vol = (ao_control_vol_t*)arg; - vol->left = vol->right = (float)((volume + 127)/2.55); + vol->left = vol->right = (float)((*volume + 127)/2.55); return MPXP_Ok; } case AOCONTROL_SET_VOLUME: { float diff; ao_control_vol_t* vol = (ao_control_vol_t*)arg; diff = (vol->left+vol->right) / 2; -// volume = (int)(diff * 2.55) - 127; -// return MPXP_Ok; + *volume = (int)(diff * 2.55) - 127; + return MPXP_Ok; return MPXP_False; } } @@ -170,7 +171,7 @@ { unsigned i; UNUSED(flags); - volume=127; + *volume=127; /* Allocate ring-priv->buffer memory */ for(i=0;i<NUM_BUFS;i++) buffer[i]=new uint8_t[BUFFSIZE]; Modified: mplayerxp/libvo2/vo_sdl.cpp =================================================================== --- mplayerxp/libvo2/vo_sdl.cpp 2012-12-14 14:52:33 UTC (rev 560) +++ mplayerxp/libvo2/vo_sdl.cpp 2012-12-14 15:13:41 UTC (rev 561) @@ -135,13 +135,12 @@ #endif #include "vo_msg.h" -int sdl_noxv; -int sdl_forcexv; -int sdl_forcegl; - #include <SDL/SDL.h> namespace mpxp { +int sdl_noxv; +int sdl_forcexv; +int sdl_forcegl; #if defined(sun) && defined(__svr4__) /* setenv is missing on solaris */ static void setenv(const char *name, const char *val, int _xx) Modified: mplayerxp/xmpcore/xmp_context.cpp =================================================================== --- mplayerxp/xmpcore/xmp_context.cpp 2012-12-14 14:52:33 UTC (rev 560) +++ mplayerxp/xmpcore/xmp_context.cpp 2012-12-14 15:13:41 UTC (rev 561) @@ -10,6 +10,7 @@ #include "libmpsub/spudec.h" #include "libmpstream2/network.h" +namespace mpxp { #ifdef HAVE_SDL //extern char *sdl_driver; extern int sdl_noxv; @@ -17,8 +18,6 @@ extern int sdl_forcegl; //extern char *sdl_adriver; #endif - -namespace mpxp { extern const char *oss_mixer_device; static const config_t xpcore_config[]={ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-14 14:52:43
|
Revision: 560 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=560&view=rev Author: nickols_k Date: 2012-12-14 14:52:33 +0000 (Fri, 14 Dec 2012) Log Message: ----------- convert struct ao_functions_t into class AO_Interface Modified Paths: -------------- mplayerxp/libao2/ao_alsa9.cpp mplayerxp/libao2/ao_arts.cpp mplayerxp/libao2/ao_esd.cpp mplayerxp/libao2/ao_jack.cpp mplayerxp/libao2/ao_nas.cpp mplayerxp/libao2/ao_null.cpp mplayerxp/libao2/ao_openal.cpp mplayerxp/libao2/ao_oss.cpp mplayerxp/libao2/ao_sdl.cpp mplayerxp/libao2/ao_wav.cpp mplayerxp/libao2/audio_out.cpp mplayerxp/libao2/audio_out.h mplayerxp/libao2/audio_out_internal.h mplayerxp/mplayerxp.cpp mplayerxp/postproc/af.cpp mplayerxp/postproc/af_ao2.cpp mplayerxp/xmpcore/xmp_context.cpp Modified: mplayerxp/libao2/ao_alsa9.cpp =================================================================== --- mplayerxp/libao2/ao_alsa9.cpp 2012-12-13 14:55:16 UTC (rev 559) +++ mplayerxp/libao2/ao_alsa9.cpp 2012-12-14 14:52:33 UTC (rev 560) @@ -31,25 +31,7 @@ #include "ao_msg.h" #include "libmpstream2/mrl.h" -static ao_info_t info = -{ - "ALSA-1.x audio output", - "alsa", - "Alex Beregszaszi <al...@na...>, Joy Winter <jo...@pi...>", - "under developement" -}; - -LIBAO_EXTERN(alsa) - -typedef struct priv_s { - snd_pcm_t* handler; - snd_pcm_format_t format; - snd_pcm_hw_params_t*hwparams; - snd_pcm_sw_params_t*swparams; - size_t bytes_per_sample; - int first; -}priv_t; - +namespace mpxp { typedef struct priv_conf_s { int mmap; int noblock; @@ -60,15 +42,78 @@ { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, { NULL, NULL, 0, 0, 0 } }; +class Alsa_AO_Interface : public AO_Interface { + public: + Alsa_AO_Interface(const std::string& subdevice); + virtual ~Alsa_AO_Interface(); + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + void show_caps(unsigned device) const; + int xrun(const char *str_mode) const; + unsigned play_normal(const any_t* data, unsigned len); + unsigned play_mmap(const any_t* data, unsigned len); + snd_pcm_format_t fmt2alsa(unsigned format) const; + + snd_pcm_t* handler; + snd_pcm_format_t snd_format; + snd_pcm_hw_params_t* hwparams; + snd_pcm_sw_params_t* swparams; + size_t bytes_per_sample; + int first; +}; + +Alsa_AO_Interface::Alsa_AO_Interface(const std::string& _subdevice) + :AO_Interface(_subdevice) {} +Alsa_AO_Interface::~Alsa_AO_Interface() { + int err; + if(!handler) { + MSG_ERR("alsa-uninit: no handler defined!\n"); + return; + } + if (!priv_conf.noblock) { + if ((err = snd_pcm_drain(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); + return; + } + } + if ((err = snd_pcm_close(handler)) < 0) { + MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + return; + } else { + handler = NULL; + MSG_V("alsa-uninit: pcm closed\n"); + } + snd_pcm_hw_params_free(hwparams); + snd_pcm_sw_params_free(swparams); +} + #define ALSA_DEVICE_SIZE 48 #define BUFFERTIME // else SET_CHUNK_SIZE #undef USE_POLL -static snd_pcm_format_t __FASTCALL__ fmt2alsa(unsigned format) -{ - switch (format) +snd_pcm_format_t Alsa_AO_Interface::fmt2alsa(unsigned f) const { + switch (f) { case AFMT_S8: return SND_PCM_FORMAT_S8; @@ -132,23 +177,8 @@ } /* to set/get/query special features/parameters */ -static MPXP_Rc __FASTCALL__ control_ao(const ao_data_t* ao,int cmd, long arg) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - int rval; +MPXP_Rc Alsa_AO_Interface::ctrl(int cmd, long arg) const { switch(cmd) { - case AOCONTROL_QUERY_FORMAT: - rval=fmt2alsa(arg); - return snd_pcm_hw_params_test_format(priv->handler, priv->hwparams,snd_pcm_format_t(rval))==0? - MPXP_True:MPXP_False; - case AOCONTROL_QUERY_CHANNELS: - rval=arg; - return snd_pcm_hw_params_test_channels(priv->handler, priv->hwparams,rval)==0? - MPXP_True:MPXP_False; - case AOCONTROL_QUERY_RATE: - rval=arg; - return snd_pcm_hw_params_test_rate(priv->handler, priv->hwparams,rval,0)==0? - MPXP_True:MPXP_False; case AOCONTROL_GET_VOLUME: case AOCONTROL_SET_VOLUME: #ifndef WORDS_BIGENDIAN @@ -167,7 +197,7 @@ long get_vol, set_vol; float calc_vol, diff, f_multi; - if(ao->format == AFMT_AC3) return MPXP_True; + if(_format == AFMT_AC3) return MPXP_True; //allocate simple id snd_mixer_selem_id_alloca(&sid); @@ -244,8 +274,7 @@ return MPXP_Unknown; } -static void __FASTCALL__ show_caps(unsigned device) -{ +void Alsa_AO_Interface::show_caps(unsigned device) const { snd_pcm_info_t *alsa_info; snd_pcm_t *pcm; snd_pcm_hw_params_t *hw_params; @@ -264,20 +293,17 @@ sdmin=snd_pcm_info_get_subdevice(alsa_info); sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); - for(j=sdmin;j<=sdmax;j++) - { + for(j=sdmin;j<=sdmax;j++) { int i; snd_pcm_info_set_subdevice(alsa_info,j); sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); - if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) - { + if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); return; } snd_pcm_hw_params_malloc(&hw_params); - if(snd_pcm_hw_params_any(pcm, hw_params)<0) - { + if(snd_pcm_hw_params_any(pcm, hw_params)<0) { MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); return; } @@ -311,8 +337,7 @@ open & setup audio device return: 1=success 0=fail */ -static MPXP_Rc __FASTCALL__ init(ao_data_t* ao,unsigned flags) -{ +MPXP_Rc Alsa_AO_Interface::open(unsigned flags) { int err; int cards = -1; snd_pcm_info_t *alsa_info; @@ -321,21 +346,18 @@ char *alsa_port=NULL; char alsa_device[ALSA_DEVICE_SIZE]; UNUSED(flags); - priv_t*priv; - priv=new(zeromem) priv_t; - ao->priv=priv; - priv->first=1; + first=1; - priv->handler = NULL; + handler = NULL; alsa_device[0]='\0'; MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); - if (ao->subdevice) { + if (!subdevice.empty()) { const char *param; char *p; // example: -ao alsa:hw:0#mmap=1 - param=mrl_parse_line(ao->subdevice,NULL,NULL,&alsa_dev,&alsa_port); + param=mrl_parse_line(subdevice,NULL,NULL,&alsa_dev,&alsa_port); mrl_parse_params(param,alsaconf); if(alsa_port) { p=strchr(alsa_port,','); @@ -395,12 +417,12 @@ str_block_mode = "block-mode"; } - if (!priv->handler) { + if (!handler) { //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC - if ((err = snd_pcm_open(&priv->handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { if (priv_conf.noblock) { MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); - if ((err = snd_pcm_open(&priv->handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); alsa_device[0]='\0'; return MPXP_False; @@ -414,128 +436,118 @@ return MPXP_False; } } - alsa_device[0]='\0'; - if ((err = snd_pcm_nonblock(priv->handler, block_mode)) < 0) { - MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); - } - else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); + alsa_device[0]='\0'; + if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { + MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); + } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); - snd_pcm_hw_params_malloc(&priv->hwparams); - snd_pcm_sw_params_malloc(&priv->swparams); + snd_pcm_hw_params_malloc(&hwparams); + snd_pcm_sw_params_malloc(&swparams); - // setting hw-parameters - if ((err = snd_pcm_hw_params_any(priv->handler, priv->hwparams)) < 0) - { - MSG_ERR("alsa-init: unable to get initial parameters: %s\n", + // setting hw-parameters + if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { + MSG_ERR("alsa-init: unable to get initial parameters: %s\n", snd_strerror(err)); - return MPXP_False; + return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_any()\n"); - if (priv_conf.mmap) { - snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); - snd_pcm_access_mask_none(mask); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); - snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); - err = snd_pcm_hw_params_set_access_mask(priv->handler, priv->hwparams, mask); - MSG_ERR("alsa-init: mmap set\n"); - } else { - err = snd_pcm_hw_params_set_access(priv->handler, priv->hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); - MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); - } - if (err < 0) { - MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); - return MPXP_False; - } + MSG_DBG2("snd_pcm_hw_params_any()\n"); + if (priv_conf.mmap) { + snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); + snd_pcm_access_mask_none(mask); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); + err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); + MSG_ERR("alsa-init: mmap set\n"); + } else { + err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); + MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); + } + if (err < 0) { + MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); + return MPXP_False; + } } // end switch priv->handler (spdif) return MPXP_Ok; } // end init -static MPXP_Rc __FASTCALL__ config_ao(ao_data_t* ao,unsigned rate_hz,unsigned channels,unsigned format) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +MPXP_Rc Alsa_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { int err,i; size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; snd_pcm_uframes_t dummy; - MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", rate_hz, - channels, ao_format_name(format)); + MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, + c, ao_format_name(f)); - ao->samplerate = rate_hz; - ao->bps = channels * rate_hz; - ao->format = format; - ao->channels = channels; - ao->outburst = OUTBURST; + _samplerate = r; + _format = f; + _channels = c; + _outburst = OUTBURST; //ao->buffersize = MAX_OUTBURST; // was 16384 - priv->format=fmt2alsa(format); + snd_format=fmt2alsa(_format); - switch(priv->format) { + switch(snd_format) { case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_U16_LE: case SND_PCM_FORMAT_S16_BE: case SND_PCM_FORMAT_U16_BE: - ao->bps *= 2; - break; case SND_PCM_FORMAT_S32_LE: case SND_PCM_FORMAT_S32_BE: case SND_PCM_FORMAT_U32_LE: case SND_PCM_FORMAT_U32_BE: case SND_PCM_FORMAT_FLOAT_BE: case SND_PCM_FORMAT_FLOAT_LE: - ao->bps *= 4; - break; case SND_PCM_FORMAT_S24_LE: case SND_PCM_FORMAT_S24_BE: case SND_PCM_FORMAT_U24_LE: case SND_PCM_FORMAT_U24_BE: - ao->bps *= 3; break; case -1: MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", - ao_format_name(format)); + ao_format_name(_format)); return MPXP_False; default: break; } - priv->bytes_per_sample = ao->bps / ao->samplerate; + bytes_per_sample = bps() / _samplerate; - if ((err = snd_pcm_hw_params_set_format(priv->handler, priv->hwparams, - priv->format)) < 0) { + if ((err = snd_pcm_hw_params_set_format(handler, hwparams, + snd_format)) < 0) { MSG_ERR("alsa-conf: unable to set format(%s): %s\n", - snd_pcm_format_name(priv->format), + snd_pcm_format_name(snd_format), snd_strerror(err)); MSG_HINT("Please try one of: "); for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if (!(snd_pcm_hw_params_test_format(priv->handler, priv->hwparams, snd_pcm_format_t(i)))) + if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); MSG_HINT("\n"); return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",priv->format); + MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); - if ((err = snd_pcm_hw_params_set_rate_near(priv->handler, priv->hwparams, &ao->samplerate, 0)) < 0) { + if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", - ao->samplerate, + _samplerate, snd_strerror(err)); return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",ao->samplerate); + MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); - if ((err = snd_pcm_hw_params_set_channels(priv->handler, priv->hwparams, - ao->channels)) < 0) { + if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, + _channels)) < 0) { MSG_ERR("alsa-conf: unable to set %u channels: %s\n", - ao->channels, + _channels, snd_strerror(err)); return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",ao->channels); + MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); #ifdef BUFFERTIME { int dir; unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ - if ((err = snd_pcm_hw_params_set_buffer_time_near(priv->handler, priv->hwparams, &alsa_buffer_time, &dir)) < 0) { + if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { MSG_ERR("alsa-init: unable to set buffer time near: %s\n", snd_strerror(err)); return MPXP_False; @@ -543,7 +555,7 @@ MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); period_time = alsa_buffer_time/4; - if ((err = snd_pcm_hw_params_set_period_time_near(priv->handler, priv->hwparams, &period_time, &dir)) < 0) { + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { /* original: alsa_buffer_time/ao->bps */ MSG_ERR("alsa-init: unable to set period time: %s\n", snd_strerror(err)); @@ -557,14 +569,14 @@ int dir=0; unsigned period_time=100000; /* period time in us */ snd_pcm_uframes_t size; - if ((err = snd_pcm_hw_params_set_period_time_near(priv->handler, priv->hwparams, &period_time, &dir)) < 0) { + if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); return MPXP_False; } MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); //get chunksize - if ((err = snd_pcm_hw_params_get_period_size(priv->hwparams, &size, &dir)) < 0) { + if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); return MPXP_False; } @@ -573,23 +585,23 @@ } #endif // gets buffersize for control_ao - if ((err = snd_pcm_hw_params_get_buffer_size(priv->hwparams,&dummy)) < 0) { + if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); return MPXP_False; } else { - ao->buffersize = dummy * priv->bytes_per_sample; - MSG_V("alsa-conf: got buffersize=%i\n", ao->buffersize); + _buffersize = dummy * bytes_per_sample; + MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); } MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); - bits_per_sample = snd_pcm_format_physical_width(priv->format); + bits_per_sample = snd_pcm_format_physical_width(snd_format); MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); - bits_per_frame = bits_per_sample * channels; + bits_per_frame = bits_per_sample * _channels; chunk_bytes = chunk_size * bits_per_frame / 8; MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); /* finally install hardware parameters */ - if ((err = snd_pcm_hw_params(priv->handler, priv->hwparams)) < 0) { + if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", snd_strerror(err)); return MPXP_False; @@ -597,76 +609,42 @@ MSG_DBG2("snd_pcm_hw_params()\n"); // setting sw-params (only avail-min) if noblocking mode was choosed if (priv_conf.noblock) { - if ((err = snd_pcm_sw_params_current(priv->handler, priv->swparams)) < 0) { + if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); return MPXP_False; } //set min available frames to consider pcm ready (4) //increased for nonblock-mode should be set dynamically later - if ((err = snd_pcm_sw_params_set_avail_min(priv->handler, priv->swparams, 4)) < 0) { + if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); return MPXP_False; } - if ((err = snd_pcm_sw_params(priv->handler, priv->swparams)) < 0) { + if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { MSG_ERR("alsa-conf: unable to install sw-params\n"); return MPXP_False; } }//end swparams - if ((err = snd_pcm_prepare(priv->handler)) < 0) { + if ((err = snd_pcm_prepare(handler)) < 0) { MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); return MPXP_False; } // end setting hw-params MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", - ao->samplerate, ao->channels, priv->bytes_per_sample, ao->buffersize, - snd_pcm_format_description(priv->format)); + _samplerate, _channels, bytes_per_sample, _buffersize, + snd_pcm_format_description(snd_format)); return MPXP_Ok; } // end config_ao -/* close audio device */ -static void uninit(ao_data_t* ao) -{ +void Alsa_AO_Interface::pause() { int err; - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - if(!priv->handler) { - MSG_ERR("alsa-uninit: no handler defined!\n"); - delete priv; - return; - } if (!priv_conf.noblock) { - if ((err = snd_pcm_drain(priv->handler)) < 0) { - MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); - delete priv; - return; - } - } - - if ((err = snd_pcm_close(priv->handler)) < 0) { - MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); - delete priv; - return; - } else { - priv->handler = NULL; - MSG_V("alsa-uninit: pcm closed\n"); - } - snd_pcm_hw_params_free(priv->hwparams); - snd_pcm_sw_params_free(priv->swparams); - delete priv; -} - -static void audio_pause(ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - int err; - - if (!priv_conf.noblock) { //drain causes error in nonblock-mode! - if ((err = snd_pcm_drain(priv->handler)) < 0) { + if ((err = snd_pcm_drain(handler)) < 0) { MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); return; } @@ -676,28 +654,24 @@ } } -static void audio_resume(ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +void Alsa_AO_Interface::resume() { int err; - if ((err = snd_pcm_prepare(priv->handler)) < 0) { + if ((err = snd_pcm_prepare(handler)) < 0) { MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); return; } } /* stop playing and empty buffers (for seeking/pause) */ -static void reset(ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +void Alsa_AO_Interface::reset() { int err; - if ((err = snd_pcm_drop(priv->handler)) < 0) { + if ((err = snd_pcm_drop(handler)) < 0) { MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); return; } - if ((err = snd_pcm_prepare(priv->handler)) < 0) { + if ((err = snd_pcm_prepare(handler)) < 0) { MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); return; } @@ -718,28 +692,23 @@ } #endif -#ifndef timersub -#define timersub(a, b, result) \ -do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000; \ - } \ -} while (0) -#endif +static void _timersub(const struct timeval*a,const struct timeval* b,struct timeval* result) { + result->tv_sec = a->tv_sec - b->tv_sec; + result->tv_usec = a->tv_usec - b->tv_usec; + if (result->tv_usec < 0) { + --result->tv_sec; + result->tv_usec += 1000000; + } +} /* I/O error handler */ -static int __FASTCALL__ xrun(const ao_data_t* ao,const char *str_mode) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +int Alsa_AO_Interface::xrun(const char *str_mode) const { int err; snd_pcm_status_t *status; snd_pcm_status_alloca(&status); - if ((err = snd_pcm_status(priv->handler, status))<0) { + if ((err = snd_pcm_status(handler, status))<0) { MSG_ERR("status error: %s", snd_strerror(err)); return 0; } @@ -748,13 +717,13 @@ struct timeval now, diff, tstamp; gettimeofday(&now, 0); snd_pcm_status_get_trigger_tstamp(status, &tstamp); - timersub(&now, &tstamp, &diff); + _timersub(&now, &tstamp, &diff); MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", str_mode, diff.tv_sec * 1000 + diff.tv_usec / 1000.0); } - if ((err = snd_pcm_prepare(priv->handler))<0) { + if ((err = snd_pcm_prepare(handler))<0) { MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); return 0; } @@ -762,16 +731,12 @@ return 1; /* ok, data should be accepted again */ } -static unsigned __FASTCALL__ play_normal(ao_data_t* ao,const any_t* data, unsigned len); -static unsigned __FASTCALL__ play_mmap(ao_data_t* ao,const any_t* data, unsigned len); - -static unsigned __FASTCALL__ play(ao_data_t* ao,const any_t* data, unsigned len, unsigned flags) -{ +unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { unsigned result; UNUSED(flags); MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); - if (priv_conf.mmap) result = play_mmap(ao,data, len); - else result = play_normal(ao,data, len); + if (priv_conf.mmap) result = play_mmap(data, len); + else result = play_normal(data, len); return result; } @@ -782,36 +747,33 @@ thanxs for marius <ma...@ro...> for giving us the light ;) */ -static unsigned __FASTCALL__ play_normal(ao_data_t* ao,const any_t* data, unsigned len) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - //priv->bytes_per_sample is always 4 for 2 chn S16_LE - unsigned num_frames = len / priv->bytes_per_sample; - char *output_samples = (char *)data; +unsigned Alsa_AO_Interface::play_normal(const any_t* data, unsigned len) { + unsigned num_frames = len / bytes_per_sample; + const char *output_samples = (const char *)data; snd_pcm_sframes_t res = 0; //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); - if (!priv->handler) { + if (!handler) { MSG_ERR("alsa-play: device configuration error"); return 0; } while (num_frames > 0) { - res = snd_pcm_writei(priv->handler, (any_t*)output_samples, num_frames); + res = snd_pcm_writei(handler, (any_t*)output_samples, num_frames); if (res == -EAGAIN) { - snd_pcm_wait(priv->handler, 1000); + snd_pcm_wait(handler, 1000); } else if (res == -EPIPE) { /* underrun */ - if (xrun(ao,"play") <= 0) { + if (xrun("play") <= 0) { MSG_ERR("alsa-play: xrun reset error"); return 0; } } else if (res == -ESTRPIPE) { /* suspend */ MSG_WARN("alsa-play: pcm in suspend mode. trying to resume\n"); - while ((res = snd_pcm_resume(priv->handler)) == -EAGAIN) sleep(1); + while ((res = snd_pcm_resume(handler)) == -EAGAIN) ::sleep(1); } else if (res < 0) { MSG_ERR("alsa-play: unknown status, trying to reset soundcard\n"); - if ((res = snd_pcm_prepare(priv->handler)) < 0) { + if ((res = snd_pcm_prepare(handler)) < 0) { MSG_ERR("alsa-play: snd prepare error"); return 0; break; @@ -820,7 +782,7 @@ if (res > 0) { /* output_samples += ao->channels * res; */ - output_samples += res * priv->bytes_per_sample; + output_samples += res * bytes_per_sample; num_frames -= res; } } //end while @@ -836,51 +798,49 @@ * 'An overview of the ALSA API' http://people.debian.org/~joshua/x66.html * and some help by Paul Davis <pb...@op...> */ -static unsigned __FASTCALL__ play_mmap(ao_data_t* ao,const any_t* data, unsigned len) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +unsigned Alsa_AO_Interface::play_mmap(const any_t* data, unsigned len) { snd_pcm_sframes_t commitres, frames_available; snd_pcm_uframes_t frames_transmit, size, offset; const snd_pcm_channel_area_t *area; - any_t*outbuffer; + any_t* outbuffer; unsigned result; #ifdef USE_POLL //seems not really be needed struct pollfd *ufds; int count; - count = snd_pcm_poll_descriptors_count (priv->handler); + count = snd_pcm_poll_descriptors_count (handler); ufds = mp_malloc(sizeof(struct pollfd) * count); - snd_pcm_poll_descriptors(priv->handler, ufds, count); + snd_pcm_poll_descriptors(handler, ufds, count); //first wait_for_poll - if (err = (wait_for_poll(priv->handler, ufds, count) < 0)) { - if (snd_pcm_state(priv->handler) == SND_PCM_STATE_XRUN || - snd_pcm_state(priv->handler) == SND_PCM_STATE_SUSPENDED) { + if (err = (wait_for_poll(handler, ufds, count) < 0)) { + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { xrun("play"); } } #endif - outbuffer = alloca(ao->buffersize); + outbuffer = alloca(_buffersize); //don't trust get_space() ;) - frames_available = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; - if (frames_available < 0) xrun(ao,"play"); + frames_available = snd_pcm_avail_update(handler) * bytes_per_sample; + if (frames_available < 0) xrun("play"); if (frames_available < 4) { - if (priv->first) { - priv->first = 0; - snd_pcm_start(priv->handler); + if (first) { + first = 0; + snd_pcm_start(handler); } else { //FIXME should break and return 0? - snd_pcm_wait(priv->handler, -1); - priv->first = 1; + snd_pcm_wait(handler, -1); + first = 1; } } /* len is simply the available bufferspace got by get_space() * but real avail_buffer in frames is ab/priv->bytes_per_sample */ - size = len / priv->bytes_per_sample; + size = len / bytes_per_sample; //if (verbose) //printf("len: %i size %i, f_avail %i, bps %i ...\n", len, size, frames_available, priv->bytes_per_sample); @@ -890,43 +850,26 @@ /* prepare areas and set sw-pointers * frames_transmit returns the real available buffer-size * sometimes != frames_available cause of ringbuffer 'emulation' */ - snd_pcm_mmap_begin(priv->handler, &area, &offset, &frames_transmit); + snd_pcm_mmap_begin(handler, &area, &offset, &frames_transmit); /* this is specific to interleaved streams (or non-interleaved * streams with only one channel) */ outbuffer = ((char *) area->addr + (area->first + area->step * offset) / 8); //8 //write data - memcpy(outbuffer, data, (frames_transmit * priv->bytes_per_sample)); - commitres = snd_pcm_mmap_commit(priv->handler, offset, frames_transmit); + memcpy(outbuffer, data, (frames_transmit * bytes_per_sample)); + commitres = snd_pcm_mmap_commit(handler, offset, frames_transmit); if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames_transmit) { - if (snd_pcm_state(priv->handler) == SND_PCM_STATE_XRUN || - snd_pcm_state(priv->handler) == SND_PCM_STATE_SUSPENDED) { - xrun(ao,"play"); + if (snd_pcm_state(handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(handler) == SND_PCM_STATE_SUSPENDED) { + xrun("play"); } } - //if (verbose) - //printf("mmap ft: %i, cres: %i\n", frames_transmit, commitres); - - /* err = snd_pcm_area_copy(&area, offset, &data, offset, len, priv->format); */ - /* if (err < 0) { */ - /* printf("area-copy-error\n"); */ - /* return 0; */ - /* } */ - //calculate written frames! - result = commitres * priv->bytes_per_sample; + result = commitres * bytes_per_sample; - - /* if (verbose) { */ - /* if (len == result) */ - /* printf("result: %i, frames written: %i ...\n", result, frames_transmit); */ - /* else */ - /* printf("result: %i, frames written: %i, result != len ...\n", result, frames_transmit); */ - /* } */ - //mplayer doesn't like -result if ((int)result < 0) result = 0; @@ -946,9 +889,7 @@ GET_SPACE_UNDEFINED }space_status; /* how many byes are mp_free in the buffer */ -static unsigned get_space(const ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +unsigned Alsa_AO_Interface::get_space() { snd_pcm_status_t *status; int ret,st; space_status e_status=GET_SPACE_UNDEFINED; @@ -960,7 +901,7 @@ return 0; } - if ((ret = snd_pcm_status(priv->handler, status)) < 0) { + if ((ret = snd_pcm_status(handler, status)) < 0) { MSG_ERR("alsa-space: cannot get pcm status: %s\n", snd_strerror(ret)); return 0; } @@ -971,14 +912,14 @@ case SND_PCM_STATE_PREPARED: if (e_status!=GET_SPACE_OPEN) { e_status = GET_SPACE_PREPARED; - priv->first = 1; - ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; + first = 1; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; if (ret == 0) //ugly workaround for hang in mmap-mode ret = 10; break; } case SND_PCM_STATE_RUNNING: - ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; //avail_frames = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; if (e_status!=GET_SPACE_OPEN && e_status!=GET_SPACE_PREPARED) e_status = GET_SPACE_RUNNING; @@ -989,16 +930,16 @@ ret = 0; break; case SND_PCM_STATE_XRUN: - xrun(ao,"space"); + xrun("space"); e_status = GET_SPACE_XRUN; - priv->first = 1; + first = 1; ret = 0; break; default: e_status = GET_SPACE_UNDEFINED; - ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; if (ret <= 0) { - xrun(ao,"space"); + xrun("space"); } } @@ -1015,10 +956,9 @@ } /* delay in seconds between first and last sample in buffer */ -static float get_delay(const ao_data_t* ao) +float Alsa_AO_Interface::get_delay() { - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - if (priv->handler) { + if (handler) { snd_pcm_status_t *status; int r; float ret; @@ -1028,7 +968,7 @@ return 0; } - if ((ret = snd_pcm_status(priv->handler, status)) < 0) { + if ((ret = snd_pcm_status(handler, status)) < 0) { MSG_ERR("alsa-delay: cannot get pcm status: %s\n", snd_strerror(ret)); return 0; } @@ -1038,7 +978,7 @@ case SND_PCM_STATE_PREPARED: case SND_PCM_STATE_RUNNING: r=snd_pcm_status_get_delay(status); - ret = (float)r/(float)ao->samplerate; + ret = (float)r/(float)_samplerate; break; default: ret = 0; @@ -1049,3 +989,36 @@ return ret; } else return 0; } + +unsigned Alsa_AO_Interface::samplerate() const { return _samplerate; } +unsigned Alsa_AO_Interface::channels() const { return _channels; } +unsigned Alsa_AO_Interface::format() const { return _format; } +unsigned Alsa_AO_Interface::buffersize() const { return _buffersize; } +unsigned Alsa_AO_Interface::outburst() const { return _outburst; } +MPXP_Rc Alsa_AO_Interface::test_channels(unsigned c) const { + return snd_pcm_hw_params_test_channels(handler, hwparams,c)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_rate(unsigned r) const { + return snd_pcm_hw_params_test_rate(handler, hwparams,r,0)==0? + MPXP_True:MPXP_False; +} +MPXP_Rc Alsa_AO_Interface::test_format(unsigned f) const { + snd_pcm_format_t rval; + rval=fmt2alsa(f); + return snd_pcm_hw_params_test_format(handler, hwparams,snd_pcm_format_t(rval))==0? + MPXP_True:MPXP_False; +} + +static AO_Interface* query_interface(const std::string& sd) { return new Alsa_AO_Interface(sd); } + +extern const ao_info_t audio_out_alsa = +{ + "ALSA-1.x audio output", + "alsa", + "Alex Beregszaszi <al...@na...>, Joy Winter <jo...@pi...>", + "under developement", + query_interface +}; +} //namespace mpxp + Modified: mplayerxp/libao2/ao_arts.cpp =================================================================== --- mplayerxp/libao2/ao_arts.cpp 2012-12-13 14:55:16 UTC (rev 559) +++ mplayerxp/libao2/ao_arts.cpp 2012-12-14 14:52:33 UTC (rev 560) @@ -32,33 +32,57 @@ #include "afmt.h" #include "ao_msg.h" +namespace mpxp { /* Feel mp_free to experiment with the following values: */ #define ARTS_PACKETS 10 /* Number of audio packets */ #define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ +class Arts_AO_Interface : public AO_Interface { + public: + Arts_AO_Interface(const std::string& subdevice); + virtual ~Arts_AO_Interface(); -static const ao_info_t info = -{ - "aRts audio output", - "arts", - "Michele Balistreri <br...@gm...>", - "" + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + + arts_stream_t stream; }; -LIBAO_EXTERN(arts) +Arts_AO_Interface::Arts_AO_Interface(const std::string& _subdevice) + :AO_Interface(_subdevice) {} +Arts_AO_Interface::~Arts_AO_Interface() { + arts_close_stream(stream); + arts_free(); +} -static MPXP_Rc control_ao(const ao_data_t* ao,int cmd, long arg) -{ - UNUSED(ao); +MPXP_Rc Arts_AO_Interface::ctrl(int cmd, long arg) const { UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; } -static MPXP_Rc init(ao_data_t* ao,unsigned flags) +MPXP_Rc Arts_AO_Interface::open(unsigned flags) { int err; - UNUSED(ao); UNUSED(flags); if( (err=arts_init()) ) { @@ -70,9 +94,7 @@ return MPXP_Ok; } -static MPXP_Rc __FASTCALL__ config_ao(ao_data_t* ao,unsigned rate,unsigned channels,unsigned format) -{ - arts_stream_t stream; +MPXP_Rc Arts_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { unsigned frag_spec,samplesize; /* * arts supports 8bit unsigned and 16bit signed sample formats @@ -82,10 +104,13 @@ * Unsupported formats are translated to one of these two formats * using mplayer's audio filters. */ - switch (format) { + _samplerate=r; + _channels=c; + _format=f; + switch (f) { case AFMT_U8: case AFMT_S8: - format = AFMT_U8; + _format = AFMT_U8; samplesize=1; break; #if 0 @@ -93,31 +118,25 @@ case AFMT_S24_BE: case AFMT_U24_LE: case AFMT_U24_BE: - format = AFMT_S24_LE; + _format = AFMT_S24_LE; samplesize=3; break; case AFMT_S32_LE: case AFMT_S32_BE: case AFMT_U32_LE: case AFMT_U32_BE: - format = AFMT_S32_LE; + _format = AFMT_S32_LE; samplesize=4; break; #endif default: samplesize=2; - format = AFMT_S16_LE; /* artsd always expects little endian?*/ + _format = AFMT_S16_LE; /* artsd always expects little endian?*/ break; } - ao->format = format; - ao->channels = channels; - ao->samplerate = rate; - ao->bps = rate*channels*samplesize; + stream=arts_play_stream(_samplerate, samplesize*8, _channels, "MPlayerXP"); - stream=arts_play_stream(rate, samplesize*8, channels, "MPlayerXP"); - ao->priv=stream; - if(stream == NULL) { MSG_ERR("[aRts] Can't open stream\n"); arts_free(); @@ -129,47 +148,61 @@ arts_stream_set(stream, ARTS_P_BLOCKING, 1); frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); - ao->buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); + _buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); MSG_INFO("[aRts] Stream opened\n"); - MSG_V("[aRts] buffersize=%u\n",ao->buffersize); + MSG_V("[aRts] buffersize=%u\n",_buffersize); MSG_V("[aRts] buffersize=%u\n", arts_stream_get(stream, ARTS_P_PACKET_SIZE)); return MPXP_Ok; } -static void uninit(ao_data_t* ao) +unsigned Arts_AO_Interface::play(const any_t* data,unsigned len,unsigned flags) { - arts_stream_t stream=ao->priv; - arts_close_stream(stream); - arts_free(); -} - -static unsigned play(ao_data_t* ao,const any_t* data,unsigned len,unsigned flags) -{ - arts_stream_t stream=ao->priv; UNUSED(flags); return arts_write(stream, data, len); } -static void audio_pause(ao_data_t* ao) -{ - UNUSED(ao); +void Arts_AO_Interface::pause() {} +void Arts_AO_Interface::resume() {} +void Arts_AO_Interface::reset() {} +unsigned Arts_AO_Interface::get_space() { + return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); } -static void audio_resume(ao_data_t* ao) { UNUSED(ao); } -static void reset(ao_data_t* ao) { UNUSED(ao); } +float Arts_AO_Interface::get_delay() { + return ((float) (_buffersize - arts_stream_get(stream, + ARTS_P_BUFFER_SPACE))) / ((float) bps()); +} -static unsigned get_space(const ao_data_t* ao) -{ - arts_stream_t stream=ao->priv; - return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); +unsigned Arts_AO_Interface::samplerate() const { return _samplerate; } +unsigned Arts_AO_Interface::channels() const { return _channels; } +unsigned Arts_AO_Interface::format() const { return _format; } +unsigned Arts_AO_Interface::buffersize() const { return _buffersize; } +unsigned Arts_AO_Interface::outburst() const { return _outburst; } +MPXP_Rc Arts_AO_Interface::test_channels(unsigned c) const { UNUSED(c); return MPXP_Ok; } +MPXP_Rc Arts_AO_Interface::test_rate(unsigned r) const { UNUSED(r); return MPXP_Ok; } +MPXP_Rc Arts_AO_Interface::test_format(unsigned f) const { + switch (f) { + case AFMT_U8: + case AFMT_S8: + case AFMT_U16_LE: + case AFMT_S16_LE: + case AFMT_U16_BE: + case AFMT_S16_BE: return MPXP_Ok; + default: break; + } + return MPXP_False; } -static float get_delay(const ao_data_t* ao) +static AO_Interface* query_interface(const std::string& sd) { return new Arts_AO_Interface(sd); } + +extern const ao_info_t audio_out_arts = { - arts_stream_t stream=ao->priv; - return ((float) (ao->buffersize - arts_stream_get(stream, - ARTS_P_BUFFER_SPACE))) / ((float) ao->bps); -} - + "aRts audio output", + "arts", + "Michele Balistreri <br...@gm...>", + "", + query_interface +}; +} // namespace mpxp Modified: mplayerxp/libao2/ao_esd.cpp =================================================================== --- mplayerxp/libao2/ao_esd.cpp 2012-12-13 14:55:16 UTC (rev 559) +++ mplayerxp/libao2/ao_esd.cpp 2012-12-14 14:52:33 UTC (rev 560) @@ -56,6 +56,8 @@ #include "afmt.h" #include "ao_msg.h" + +namespace mpxp { #define ESD_RESAMPLES 0 #define ESD_DEBUG 0 @@ -65,37 +67,68 @@ #define dprintf(...) /**/ #endif - #define ESD_CLIENT_NAME "MPlayerXP" #define ESD_MAX_DELAY (1.0f) /* max amount of data buffered in esd (#sec) */ -static const ao_info_t info = -{ - "EsounD audio output", - "esd", - "Juergen Keil <jk...@to...>", - "" +class Esd_AO_Interface : public AO_Interface { + public: + Esd_AO_Interface(const std::string& subdevice); + virtual ~Esd_AO_Interface(); + + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + + int fd; + int play_fd; + esd_server_info_t*svinfo; + int latency; + int bytes_per_sample; + unsigned long samples_written; + struct timeval play_start; + float audio_delay; }; -LIBAO_EXTERN(esd) +Esd_AO_Interface::Esd_AO_Interface(const std::string& _subdevice) + :AO_Interface(_subdevice) {} +Esd_AO_Interface::~Esd_AO_Interface() { + if (play_fd >= 0) { + esd_close(play_fd); + play_fd = -1; + } -typedef struct priv_s { - int fd; - int play_fd; - esd_server_info_t* svinfo; - int latency; - int bytes_per_sample; - unsigned long samples_written; - struct timeval play_start; - float audio_delay; -}priv_t; + if (svinfo) { + esd_free_server_info(svinfo); + svinfo = NULL; + } + if (fd >= 0) { + esd_close(fd); + fd = -1; + } +} /* * to set/get/query special features/parameters */ -static MPXP_Rc control_ao(const ao_data_t* ao,int cmd, long arg) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +MPXP_Rc Esd_AO_Interface::ctrl(int cmd, long arg) const { esd_player_info_t *esd_pi; esd_info_t *esd_i; time_t now; @@ -111,7 +144,7 @@ } dprintf("esd: get vol\n"); - if ((esd_i = esd_get_all_info(priv->fd)) == NULL) + if ((esd_i = esd_get_all_info(fd)) == NULL) return MPXP_Error; for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) @@ -132,7 +165,7 @@ case AOCONTROL_SET_VOLUME: dprintf("esd: set vol\n"); - if ((esd_i = esd_get_all_info(priv->fd)) == NULL) + if ((esd_i = esd_get_all_info(fd)) == NULL) return MPXP_Error; for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) @@ -141,7 +174,7 @@ if (esd_pi != NULL) { ao_control_vol_t *vol = (ao_control_vol_t *)arg; - esd_set_stream_pan(priv->fd, esd_pi->source_id, + esd_set_stream_pan(fd, esd_pi->source_id, vol->left * ESD_VOLUME_BASE / 100, vol->right * ESD_VOLUME_BASE / 100); @@ -161,17 +194,12 @@ * open & setup audio device * return: 1=success 0=fail */ -static MPXP_Rc init(ao_data_t* ao,unsigned flags) -{ - priv_t*priv; - ao->priv=new(zeromem) priv_t; - ao->priv=priv; - priv->fd=priv->play_fd=-1; - char *server = ao->subdevice; /* NULL for localhost */ +MPXP_Rc Esd_AO_Interface::open(unsigned flags) { + fd=play_fd=-1; UNUSED(flags); - if (priv->fd < 0) { - priv->fd = esd_open_sound(server); - if (priv->fd < 0) { + if (fd < 0) { + fd = esd_open_sound(subdevice.c_str()); + if (fd < 0) { MSG_ERR("ESD: Can't open sound: %s\n", strerror(errno)); return MPXP_False; } @@ -179,67 +207,60 @@ return MPXP_Ok; } -static MPXP_Rc config_ao(ao_data_t* ao,unsigned rate_hz,unsigned channels,unsigned format) +MPXP_Rc Esd_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - char *server = ao->subdevice; /* NULL for localhost */ + std::string server = subdevice; /* NULL for localhost */ esd_format_t esd_fmt; - int bytes_per_sample; + int _bytes_per_sample; int fl; float lag_seconds, lag_net, lag_serv; struct timeval proto_start, proto_end; - /* get server info, and measure network latency */ - gettimeofday(&proto_start, NULL); - priv->svinfo = esd_get_server_info(priv->fd); - if(server) { - gettimeofday(&proto_end, NULL); - lag_net = (proto_end.tv_sec - proto_start.tv_sec) + - (proto_end.tv_usec - proto_start.tv_usec) / 1000000.0; - lag_net /= 2.0; /* round trip -> one way */ - } else - lag_net = 0.0; /* no network lag */ - /* - if (priv->svinfo) { - mp_msg(MSGT_AO, MSGL_INFO, "AO: [esd] server info:\n"); - esd_print_server_info(priv->svinfo); - } - */ + /* get server info, and measure network latency */ + gettimeofday(&proto_start, NULL); + svinfo = esd_get_server_info(fd); + if(!server.empty()) { + gettimeofday(&proto_end, NULL); + lag_net = (proto_end.tv_sec - proto_start.tv_sec) + + (proto_end.tv_usec - proto_start.tv_usec) / 1000000.0; + lag_net /= 2.0; /* round trip -> one way */ + } else + lag_net = 0.0; /* no network lag */ esd_fmt = ESD_STREAM | ESD_PLAY; #if ESD_RESAMPLES /* let the esd daemon convert sample rate */ #else /* let mplayer's audio filter convert the sample rate */ - if (priv->svinfo != NULL) - rate_hz = priv->svinfo->rate; + if (svinfo != NULL) + r = svinfo->rate; #endif - ao->samplerate = rate_hz; + _samplerate = r; - /* EsounD can play mono or stereo */ - switch (channels) { - case 1: - esd_fmt |= ESD_MONO; - ao->channels = bytes_per_sample = 1; + /* EsounDscan play mono or stereo */ + switch (c) { + case 1: + esd_fmt |= ESD_MONO; + _channels = _bytes_per_sample = 1; + break; + default: + esd_fmt |= ESD_STEREO; + _channels = _bytes_per_sample = 2; break; - default: - esd_fmt |= ESD_STEREO; - ao->channels = bytes_per_sample = 2; - break; } /* EsounD can play 8bit unsigned and 16bit signed native */ - switch (format) { - case AFMT_S8: - case AFMT_U8: - esd_fmt |= ESD_BITS8; - ao->format = AFMT_U8; - break; - default: - esd_fmt |= ESD_BITS16; - ao->format = AFMT_S16_NE; - bytes_per_sample *= 2; - break; + switch (f) { + case AFMT_S8: + case AFMT_U8: + esd_fmt |= ESD_BITS8; + _format = AFMT_U8; + break; + default: + esd_fmt |= ESD_BITS16; + _format = AFMT_S16_NE; + _bytes_per_sample *= 2; + break; } /* modify priv->audio_delay depending on priv->latency @@ -247,86 +268,57 @@ * adjust according to rate_hz & bytes_per_sample */ #ifdef CONFIG_ESD_LATENCY - priv->latency = esd_get_latency(priv->fd); + latency = esd_get_latency(fd); #else - priv->latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * - (ESD_BUF_SIZE + 64 * (4.0f / bytes_per_sample)) - ) / rate_hz; - priv->latency += ESD_BUF_SIZE * 2; + latency = ((_channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * + (ESD_BUF_SIZE + 64 * (4.0f / _bytes_per_sample)) + ) / _samplerate; + latency += ESD_BUF_SIZE * 2; #endif - if(priv->latency > 0) { - lag_serv = (priv->latency * 4.0f) / (bytes_per_sample * rate_hz); + if(latency > 0) { + lag_serv = (latency * 4.0f) / (_bytes_per_sample * _samplerate); lag_seconds = lag_net + lag_serv; - priv->audio_delay += lag_seconds; + audio_delay += lag_seconds; MSG_INFO("ESD: LatencyInfo: %f %f %f\n",lag_serv, lag_net, lag_seconds); } - priv->play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, - server, ESD_CLIENT_NAME); - if (priv->play_fd < 0) { + play_fd = esd_play_stream_fallback(esd_fmt, _samplerate, + server.c_str(), ESD_CLIENT_NAME); + if (play_fd < 0) { MSG_ERR("ESD: Can't open play stream: %s\n", strerror(errno)); return MPXP_False; } /* enable non-blocking i/o on the socket connection to the esd server */ - if ((fl = fcntl(priv->play_fd, F_GETFL)) >= 0) - fcntl(priv->play_fd, F_SETFL, O_NDELAY|fl); + if ((fl = ::fcntl(play_fd, F_GETFL)) >= 0) ::fcntl(play_fd, F_SETFL, O_NDELAY|fl); #if ESD_DEBUG { int sbuf, rbuf, len; len = sizeof(sbuf); - getsockopt(priv->play_fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &len); + getsockopt(play_fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &len); len = sizeof(rbuf); - getsockopt(priv->play_fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &len); + getsockopt(play_fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &len); dprintf("esd: send/receive socket buffer space %d/%d bytes\n", sbuf, rbuf); } #endif - ao->bps = bytes_per_sample * rate_hz; - ao->outburst = ao->bps > 100000 ? 4*ESD_BUF_SIZE : 2*ESD_BUF_SIZE; + _outburst = bps() > 100000 ? 4*ESD_BUF_SIZE : 2*ESD_BUF_SIZE; - priv->play_start.tv_sec = 0; - priv->samples_written = 0; - priv->bytes_per_sample = bytes_per_sample; + play_start.tv_sec = 0; + samples_written = 0; + bytes_per_sample = _bytes_per_sample; return MPXP_Ok; } - /* - * close audio device - */ -static void uninit(ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); - if (priv->play_fd >= 0) { - esd_close(priv->play_fd); - priv->play_fd = -1; - } - - if (priv->svinfo) { - esd_free_server_info(priv->svinfo); - priv->svinfo = NULL; - } - - if (priv->fd >= 0) { - esd_close(priv->fd); - priv->fd = -1; - } - delete priv; -} - - -/* * plays 'len' bytes of 'data' * it should round it down to outburst*n * return: number of bytes played */ -static unsigned play(ao_data_t* ao,const any_t* data, unsigned len, unsigned flags) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +unsigned Esd_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { unsigned offs; unsigned nwritten; int nsamples; @@ -337,14 +329,14 @@ #define SINGLE_WRITE 0 #if SINGLE_WRITE - nwritten = write(priv->play_fd, data, len); + nwritten = ::write(play_fd, data, len); #else for (offs = 0, nwritten=0; offs + ESD_BUF_SIZE <= len; offs += ESD_BUF_SIZE) { /* * note: we're writing to a non-blocking socket here. * A partial write means, that the socket buffer is full. */ - n = write(priv->play_fd, (char*)data + offs, ESD_BUF_SIZE); + n = ::write(play_fd, (char*)data + offs, ESD_BUF_SIZE); if ( n < 0 ) { if ( errno != EAGAIN ) { dprintf("esd play: write failed: %s\n", strerror(errno)); @@ -359,39 +351,26 @@ #endif if (nwritten > 0) { - if (!priv->play_start.tv_sec) - gettimeofday(&priv->play_start, NULL); - nsamples = nwritten / priv->bytes_per_sample; - priv->samples_written += nsamples; + if (!play_start.tv_sec) + ::gettimeofday(&play_start, NULL); + nsamples = nwritten / bytes_per_sample; + samples_written += nsamples; - dprintf("esd play: %d %lu\n", nsamples, priv->samples_written); + dprintf("esd play: %d %lu\n", nsamples, samples_written); } else { - dprintf("esd play: blocked / %lu\n", priv->samples_written); + dprintf("esd play: blocked / %lu\n", samples_written); } - return nwritten; } - /* * stop playing, keep buffers (for pause) */ -static void audio_pause(ao_data_t* ao) -{ - /* - * not possible with priv-> the esd daemom will continue playing - * buffered data (not more than ESD_MAX_DELAY seconds of samples) - */ - UNUSED(ao); -} - - +void Esd_AO_Interface::pause() {} /* * resume playing, after audio_pause() */ -static void audio_resume(ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +void Esd_AO_Interface::resume() { /* * not possible with priv-> * @@ -399,33 +378,25 @@ * buffered data; we restart our time based delay computation * for an audio resume. */ - priv->play_start.tv_sec = 0; - priv->samples_written = 0; + play_start.tv_sec = 0; + samples_written = 0; } - /* * stop playing and empty buffers (for seeking/pause) */ -static void reset(ao_data_t* ao) -{ +void Esd_AO_Interface::reset() { #ifdef __svr4__ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); /* throw away data buffered in the esd connection */ - if (ioctl(priv->play_fd, I_FLUSH, FLUSHW)) - perror("I_FLUSH"); -#else - UNUSED(ao); + if (::ioctl(play_fd, I_FLUSH, FLUSHW)) perror("I_FLUSH"); #endif } - /* * return: how many bytes can be played without blocking */ -static unsigned get_space(const ao_data_t* ao) +unsigned Esd_AO_Interface::get_space() { - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); struct timeval tmout; fd_set wfds; float current_delay; @@ -438,24 +409,24 @@ * device, and the consequence is a huge slow down for things like * esd_get_all_info(). */ - if ((current_delay = get_delay(ao)) >= ESD_MAX_DELAY) { + if ((current_delay = get_delay()) >= ESD_MAX_DELAY) { dprintf("esd get_space: too much data buffered\n"); return 0; } FD_ZERO(&wfds); - FD_SET(priv->play_fd, &wfds); + FD_SET(play_fd, &wfds); tmout.tv_sec = 0; tmout.tv_usec = 0; - if (select(priv->play_fd + 1, NULL, &wfds, NULL, &tmout) != 1) + if (::select(play_fd + 1, NULL, &wfds, NULL, &tmout) != 1) return 0; - if (!FD_ISSET(priv->play_fd, &wfds)) + if (!FD_ISSET(play_fd, &wfds)) return 0; /* try to fill 50% of the remaining "mp_free" buffer space */ - space = (ESD_MAX_DELAY - current_delay) * ao->bps * 0.5f; + space = (ESD_MAX_DELAY - current_delay) * bps() * 0.5f; /* round up to next multiple of ESD_BUF_SIZE */ space = (space + ESD_BUF_SIZE-1) / ESD_BUF_SIZE * ESD_BUF_SIZE; @@ -464,34 +435,50 @@ return space; } - /* * return: delay in seconds between first and last sample in buffer */ -static float get_delay(const ao_data_t* ao) -{ - priv_t*priv=reinterpret_cast<priv_t*>(ao->priv); +float Esd_AO_Interface::get_delay() { struct timeval now; double buffered_samples_time; double play_time; - if (!priv->play_start.tv_sec) - return 0; + if (!play_start.tv_sec) return 0; - buffered_samples_time = (float)priv->samples_written / ao->samplerate; - gettimeofday(&now, NULL); - play_time = now.tv_sec - priv->play_start.tv_sec; - play_time += (now.tv_usec - priv->play_start.tv_usec) / 1000000.; + buffered_samples_time = (float)samples_written / _samplerate; + ::gettimeofday(&now, NULL); + play_time = now.tv_sec - play_start.tv_sec; + play_time += (now.tv_usec - play_start.tv_usec) / 1000000.; /* dprintf("esd delay: %f %f\n", play_time, buffered_samples_time); */ if (play_time > buffered_samples_time) { dprintf("esd: underflow\n"); - priv->play_start.tv_sec = 0; - priv->samples_written = 0; + play_start.tv_sec = 0; + samples_written = 0; return 0; } dprintf("esd: get_delay %f\n", buffered_samples_time - play_time); return buffered_samples_time - play_time; } + +unsigned Esd_AO_Interface::samplerate() const { return _samplerate; } +unsigned Esd_AO_Interface::channels() const { return _channels; } +unsigned Esd_AO_Interface::format() const { return _format; } +unsigned Esd_AO_Interface::buffersize() const { return _buffersize; } +unsigned Esd_AO_Interface::outburst() const { return _outburst; } +MPXP_Rc Esd_AO_Interface::test_channels(unsigned c) const { UNUSED(c); return MPXP_Ok; } +MPXP_Rc Esd_AO_Interface::test_rate(unsigned r) const { UNUSED(r); return MPXP_Ok; } +MPXP_Rc Esd_AO_Interface::test_format(unsigned f) const { UNUSED(f); return MPXP_Ok; } + +static AO_Interface* query_interface(const std::string& sd) { return new Esd_AO_Interface(sd); } + +extern const ao_info_t audio_out_esd = { + "EsounD audio output", + "esd", + "Juergen Keil <jk...@to...>", + "", + query_interface +}; +} // namespace mpxp Modified: mplayerxp/libao2/ao_jack.cpp =================================================================== --- mplayerxp/libao2/ao_jack.cpp 2012-12-13 14:55:16 UTC (rev 559) +++ mplayerxp/libao2/ao_jack.cpp 2012-12-14 14:52:33 UTC (rev 560) @@ -39,42 +39,71 @@ #include "mp_conf_lavc.h" #include <jack/jack.h> -static const ao_info_t info = -{ - "JACK audio output", - "jack", - "Reimar Döffinger <Rei...@st...>", - "based on ao_sdl.c" -}; +namespace mpxp { -LIBAO_EXTERN(jack) - //! maximum number of channels supported, avoids lots of mallocs #define MAX_CHANS 6 -typedef struct priv_s { - jack_port_t * ports[MAX_CHANS]; - unsigned num_ports; ///< Number of used ports == number of channels - jack_client_t * client; - float latency; - int estimate; - volatile int paused; ///< set if paused - volatile int underrun; ///< signals if an priv->underrun occured +class Jack_AO_Interface : public AO_Interface { + public: + Jack_AO_Interface(const std::string& subdevice); + virtual ~Jack_AO_Interface(); - volatile float callback_interval; - volatile float callback_time; + virtual MPXP_Rc open(unsigned flags); + virtual MPXP_Rc configure(unsigned rate,unsigned channels,unsigned format); + virtual unsigned samplerate() const; + virtual unsigned channels() const; + virtual unsigned format() const; + virtual unsigned buffersize() const; + virtual unsigned outburst() const; + virtual MPXP_Rc test_rate(unsigned r) const; + virtual MPXP_Rc test_channels(unsigned c) const; + virtual MPXP_Rc test_format(unsigned f) const; + virtual void reset(); + virtual unsigned get_space(); + virtual float get_delay(); + virtual unsigned play(const any_t* data,unsigned len,unsigned flags); + virtual void pause(); + virtual void resume(); + virtual MPXP_Rc ctrl(int cmd,long arg) const; + static void deinterleave_data(any_t*_info, any_t*src, int len); + static int outputaudio(jack_nframes_t nframes, any_t* _ao); + private: + unsigned _channels,_samplerate,_format; + unsigned _buffersize,_outburst; + unsigned bps() const { return _channels*_samplerate*afmt2bps(_format); } + unsigned read_buffer(float **bufs, unsigned cnt, unsigned num_bufs); + int write_buffer(const unsigned char* data, int len); + static void silence(float **bufs, int cnt, int num_bufs); - AVFifoBuffer * buffer; //! buffer for audio data -}priv_t; + jack_port_t * ports[MAX_CHANS]; + unsigned num_ports; ///< Number of used ports == number of channels + jack_client_t * client; + float latency; + int estimate; + volatile int paused; ///< set if paused + volatile int underrun; ///< signals if an priv->underrun occur... [truncated message content] |
From: <nic...@us...> - 2012-12-13 14:55:28
|
Revision: 559 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=559&view=rev Author: nickols_k Date: 2012-12-13 14:55:16 +0000 (Thu, 13 Dec 2012) Log Message: ----------- c++ way: decrease number of typedef Modified Paths: -------------- mplayerxp/libao2/audio_out.h mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/vd.h mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_property.h mplayerxp/libmpconf/m_struct.h mplayerxp/libmpconf/subopt-helper.h mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/matroska.h mplayerxp/libmpdemux/mpeg_hdr.h mplayerxp/libmpdemux/mpxpav64.h mplayerxp/libmpdemux/muxer.h mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/subreader.h mplayerxp/libmpsub/vobsub.cpp mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libplaytree/playtreeparser.h mplayerxp/libvo2/dri_vo.h mplayerxp/libvo2/font_load.h mplayerxp/libvo2/img_format.h mplayerxp/libvo2/jpeg_enc.h mplayerxp/libvo2/sub.h mplayerxp/libvo2/video_out.h mplayerxp/libvo2/x11_system.h mplayerxp/mp_msg.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/cpudetect.h mplayerxp/osdep/vbelib.h mplayerxp/xmpcore/mp_aframe.h mplayerxp/xmpcore/mp_image.h Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libao2/audio_out.h 2012-12-13 14:55:16 UTC (rev 559) @@ -4,16 +4,16 @@ #include "xmpcore/xmp_enums.h" /** Text description of AO-driver */ -typedef struct ao_info_s +struct ao_info_t { const char *name; /**< driver name ("alsa driver") */ const char *short_name; /**< short name (for config strings) ("alsa") */ const char *author; /**< author ("Aaron Holtzman <aho...@es...>") */ const char *comment;/**< any additional comments */ -} ao_info_t; +}; /** Global data used by mplayerxp and plugins */ -typedef struct ao_data_s +struct ao_data_t { char* subdevice; char antiviral_hole[RND_CHAR2]; @@ -26,10 +26,10 @@ float pts; /**< PTS of audio buffer */ any_t* opaque; /**< for internal use */ any_t* priv; -} ao_data_t; +}; /** AO-driver interface */ -typedef struct ao_functions_s +struct ao_functions_t { const ao_info_t *info; /**< text-info about this driver */ @@ -80,7 +80,7 @@ /** Resumes playing, after audio_pause() */ void (* __FASTCALL__ resume)(ao_data_t*); -} ao_functions_t; +}; enum { AOCONTROL_SET_DEVICE =1, /**< Sets new audio device (example: /dev/dsp2) */ @@ -91,10 +91,11 @@ AOCONTROL_GET_VOLUME =6, /**< Query volume level */ AOCONTROL_SET_VOLUME =7 /**< Sets new volume level */ }; -typedef struct ao_control_vol_s { + +struct ao_control_vol_t { float left; float right; -} ao_control_vol_t; +}; /* prototypes */ extern const char * __FASTCALL__ ao_format_name(int format); Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpcodecs/ad.h 2012-12-13 14:55:16 UTC (rev 559) @@ -8,13 +8,12 @@ #include "xmpcore/xmp_enums.h" #include "libao2/afmt.h" -typedef struct ad_info_s -{ +struct ad_info_t { const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ const char *driver_name; /* driver name ("dshow") */ const char *author; /* interface author/maintainer */ const char *url; /* URL of homepage */ -} ad_info_t; +}; enum { ADCTRL_RESYNC_STREAM=0, @@ -32,13 +31,13 @@ ACodecStatus_NotWorking =0, }acodec_status_e; -typedef struct audio_probe_s { +struct audio_probe_t { const char* driver; const char* codec_dll; uint32_t wtag; acodec_status_e status; unsigned sample_fmt[Audio_MaxOutSample]; -}audio_probe_t; +}; struct audio_filter_info_t { af_stream_t* afilter; @@ -47,7 +46,7 @@ /* interface of video decoder drivers */ struct ad_private_t; -typedef struct ad_functions_s +struct ad_functions_t { const ad_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ @@ -57,7 +56,7 @@ void (* __FASTCALL__ uninit)(ad_private_t *ctx); MPXP_Rc (*control_ad)(ad_private_t *ctx,int cmd,any_t* arg, ...); unsigned (* __FASTCALL__ decode)(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); -} ad_functions_t; +}; extern const ad_functions_t* afm_find_driver(const char *name); extern const audio_probe_t* afm_probe_driver(ad_private_t*ctx,sh_audio_t*sh,audio_filter_info_t* afi); Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpcodecs/vd.h 2012-12-13 14:55:16 UTC (rev 559) @@ -30,22 +30,21 @@ VCodecStatus_NotWorking =0, }vcodec_status_e; -typedef struct video_probe_s { +struct video_probe_t { const char* driver; const char* codec_dll; uint32_t fourcc; vcodec_status_e status; uint32_t pix_fmt[Video_MaxOutFmt]; video_flags_e flags[Video_MaxOutFmt]; -}video_probe_t; +}; -typedef struct vd_info_s -{ +struct vd_info_t { const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ const char *driver_name; /* driver name ("dshow") */ const char *author; /* interface author/maintainer */ const char *url; /* URL of homepage */ -} vd_info_t; +}; struct put_slice_info_t { int vf_flags; @@ -53,8 +52,7 @@ }; /* interface of video decoder drivers */ struct vd_private_t; -typedef struct vd_functions_s -{ +struct vd_functions_t { const vd_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ const video_probe_t*(*__FASTCALL__ probe)(uint32_t fourcc); @@ -63,7 +61,7 @@ void (*__FASTCALL__ uninit)(vd_private_t *ctx); MPXP_Rc (*control_vd)(vd_private_t *ctx,int cmd,any_t* arg, ...); mp_image_t* (*__FASTCALL__ decode)(vd_private_t *ctx,const enc_frame_t* frame); -} vd_functions_t; +}; extern const vd_functions_t* vfm_find_driver(const char *name); extern const video_probe_t* vfm_driver_probe(vd_private_t*ctx,sh_video_t *sh,put_slice_info_t* psi); Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-13 14:55:16 UTC (rev 559) @@ -37,8 +37,6 @@ CONF_GLOBAL =(1<<4), CONF_NOSAVE =(1<<5) }; -typedef struct m_config m_config_t; -typedef struct config_save config_save_t; struct config_t { const char *name; @@ -50,9 +48,10 @@ }; typedef void (*cfg_default_func_t)(config_t*,const char*); -struct m_config { - m_config(libinput_t& _libinput):libinput(_libinput) {} - ~m_config() {} +struct config_save_t; +struct m_config_t { + m_config_t(libinput_t& _libinput):libinput(_libinput) {} + ~m_config_t() {} const config_t** opt_list; config_save_t** config_stack; @@ -69,7 +68,7 @@ libinput_t& libinput; }; -struct config_save { +struct config_save_t { const config_t* opt; union { int as_int; Modified: mplayerxp/libmpconf/m_option.h =================================================================== --- mplayerxp/libmpconf/m_option.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpconf/m_option.h 2012-12-13 14:55:16 UTC (rev 559) @@ -10,8 +10,8 @@ /// \file m_option.h /// \ingroup OptionTypes -typedef struct m_option_type m_option_type_t; -typedef struct m_option m_option_t; +struct m_option_type_t; +struct m_option_t; struct m_struct_t; /// \defgroup OptionTypes Options types @@ -46,24 +46,25 @@ END_AT_TIME=1, END_AT_SIZE=2 }; -typedef struct { + +struct m_time_size_t { double pos; int type; -} m_time_size_t; +}; /// Extra definition needed for \ref m_option_type_obj_settings_list options. -typedef struct { +struct m_obj_list_t { any_t** list; /// Pointer to an array of pointer to some object type description struct. any_t* name_off; /// Offset of the object type name (char*) in the description struct. any_t* info_off; /// Offset of the object type info string (char*) in the description struct. any_t* desc_off; /// \brief Offset of the object type parameter description (\ref m_struct_st) in the description struct. -} m_obj_list_t; +}; /// The data type used by \ref m_option_type_obj_settings_list. -typedef struct m_obj_settings { +struct m_obj_settings_t { const char* name; /// Type of the object. char** attribs; /// NULL terminated array of parameter/value pairs. -} m_obj_settings_t; +}; /// A parser to set up a list of objects. /** It creates a NULL terminated array \ref m_obj_settings. The option priv @@ -73,12 +74,12 @@ extern const m_option_type_t m_option_type_obj_settings_list; /// Extra definition needed for \ref m_option_type_obj_presets options. -typedef struct { +struct m_obj_presets_t { struct m_struct_t* in_desc; /// Description of the struct holding the presets. struct m_struct_t* out_desc; /// Description of the struct that should be set by the presets. any_t* presets; /// Pointer to an array of structs defining the various presets. any_t* name_off; /// Offset of the preset's name inside the in_struct. -} m_obj_presets_t; +}; /// Set several fields in a struct at once. /** For this two struct descriptions are used. One for the struct holding the @@ -97,10 +98,10 @@ extern const m_option_type_t m_option_type_custom_url; #endif /// Extra definition needed for \ref m_option_type_obj_params options. -typedef struct { +struct m_obj_params_t { const struct m_struct_t* desc; /// Field descriptions. char separator; /// Field separator to use. -} m_obj_params_t; +}; /// Parse a set of parameters. /** Parameters are separated by the given separator and each one @@ -109,10 +110,10 @@ */ extern const m_option_type_t m_option_type_obj_params; -typedef struct { +struct m_span_t { int start; int end; -} m_span_t; +}; /// Ready made settings to parse a \ref m_span_t with a start-end syntax. extern const m_obj_params_t m_span_params_def; @@ -143,7 +144,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////// /// Option type description -struct m_option_type { +struct m_option_type_t { const char* name; const char* comments; /// Syntax description, etc unsigned int size; /// Size needed for the data. @@ -214,7 +215,7 @@ /// Option description /** \ingroup Options */ -struct m_option { +struct m_option_t { const char *name; /// Option name. /** The suboption parser and func types do use it. They should instead * use the priv field but this was inherited from older versions of the Modified: mplayerxp/libmpconf/m_property.h =================================================================== --- mplayerxp/libmpconf/m_property.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpconf/m_property.h 2012-12-13 14:55:16 UTC (rev 559) @@ -52,11 +52,11 @@ ///@{ /// Argument for \ref M_PROPERTY_KEY_ACTION -typedef struct { +struct m_property_action_t { const char* key; int action; const any_t* arg; -} m_property_action_t; +}; ///@} Modified: mplayerxp/libmpconf/m_struct.h =================================================================== --- mplayerxp/libmpconf/m_struct.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpconf/m_struct.h 2012-12-13 14:55:16 UTC (rev 559) @@ -8,7 +8,7 @@ /// \file m_struct.h -struct m_option; +struct m_option_t; /// Struct definition struct m_struct_t { @@ -19,7 +19,7 @@ /** The p field of the \ref m_option struct must contain the offset * of the member in the struct (use M_ST_OFF macro for this). */ - const struct m_option* fields; + const struct m_option_t* fields; }; @@ -97,7 +97,7 @@ * \param f Name of the field. * \return The \ref m_option struct describing the field or NULL if not found. */ -const struct m_option* +const struct m_option_t* m_struct_get_field(const m_struct_t* st,const char* f); ///@} Modified: mplayerxp/libmpconf/subopt-helper.h =================================================================== --- mplayerxp/libmpconf/subopt-helper.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpconf/subopt-helper.h 2012-12-13 14:55:16 UTC (rev 559) @@ -19,26 +19,23 @@ typedef int (*opt_test_f)(any_t*); /** simple structure for defining the option name, type and storage location */ -typedef struct opt_s -{ +struct opt_t { const char * name; ///< string that identifies the option int type; ///< option type as defined in subopt-helper.h any_t* valp; ///< pointer to the mem where the value should be stored opt_test_f test; ///< argument test func ( optional ) -} opt_t; +}; /** parses the string for the options specified in opt */ int subopt_parse( char const * const str, const opt_t * opts ); /*------------------ arg specific types and declaration -------------------*/ -typedef struct strarg_s -{ +typedef struct strarg_t { int len; ///< length of the string determined by the parser char const * str; ///< pointer to position inside the parse string -} strarg_t; +}; - int int_non_neg( int * i ); int int_pos( int * i ); Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-13 14:55:16 UTC (rev 559) @@ -37,10 +37,10 @@ DEMUX_SEEK_PERCENTS =0x02 }; - typedef struct seek_args_s { + struct seek_args_t { float secs; unsigned flags; - }seek_args_t; + }; struct sh_audio_t; struct sh_video_t; Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-12-13 14:55:16 UTC (rev 559) @@ -12,14 +12,14 @@ VideoFrame=RND_NUMBER1 }enc_frame_type_e; -typedef struct enc_frame_s { +struct enc_frame_t { enc_frame_type_e type; float pts; float duration; unsigned len; uint8_t* data; unsigned flags; // codec specific flags. filled by video_decode -}enc_frame_t; +}; extern enc_frame_t* new_enc_frame(enc_frame_type_e type,unsigned len,float pts,float duration); extern void free_enc_frame(enc_frame_t* frame); Modified: mplayerxp/libmpdemux/matroska.h =================================================================== --- mplayerxp/libmpdemux/matroska.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/matroska.h 2012-12-13 14:55:16 UTC (rev 559) @@ -154,7 +154,7 @@ MATROSKA_SUBTYPE_VOBSUB =3 }; -typedef struct { +struct mkv_sh_sub_t { char type; // t = text, v = VobSub int has_palette; // If we have a valid palette unsigned int palette[16]; // for VobSubs @@ -162,7 +162,7 @@ int custom_colors; unsigned int colors[4]; int forced_subs_only; -} mkv_sh_sub_t; +}; #if 0 int demux_mkv_num_subs(demuxer_t *demuxer); Modified: mplayerxp/libmpdemux/mpeg_hdr.h =================================================================== --- mplayerxp/libmpdemux/mpeg_hdr.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/mpeg_hdr.h 2012-12-13 14:55:16 UTC (rev 559) @@ -1,5 +1,5 @@ -typedef struct { +struct mp_mpeg_header_t { // video info: int mpeg1; // 0=mpeg2 1=mpeg1 int display_picture_width; @@ -18,7 +18,7 @@ //the following are for mpeg4 int timeinc_resolution, timeinc_bits, timeinc_unit; int picture_type; -} mp_mpeg_header_t; +}; int mp_header_process_sequence_header (mp_mpeg_header_t * picture, unsigned char * buffer); int mp_header_process_extension (mp_mpeg_header_t * picture, unsigned char * buffer); Modified: mplayerxp/libmpdemux/mpxpav64.h =================================================================== --- mplayerxp/libmpdemux/mpxpav64.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/mpxpav64.h 2012-12-13 14:55:16 UTC (rev 559) @@ -8,7 +8,7 @@ MPXPAV64_FP_FCNT_UTF16 =0x00000002ULL, MPXPAV64_FP_FCNT_UTF32 =0x00000003ULL }; -typedef struct __attribute__((__packed__)) mpxpav64FileProperties_s /* FPRP */ +struct __attribute__((__packed__)) mpxpav64FileProperties_t /* FPRP */ { uint64_t num_packets; //Number of 'DATx' packets uint64_t num_bytes; //Number of 'DATx' bytes @@ -18,19 +18,19 @@ uint32_t MaxBitrate; //Maximum bitrate of the media (sum of all the stream) uint32_t AveBitrate; //Average bitrate of the media (sum of all the stream) uint16_t StreamCount; //Number of StreamProp Objects -}mpxpav64FileProperties_t; -#define le2me_mpxpav64FileProperties(h) { \ - (h)->num_packets = le2me_64((h)->num_packets); \ - (h)->num_bytes = le2me_64((h)->num_bytes); \ - (h)->flags = le2me_64((h)->flags); \ - (h)->PlayDuration = le2me_64((h)->PlayDuration); \ - (h)->Preroll = le2me_32((h)->Preroll); \ - (h)->MaxBitrate = le2me_32((h)->MaxBitrate); \ - (h)->AveBitrate = le2me_32((h)->AveBitrate); \ - (h)->StreamCount = le2me_16((h)->StreamCount); \ +}; +inline void le2me_mpxpav64FileProperties(mpxpav64FileProperties_t* h) { + h->num_packets = le2me_64(h->num_packets); + h->num_bytes = le2me_64(h->num_bytes); + h->flags = le2me_64(h->flags); + h->PlayDuration = le2me_64(h->PlayDuration); + h->Preroll = le2me_32(h->Preroll); + h->MaxBitrate = le2me_32(h->MaxBitrate); + h->AveBitrate = le2me_32(h->AveBitrate); + h->StreamCount = le2me_16(h->StreamCount); } -typedef struct __attribute__((__packed__)) mpxpav64StreamProperties_s +struct __attribute__((__packed__)) mpxpav64StreamProperties_t { uint64_t num_packets; //Number of 'DATx' packets of this stream type uint64_t num_bytes; //Number of 'DATx' bytes of this stream type @@ -50,24 +50,24 @@ uint64_t size_scaler; //Numerator of SIZE fields to get size in bytes (default: 1) uint8_t mimetype_len; //length of mime-type uint8_t ascii[0];//mime-type: video/x-video audio/x-audio text/x-text -}mpxpav64StreamProperties_t; -#define le2me_mpxpav64StreamProperties(h) { \ - (h)->num_packets = le2me_64((h)->num_packets); \ - (h)->num_bytes = le2me_64((h)->num_bytes); \ - (h)->flags = le2me_64((h)->flags); \ - (h)->PlayDuration = le2me_64((h)->PlayDuration); \ - (h)->Preroll = le2me_32((h)->Preroll); \ - (h)->MaxPacketSize = le2me_32((h)->MaxPacketSize); \ - (h)->AvePacketSize = le2me_32((h)->AvePacketSize); \ - (h)->MinPacketSize = le2me_32((h)->MinPacketSize); \ - (h)->MaxFrameDuration = le2me_32((h)->MaxFrameDuration); \ - (h)->AveFrameDuration = le2me_32((h)->AveFrameDuration); \ - (h)->MinFrameDuration = le2me_32((h)->MinFrameDuration); \ - (h)->MaxBitrate = le2me_32((h)->MaxBitrate); \ - (h)->AveBitrate = le2me_32((h)->AveBitrate); \ - (h)->MinBitrate = le2me_32((h)->MinBitrate); \ - (h)->pts_rate = le2me_64((h)->pts_rate); \ - (h)->size_scaler = le2me_64((h)->size_scaler); \ +}; +static void le2me_mpxpav64StreamProperties(mpxpav64StreamProperties_t *h) { + h->num_packets = le2me_64(h->num_packets); + h->num_bytes = le2me_64(h->num_bytes); + h->flags = le2me_64(h->flags); + h->PlayDuration = le2me_64(h->PlayDuration); + h->Preroll = le2me_32(h->Preroll); + h->MaxPacketSize = le2me_32(h->MaxPacketSize); + h->AvePacketSize = le2me_32(h->AvePacketSize); + h->MinPacketSize = le2me_32(h->MinPacketSize); + h->MaxFrameDuration = le2me_32(h->MaxFrameDuration); + h->AveFrameDuration = le2me_32(h->AveFrameDuration); + h->MinFrameDuration = le2me_32(h->MinFrameDuration); + h->MaxBitrate = le2me_32(h->MaxBitrate); + h->AveBitrate = le2me_32(h->AveBitrate); + h->MinBitrate = le2me_32(h->MinBitrate); + h->pts_rate = le2me_64(h->pts_rate); + h->size_scaler = le2me_64(h->size_scaler); } #endif Modified: mplayerxp/libmpdemux/muxer.h =================================================================== --- mplayerxp/libmpdemux/muxer.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpdemux/muxer.h 2012-12-13 14:55:16 UTC (rev 559) @@ -16,18 +16,18 @@ }; #include "demuxer_r.h" -typedef struct muxer_packet_s{ +struct muxer_packet_t { float pts; any_t*data; unsigned length; unsigned flags; - struct muxer_packet_s *next; -}muxer_packet_t; + muxer_packet_t *next; +}; muxer_packet_t* new_muxer_packet(float pts,any_t*data,unsigned length,unsigned flags); void free_muxer_packet(muxer_packet_t *packet); -typedef struct { +struct muxer_stream_t { // muxer data: int type; // audio or video int id; // stream no @@ -54,14 +54,14 @@ muxer_packet_t *first; muxer_packet_t *last; any_t*priv; -} muxer_stream_t; +}; -typedef struct { +struct muxer_info_t { uint32_t id; const char *text; -} muxer_info_t; +}; -typedef struct muxer_t{ +struct muxer_t { // encoding: MainAVIHeader avih; muxer_stream_t* def_v; // default video stream (for general headers) @@ -73,7 +73,7 @@ muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int); FILE* file; any_t*priv; -} muxer_t; +}; muxer_t *muxer_new_muxer(const char *type,const char *subtype,FILE *f); #define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a) Modified: mplayerxp/libmpsub/spudec.cpp =================================================================== --- mplayerxp/libmpsub/spudec.cpp 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpsub/spudec.cpp 2012-12-13 14:55:16 UTC (rev 559) @@ -42,7 +42,6 @@ int spu_alignment = -1; float spu_gaussvar = 1.0; -typedef struct packet_t packet_t; struct packet_t { unsigned char *packet; unsigned int palette[4]; @@ -59,7 +58,7 @@ packet_t *next; }; -typedef struct { +struct spudec_handle_t { packet_t *queue_head; packet_t *queue_tail; unsigned int global_palette[16]; @@ -92,7 +91,7 @@ int spu_changed; unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ -} spudec_handle_t; +}; static void __FASTCALL__ spudec_queue_packet(spudec_handle_t *self, packet_t *packet) { @@ -670,13 +669,12 @@ return alpha ? 256 - alpha : 0; } -typedef struct { +struct scale_pixel { unsigned position; unsigned left_up; unsigned right_down; -}scale_pixel; +}; - static void __FASTCALL__ scale_table(unsigned int start_src, unsigned int start_tar, unsigned int end_src, unsigned int end_tar, scale_pixel * table) { unsigned int t; Modified: mplayerxp/libmpsub/subreader.h =================================================================== --- mplayerxp/libmpsub/subreader.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpsub/subreader.h 2012-12-13 14:55:16 UTC (rev 559) @@ -27,15 +27,14 @@ SUB_MAX_TEXT =5 }; -typedef struct { - +struct subtitle { int lines; unsigned long start; unsigned long end; char *text[SUB_MAX_TEXT]; -} subtitle; +}; extern subtitle* sub_read_file (const char *filename, float pts); extern char * sub_filename(const char *path,const char *fname); Modified: mplayerxp/libmpsub/vobsub.cpp =================================================================== --- mplayerxp/libmpsub/vobsub.cpp 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libmpsub/vobsub.cpp 2012-12-13 14:55:16 UTC (rev 559) @@ -73,7 +73,7 @@ * MPEG parsing **********************************************************************/ -typedef struct { +struct mpeg_t { Stream *stream; unsigned int pts; int aid; @@ -81,7 +81,7 @@ unsigned int packet_reserve; unsigned int packet_size; int fd; -} mpeg_t; +}; static mpeg_t * __FASTCALL__ mpeg_open(const char *filename) { @@ -290,20 +290,20 @@ * Packet queue **********************************************************************/ -typedef struct { +struct packet_t { unsigned int pts100; off_t filepos; unsigned int size; unsigned char *data; -} packet_t; +}; -typedef struct { +struct packet_queue_t { char *id; packet_t *packets; unsigned int packets_reserve; unsigned int packets_size; unsigned int current_index; -} packet_queue_t; +}; static void __FASTCALL__ packet_construct(packet_t *pkt) { @@ -397,7 +397,7 @@ * Vosub **********************************************************************/ -typedef struct { +struct vobsub_t { unsigned int palette[16]; unsigned int cuspal[4]; int delay; @@ -410,7 +410,7 @@ packet_queue_t *spu_streams; unsigned int spu_streams_size; unsigned int spu_streams_current; -} vobsub_t; +}; /* Make sure that the spu stream idx exists. */ static int __FASTCALL__ vobsub_ensure_spu_stream(vobsub_t *vob, unsigned int _index) Modified: mplayerxp/libplaytree/playtree.h =================================================================== --- mplayerxp/libplaytree/playtree.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libplaytree/playtree.h 2012-12-13 14:55:16 UTC (rev 559) @@ -1,8 +1,10 @@ #ifndef __PLAYTREE_H #define __PLAYTREE_H +struct m_config_t; namespace mpxp { struct Stream; + struct libinput_t; } enum { @@ -37,20 +39,6 @@ /// \defgroup Playtree ///@{ -#include "libmpconf/cfgparser.h" - -#if 0 -typedef struct play_tree_info play_tree_info_t; -// TODO : a attrib,val pair system and not something hardcoded -struct play_tree_info { - char* title; - char* author; - char* copyright; - char* abstract; - // Some more ?? -} -#endif - struct play_tree_param_t { char* name; char* value; Modified: mplayerxp/libplaytree/playtreeparser.cpp =================================================================== --- mplayerxp/libplaytree/playtreeparser.cpp 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libplaytree/playtreeparser.cpp 2012-12-13 14:55:16 UTC (rev 559) @@ -192,11 +192,11 @@ return i+1; } -typedef struct pls_entry { +struct pls_entry_t { char* file; char* title; char* length; -} pls_entry_t; +}; static int __FASTCALL__ pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) { int num,max_entry = (*_max_entry); Modified: mplayerxp/libplaytree/playtreeparser.h =================================================================== --- mplayerxp/libplaytree/playtreeparser.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libplaytree/playtreeparser.h 2012-12-13 14:55:16 UTC (rev 559) @@ -3,14 +3,13 @@ #include "playtree.h" -typedef struct play_tree_parser { +struct play_tree_parser_t { Stream* stream; char *buffer,*iter,*line; int buffer_size , buffer_end; int deep,keep; -} play_tree_parser_t; +}; - play_tree_parser_t* play_tree_parser_new(Stream * stream,int deep); void play_tree_parser_free(play_tree_parser_t* p); Modified: mplayerxp/libvo2/dri_vo.h =================================================================== --- mplayerxp/libvo2/dri_vo.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/dri_vo.h 2012-12-13 14:55:16 UTC (rev 559) @@ -22,22 +22,20 @@ DRI_CAP_HWOSD =0x00000100UL,/**< Driver supports OSD painting */ DRI_CAP_BUSMASTERING=0x80000000UL /**< Means: final video buffer but allocated in RAM */ }; -typedef struct dri_surface_cap_s -{ +struct dri_surface_cap_t { unsigned caps; /**< Capabilities of surface (see DRI_CAP_* for detail) */ unsigned fourcc; /**< real fourcc of vo2 surface */ unsigned width,height; /**< specify total dimension of surface */ unsigned x,y,w,h; /**< specify movie position within surface */ unsigned strides[4]; /**< drv->app:specify strides of each plane */ -}dri_surface_cap_t; +}; enum { MAX_DRI_BUFFERS=1024 /**< Maximal number of surfaces */ }; /** Contains surface address */ -typedef struct dri_surface_s -{ +struct dri_surface_t { unsigned idx; /**< app->drv:specify number of surface (0 default for single buffering) */ uint8_t* planes[4]; /**< drv->app:specify planes (include alpha channel) */ -}dri_surface_t; +}; #endif Modified: mplayerxp/libvo2/font_load.h =================================================================== --- mplayerxp/libvo2/font_load.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/font_load.h 2012-12-13 14:55:16 UTC (rev 559) @@ -1,13 +1,13 @@ #ifndef __FONT_LOAD_H #define __FONT_LOAD_H 1 -typedef struct { +struct raw_file { unsigned char *bmp; unsigned char *pal; int w,h,c; -} raw_file; +}; -typedef struct { +struct font_desc_t { char *name; char *fpath; int spacewidth; @@ -20,7 +20,7 @@ short font[65536]; int start[65536]; short width[65536]; -} font_desc_t; +}; raw_file* load_raw(const char *name,int verbose); font_desc_t* read_font_desc(const char* fname,float factor,int verbose); Modified: mplayerxp/libvo2/img_format.h =================================================================== --- mplayerxp/libvo2/img_format.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/img_format.h 2012-12-13 14:55:16 UTC (rev 559) @@ -142,12 +142,12 @@ static inline int IMGFMT_IS_XVMC(uint32_t fmt) { return ((fmt)&IMGFMT_XVMC_MASK)==IMGFMT_XVMC; } static inline int IMGFMT_IS_VDPAU(uint32_t fmt) { return ((fmt)&IMGFMT_VDPAU_MASK)==IMGFMT_VDPAU; } -typedef struct { +struct vo_mpegpes_t { any_t* data; int size; int id; // stream id. usually 0x1E0 int timestamp; // pts, 90000 Hz counter based -} vo_mpegpes_t; +}; /** Returns human-readable fourcc description * @param format fourcc of image Modified: mplayerxp/libvo2/jpeg_enc.h =================================================================== --- mplayerxp/libvo2/jpeg_enc.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/jpeg_enc.h 2012-12-13 14:55:16 UTC (rev 559) @@ -23,7 +23,7 @@ */ -typedef struct { +struct jpeg_enc_t { struct MpegEncContext *s; int cheap_upsample; int bw; @@ -33,7 +33,7 @@ int y_rs; int u_rs; int v_rs; -} jpeg_enc_t; +}; jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, int u_psize, int u_rsize, int v_psize, int v_rsize, Modified: mplayerxp/libvo2/sub.h =================================================================== --- mplayerxp/libvo2/sub.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/sub.h 2012-12-13 14:55:16 UTC (rev 559) @@ -4,9 +4,9 @@ #include "osd_render.h" namespace mpxp { - typedef struct mp_osd_bbox_s { + struct mp_osd_bbox_t { int x1,y1,x2,y2; - } mp_osd_bbox_t; + }; enum { OSDTYPE_OSD =1, @@ -31,8 +31,8 @@ MAX_UCSLINES =16 }; - typedef struct mp_osd_obj_s { - struct mp_osd_obj_s* next; + struct mp_osd_obj_t { + mp_osd_obj_t* next; unsigned char type; unsigned char alignment; // 2 bits: x;y percents, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center unsigned short flags; @@ -56,7 +56,7 @@ int allocated; unsigned char *alpha_buffer; unsigned char *bitmap_buffer; - } mp_osd_obj_t; + }; enum { OSD_PLAY =0x01, @@ -78,14 +78,14 @@ OSD_PB_1 =0x13 }; - typedef struct sub_data_s { + struct sub_data_t { char * cp; int unicode; int utf8; int pos; int bg_color; /* subtitles background color */ int bg_alpha; - }sub_data_t; + }; extern sub_data_t sub_data; class Video_Output; Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/video_out.h 2012-12-13 14:55:16 UTC (rev 559) @@ -75,14 +75,14 @@ inline vo_flags_e operator^=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } /** Request for supported FOURCC by VO-driver */ - typedef struct vo_query_fourcc_s { + struct vo_query_fourcc_t { uint32_t fourcc; /**< Fourcc of decoded image */ unsigned w,h; /**< Width and height of decoded image */ unsigned flags; /**< Flags for this fourcc VOCAP_* */ - }vo_query_fourcc_t; + }; /** Named video equalizer */ - typedef struct vo_videq_s { + struct vo_videq_t { #define VO_EC_BRIGHTNESS "Brightness" #define VO_EC_CONTRAST "Contrast" #define VO_EC_GAMMA "Gamma" @@ -93,9 +93,9 @@ #define VO_EC_BLUE_INTENSITY "BlueIntensity" const char *name; /**< name of equalizer control */ int value; /**< value of equalizer control in range -1000 +1000 */ - }vo_videq_t; + }; - typedef struct vo_gamma_s{ + struct vo_gamma_t{ int brightness; int saturation; int contrast; @@ -103,11 +103,11 @@ int red_intensity; int green_intensity; int blue_intensity; - }vo_gamma_t; + }; - typedef struct vo_rect_s { + struct vo_rect_t { unsigned x,y,w,h; - }vo_rect_t; + }; struct vo_rect2 { int left, right, top, bottom, width, height; @@ -242,12 +242,12 @@ vo_adjust_size_t adjust_size; }; /** Contains geometry of fourcc */ - typedef struct s_vo_format_desc { + struct vo_format_desc { unsigned bpp; /* in some strange fourccs (NV12) horz period != vert period of UV */ unsigned x_mul[4],x_div[4]; unsigned y_mul[4],y_div[4]; - }vo_format_desc; + }; extern int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd); } // namespace mpxp #endif Modified: mplayerxp/libvo2/x11_system.h =================================================================== --- mplayerxp/libvo2/x11_system.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/libvo2/x11_system.h 2012-12-13 14:55:16 UTC (rev 559) @@ -21,13 +21,13 @@ #include "dri_vo.h" namespace mpxp { - typedef struct { + struct MotifWmHints_t { long flags; long functions; long decorations; long input_mode; long state; - }MotifWmHints_t; + }; class X11_System { public: Modified: mplayerxp/mp_msg.cpp =================================================================== --- mplayerxp/mp_msg.cpp 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/mp_msg.cpp 2012-12-13 14:55:16 UTC (rev 559) @@ -13,14 +13,14 @@ #include "mp_msg.h" namespace mpxp { -#define _bg(x) ((x) >> 4) -#define _fg(x) ((x) & 0x0f) -typedef struct priv_s { +inline int _bg(int x) { return x >> 4; } +inline int _fg(int x) { return x & 0x0f; } +struct priv_t { int _color[8]; char vtmp[100]; char scol[9][20]; pthread_mutex_t mp_msg_mutex; -}priv_t; +}; const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; static char *_2ansi(unsigned char attr) Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/mplayerxp.h 2012-12-13 14:55:16 UTC (rev 559) @@ -125,7 +125,7 @@ extern MP_Config mp_conf; /* Benchmarking */ - typedef struct time_usage_s { + struct time_usage_t { double video; double vout; double audio_decode_correction; @@ -146,7 +146,7 @@ double cur_vout; double min_vout; double total_start; - }time_usage_t; + }; struct MPXPSystem; struct xp_core_t; Modified: mplayerxp/osdep/cpudetect.h =================================================================== --- mplayerxp/osdep/cpudetect.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/osdep/cpudetect.h 2012-12-13 14:55:16 UTC (rev 559) @@ -38,7 +38,7 @@ CPUTYPE_I686=6 }; - typedef struct cpucaps_s { + struct CpuCaps { int cpuType; int cpuStepping; int hasMMX; @@ -56,7 +56,7 @@ int hasAVX; int isX86; unsigned cl_size; /* size of cache line */ - } CpuCaps; + }; extern CpuCaps gCpuCaps; Modified: mplayerxp/osdep/vbelib.h =================================================================== --- mplayerxp/osdep/vbelib.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/osdep/vbelib.h 2012-12-13 14:55:16 UTC (rev 559) @@ -13,10 +13,10 @@ /* Note: every pointer within structures is 32-bit protected mode pointer. So you don't need to convert it from real mode. */ - typedef struct tagFarPtr { + struct FarPtr { unsigned short off; unsigned short seg; - }FarPtr; + }; enum { VBE_DAC_8BIT =(1 << 0), Modified: mplayerxp/xmpcore/mp_aframe.h =================================================================== --- mplayerxp/xmpcore/mp_aframe.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/xmpcore/mp_aframe.h 2012-12-13 14:55:16 UTC (rev 559) @@ -62,7 +62,7 @@ MP_AFLG_FINALIZED =0x80000000 }; - typedef struct mp_audio_frame_s { + struct mp_aframe_t { unsigned flags; /* currently unused */ float pts; /* PTS if this frame */ unsigned xp_idx;/* index in ring buffer */ @@ -72,7 +72,7 @@ unsigned rate; /* rate of audio */ unsigned nch; /* number of channels */ mpaf_format_e format;/* PCM format of audio */ - }mp_aframe_t; + }; mp_aframe_t* new_mp_aframe(unsigned rate,unsigned nch,mpaf_format_e format,unsigned xp_idx); mp_aframe_t* new_mp_aframe_genome(const mp_aframe_t* in); Modified: mplayerxp/xmpcore/mp_image.h =================================================================== --- mplayerxp/xmpcore/mp_image.h 2012-12-13 13:52:35 UTC (rev 558) +++ mplayerxp/xmpcore/mp_image.h 2012-12-13 14:55:16 UTC (rev 559) @@ -65,7 +65,7 @@ }; enum { XP_IDX_INVALID=UINT_MAX }; - typedef struct mp_image_s { + struct mp_image_t { unsigned xp_idx; /* index of xp_frame associated with this image */ unsigned int flags; unsigned char type; @@ -87,7 +87,7 @@ int chroma_x_shift; // horizontal int chroma_y_shift; // vertical any_t* priv; /* for private use by filter or vo driver (to store buffer id or dmpi) */ - } mp_image_t; + }; void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |