# HG changeset patch
# User Xeli
# Date 1351433557 -3600
# Node ID 2bc61f8841a1ea3b45ed40b31fb9343ee38ec88d
# Parent ddcdedd3330b4bf32eaf613500f88eae0aa3c198# Parent 6237d2f002ba81d8962793c3270b139ded45a0da
merge Medo's GSoC work
diff -r 6237d2f002ba -r 2bc61f8841a1 .hgignore
--- a/.hgignore Sun Sep 16 23:52:36 2012 +0200
+++ b/.hgignore Sun Oct 28 15:12:37 2012 +0100
@@ -3,6 +3,7 @@
glob:moc_*.cxx
glob:qrc_*.cxx
glob:*.o
+glob:*.qm
glob:Makefile
glob:bin
glob:*.hi
@@ -50,3 +51,8 @@
glob:project_files/Android-build/SDL-android-project/.*
glob:project_files/Android-build/out
glob:project_files/Android-build/Makefile.android
+glob:hedgewars-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug
+glob:hedgewars-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Release
+glob:*.depends
+glob:tools/build_windows_koda.bat
+
diff -r 6237d2f002ba -r 2bc61f8841a1 CMakeLists.txt
--- a/CMakeLists.txt Sun Sep 16 23:52:36 2012 +0200
+++ b/CMakeLists.txt Sun Oct 28 15:12:37 2012 +0100
@@ -16,7 +16,8 @@
set(HGCHANGED "")
IF(version_suffix MATCHES "-dev")
set(HW_DEV true)
- IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.hg)
+ set(default_build_type "DEBUG")
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.hg)
FIND_PROGRAM(HGCOMMAND hg)
IF(HGCOMMAND)
exec_program(${HGCOMMAND}
@@ -35,6 +36,7 @@
ENDIF()
ELSE()
set(HW_DEV false)
+ set(default_build_type "RELEASE")
ENDIF()
@@ -46,11 +48,15 @@
set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-#set some safe values
-IF(NOT BUILD_ENGINE_LIBRARY)
- SET(BUILD_ENGINE_LIBRARY 0)
-ENDIF(NOT BUILD_ENGINE_LIBRARY)
-set(target_dir "bin")
+#set some default values
+option(NOSERVER "Disable gameServer build [default: auto]" OFF)
+option(NOPNG "Disable screenshoot compression [default: auto]" OFF)
+option(NOVIDEOREC "Disable video recording [default: auto]" OFF)
+
+option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF)
+option(ANDROID "Enable Android build [default: off]" OFF)
+option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF)
+
#bundle .app setup
if(APPLE OR CROSSAPPLE)
@@ -61,6 +67,8 @@
set(DATA_INSTALL_DIR "../Resources/")
set(target_dir ".")
set(minimum_macosx_version "10.6")
+else()
+ set(target_dir "bin")
endif()
if(APPLE)
@@ -137,18 +145,16 @@
endif(APPLE)
-#build Debug only when explicitally set
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: Debug Release." FORCE)
-endif (NOT CMAKE_BUILD_TYPE)
-
-if(CMAKE_BUILD_TYPE MATCHES DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "debug")
- message(STATUS "Building Debug")
- set(Optz false)
-else()
- message(STATUS "Building Release")
- set(Optz true)
-endif()
+#when build type is not specified, assume Debug/Release according to build version information
+if (CMAKE_BUILD_TYPE)
+ string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
+ if ( NOT( (CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "DEBUG") ) )
+ set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Only 'Debug' or 'Release' options are allowed." FORCE)
+ message (STATUS "Unknown build type, using default (${default_build_type})")
+ endif ()
+else (CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Choose the build type, options are: Debug Release." FORCE)
+endif (CMAKE_BUILD_TYPE)
#set default flags values for all projects
@@ -163,34 +169,40 @@
if(FPFLAGS OR GHFLAGS)
math(EXPR cmake_version "${CMAKE_MAJOR_VERSION}*10000 + ${CMAKE_MINOR_VERSION}*100 + ${CMAKE_PATCH_VERSION}")
if(cmake_version LESS "020800")
- message(STATUS "FPFLAGS and GHFLAGS are available only from Cmake 2.8, ignoring...")
+ message(STATUS "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8")
else()
- separate_arguments(fpflags_full UNIX_COMMAND ${FPFLAGS})
- separate_arguments(ghflags_full UNIX_COMMAND ${GHFLAGS})
+ separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS})
+ separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
endif()
endif()
-set(pascal_flags ${fpflags_full} "-B" "-FE../bin" "-Cs2000000" "-vewn" "-dDEBUGFILE" ${pascal_flags})
-set(haskell_flags "-O2" ${ghflags_full} ${haskell_flags})
+set(pascal_flags ${fpflags_parsed} "-vm4079,4080,4081" "-B" "-FE../bin" "-Cs2000000" "-vewnq" "-dDEBUGFILE" ${pascal_flags})
+set(haskell_flags "-O2" ${ghflags_parsed} ${haskell_flags})
-if(Optz)
+#get BUILD_TYPE and enable/disable optimisation
+if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
+ message(STATUS "Building Debug flavour")
+ set(pascal_flags "-O-" "-g" "-gl" "-gv" ${pascal_flags})
+ set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
+else()
+ message(STATUS "Building Release flavour")
# set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
set(pascal_flags "-Os" "-Ooregvar" "-Xs" "-Si" ${pascal_flags})
set(haskell_flags "-w" "-fno-warn-unused-do-bind" ${haskell_flags})
-else(Optz)
- set(pascal_flags "-O-" "-g" "-gl" "-gv" "-Ct" ${pascal_flags})
- set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
-endif(Optz)
+endif()
+#finish setting paths
if(DEFINED DATA_INSTALL_DIR)
set(SHAREPATH ${DATA_INSTALL_DIR}/hedgewars/)
else()
set(SHAREPATH share/hedgewars/)
endif()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
+#server discovery
if(NOT NOSERVER)
if(GHC)
set(ghc_executable ${GHC})
@@ -201,8 +213,9 @@
if(ghc_executable)
set(HAVE_NETSERVER true)
add_subdirectory(gameServer)
+ message(STATUS "Found GHC: ${ghc_executable}")
else()
- message(STATUS "No GHC executable found, server will not be built")
+ message(STATUS "Could NOT find GHC, server will not be built")
set(HAVE_NETSERVER false)
endif()
else()
@@ -210,29 +223,29 @@
set(HAVE_NETSERVER false)
endif()
+
+#lua discovery
find_package(Lua)
if(LUA_FOUND)
- message(STATUS "Lua library is present on your system (${LUA_DEFAULT})")
+ message(STATUS "Found LUA: ${LUA_DEFAULT}")
else()
- message(STATUS "Lua library not found, building bundled dependency")
+ message(STATUS "LUA will be provided by the bundled sources")
add_subdirectory(misc/liblua)
#linking with liblua.a requires system readline -- this works everywhere, right?
- if(WIN32)
- set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.dll.a" "-k-lreadline" ${pascal_flags})
- else()
- set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_flags})
- endif()
+ set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
endif()
+
+#main engine
add_subdirectory(hedgewars)
-
-#run cmake -DANDROID=1 to enable this
+#Android related build scripts
if(ANDROID)
+ #run cmake -DANDROID=1 to enable this
add_subdirectory(project_files/Android-build)
endif()
-
+#TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID))
add_subdirectory(bin)
add_subdirectory(misc/quazip)
diff -r 6237d2f002ba -r 2bc61f8841a1 CREDITS
--- a/CREDITS Sun Sep 16 23:52:36 2012 +0200
+++ b/CREDITS Sun Oct 28 15:12:37 2012 +0100
@@ -18,6 +18,12 @@
- hillis -> AkuAku (2010)
- Lortinak -> OldMan (2010), ShortHair (2010)
- chujoii -> BrainSlug (2010), Dragon (2010), Ladle (2010), Laminaria (2010), Pantsu (2010), Pig (2010), Plunger (2010), SauceBoat (2010), ShaggyYeti (2010), SleepWalker (2010), SunWukong (2010), Teapot (2010), Teacup (2010), Zombi (2010)
+- Randy Broda -> Cyclops (2011), Soldier (2011)
+
+==========
+= GRAVESTONES
+==========
+- Randy Broda -> Dragonball (2012)
==========
= MAPS
diff -r 6237d2f002ba -r 2bc61f8841a1 ChangeLog.txt
--- a/ChangeLog.txt Sun Sep 16 23:52:36 2012 +0200
+++ b/ChangeLog.txt Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,34 @@
+ features
* bugfixes
+0.9.17 -> 0.9.18:
+
+ + 'A Classic Fairytale' Campaign
+ + Video recorder (requires ffmpeg)
+ + Cleaver weapon
+ + AI is now aware of drowning and fall damage
+ + AI learned how to use Sniper Rifle and Cake
+ + Variable pen width and eraser for drawn maps
+ + Several trainings and missions
+ + Allow setting custom local palette of teams colors
+ + Hide eliminated teams from teams healths widget
+ + Server doesn't delete room till last player quits it
+ + PNG screenshots
+ + Show bot level on CPU flag
+ + Objects now have density value assigned which impacts their behavior on explosions, throwing from rope and drowning
+ + Improve AI skills at Desert Eagel, Whip, Firepunch, Baseball Bat, Hammer, Cluster Bomb, Watermelon and walking
+ + Individual hedgehogs healths in team health bar
+ + Drill rocket wouldn't explode in your face if you stand close to wall
+ + Ability to rope into a portal, allow RC plane to go through portals
+ + Many small frontend improvements: get rid of "save" buttons, descriptions, allow to use network proxy, etc
+ + Reduce amount of memory needed for engine to store land data
+ + Countless other small fixes and improvements
+ + Detect desyncs early
+ * Fix cake getting stuck in barrels, crates and hedgehogs
+ * Fix all knowns bugs which caused network game hang when players close engine or quit
+ * Fix drill strike bug when drill's timer gets ridiculously high value instead of explosion
+ * Fix some crashes, freezes and memory leaks in frontend and engine
+
0.9.16 -> 0.9.17:
+ New theme, Cave
+ New voicepack, Hillbilly
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/CMakeLists.txt Sun Oct 28 15:12:37 2012 +0100
@@ -28,7 +28,9 @@
# Configure for SDL
find_package(SDL REQUIRED)
find_package(SDL_mixer REQUIRED)
-find_package(FFMPEG)
+if(NOT NOVIDEOREC)
+ find_package(FFMPEG)
+endif()
include_directories(.)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model)
@@ -51,7 +53,7 @@
if(WIN32 AND NOT UNIX)
set(HEDGEWARS_BINDIR ".")
set(HEDGEWARS_DATADIR "../share/")
- add_definitions(-DUSE_XFIRE)
+ add_definitions(-DUSE_XFIRE)
else()
set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
if(DEFINED DATA_INSTALL_DIR)
@@ -73,8 +75,8 @@
file(GLOB_RECURSE UIcpp ui/*.cpp)
file(GLOB UtilCpp util/*.cpp)
-if((NOT NO_VIDEOREC) AND "${FFMPEG_FOUND}")
- add_definitions(-DVIDEOREC)
+if(${FFMPEG_FOUND})
+ add_definitions(-DVIDEOREC -D__STDC_CONSTANT_MACROS)
endif()
set(hwfr_src
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/campaign.cpp
--- a/QTfrontend/campaign.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/campaign.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -19,7 +19,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/game.cpp
--- a/QTfrontend/game.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/game.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
#include
#include "game.h"
@@ -125,6 +124,8 @@
.arg((themeModel->rowCount() > 0) ? themeModel->index(rand() % themeModel->rowCount()).data().toString() : "steel"));
HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString());
+ HWProto::addStringToBuffer(teamscfg, "e$template_filter 2");
+
HWTeam team1;
team1.setDifficulty(0);
team1.setColor(0);
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/gameuiconfig.cpp
--- a/QTfrontend/gameuiconfig.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/gameuiconfig.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -16,13 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include
#include
#include
#include
#include
#include
#include
+#include
+#include
#include "gameuiconfig.h"
#include "hwform.h"
@@ -34,6 +35,14 @@
#include "HWApplication.h"
#include "DataManager.h"
+
+const QNetworkProxy::ProxyType proxyTypesMap[] = {
+ QNetworkProxy::NoProxy
+ , QNetworkProxy::NoProxy // dummy value
+ , QNetworkProxy::Socks5Proxy
+ , QNetworkProxy::HttpProxy};
+
+
GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
: QSettings(fileName, QSettings::IniFormat)
{
@@ -109,6 +118,12 @@
Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
+ Form->ui.pageOptions->cbProxyType->setCurrentIndex(value("proxy/type", 0).toInt());
+ Form->ui.pageOptions->leProxy->setText(value("proxy/host", "").toString());
+ Form->ui.pageOptions->sbProxyPort->setValue(value("proxy/port", "8080").toInt());
+ Form->ui.pageOptions->leProxyLogin->setText(value("proxy/login", "").toString());
+ Form->ui.pageOptions->leProxyPassword->setText(value("proxy/password", "").toString());
+
depth = HWApplication::desktop()->depth();
if (depth < 16) depth = 16;
else if (depth > 16) depth = 32;
@@ -217,6 +232,36 @@
setValue("misc/autoUpdate", isAutoUpdateEnabled());
#endif
+ { // setup proxy
+ int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex();
+ setValue("proxy/type", proxyType);
+
+ if(proxyType == PageOptions::Socks5Proxy || proxyType == PageOptions::HTTPProxy)
+ {
+ setValue("proxy/host", Form->ui.pageOptions->leProxy->text());
+ setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value());
+ setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text());
+ setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text());
+ }
+
+ QNetworkProxy proxy;
+
+ if(proxyType == PageOptions::SystemProxy)
+ {
+ // use system proxy settings
+ proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
+ } else
+ {
+ proxy.setType(proxyTypesMap[proxyType]);
+ proxy.setHostName(Form->ui.pageOptions->leProxy->text());
+ proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
+ proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
+ proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
+ }
+
+ QNetworkProxy::setApplicationProxy(proxy);
+ }
+
{ // save colors
QStandardItemModel * model = DataManager::instance().colorsModel();
for(int i = model->rowCount() - 1; i >= 0; --i)
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/hedgewars.qrc Sun Oct 28 15:12:37 2012 +0100
@@ -5,7 +5,7 @@
res/css/chat.cssres/css/christmas.cssres/css/easter.css
- res/css/birthday.css
+ res/css/birthday.cssres/hh25x25.pngres/hh25x25grey.pngres/ammopic.png
@@ -102,20 +102,11 @@
res/iconRope.pngres/dice.pngres/Star.png
- res/Flake.png
- res/Egg.png
- res/Confetti.png
+ res/Flake.png
+ res/Egg.png
+ res/Confetti.pngres/file_save.pngres/file_demo.png
- res/chat_default.png
- res/chat_ignore.png
- res/chat_friend.png
- res/chat_default_on.png
- res/chat_ignore_on.png
- res/chat_friend_on.png
- res/chat_default_off.png
- res/chat_ignore_off.png
- res/chat_friend_off.pngres/addfriend.pngres/remfriend.pngres/ignore.png
@@ -143,5 +134,16 @@
res/mapMissing.pngres/mapCustom.pngres/mapMission.png
+ res/chat/friend.png
+ res/chat/ignore.png
+ res/chat/lamp.png
+ res/chat/hedgehog.png
+ res/chat/hedgehog_gray.png
+ res/chat/roomadmin.png
+ res/chat/roomadmin_gray.png
+ res/chat/serveradmin.png
+ res/chat/serveradmin_gray.png
+ res/chat/lamp_off.png
+ res/chat/ingame.png
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/hwconsts.h
--- a/QTfrontend/hwconsts.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/hwconsts.h Sun Oct 28 15:12:37 2012 +0100
@@ -63,40 +63,40 @@
#define HEDGEHOGS_PER_TEAM 8
-#define AMMOLINE_DEFAULT_QT "9391929422199121032235111001201000000211110101011111011"
-#define AMMOLINE_DEFAULT_PROB "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_DEFAULT_DELAY "0000000000000205500000040007004000000000220000000600000"
-#define AMMOLINE_DEFAULT_CRATE "1311110312111111123114111111111111111211111101111111010"
+#define AMMOLINE_DEFAULT_QT "93919294221991210322351110012010000002111101010111110101"
+#define AMMOLINE_DEFAULT_PROB "04050405416006555465544647765766666661555101011154110101"
+#define AMMOLINE_DEFAULT_DELAY "00000000000002055000000400070040000000002200000006000000"
+#define AMMOLINE_DEFAULT_CRATE "13111103121111111231141111111111111112111111011111110101"
-#define AMMOLINE_CRAZY_QT "9999999999999999992999999999999999299999999909999992099"
-#define AMMOLINE_CRAZY_PROB "1111110111111111111111111111111111111111111101111111011"
-#define AMMOLINE_CRAZY_DELAY "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE "1311110312111111123114111111111111111211110101111111011"
+#define AMMOLINE_CRAZY_QT "99999999999999999929999999999999992999999999099999920909"
+#define AMMOLINE_CRAZY_PROB "11111101111111111111111111111111111111111111011111110101"
+#define AMMOLINE_CRAZY_DELAY "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CRAZY_CRATE "13111103121111111231141111111111111112111101011111110101"
-#define AMMOLINE_PROMODE_QT "9090009000000000000009000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_PROB "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_DELAY "0000000000000205500000040007004000000000200000000000000"
-#define AMMOLINE_PROMODE_CRATE "1111111111111111111111111111111111111111100101111111011"
+#define AMMOLINE_PROMODE_QT "90900090000000000000090000000000000000000000000000000001"
+#define AMMOLINE_PROMODE_PROB "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_DELAY "00000000000002055000000400070040000000002000000000000009"
+#define AMMOLINE_PROMODE_CRATE "11111111111111111111111111111111111111111001011111110101"
-#define AMMOLINE_SHOPPA_QT "0000009900000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_PROB "4444410044244402210112121222422000000002000400010011000"
-#define AMMOLINE_SHOPPA_DELAY "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_CRATE "1111111111111111111111111111111111111111101101111111001"
+#define AMMOLINE_SHOPPA_QT "00000099000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_PROB "44444100442444022101121212224220000000020004000100110000"
+#define AMMOLINE_SHOPPA_DELAY "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_CRATE "11111111111111111111111111111111111111111011011111110001"
-#define AMMOLINE_CLEAN_QT "1010009000010000011000000000000000000000000000001000000"
-#define AMMOLINE_CLEAN_PROB "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_CLEAN_DELAY "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CLEAN_CRATE "1311110312111111123114111111111111111211111101111111011"
+#define AMMOLINE_CLEAN_QT "10100090000100000110000000000000000000000000000010000000"
+#define AMMOLINE_CLEAN_PROB "04050405416006555465544647765766666661555101011154110101"
+#define AMMOLINE_CLEAN_DELAY "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CLEAN_CRATE "13111103121111111231141111111111111112111111011111110101"
-#define AMMOLINE_MINES_QT "0000009900090000000300000000000000000000000000000000000"
-#define AMMOLINE_MINES_PROB "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_MINES_DELAY "0000000000000205500000040007004000000000200000000600000"
-#define AMMOLINE_MINES_CRATE "1111111111111111111111111111111111111111111101111111011"
+#define AMMOLINE_MINES_QT "00000099000900000003000000000000000000000000000000000000"
+#define AMMOLINE_MINES_PROB "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_MINES_DELAY "00000000000002055000000400070040000000002000000006000000"
+#define AMMOLINE_MINES_CRATE "11111111111111111111111111111111111111111111011111110101"
-#define AMMOLINE_PORTALS_QT "9000009002000000002100000000000000110000090000000000000"
-#define AMMOLINE_PORTALS_PROB "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_PORTALS_DELAY "0000000000000205500000040007004000000000200000000600000"
-#define AMMOLINE_PORTALS_CRATE "1311110312111111123114111111111111111211111101111111011"
+#define AMMOLINE_PORTALS_QT "90000090020000000021000000000000001100000900000000000000"
+#define AMMOLINE_PORTALS_PROB "04050405416006555465544647765766666661555101011154110100"
+#define AMMOLINE_PORTALS_DELAY "00000000000002055000000400070040000000002000000006000000"
+#define AMMOLINE_PORTALS_CRATE "13111103121111111231141111111111111112111111011111110101"
//Different seasons; assigned to season (int)
#define SEASON_NONE 0
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/hwform.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -93,6 +93,7 @@
#include "mouseoverfilter.h"
#include "roomslistmodel.h"
#include "recorder.h"
+#include "playerslistmodel.h"
#include "DataManager.h"
@@ -162,8 +163,8 @@
// ctrl+q closes frontend for consistency
QShortcut * closeFrontend = new QShortcut(QKeySequence("Ctrl+Q"), this);
connect (closeFrontend, SIGNAL(activated()), this, SLOT(close()));
- QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
- connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
+ //QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
+ //connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
#endif
UpdateTeamsLists();
@@ -189,8 +190,10 @@
connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
pageSwitchMapper->setMapping(ui.pageMain->BtnSetup, ID_PAGE_SETUP);
+#if 0
connect(ui.pageMain->BtnFeedback, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
pageSwitchMapper->setMapping(ui.pageMain->BtnFeedback, ID_PAGE_FEEDBACK);
+#endif
connect(ui.pageMain->BtnNet, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
pageSwitchMapper->setMapping(ui.pageMain->BtnNet, ID_PAGE_NETTYPE);
@@ -201,8 +204,6 @@
connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
- connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map()));
- pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD);
#ifdef VIDEOREC
connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
@@ -625,19 +626,6 @@
{
config->reloadVideosValues();
}
-
- // load and save ignore/friends lists
- if (lastid == ID_PAGE_NETGAME) // leaving a room
- ui.pageNetGame->pChatWidget->saveLists(ui.pageOptions->editNetNick->text());
- else if(lastid == ID_PAGE_ROOMSLIST) // leaving the lobby
- ui.pageRoomsList->chatWidget->saveLists(ui.pageOptions->editNetNick->text());
-
- if (id == ID_PAGE_NETGAME) // joining a room
- ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
-// joining the lobby
- else if (id == ID_PAGE_ROOMSLIST)
- ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
-
}
void HWForm::GoToPage(int id)
@@ -712,9 +700,10 @@
group->addAnimation(animationOldOpacity);
group->addAnimation(animationNewOpacity);
#endif
+
+ connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
group->start();
- connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
/* this is for the situation when the animation below is interrupted by a new animation. For some reason, finished is not being fired */
for(int i=0;iwidget(i)->hide();
}
@@ -825,11 +814,18 @@
group->addAnimation(animationOldOpacity);
group->addAnimation(animationNewOpacity);
#endif
- group->start();
connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
+ group->start();
}
#endif
+
+ if (stopAnim)
+ ui.Pages->widget(curid)->hide();
+
+// TODO the whole pages shown and effects stuff should be moved
+// out of hwform.cpp and into a subclass of QStackedLayout
+
}
void HWForm::OpenSnapshotFolder()
@@ -909,10 +905,18 @@
void HWForm::DeleteTeam(const QString & teamName)
{
- ui.pageEditTeam->deleteTeam(teamName);
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Teams - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the team '%1'?").arg(teamName));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- UpdateTeamsLists();
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
+ {
+ ui.pageEditTeam->deleteTeam(teamName);
+ UpdateTeamsLists();
+ }
}
void HWForm::DeleteScheme()
@@ -920,7 +924,7 @@
ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes)
{
- QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Can not delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
+ ShowErrorMessage(QMessageBox::tr("Cannot delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
}
else
{
@@ -946,10 +950,7 @@
QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list above"),
- tr("OK"));
+ ShowErrorMessage(QMessageBox::tr("Please select a record from the list"));
return;
}
CreateGame(0, 0, 0);
@@ -1013,7 +1014,7 @@
void HWForm::NetNickTaken(const QString & nick)
{
bool ok = false;
- QString newNick = QInputDialog::getText(this, tr("Nickname"), tr("Some one already uses\n your nickname %1\non the server.\nPlease pick another nickname:").arg(nick), QLineEdit::Normal, nick, &ok);
+ QString newNick = QInputDialog::getText(this, tr("Nickname"), tr("Someone already uses your nickname %1 on the server.\nPlease pick another nickname:").arg(nick), QLineEdit::Normal, nick, &ok);
if (!ok || newNick.isEmpty())
{
@@ -1091,6 +1092,9 @@
connect(hwnet, SIGNAL(AuthFailed()), this, SLOT(NetAuthFailed()), Qt::QueuedConnection);
//connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
+ ui.pageRoomsList->chatWidget->setUsersModel(hwnet->lobbyPlayersModel());
+ ui.pageNetGame->pChatWidget->setUsersModel(hwnet->roomPlayersModel());
+
// rooms list page stuff
ui.pageRoomsList->setModel(hwnet->roomsListModel());
connect(hwnet, SIGNAL(adminAccess(bool)),
@@ -1119,8 +1123,7 @@
// net page stuff
connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)), Qt::QueuedConnection);
- connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)),
- ui.pageNetGame->pChatWidget, SLOT(setReadyStatus(const QString &, bool)), Qt::QueuedConnection);
+
connect(hwnet, SIGNAL(chatStringFromMe(const QString&)),
ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(roomMaster(bool)),
@@ -1239,10 +1242,10 @@
config->SaveOptions();
pnetserver = new HWNetServer;
- if(!pnetserver->StartServer(ui.pageNetServer->sbPort->value()))
+ if (!pnetserver->StartServer(ui.pageNetServer->sbPort->value()))
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to start the server"));
+ ShowErrorMessage(QMessageBox::tr("Unable to start server"));
+
delete pnetserver;
pnetserver = 0;
return;
@@ -1281,14 +1284,20 @@
void HWForm::ForcedDisconnect(const QString & reason)
{
- if(pnetserver) return; // we have server - let it care of all things
+ if (pnetserver)
+ return; // we have server - let it care of all things
if (hwnet)
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"')));
+ QString errorStr = QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"'));
+ ShowErrorMessage(errorStr);
+ }
+ while (ui.Pages->currentIndex() != ID_PAGE_NET
+ && ui.Pages->currentIndex() != ID_PAGE_NETTYPE
+ && ui.Pages->currentIndex() != ID_PAGE_MAIN)
+ {
+ GoBack();
}
- if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack();
}
void HWForm::NetConnected()
@@ -1389,9 +1398,12 @@
void HWForm::ShowErrorMessage(const QString & msg)
{
- QMessageBox::warning(this,
- "Hedgewars",
- msg);
+ QMessageBox msgMsg(this);
+ msgMsg.setIcon(QMessageBox::Warning);
+ msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
+ msgMsg.setText(msg);
+ msgMsg.setWindowModality(Qt::WindowModal);
+ msgMsg.exec();
}
void HWForm::GetRecord(RecordType type, const QByteArray & record)
@@ -1518,10 +1530,12 @@
// disconnect connections first to ensure their inexistance and not to connect twice
ui.pageNetGame->BtnStart->disconnect(hwnet);
ui.pageNetGame->BtnUpdate->disconnect(hwnet);
- ui.pageNetGame->setRoomName(hwnet->getRoom());
ui.pageNetGame->restrictJoins->disconnect(hwnet);
ui.pageNetGame->restrictTeamAdds->disconnect(hwnet);
ui.pageNetGame->disconnect(hwnet, SLOT(updateRoomName(const QString&)));
+
+ ui.pageNetGame->setRoomName(hwnet->getRoom());
+
connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame()));
connect(ui.pageNetGame, SIGNAL(askForUpdateRoomName(const QString &)), hwnet, SLOT(updateRoomName(const QString &)));
connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins()));
@@ -1682,8 +1696,17 @@
// hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home. This assumes no spaces in the data dir path
if (success) success = system(("sed -i 's/^\\(Exec=.*\\) \\([^ ]* %f\\)/\\1 "+cfgdir->absolutePath().replace(" ","\\\\ ").replace("/","\\/")+" \\2 --set-everything "+arguments+"/' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
#endif
- if (success) QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
- else QMessageBox::information(0, "", QMessageBox::tr("File association failed."));
+ if (success)
+ {
+ QMessageBox infoMsg(this);
+ infoMsg.setIcon(QMessageBox::Information);
+ infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success"));
+ infoMsg.setText(QMessageBox::tr("All file associations have been set"));
+ infoMsg.setWindowModality(Qt::WindowModal);
+ infoMsg.exec();
+ }
+ else
+ ShowErrorMessage(QMessageBox::tr("File association failed."));
}
void HWForm::saveDemoWithCustomName()
@@ -1719,8 +1742,7 @@
//Create Xml representation of google code issue first
if (!CreateIssueXml())
{
- QMessageBox::warning(this, QMessageBox::tr("Fields required"),
- QMessageBox::tr("Please fill out all fields"));
+ ShowErrorMessage(QMessageBox::tr("Please fill out all fields"));
return;
}
@@ -1766,18 +1788,23 @@
if (authToken.length() != 0)
{
- QMessageBox::information(this, QMessageBox::tr("Success"),
- QMessageBox::tr("Successfully posted the issue on code.google.com!"));
+
+ QMessageBox infoMsg(this);
+ infoMsg.setIcon(QMessageBox::Information);
+ infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success"));
+ infoMsg.setText(QMessageBox::tr("Successfully posted the issue on hedgewars.googlecode.com"));
+ infoMsg.setWindowModality(Qt::WindowModal);
+ infoMsg.exec();
+
ui.pageFeedback->summary->clear();
ui.pageFeedback->description->clear();
authToken = "";
return;
}
- if(!getAuthToken(str))
+ if (!getAuthToken(str))
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error during authentication with www.google.com"));
+ ShowErrorMessage(QMessageBox::tr("Error during authentication at google.com"));
return;
}
@@ -1790,12 +1817,10 @@
}
else if (authToken.length() == 0)
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error during authentication with www.google.com"));
+ ShowErrorMessage(QMessageBox::tr("Error during authentication at google.com"));
else
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error creating the issue"));
+ ShowErrorMessage(QMessageBox::tr("Error reporting the issue, please try again later (or visit hedgewars.googlecode.come directly)"));
authToken = "";
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/main.cpp
--- a/QTfrontend/main.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/main.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -91,10 +91,12 @@
if (!tmpdir.exists(dir))
if (!tmpdir.mkdir(dir))
{
- QMessageBox::critical(0,
- QObject::tr("Error"),
- QObject::tr("Cannot create directory %1").arg(dir),
- QObject::tr("OK"));
+ QMessageBox directoryMsg(QApplication::activeWindow());
+ directoryMsg.setIcon(QMessageBox::Warning);
+ directoryMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
+ directoryMsg.setText(QMessageBox::tr("Cannot create directory %1").arg(dir));
+ directoryMsg.setWindowModality(Qt::WindowModal);
+ directoryMsg.exec();
return false;
}
return true;
@@ -205,10 +207,14 @@
datadir->cd(*cDataDir);
if(!datadir->cd("hedgewars/Data"))
{
- QMessageBox::critical(0, QMessageBox::tr("Error"),
- QMessageBox::tr("Failed to open data directory:\n%1\n"
- "Please check your installation").
- arg(datadir->absolutePath()+"/hedgewars/Data"));
+ QMessageBox missingMsg(QApplication::activeWindow());
+ missingMsg.setIcon(QMessageBox::Critical);
+ missingMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
+ missingMsg.setText(QMessageBox::tr("Failed to open data directory:\n%1\n\n"
+ "Please check your installation!").
+ arg(datadir->absolutePath()+"/hedgewars/Data"));
+ missingMsg.setWindowModality(Qt::WindowModal);
+ missingMsg.exec();
return 1;
}
@@ -272,18 +278,10 @@
QFile resFile(":/res/css/" + fname);
- QFile & file = (extFile.exists()?extFile:resFile);
+ QFile & file = (extFile.exists() ? extFile : resFile);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- QTextStream in(&file);
- while (!in.atEnd())
- {
- QString line = in.readLine();
- if(!line.isEmpty())
- style.append(line);
- }
- }
+ style.append(file.readAll());
app.form = new HWForm(NULL, style);
app.form->show();
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/model/playerslistmodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/playerslistmodel.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,393 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "playerslistmodel.h"
+#include "hwconsts.h"
+
+PlayersListModel::PlayersListModel(QObject *parent) :
+ QAbstractListModel(parent)
+{
+
+}
+
+
+int PlayersListModel::rowCount(const QModelIndex &parent) const
+{
+ if(parent.isValid())
+ return 0;
+ else
+ return m_data.size();
+}
+
+
+QVariant PlayersListModel::data(const QModelIndex &index, int role) const
+{
+ if(!index.isValid() || index.row() < 0 || index.row() >= rowCount() || index.column() != 0)
+ return QVariant(QVariant::Invalid);
+
+ return m_data.at(index.row()).value(role);
+}
+
+
+bool PlayersListModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if(!index.isValid() || index.row() < 0 || index.row() >= rowCount() || index.column() != 0)
+ return false;
+
+ m_data[index.row()].insert(role, value);
+
+ emit dataChanged(index, index);
+
+ return true;
+}
+
+
+bool PlayersListModel::insertRow(int row, const QModelIndex &parent)
+{
+ return insertRows(row, 1, parent);
+}
+
+
+bool PlayersListModel::insertRows(int row, int count, const QModelIndex &parent)
+{
+ if(parent.isValid() || row > rowCount() || row < 0 || count < 1)
+ return false;
+
+ beginInsertRows(parent, row, row + count - 1);
+
+ for(int i = 0; i < count; ++i)
+ m_data.insert(row, DataEntry());
+
+ endInsertRows();
+
+ return true;
+}
+
+
+bool PlayersListModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+ if(parent.isValid() || row + count > rowCount() || row < 0 || count < 1)
+ return false;
+
+ beginRemoveRows(parent, row, row + count - 1);
+
+ for(int i = 0; i < count; ++i)
+ m_data.removeAt(row);
+
+ endRemoveRows();
+
+ return true;
+}
+
+
+void PlayersListModel::addPlayer(const QString & nickname)
+{
+ insertRow(rowCount());
+
+ QModelIndex mi = index(rowCount() - 1);
+ setData(mi, nickname);
+
+ checkFriendIgnore(mi);
+}
+
+
+void PlayersListModel::removePlayer(const QString & nickname)
+{
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
+
+ if(mil.size())
+ removeRow(mil[0].row());
+}
+
+
+void PlayersListModel::playerJoinedRoom(const QString & nickname)
+{
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
+
+ if(mil.size())
+ {
+ setData(mil[0], true, RoomFilterRole);
+ updateIcon(mil[0]);
+ updateSortData(mil[0]);
+ }
+}
+
+
+void PlayersListModel::playerLeftRoom(const QString & nickname)
+{
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
+
+ if(mil.size())
+ {
+ setData(mil[0], false, RoomFilterRole);
+ setData(mil[0], false, RoomAdmin);
+ setData(mil[0], false, Ready);
+ setData(mil[0], false, InGame);
+ updateIcon(mil[0]);
+ }
+}
+
+
+void PlayersListModel::setFlag(const QString &nickname, StateFlag flagType, bool isSet)
+{
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
+
+ if(mil.size())
+ {
+ setData(mil[0], isSet, flagType);
+
+ if(flagType == Friend || flagType == ServerAdmin
+ || flagType == Ignore || flagType == RoomAdmin)
+ updateSortData(mil[0]);
+
+ if(flagType == Friend)
+ {
+ if(isSet)
+ m_friendsSet.insert(nickname.toLower());
+ else
+ m_friendsSet.remove(nickname.toLower());
+
+ saveSet(m_friendsSet, "friends");
+ }
+
+ if(flagType == Ignore)
+ {
+ if(isSet)
+ m_ignoredSet.insert(nickname.toLower());
+ else
+ m_ignoredSet.remove(nickname.toLower());
+
+ saveSet(m_ignoredSet, "ignore");
+ }
+
+ updateIcon(mil[0]);
+ }
+}
+
+
+bool PlayersListModel::isFlagSet(const QString & nickname, StateFlag flagType)
+{
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
+
+ if(mil.size())
+ return mil[0].data(flagType).toBool();
+ else
+ return false;
+}
+
+void PlayersListModel::resetRoomFlags()
+{
+ for(int i = rowCount() - 1; i >= 0; --i)
+ {
+ QModelIndex mi = index(i);
+
+ if(mi.data(RoomFilterRole).toBool())
+ {
+ setData(mi, false, RoomFilterRole);
+ setData(mi, false, RoomAdmin);
+ setData(mi, false, Ready);
+ setData(mi, false, InGame);
+
+ updateSortData(mi);
+ updateIcon(mi);
+ }
+ }
+}
+
+void PlayersListModel::updateIcon(const QModelIndex & index)
+{
+ quint32 iconNum = 0;
+
+ QList flags;
+ flags
+ << index.data(Ready).toBool()
+ << index.data(ServerAdmin).toBool()
+ << index.data(RoomAdmin).toBool()
+ << index.data(Registered).toBool()
+ << index.data(Friend).toBool()
+ << index.data(Ignore).toBool()
+ << index.data(InGame).toBool()
+ << index.data(RoomFilterRole).toBool()
+ ;
+
+ for(int i = flags.size() - 1; i >= 0; --i)
+ if(flags[i])
+ iconNum |= 1 << i;
+
+ if(m_icons().contains(iconNum))
+ {
+ setData(index, m_icons().value(iconNum), Qt::DecorationRole);
+ }
+ else
+ {
+ QPixmap result(24, 16);
+ result.fill(Qt::transparent);
+
+ QPainter painter(&result);
+
+ if(index.data(RoomFilterRole).toBool())
+ {
+ if(index.data(InGame).toBool())
+ {
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/ingame.png"));
+ }
+ else
+ {
+ if(index.data(Ready).toBool())
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
+ else
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
+ }
+ }
+
+ QString mainIconName(":/res/chat/");
+
+ if(index.data(RoomAdmin).toBool())
+ mainIconName += "roomadmin";
+ else if(index.data(ServerAdmin).toBool())
+ mainIconName += "serveradmin";
+ else
+ mainIconName += "hedgehog";
+
+ if(!index.data(Registered).toBool())
+ mainIconName += "_gray";
+
+ painter.drawPixmap(8, 0, 16, 16, QPixmap(mainIconName + ".png"));
+
+ if(index.data(Ignore).toBool())
+ painter.drawPixmap(8, 0, 16, 16, QPixmap(":/res/chat/ignore.png"));
+ else
+ if(index.data(Friend).toBool())
+ painter.drawPixmap(8, 0, 16, 16, QPixmap(":/res/chat/friend.png"));
+
+ painter.end();
+
+ QIcon icon(result);
+
+ setData(index, icon, Qt::DecorationRole);
+ m_icons().insert(iconNum, icon);
+ }
+
+ if(index.data(Ignore).toBool())
+ setData(index, Qt::gray, Qt::ForegroundRole);
+ else
+ if(index.data(Friend).toBool())
+ setData(index, Qt::green, Qt::ForegroundRole);
+ else
+ setData(index, QBrush(QColor(0xff, 0xcc, 0x00)), Qt::ForegroundRole);
+}
+
+
+QHash & PlayersListModel::m_icons()
+{
+ static QHash iconsCache;
+
+ return iconsCache;
+}
+
+
+void PlayersListModel::updateSortData(const QModelIndex & index)
+{
+ QString result = QString("%1%2%3%4%5%6")
+ // room admins go first, then server admins, then friends
+ .arg(1 - index.data(RoomAdmin).toInt())
+ .arg(1 - index.data(ServerAdmin).toInt())
+ .arg(1 - index.data(Friend).toInt())
+ // ignored at bottom
+ .arg(index.data(Ignore).toInt())
+ // keep nicknames starting from non-letter character at bottom within group
+ // assume there are no empty nicks in list
+ .arg(index.data(Qt::DisplayRole).toString().at(0).isLetter() ? 0 : 1)
+ // sort ignoring case
+ .arg(index.data(Qt::DisplayRole).toString().toLower())
+ ;
+
+ setData(index, result, SortRole);
+}
+
+
+void PlayersListModel::setNickname(const QString &nickname)
+{
+ m_nickname = nickname;
+
+ loadSet(m_friendsSet, "friends");
+ loadSet(m_ignoredSet, "ignore");
+
+ for(int i = rowCount() - 1; i >= 0; --i)
+ checkFriendIgnore(index(i));
+}
+
+
+void PlayersListModel::checkFriendIgnore(const QModelIndex &mi)
+{
+ setData(mi, m_friendsSet.contains(mi.data().toString().toLower()), Friend);
+ setData(mi, m_ignoredSet.contains(mi.data().toString().toLower()), Ignore);
+
+ updateIcon(mi);
+ updateSortData(mi);
+}
+
+void PlayersListModel::loadSet(QSet & set, const QString & suffix)
+{
+ set.clear();
+
+ QString fileName = QString("%1/%2_%3.txt").arg(cfgdir->absolutePath(), m_nickname.toLower(), suffix);
+
+ QFile txt(fileName);
+ if(!txt.open(QIODevice::ReadOnly))
+ return;
+
+ QTextStream stream(&txt);
+ stream.setCodec("UTF-8");
+
+ while(!stream.atEnd())
+ {
+ QString str = stream.readLine();
+ if(str.startsWith(";") || str.isEmpty())
+ continue;
+
+ set.insert(str.trimmed());
+ }
+
+ txt.close();
+}
+
+void PlayersListModel::saveSet(const QSet & set, const QString & suffix)
+{
+ qDebug("saving set");
+
+ QString fileName = QString("%1/%2_%3.txt").arg(cfgdir->absolutePath(), m_nickname.toLower(), suffix);
+
+ QFile txt(fileName);
+
+ // list empty? => rather have no file for the list than an empty one
+ if (set.isEmpty())
+ {
+ if (txt.exists())
+ {
+ // try to remove file, if successful we're done here.
+ if (txt.remove())
+ return;
+ }
+ else
+ // there is no file
+ return;
+ }
+
+ if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
+ return;
+
+ QTextStream stream(&txt);
+ stream.setCodec("UTF-8");
+
+ stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl;
+
+ foreach(const QString & nick, set.values())
+ stream << nick << endl;
+
+ txt.close();
+}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/model/playerslistmodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/playerslistmodel.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,65 @@
+#ifndef PLAYERSLISTMODEL_H
+#define PLAYERSLISTMODEL_H
+
+#include
+#include
+#include
+#include
+#include
+
+class PlayersListModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ enum StateFlag {
+ Ready = Qt::UserRole,
+ ServerAdmin = Qt::UserRole + 1,
+ RoomAdmin = Qt::UserRole + 2,
+ Registered = Qt::UserRole + 3,
+ Friend = Qt::UserRole + 4,
+ Ignore = Qt::UserRole + 5,
+ InGame = Qt::UserRole + 6
+ };
+
+ enum SpecialRoles {
+ SortRole = Qt::UserRole + 100,
+ RoomFilterRole = Qt::UserRole + 101
+ };
+
+ explicit PlayersListModel(QObject *parent = 0);
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ QVariant data(const QModelIndex &index, int role) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole);
+ void setFlag(const QString & nickname, StateFlag flagType, bool isSet);
+ bool isFlagSet(const QString & nickname, StateFlag flagType);
+
+ bool insertRow(int row, const QModelIndex &parent = QModelIndex());
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+
+public slots:
+ void addPlayer(const QString & nickname);
+ void removePlayer(const QString & nickname);
+ void playerJoinedRoom(const QString & nickname);
+ void playerLeftRoom(const QString & nickname);
+ void resetRoomFlags();
+ void setNickname(const QString & nickname);
+
+private:
+ QHash & m_icons();
+ typedef QHash DataEntry;
+ QList m_data;
+ QSet m_friendsSet, m_ignoredSet;
+ QString m_nickname;
+
+ void updateIcon(const QModelIndex & index);
+ void updateSortData(const QModelIndex & index);
+ void loadSet(QSet & set, const QString & suffix);
+ void saveSet(const QSet & set, const QString & suffix);
+ void checkFriendIgnore(const QModelIndex & mi);
+};
+
+#endif // PLAYERSLISTMODEL_H
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/net/netserver.cpp
--- a/QTfrontend/net/netserver.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/net/netserver.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -17,8 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include
-
#include "hwconsts.h"
#include "netserver.h"
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/net/newnetclient.cpp
--- a/QTfrontend/net/newnetclient.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/net/newnetclient.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -20,12 +20,14 @@
#include
#include
#include
+#include
#include "hwconsts.h"
#include "newnetclient.h"
#include "proto.h"
#include "game.h"
#include "roomslistmodel.h"
+#include "playerslistmodel.h"
char delimeter='\n';
@@ -36,7 +38,24 @@
netClientState(Disconnected)
{
m_roomsListModel = new RoomsListModel(this);
-// socket stuff
+
+ m_playersModel = new PlayersListModel(this);
+
+ m_lobbyPlayersModel = new QSortFilterProxyModel(this);
+ m_lobbyPlayersModel->setSourceModel(m_playersModel);
+ m_lobbyPlayersModel->setSortRole(PlayersListModel::SortRole);
+ m_lobbyPlayersModel->setDynamicSortFilter(true);
+ m_lobbyPlayersModel->sort(0);
+
+ m_roomPlayersModel = new QSortFilterProxyModel(this);
+ m_roomPlayersModel->setSourceModel(m_playersModel);
+ m_roomPlayersModel->setSortRole(PlayersListModel::SortRole);
+ m_roomPlayersModel->setDynamicSortFilter(true);
+ m_roomPlayersModel->sort(0);
+ m_roomPlayersModel->setFilterRole(PlayersListModel::RoomFilterRole);
+ m_roomPlayersModel->setFilterFixedString("true");
+
+ // socket stuff
connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
@@ -83,9 +102,6 @@
RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room));
isChief = true;
-
- //set our ready status to be true
- RawSendNet(QString("TOGGLE_READY"));
}
void HWNewNet::JoinRoom(const QString & room)
@@ -224,6 +240,7 @@
if (lst[0] == "NICK")
{
mynick = lst[1];
+ m_playersModel->setNickname(mynick);
return ;
}
@@ -375,13 +392,19 @@
if (isChief && !setFlag) ToggleReady();
else emit setMyReadyStatus(setFlag);
}
- emit setReadyStatus(nick, setFlag);
+ m_playersModel->setFlag(nick, PlayersListModel::Ready, setFlag);
}
break;
// flag indicating if a player is a registered user
case 'u':
- emit setRegisteredStatus(nicks, setFlag);
+ foreach(const QString & nick, nicks)
+ m_playersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
+ break;
+
+ case 'g':
+ foreach(const QString & nick, nicks)
+ m_playersModel->setFlag(nick, PlayersListModel::InGame, setFlag);
break;
// flag indicating if a player is the host/master of the room
@@ -394,7 +417,7 @@
emit roomMaster(isChief);
}
- emit setRoomMasterStatus(nick, setFlag);
+ m_playersModel->setFlag(nick, PlayersListModel::RoomAdmin, setFlag);
}
break;
@@ -405,7 +428,7 @@
if (nick == mynick)
emit adminAccess(setFlag);
- emit setAdminStatus(nick, setFlag);
+ m_playersModel->setFlag(nick, PlayersListModel::ServerAdmin, setFlag);
}
break;
@@ -422,6 +445,8 @@
netClientState = InLobby;
askRoomsList();
emit LeftRoom(tr("You got kicked"));
+ m_playersModel->resetRoomFlags();
+
return;
}
@@ -444,6 +469,7 @@
emit nickAddedLobby(lst[i], false);
emit chatStringLobby(lst[i], tr("%1 *** %2 has joined").arg('\x03').arg("|nick|"));
+ m_playersModel->addPlayer(lst[i]);
}
return;
}
@@ -466,6 +492,11 @@
QString roomName = tmp.takeFirst();
m_roomsListModel->updateRoom(roomName, tmp);
+
+ // keep track of room name so correct name is displayed when you become room admin
+ if(myroom == roomName)
+ myroom = tmp[1];
+
return;
}
@@ -487,6 +518,9 @@
emit chatStringLobby(tr("%1 *** %2 has left").arg('\x03').arg(lst[1]));
else
emit chatStringLobby(lst[1], tr("%1 *** %2 has left (%3)").arg('\x03').arg("|nick|", lst[2]));
+
+ m_playersModel->removePlayer(lst[1]);
+
return;
}
@@ -561,6 +595,7 @@
emit nickAdded(lst[i], isChief && (lst[i] != mynick));
emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
+ m_playersModel->playerJoinedRoom(lst[i]);
}
return;
}
@@ -609,7 +644,7 @@
if(lst[0] == "ROOMABANDONED")
{
netClientState = InLobby;
- askRoomsList();
+ m_playersModel->resetRoomFlags();
emit LeftRoom(tr("Room destroyed"));
return;
}
@@ -687,6 +722,7 @@
{
emit nickAdded(lst[i], isChief && (lst[i] != mynick));
emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
+ m_playersModel->playerJoinedRoom(lst[i]);
}
return;
}
@@ -703,6 +739,7 @@
emit chatStringFromNet(tr("%1 *** %2 has left").arg('\x03').arg(lst[1]));
else
emit chatStringFromNet(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2]));
+ m_playersModel->playerLeftRoom(lst[1]);
return;
}
@@ -870,8 +907,8 @@
void HWNewNet::partRoom()
{
netClientState = InLobby;
+ m_playersModel->resetRoomFlags();
RawSendNet(QString("PART"));
- askRoomsList();
}
bool HWNewNet::isInRoom()
@@ -915,3 +952,13 @@
{
return m_roomsListModel;
}
+
+QAbstractItemModel *HWNewNet::lobbyPlayersModel()
+{
+ return m_lobbyPlayersModel;
+}
+
+QAbstractItemModel *HWNewNet::roomPlayersModel()
+{
+ return m_roomPlayersModel;
+}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/net/newnetclient.h
--- a/QTfrontend/net/newnetclient.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/net/newnetclient.h Sun Oct 28 15:12:37 2012 +0100
@@ -32,6 +32,9 @@
class GameCFGWidget;
class TeamSelWidget;
class RoomsListModel;
+class PlayersListModel;
+class QSortFilterProxyModel;
+class QAbstractItemModel;
extern char delimeter;
@@ -55,6 +58,8 @@
QString getRoom();
QString getHost();
RoomsListModel * roomsListModel();
+ QAbstractItemModel * lobbyPlayersModel();
+ QAbstractItemModel * roomPlayersModel();
private:
bool isChief;
@@ -65,6 +70,9 @@
QString seed;
bool m_game_connected;
RoomsListModel * m_roomsListModel;
+ PlayersListModel * m_playersModel;
+ QSortFilterProxyModel * m_lobbyPlayersModel;
+ QSortFilterProxyModel * m_roomPlayersModel;
QStringList cmdbuf;
@@ -116,11 +124,7 @@
void serverMessageOld(const QString &);
void latestProtocolVar(int);
- void setReadyStatus(const QString & nick, bool isReady);
void setMyReadyStatus(bool isReady);
- void setAdminStatus(const QString & nick, bool isAdmin);
- void setRoomMasterStatus(const QString & nick, bool isAdmin);
- void setRegisteredStatus(const QStringList & nicks, bool isRegistered);
public slots:
void ToggleReady();
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/net/recorder.cpp
--- a/QTfrontend/net/recorder.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/net/recorder.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -18,7 +18,6 @@
#include
#include
-//#include
#include "recorder.h"
#include "gameuiconfig.h"
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/net/tcpBase.cpp
--- a/QTfrontend/net/tcpBase.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/net/tcpBase.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -21,7 +21,7 @@
#include
#include
-
+#include
#include
#include "hwconsts.h"
@@ -45,10 +45,14 @@
IPCServer->setMaxPendingConnections(1);
if (!IPCServer->listen(QHostAddress::LocalHost))
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to start the server: %1.")
- .arg(IPCServer->errorString()));
- exit(0); // FIXME - should be graceful exit here
+ QMessageBox deniedMsg(QApplication::activeWindow());
+ deniedMsg.setIcon(QMessageBox::Critical);
+ deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+ deniedMsg.setText(QMessageBox::tr("Unable to start the server: %1.").arg(IPCServer->errorString()));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
+ exit(0); // FIXME - should be graceful exit here (lower Critical -> Warning above when implemented)
}
}
ipc_port=IPCServer->serverPort();
@@ -113,9 +117,13 @@
void TCPBase::StartProcessError(QProcess::ProcessError error)
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to run engine: %1 (")
- .arg(error) + bindir->absolutePath() + "/hwengine)");
+ QMessageBox deniedMsg(QApplication::activeWindow());
+ deniedMsg.setIcon(QMessageBox::Critical);
+ deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+ deniedMsg.setText(QMessageBox::tr("Unable to run engine at ") + bindir->absolutePath() + "/hwengine\n" +
+ QMessageBox::tr("Error code: %1").arg(error));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
ClientDisconnect();
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/friend.png
Binary file QTfrontend/res/chat/friend.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/hedgehog.png
Binary file QTfrontend/res/chat/hedgehog.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/hedgehog_gray.png
Binary file QTfrontend/res/chat/hedgehog_gray.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/ignore.png
Binary file QTfrontend/res/chat/ignore.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/ingame.png
Binary file QTfrontend/res/chat/ingame.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/lamp.png
Binary file QTfrontend/res/chat/lamp.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/lamp_off.png
Binary file QTfrontend/res/chat/lamp_off.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/roomadmin.png
Binary file QTfrontend/res/chat/roomadmin.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/roomadmin_gray.png
Binary file QTfrontend/res/chat/roomadmin_gray.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/serveradmin.png
Binary file QTfrontend/res/chat/serveradmin.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat/serveradmin_gray.png
Binary file QTfrontend/res/chat/serveradmin_gray.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_default.png
Binary file QTfrontend/res/chat_default.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_default_off.png
Binary file QTfrontend/res/chat_default_off.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_default_on.png
Binary file QTfrontend/res/chat_default_on.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_friend.png
Binary file QTfrontend/res/chat_friend.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_friend_off.png
Binary file QTfrontend/res/chat_friend_off.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_friend_on.png
Binary file QTfrontend/res/chat_friend_on.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_ignore.png
Binary file QTfrontend/res/chat_ignore.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_ignore_off.png
Binary file QTfrontend/res/chat_ignore_off.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/chat_ignore_on.png
Binary file QTfrontend/res/chat_ignore_on.png has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/res/css/qt.css
--- a/QTfrontend/res/css/qt.css Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/res/css/qt.css Sun Oct 28 15:12:37 2012 +0100
@@ -32,7 +32,7 @@
a { color:#c8c8ff; }
-QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox,
+QLineEdit, QListWidget, QListView, QTableView, QTextBrowser, QSpinBox, QComboBox,
QComboBox QAbstractItemView, QPlainTextEdit, QMenu::item {
background-color: rgba(13, 5, 68, 70%);
}
@@ -41,7 +41,7 @@
border: solid; border-width: 3px; border-color: #ffcc00;
}
-QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView,
+QPushButton, QListWidget, QListView, QTableView, QLineEdit, QHeaderView,
QTextBrowser, QSpinBox, QToolBox, QComboBox, QPlainTextEdit,
QComboBox QAbstractItemView, IconedGroupBox,
.QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget,
@@ -51,17 +51,17 @@
border-color: #ffcc00;
}
-QPushButton:hover, QLineEdit:hover, QListWidget:hover,
+QPushButton:hover, QLineEdit:hover, QListWidget:hover, QListView:hover,
QSpinBox:hover, QToolBox:hover, QComboBox:hover {
border-color: yellow;
}
-QLineEdit, QListWidget,QTableView, QTextBrowser,
+QLineEdit, QListWidget, QListView, QTableView, QTextBrowser,
QSpinBox, QToolBox, QPlainTextEdit {
border-radius: 10px;
}
-QLineEdit, QLabel, QHeaderView, QListWidget, QTableView,
+QLineEdit, QLabel, QHeaderView, QListWidget, QListView, QTableView,
QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView,
IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget,
SelWeaponWidget, QCheckBox, QRadioButton, QPushButton, QPlainTextEdit {
@@ -116,17 +116,18 @@
alternate-background-color: #2f213a;
gridline-color: transparent;
}
-
+QTabWidget::pane { top: -2px; }
QTabBar::tab {
-border-bottom-width: 0;
border-radius: 0;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
padding: 3px;
+background-color: #00351d;
+color: #ffcc00;
}
-QTabBar::tab:!selected {
-color: #0d0544;
-background-color: #ffcc00;
+QTabBar::tab:selected {
+border-bottom-color: #0d0544;
+border-bottom-width: 0;
}
QSpinBox::up-button{
background: transparent;
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/dialog/ask_quit.cpp
--- a/QTfrontend/ui/dialog/ask_quit.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/dialog/ask_quit.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -58,6 +58,8 @@
QTimer * timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updateList()));
timer->start(200);
+
+ this->setWindowModality(Qt::WindowModal);
}
void HWAskQuitDialog::goToPageVideos()
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/dialog/input_ip.cpp
--- a/QTfrontend/ui/dialog/input_ip.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/dialog/input_ip.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -60,6 +60,8 @@
connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
+
+ this->setWindowModality(Qt::WindowModal);
}
void HWHostPortDialog::setDefaultPort()
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/dialog/input_password.cpp
--- a/QTfrontend/ui/dialog/input_password.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/dialog/input_password.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -50,4 +50,6 @@
connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ this->setWindowModality(Qt::WindowModal);
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/dialog/upload_video.cpp
--- a/QTfrontend/ui/dialog/upload_video.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/dialog/upload_video.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -32,7 +32,6 @@
#include
#include
#include
-#include
#include "upload_video.h"
#include "hwconsts.h"
@@ -159,6 +158,8 @@
connect(btnUpload, SIGNAL(clicked()), this, SLOT(upload()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ this->setWindowModality(Qt::WindowModal);
}
void HWUploadVideoDialog::showEvent(QShowEvent * event)
@@ -233,7 +234,14 @@
errorStr += QMessageBox::tr("Login or password is incorrect");
else
errorStr += reply->errorString();
- QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
+
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Video upload - Error"));
+ deniedMsg.setText(errorStr);
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
setEditable(true);
return;
}
@@ -288,7 +296,14 @@
{
QString errorStr = QMessageBox::tr("Error while sending metadata to youtube.com:\n");
errorStr += reply->errorString();
- QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
+
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Video upload - Error"));
+ deniedMsg.setText(errorStr);
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
setEditable(true);
return;
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/AbstractPage.cpp
--- a/QTfrontend/ui/page/AbstractPage.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/AbstractPage.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -25,8 +25,8 @@
#include
#include
#include
-#include
-#include
+
+#include "qpushbuttonwithsound.h"
AbstractPage::AbstractPage(QWidget* parent)
{
@@ -93,6 +93,27 @@
}
return btn;
}
+QPushButton* AbstractPage::formattedSoundlessButton(const QString & name, bool hasIcon)
+{
+ QPushButton* btn = new QPushButton(this);
+
+ if (hasIcon)
+ {
+ const QIcon& lp=QIcon(name);
+ QSize sz = lp.actualSize(QSize(65535, 65535));
+ btn->setIcon(lp);
+ btn->setFixedSize(sz);
+ btn->setIconSize(sz);
+ btn->setFlat(true);
+ btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ }
+ else
+ {
+ btn->setFont(*font14);
+ btn->setText(name);
+ }
+ return btn;
+}
QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
{
@@ -108,6 +129,13 @@
return btn;
}
+QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
+{
+ QPushButton* btn = formattedSoundlessButton(name, hasIcon);
+ box->addWidget(btn, where);
+ return btn;
+}
+
void AbstractPage::setBackButtonVisible(bool visible)
{
btnBack->setVisible(visible);
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/AbstractPage.h
--- a/QTfrontend/ui/page/AbstractPage.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/AbstractPage.h Sun Oct 28 15:12:37 2012 +0100
@@ -138,6 +138,7 @@
* @return the button.
*/
QPushButtonWithSound * formattedButton(const QString & name, bool hasIcon = false);
+ QPushButton * formattedSoundlessButton(const QString & name, bool hasIcon = false);
/**
* @brief Creates a default formatted button and adds it to a
@@ -167,6 +168,7 @@
* @return the button.
*/
QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
+ QPushButton* addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
/**
* @brief Changes visibility of the back-button.
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagedata.cpp
--- a/QTfrontend/ui/page/pagedata.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagedata.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -222,10 +222,7 @@
return false;
}
- if (this->isVisible())
- m_contentDownloaded = true;
- else
- DataManager::instance().reload();
+ m_contentDownloaded = true;
}
file.close();
@@ -248,6 +245,6 @@
if (m_contentDownloaded)
{
m_contentDownloaded = false;
- DataManager::instance().reload();
+ //DataManager::instance().reload();
}
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageeditteam.cpp
--- a/QTfrontend/ui/page/pageeditteam.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -134,7 +134,7 @@
CBVoicepack = new QComboBox(GBoxTeam);
hbox->addWidget(CBVoicepack, 100);
- btnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true);
+ btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
hbox->setStretchFactor(btnTestSound, 1);
GBTLayout->addLayout(hbox, 4, 1);
@@ -383,9 +383,14 @@
void PageEditTeam::deleteTeam(const QString & name)
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel, this);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Teams - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the team '%1'?").arg(name));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
HWTeam(name).deleteFile();
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagegamestats.cpp
--- a/QTfrontend/ui/page/pagegamestats.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagegamestats.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -140,7 +140,7 @@
while (i != healthPoints.constEnd())
{
quint32 c = i.key();
- QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255));
+ //QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255));
QVector hps = i.value();
QPainterPath path;
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagemain.cpp
--- a/QTfrontend/ui/page/pagemain.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagemain.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -58,9 +58,11 @@
BtnInfo->setWhatsThis(tr("Read about who is behind the Hedgewars Project"));
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter);
+#if 0
BtnFeedback = addButton("Feedback", pageLayout, 4, 0, 1, 4, false);
BtnFeedback->setWhatsThis(tr("Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars"));
pageLayout->setAlignment(BtnFeedback, Qt::AlignHCenter);
+#endif
BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 5, 0, 1, 4, false);
//BtnDataDownload->setToolTip(tr(Downloadable Content"));
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagenet.cpp
--- a/QTfrontend/ui/page/pagenet.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagenet.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -108,7 +108,12 @@
QModelIndex mi = tvServersList->currentIndex();
if(!mi.isValid())
{
- QMessageBox::information(this, tr("Error"), tr("Please select server from the list above"));
+ QMessageBox serverMsg(this);
+ serverMsg.setIcon(QMessageBox::Warning);
+ serverMsg.setWindowTitle(QMessageBox::tr("Netgame - Error"));
+ serverMsg.setText(QMessageBox::tr("Please select a server from the list"));
+ serverMsg.setWindowModality(Qt::WindowModal);
+ serverMsg.exec();
return;
}
QString host = model->index(mi.row(), 1).data().toString();
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagenetgame.cpp
--- a/QTfrontend/ui/page/pagenetgame.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagenetgame.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -38,7 +38,6 @@
// chatwidget
pChatWidget = new HWChatWidget(this, m_gameSettings, true);
- pChatWidget->setShowReady(true); // show status bulbs by default
pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus
pChatWidget->setIgnoreListKick(true); // kick ignored players automatically
pageLayout->addWidget(pChatWidget, 2, 0, 1, 2);
@@ -63,9 +62,6 @@
{
QHBoxLayout * bottomLayout = new QHBoxLayout;
- btnDLC = addButton(tr("DLC"), bottomLayout, 0);
- btnDLC->setWhatsThis(tr("Downloadable Content"));
-
leRoomName = new HistoryLineEdit(this,10);
leRoomName->setMaxLength(60);
leRoomName->setMinimumWidth(200);
@@ -80,23 +76,21 @@
BtnGo->setMinimumHeight(50);
bottomLayout->addWidget(leRoomName);
- BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 2);
+ BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1);
bottomLayout->addStretch();
bottomLayout->addWidget(BtnGo);
- BtnMaster = addButton(tr("Control"), bottomLayout, 4);
+ BtnMaster = addButton(tr("Control"), bottomLayout, 3);
bottomLayout->insertStretch(3, 100);
- BtnStart = addButton(QAction::tr("Start"), bottomLayout, 4);
+ BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3);
return bottomLayout;
}
void PageNetGame::connectSignals()
{
- connect(btnDLC, SIGNAL(clicked()), this, SIGNAL(DLCClicked()));
-
connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick()));
@@ -158,10 +152,12 @@
else
{
leRoomName->clear();
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please enter room name"),
- tr("OK"));
+ QMessageBox roomMsg(this);
+ roomMsg.setIcon(QMessageBox::Warning);
+ roomMsg.setWindowTitle(QMessageBox::tr("Netgame - Error"));
+ roomMsg.setText(QMessageBox::tr("Please enter room name"));
+ roomMsg.setWindowModality(Qt::WindowModal);
+ roomMsg.exec();
}
}
@@ -178,10 +174,6 @@
BtnStart->setVisible(isMaster);
BtnUpdate->setVisible(isMaster);
leRoomName->setVisible(isMaster);
-
- //disable the `toggle ready` button, because the start button does the same
- //job when the user is chief
- BtnGo->setVisible(!isMaster);
}
void PageNetGame::setUser(const QString & nickname)
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagenetgame.h
--- a/QTfrontend/ui/page/pagenetgame.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagenetgame.h Sun Oct 28 15:12:37 2012 +0100
@@ -65,7 +65,6 @@
signals:
void SetupClicked();
- void DLCClicked();
void askForUpdateRoomName(const QString &);
private:
@@ -77,7 +76,6 @@
HistoryLineEdit * leRoomName;
QPushButton * btnSetup;
- QPushButton * btnDLC;
};
#endif
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageoptions.cpp
--- a/QTfrontend/ui/page/pageoptions.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageoptions.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -442,7 +442,55 @@
gbCLayout->addWidget(BtnAssociateFiles);
}
- page2Layout->addWidget(new QWidget(this), 1, 0);
+ {
+ IconedGroupBox * gbProxy = new IconedGroupBox(this);
+ gbProxy->setIcon(QIcon(":/res/Settings.png"));
+ gbProxy->setTitle(QGroupBox::tr("Proxy settings"));
+ page2Layout->addWidget(gbProxy, 1, 0);
+ QGridLayout * gbLayout = new QGridLayout(gbProxy);
+
+ QStringList sl;
+ sl
+ << tr("Proxy host")
+ << tr("Proxy port")
+ << tr("Proxy login")
+ << tr("Proxy password")
+ ;
+ for(int i = 0; i < sl.size(); ++i)
+ {
+ QLabel * l = new QLabel(gbProxy);
+ l->setText(sl[i]);
+ gbLayout->addWidget(l, i + 1, 0);
+ }
+
+ cbProxyType = new QComboBox(gbProxy);
+ cbProxyType->addItems(QStringList()
+ << tr("No proxy")
+ << tr("System proxy settings")
+ << tr("Socks5 proxy")
+ << tr("HTTP proxy"));
+ gbLayout->addWidget(cbProxyType, 0, 1);
+
+ leProxy = new QLineEdit(gbProxy);
+ gbLayout->addWidget(leProxy, 1, 1);
+
+ sbProxyPort = new QSpinBox(gbProxy);
+ sbProxyPort->setMaximum(65535);
+ gbLayout->addWidget(sbProxyPort, 2, 1);
+
+ leProxyLogin = new QLineEdit(gbProxy);
+ gbLayout->addWidget(leProxyLogin, 3, 1);
+
+ leProxyPassword = new QLineEdit(gbProxy);
+ leProxyPassword->setEchoMode(QLineEdit::Password);
+ gbLayout->addWidget(leProxyPassword, 4, 1);
+
+
+ connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
+ onProxyTypeChanged();
+ }
+
+ page2Layout->addWidget(new QWidget(this), 2, 0);
}
previousQuality = this->SLQuality->value();
@@ -576,3 +624,13 @@
m_colorButtons[topLeft.row()]->setStyleSheet(QString("background: %1").arg(model->item(topLeft.row())->data().value().name()));
}
+
+void PageOptions::onProxyTypeChanged()
+{
+ bool b = cbProxyType->currentIndex() != NoProxy && cbProxyType->currentIndex() != SystemProxy ;
+
+ sbProxyPort->setEnabled(b);
+ leProxy->setEnabled(b);
+ leProxyLogin->setEnabled(b);
+ leProxyPassword->setEnabled(b);
+}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageoptions.h
--- a/QTfrontend/ui/page/pageoptions.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageoptions.h Sun Oct 28 15:12:37 2012 +0100
@@ -30,6 +30,13 @@
Q_OBJECT
public:
+ enum ProxyTypes {
+ NoProxy = 0,
+ SystemProxy = 1,
+ Socks5Proxy = 2,
+ HTTPProxy = 3
+ };
+
PageOptions(QWidget* parent = 0);
QCheckBox *WeaponTooltip;
@@ -44,7 +51,7 @@
QComboBox *CBLanguage;
- IconedGroupBox *teamsBox;;
+ IconedGroupBox *teamsBox;
QPushButton *BtnAssociateFiles;
QComboBox *CBTeamName;
IconedGroupBox *AGGroupBox;
@@ -71,6 +78,11 @@
QLineEdit *editNetPassword;
QSlider *SLQuality;
QCheckBox *CBFrontendEffects;
+ QComboBox * cbProxyType;
+ QSpinBox * sbProxyPort;
+ QLineEdit * leProxy;
+ QLineEdit * leProxyLogin;
+ QLineEdit * leProxyPassword;
void setTeamOptionsEnabled(bool enabled);
@@ -105,6 +117,7 @@
void savePwdChanged(int state);
void colorButtonClicked(int i);
void onColorModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
+ void onProxyTypeChanged();
};
#endif
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageplayrecord.cpp
--- a/QTfrontend/ui/page/pageplayrecord.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageplayrecord.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -120,10 +120,12 @@
QListWidgetItem * curritem = DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list"),
- tr("OK"));
+ QMessageBox recordMsg(this);
+ recordMsg.setIcon(QMessageBox::Warning);
+ recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ recordMsg.setText(QMessageBox::tr("Please select record from the list"));
+ recordMsg.setWindowModality(Qt::WindowModal);
+ recordMsg.exec();
return ;
}
QFile rfile(curritem->data(Qt::UserRole).toString());
@@ -144,7 +146,14 @@
ok = rfile.rename(newfullname);
if(!ok)
- QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname);
+ {
+ QMessageBox renameMsg(this);
+ renameMsg.setIcon(QMessageBox::Warning);
+ renameMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ renameMsg.setText(QMessageBox::tr("Cannot rename to ") + newfullname);
+ renameMsg.setWindowModality(Qt::WindowModal);
+ renameMsg.exec();
+ }
else
FillFromDir(recType);
}
@@ -155,10 +164,12 @@
QListWidgetItem * curritem = DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list"),
- tr("OK"));
+ QMessageBox recordMsg(this);
+ recordMsg.setIcon(QMessageBox::Warning);
+ recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ recordMsg.setText(QMessageBox::tr("Please select record from the list"));
+ recordMsg.setWindowModality(Qt::WindowModal);
+ recordMsg.exec();
return ;
}
QFile rfile(curritem->data(Qt::UserRole).toString());
@@ -167,7 +178,14 @@
ok = rfile.remove();
if(!ok)
- QMessageBox::critical(this, tr("Error"), tr("Cannot delete file"));
+ {
+ QMessageBox removeMsg(this);
+ removeMsg.setIcon(QMessageBox::Warning);
+ removeMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ removeMsg.setText(QMessageBox::tr("Cannot delete file ") + rfile.fileName());
+ removeMsg.setWindowModality(Qt::WindowModal);
+ removeMsg.exec();
+ }
else
{
int i = DemosList->row(curritem);
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageroomslist.cpp
--- a/QTfrontend/ui/page/pageroomslist.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageroomslist.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -101,7 +101,6 @@
BtnCreate = addButton(tr("Create"), pageLayout, 0, 2);
BtnJoin = addButton(tr("Join"), pageLayout, 1, 2);
- BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2);
BtnClear = addButton(tr("Clear"), pageLayout, 4, 2);
// strech all but the buttons column
@@ -143,7 +142,6 @@
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
- connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick()));
connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick()));
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick()));
connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onFilterChanged()));
@@ -426,10 +424,14 @@
if (roomName->text().size())
emit askForCreateRoom(roomName->text());
else
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please enter room name"),
- tr("OK"));
+ {
+ QMessageBox roomNameMsg(this);
+ roomNameMsg.setIcon(QMessageBox::Warning);
+ roomNameMsg.setWindowTitle(QMessageBox::tr("Room Name - Error"));
+ roomNameMsg.setText(QMessageBox::tr("Please enter room name"));
+ roomNameMsg.setWindowModality(Qt::WindowModal);
+ roomNameMsg.exec();
+ }
}
void PageRoomsList::onJoinClick()
@@ -438,10 +440,12 @@
if(mdl.size() != 1)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select room from the list"),
- tr("OK"));
+ QMessageBox roomNameMsg(this);
+ roomNameMsg.setIcon(QMessageBox::Warning);
+ roomNameMsg.setWindowTitle(QMessageBox::tr("Room Name - Error"));
+ roomNameMsg.setText(QMessageBox::tr("Please select room from the list"));
+ roomNameMsg.setWindowModality(Qt::WindowModal);
+ roomNameMsg.exec();
return;
}
@@ -469,10 +473,15 @@
void PageRoomsList::onJoinConfirmation(const QString & room)
{
- if (QMessageBox::warning(this,
- tr("Warning"),
- tr("The game you are trying to join has started.\nDo you still want to join the room?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
+
+ QMessageBox reallyJoinMsg(this);
+ reallyJoinMsg.setIcon(QMessageBox::Question);
+ reallyJoinMsg.setWindowTitle(QMessageBox::tr("Room Name - Are you sure?"));
+ reallyJoinMsg.setText(QMessageBox::tr("The game you are trying to join has started.\nDo you still want to join the room?"));
+ reallyJoinMsg.setWindowModality(Qt::WindowModal);
+ reallyJoinMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyJoinMsg.exec() == QMessageBox::Ok)
{
emit askForJoinRoom(room);
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pageroomslist.h
--- a/QTfrontend/ui/page/pageroomslist.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pageroomslist.h Sun Oct 28 15:12:37 2012 +0100
@@ -42,7 +42,6 @@
QTableView * roomsList;
QPushButton * BtnCreate;
QPushButton * BtnJoin;
- QPushButton * BtnRefresh;
QPushButton * BtnAdmin;
QPushButton * BtnClear;
QComboBox * CBState;
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagescheme.cpp
--- a/QTfrontend/ui/page/pagescheme.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagescheme.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -516,12 +516,30 @@
void PageScheme::deleteRow()
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel);
+ int numberOfDefaultSchemes = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes;
+ if (selectScheme->currentIndex() < numberOfDefaultSchemes)
+ {
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Schemes - Warning"));
+ deniedMsg.setText(QMessageBox::tr("Cannot delete default scheme '%1'!").arg(selectScheme->currentText()));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+ }
+ else
+ {
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Schemes - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the game scheme '%1'?").arg(selectScheme->currentText()));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
- {
- QAbstractItemModel * model = mapper->model();
- model->removeRow(selectScheme->currentIndex());
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
+ {
+ QAbstractItemModel * model = mapper->model();
+ model->removeRow(selectScheme->currentIndex());
+ }
}
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/page/pagevideos.cpp
--- a/QTfrontend/ui/page/pagevideos.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/page/pagevideos.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -839,11 +839,14 @@
return;
// ask user if (s)he is serious
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do remove %1?").arg(item->name),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the video '%1'?").arg(item->name));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyDeleteMsg.exec() != QMessageBox::Ok)
return;
// remove
@@ -860,11 +863,14 @@
return;
// ask user if (s)he is serious
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do remove %1 file(s)?", "", num).arg(num),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to remove %1 file(s)?", "", num).arg(num));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyDeleteMsg.exec() != QMessageBox::Ok)
return;
// remove
@@ -1081,11 +1087,15 @@
if (item->pUploading)
{
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do cancel uploading %1?").arg(item->name),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ // ask user if (s)he is serious
+ QMessageBox reallyStopMsg(this);
+ reallyStopMsg.setIcon(QMessageBox::Question);
+ reallyStopMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyStopMsg.setText(QMessageBox::tr("Do you really want to cancel uploading %1?").arg(item->name));
+ reallyStopMsg.setWindowModality(Qt::WindowModal);
+ reallyStopMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyStopMsg.exec() != QMessageBox::Ok)
return;
item->pUploading->deleteLater();
filesTable->setCellWidget(row, vcProgress, NULL); // remove progress bar
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/about.cpp
--- a/QTfrontend/ui/widget/about.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/about.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -85,6 +85,10 @@
"Lua game modes and missions: John Lambert <redgrinner@gmail.com> "
"Frontend improvements: Mayur Pawashe <zorgiepoo@gmail.com> "
"Android port: Richard Deurwaarder <xeli@xelification.com> "
+ "Android netplay, portability abstraction: Simeon Maxein <smaxein@googlemail.com> "
+ "WebGL port, some pas2c and GLES2 work: Meng Xiangyun <xymengxy@gmail.com> "
+ "Video recording: Stepan Podoskin <stepik-777@mail.ru> "
+ "Campaign support, first campaign: Szabolcs Orbàn <szabibibi@gmail.com> "
"
" +
QLabel::tr("Art:") + "
"
@@ -123,7 +127,7 @@
"Chinese: Jie Luo <lililjlj@gmail.com> "
"English: Andrey Korotaev <unC0Rr@gmail.com> "
"Finnish: Nina Kuisma <ninnnu@gmail.com> "
- "French: Antoine Turmel <geekshadow@gmail.com> "
+ "French: Antoine Turmel <geekshadow@gmail.com>, Clement Woitrain <sphrixclement@gmail.com> "
"German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@" "ercatec.net> "
"Greek: <talos_kriti@yahoo.gr> "
"Italian: Luca Bonora <bonora.luca@gmail.com>, Marco Bresciani "
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/chatwidget.cpp
--- a/QTfrontend/ui/widget/chatwidget.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -19,88 +19,26 @@
#include
#include
-#include
#include
-#include
#include
-#include
-#include
#include
#include
#include
-#include
#include
-#include
#include
#include
-
-#include
-
+#include
+#include
+#include
+#include
#include "DataManager.h"
#include "hwconsts.h"
#include "gameuiconfig.h"
+#include "playerslistmodel.h"
#include "chatwidget.h"
-ListWidgetNickItem::ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored) : QListWidgetItem(nick)
-{
- this->aFriend = isFriend;
- this->isIgnored = isIgnored;
-}
-
-void ListWidgetNickItem::setFriend(bool isFriend)
-{
- this->aFriend = isFriend;
-}
-
-void ListWidgetNickItem::setIgnored(bool isIgnored)
-{
- this->isIgnored = isIgnored;
-}
-
-bool ListWidgetNickItem::isFriend()
-{
- return aFriend;
-}
-
-bool ListWidgetNickItem::ignored()
-{
- return isIgnored;
-}
-
-bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const
-{
- // case in-sensitive comparison of the associated strings
- // chars that are no letters are sorted at the end of the list
-
- ListWidgetNickItem otherNick = const_cast(dynamic_cast(other));
-
- // ignored always down
- if (isIgnored != otherNick.ignored())
- return !isIgnored;
-
- // friends always up
- if (aFriend != otherNick.isFriend())
- return aFriend;
-
- QString txt1 = text().toLower();
- QString txt2 = other.text().toLower();
-
- bool firstIsShorter = (txt1.size() < txt2.size());
- int len = firstIsShorter?txt1.size():txt2.size();
-
- for (int i = 0; i < len; i++)
- {
- if (txt1[i] == txt2[i])
- continue;
- if (txt1[i].isLetter() != txt2[i].isLetter())
- return txt1[i].isLetter();
- return (txt1[i] < txt2[i]);
- }
-
- return firstIsShorter;
-}
QString * HWChatWidget::s_styleSheet = NULL;
QStringList * HWChatWidget::s_displayNone = NULL;
@@ -289,16 +227,19 @@
this, SLOT(linkClicked(const QUrl&)));
mainLayout.addWidget(chatText, 0, 0, 2, 1);
- chatNicks = new QListWidget(this);
+ chatNicks = new QListView(this);
+ chatNicks->setIconSize(QSize(24, 16));
+ chatNicks->setSelectionMode(QAbstractItemView::SingleSelection);
+ chatNicks->setEditTriggers(QAbstractItemView::NoEditTriggers);
chatNicks->setMinimumHeight(10);
chatNicks->setMinimumWidth(10);
- chatNicks->setSortingEnabled(true);
chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu);
- connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
- this, SLOT(chatNickDoubleClicked(QListWidgetItem *)));
- connect(chatNicks, SIGNAL(currentRowChanged(int)),
- this, SLOT(chatNickSelected(int)));
+ chatNicks->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ connect(chatNicks, SIGNAL(doubleClicked(QModelIndex)),
+ this, SLOT(chatNickDoubleClicked(QModelIndex)));
+
+ connect(chatNicks, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(nicksContextMenuRequested(QPoint)));
mainLayout.addWidget(chatNicks, 0, 1, 3, 1);
@@ -333,10 +274,12 @@
chatNicks->insertAction(0, acInfo);
chatNicks->insertAction(0, acIgnore);
- showReady = false;
setShowFollow(true);
setAcceptDrops(true);
+
+ m_nicksMenu = new QMenu(this);
+
clear();
}
@@ -349,40 +292,21 @@
{
// decode nick
QString nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery()));
- QList items = chatNicks->findItems(nick, Qt::MatchExactly);
+ QModelIndexList mil = chatNicks->model()->match(chatNicks->model()->index(0, 0), Qt::DisplayRole, nick);
- bool isOffline = (items.size() < 1);
-
- QMenu * popup = new QMenu(this);
+ bool isOffline = (mil.size() < 1);
if (isOffline)
{
m_clickedNick = nick;
- chatNickSelected(0); // update friend and ignore entry
- chatNicks->setCurrentItem(NULL, QItemSelectionModel::Clear);
+ chatNicks->selectionModel()->clearSelection();
}
else
{
- // selecting an item will automatically scroll there, so let's save old position
- QScrollBar * scrollBar = chatNicks->verticalScrollBar();
- int oldScrollPos = scrollBar->sliderPosition();
- // select the nick which we want to see the actions for
- chatNicks->setCurrentItem(items[0], QItemSelectionModel::Clear);
- // selecting an item will automatically scroll there, so let's save old position
- scrollBar->setSliderPosition(oldScrollPos);
+ chatNicks->selectionModel()->select(mil[0], QItemSelectionModel::ClearAndSelect);
}
- // load actions
- QList actions = chatNicks->actions();
-
- foreach(QAction * action, actions)
- {
- if ((!isOffline) || (action->data().toBool()))
- popup->addAction(action);
- }
-
- // display menu popup at mouse cursor position
- popup->popup(QCursor::pos());
+ nicksContextMenuRequested(chatNicks->mapFromGlobal(QCursor::pos()));
}
}
@@ -405,102 +329,6 @@
m_autoKickEnabled = enabled;
}
-void HWChatWidget::loadList(QStringList & list, const QString & file)
-{
- list.clear();
- QFile txt(cfgdir->absolutePath() + "/" + file);
- if(!txt.open(QIODevice::ReadOnly))
- return;
- QTextStream stream(&txt);
- stream.setCodec("UTF-8");
-
- while(!stream.atEnd())
- {
- QString str = stream.readLine();
- if(str.startsWith(";") || str.length() == 0)
- continue;
- list << str.trimmed();
- }
- //readd once we require newer Qt than 4.4
- //list.removeDuplicates();
- txt.close();
-}
-
-void HWChatWidget::saveList(QStringList & list, const QString & file)
-{
- QFile txt(cfgdir->absolutePath() + "/" + file);
-
- // list empty? => rather have no file for the list than an empty one
- if (list.isEmpty())
- {
- if (txt.exists())
- {
- // try to remove file, if successful we're done here.
- if (txt.remove())
- return;
- }
- else
- // there is no file
- return;
- }
-
- if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
- return;
- QTextStream stream(&txt);
- stream.setCodec("UTF-8");
-
- stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl;
- for(int i = 0; i < list.size(); i++)
- stream << list[i] << endl;
- txt.close();
-}
-
-void HWChatWidget::updateNickItem(QListWidgetItem *nickItem)
-{
- QString nick = nickItem->text();
- ListWidgetNickItem * item = dynamic_cast(nickItem);
-
- item->setFriend(friendsList.contains(nick, Qt::CaseInsensitive));
- item->setIgnored(ignoreList.contains(nick, Qt::CaseInsensitive));
-
- if(item->ignored())
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_ignore_on.png" : ":/res/chat_ignore_off.png") : ":/res/chat_ignore.png"));
- item->setForeground(Qt::gray);
- }
- else if(item->isFriend())
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_friend_on.png" : ":/res/chat_friend_off.png") : ":/res/chat_friend.png"));
- item->setForeground(Qt::green);
- }
- else
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_default_on.png" : ":/res/chat_default_off.png") : ":/res/chat_default.png"));
- item->setForeground(QBrush(QColor(0xff, 0xcc, 0x00)));
- }
-}
-
-void HWChatWidget::updateNickItems()
-{
- for(int i = 0; i < chatNicks->count(); i++)
- updateNickItem(chatNicks->item(i));
-
- chatNicks->sortItems();
-}
-
-void HWChatWidget::loadLists(const QString & nick)
-{
- loadList(ignoreList, nick.toLower() + "_ignore.txt");
- loadList(friendsList, nick.toLower() + "_friends.txt");
- updateNickItems();
-}
-
-void HWChatWidget::saveLists(const QString & nick)
-{
- saveList(ignoreList, nick.toLower() + "_ignore.txt");
- saveList(friendsList, nick.toLower() + "_friends.txt");
-}
-
void HWChatWidget::returnPressed()
{
@@ -541,17 +369,24 @@
void HWChatWidget::onChatString(const QString& nick, const QString& str)
{
- bool isFriend = false;
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast(chatNicks->model());
+ if(!playersSortFilterModel)
+ return;
+
+ PlayersListModel * players = qobject_cast(playersSortFilterModel->sourceModel());
+
+ if(!players)
+ return;
if (!nick.isEmpty())
{
// don't show chat lines that are from ignored nicks
- if (ignoreList.contains(nick, Qt::CaseInsensitive))
+ if (players->isFlagSet(nick, PlayersListModel::Ignore))
return;
- // friends will get special treatment, of course
- isFriend = friendsList.contains(nick, Qt::CaseInsensitive);
}
+ bool isFriend = (!nick.isEmpty()) && players->isFlagSet(nick, PlayersListModel::Friend);
+
QString formattedStr = Qt::escape(str.mid(1));
// make hedgewars.org urls actual links
formattedStr = formattedStr.replace(URLREGEXP, "\\3");
@@ -639,9 +474,19 @@
chatText->moveCursor(QTextCursor::End);
}
+
void HWChatWidget::nickAdded(const QString & nick, bool notifyNick)
{
- bool isIgnored = ignoreList.contains(nick, Qt::CaseInsensitive);
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast(chatNicks->model());
+ if(!playersSortFilterModel)
+ return;
+
+ PlayersListModel * players = qobject_cast(playersSortFilterModel->sourceModel());
+
+ if(!players)
+ return;
+
+ bool isIgnored = players->isFlagSet(nick, PlayersListModel::Ignore);
if (isIgnored && m_isAdmin && m_autoKickEnabled)
{
@@ -649,14 +494,10 @@
return;
}
- QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), isIgnored);
- updateNickItem(item);
- chatNicks->addItem(item);
-
if ((!isIgnored) && (nick != m_userNick)) // don't auto-complete own name
chatEditLine->addNickname(nick);
- emit nickCountUpdate(chatNicks->count());
+ emit nickCountUpdate(chatNicks->model()->rowCount());
if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool())
{
@@ -669,10 +510,7 @@
{
chatEditLine->removeNickname(nick);
- foreach(QListWidgetItem * item, chatNicks->findItems(nick, Qt::MatchExactly))
- chatNicks->takeItem(chatNicks->row(item));
-
- emit nickCountUpdate(chatNicks->count());
+ emit nickCountUpdate(chatNicks->model()->rowCount());
}
void HWChatWidget::clear()
@@ -686,7 +524,7 @@
chatText->clear();
chatStrings.clear();
- chatNicks->clear();
+ //chatNicks->clear();
// clear and re compile regexp for highlighting
m_highlights.clear();
@@ -733,184 +571,123 @@
void HWChatWidget::onKick()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit kick(curritem->text());
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ if(mil.size())
+ emit kick(mil[0].data().toString());
}
void HWChatWidget::onBan()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit ban(curritem->text());
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ if(mil.size())
+ emit ban(mil[0].data().toString());
}
void HWChatWidget::onInfo()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit info(curritem->text());
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ if(mil.size())
+ emit info(mil[0].data().toString());
}
void HWChatWidget::onFollow()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit follow(curritem->text());
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ if(mil.size())
+ emit follow(mil[0].data().toString());
}
void HWChatWidget::onIgnore()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- QString nick = "";
- if(curritem != NULL)
- nick = curritem->text();
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ QString nick;
+ if(mil.size())
+ nick = mil[0].data().toString();
else
nick = m_clickedNick;
- if(ignoreList.contains(nick, Qt::CaseInsensitive)) // already on list - remove him
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast(chatNicks->model());
+ if(!playersSortFilterModel)
+ return;
+
+ PlayersListModel * players = qobject_cast(playersSortFilterModel->sourceModel());
+
+ if(!players)
+ return;
+
+ if(players->isFlagSet(nick, PlayersListModel::Ignore))
{
- ignoreList.removeAll(nick.toLower());
+ players->setFlag(nick, PlayersListModel::Ignore, false);
chatEditLine->addNickname(nick);
displayNotice(tr("%1 has been removed from your ignore list").arg(linkedNick(nick)));
}
else // not on list - add
{
// don't consider ignored people friends
- if(friendsList.contains(nick, Qt::CaseInsensitive))
+ if(players->isFlagSet(nick, PlayersListModel::Friend))
emit onFriend();
- // scroll down on first ignore added so that people see where that nick went to
- if (ignoreList.isEmpty())
- chatNicks->scrollToBottom();
-
- ignoreList << nick.toLower();
+ players->setFlag(nick, PlayersListModel::Ignore, true);
chatEditLine->removeNickname(nick);
displayNotice(tr("%1 has been added to your ignore list").arg(linkedNick(nick)));
}
- if(curritem != NULL)
- {
- updateNickItem(curritem); // update icon/sort order/etc
- chatNicks->sortItems();
- chatNickSelected(0); // update context menu
- }
+ if(mil.size())
+ chatNicks->scrollTo(chatNicks->selectionModel()->selectedRows()[0]);
}
void HWChatWidget::onFriend()
{
- QListWidgetItem * curritem = chatNicks->currentItem();
- QString nick = "";
- if(curritem != NULL)
- nick = curritem->text();
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ QString nick;
+ if(mil.size())
+ nick = mil[0].data().toString();
else
nick = m_clickedNick;
- if(friendsList.contains(nick, Qt::CaseInsensitive)) // already on list - remove him
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast(chatNicks->model());
+ if(!playersSortFilterModel)
+ return;
+
+ PlayersListModel * players = qobject_cast(playersSortFilterModel->sourceModel());
+
+ if(!players)
+ return;
+
+ if(players->isFlagSet(nick, PlayersListModel::Friend))
{
- friendsList.removeAll(nick.toLower());
+ players->setFlag(nick, PlayersListModel::Friend, false);
+ chatEditLine->removeNickname(nick);
displayNotice(tr("%1 has been removed from your friends list").arg(linkedNick(nick)));
}
else // not on list - add
{
- // don't ignore the new friend
- if(ignoreList.contains(nick, Qt::CaseInsensitive))
+ if(players->isFlagSet(nick, PlayersListModel::Ignore))
emit onIgnore();
- // scroll up on first friend added so that people see where that nick went to
- if (friendsList.isEmpty())
- chatNicks->scrollToTop();
-
- friendsList << nick.toLower();
+ players->setFlag(nick, PlayersListModel::Friend, true);
+ chatEditLine->addNickname(nick);
displayNotice(tr("%1 has been added to your friends list").arg(linkedNick(nick)));
}
- if(curritem != NULL)
- {
- updateNickItem(curritem); // update icon/sort order/etc
- chatNicks->sortItems();
- chatNickSelected(0); // update context menu
- }
+ if(mil.size())
+ chatNicks->scrollTo(chatNicks->selectionModel()->selectedRows()[0]);
}
-void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
+void HWChatWidget::chatNickDoubleClicked(const QModelIndex &index)
{
- if (item != NULL)
- m_clickedNick = item->text();
- else
- m_clickedNick = "";
+ m_clickedNick = index.data().toString();
+
QList actions = chatNicks->actions();
actions.first()->activate(QAction::Trigger);
}
-void HWChatWidget::chatNickSelected(int index)
-{
- Q_UNUSED(index);
-
- QListWidgetItem* item = chatNicks->currentItem();
- QString nick = "";
- if (item != NULL)
- nick = item->text();
- else
- nick = m_clickedNick;
-
- // don't display all actions for own nick
- bool isSelf = (nick == m_userNick);
-
- acFollow->setVisible(!isSelf);
-
- // update context menu labels according to possible action
- if(ignoreList.contains(nick, Qt::CaseInsensitive))
- {
- acIgnore->setText(QAction::tr("Unignore"));
- acIgnore->setIcon(QIcon(":/res/unignore.png"));
- }
- else
- {
- acIgnore->setText(QAction::tr("Ignore"));
- acIgnore->setIcon(QIcon(":/res/ignore.png"));
- acIgnore->setVisible(!isSelf);
- }
-
- if(friendsList.contains(nick, Qt::CaseInsensitive))
- {
- acFriend->setText(QAction::tr("Remove friend"));
- acFriend->setIcon(QIcon(":/res/remfriend.png"));
- }
- else
- {
- acFriend->setText(QAction::tr("Add friend"));
- acFriend->setIcon(QIcon(":/res/addfriend.png"));
- acFriend->setVisible(!isSelf);
- }
-
- if (m_isAdmin)
- {
- acKick->setVisible(!isSelf);
- acBan->setVisible(!isSelf);
- }
-}
-
-void HWChatWidget::setShowReady(bool s)
-{
- showReady = s;
-}
-
-void HWChatWidget::setReadyStatus(const QString & nick, bool isReady)
-{
- QList items = chatNicks->findItems(nick, Qt::MatchExactly);
- if (items.size() != 1)
- {
- qWarning("Bug: cannot find user in chat");
- return;
- }
-
- items[0]->setData(Qt::UserRole, isReady); // bulb status
- updateNickItem(items[0]);
-
- // ensure we're still showing the status bulbs
- showReady = true;
-}
void HWChatWidget::adminAccess(bool b)
{
@@ -1043,3 +820,75 @@
nickRemoved(nickname);
clear();
}
+
+
+void HWChatWidget::setUsersModel(QAbstractItemModel *model)
+{
+ chatNicks->selectionModel()->deleteLater();
+
+ chatNicks->setModel(model);
+ chatNicks->setModelColumn(0);
+}
+
+void HWChatWidget::nicksContextMenuRequested(const QPoint &pos)
+{
+ QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
+
+ QString nick;
+
+ if(mil.size())
+ nick = mil[0].data().toString();
+ else
+ nick = m_clickedNick;
+
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast(chatNicks->model());
+ if(!playersSortFilterModel)
+ return;
+
+ PlayersListModel * players = qobject_cast(playersSortFilterModel->sourceModel());
+
+ if(!players)
+ return;
+
+ bool isSelf = (nick == m_userNick);
+
+ acFollow->setVisible(!isSelf);
+
+ // update context menu labels according to possible action
+ if(players->isFlagSet(nick, PlayersListModel::Ignore))
+ {
+ acIgnore->setText(QAction::tr("Unignore"));
+ acIgnore->setIcon(QIcon(":/res/unignore.png"));
+ }
+ else
+ {
+ acIgnore->setText(QAction::tr("Ignore"));
+ acIgnore->setIcon(QIcon(":/res/ignore.png"));
+ acIgnore->setVisible(!isSelf);
+ }
+
+ if(players->isFlagSet(nick, PlayersListModel::Friend))
+ {
+ acFriend->setText(QAction::tr("Remove friend"));
+ acFriend->setIcon(QIcon(":/res/remfriend.png"));
+ }
+ else
+ {
+ acFriend->setText(QAction::tr("Add friend"));
+ acFriend->setIcon(QIcon(":/res/addfriend.png"));
+ acFriend->setVisible(!isSelf);
+ }
+
+ if (m_isAdmin)
+ {
+ acKick->setVisible(!isSelf);
+ acBan->setVisible(!isSelf);
+ }
+
+ m_nicksMenu->clear();
+
+ foreach(QAction * action, chatNicks->actions())
+ m_nicksMenu->addAction(action);
+
+ m_nicksMenu->popup(chatNicks->mapToGlobal(pos));
+}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/chatwidget.h
--- a/QTfrontend/ui/widget/chatwidget.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/chatwidget.h Sun Oct 28 15:12:37 2012 +0100
@@ -21,39 +21,24 @@
#define _CHAT_WIDGET_INCLUDED
#include
-#include
#include
#include
#include
#include
#include
+#include
+#include
#include "SDLInteraction.h"
#include "SmartLineEdit.h"
-class ListWidgetNickItem;
class QTextBrowser;
class QLineEdit;
-class QListWidget;
+class QListView;
class QSettings;
-
-/// Class for custom nickname sorting
-class ListWidgetNickItem : public QListWidgetItem
-{
- public:
- ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored);
- bool operator<(const QListWidgetItem & other) const;
- void setFriend(bool isFriend);
- void setIgnored(bool isIgnored);
- bool isFriend();
- bool ignored();
-
- private:
- bool aFriend;
- bool isIgnored;
-};
-
+class QAbstractItemModel;
+class QMenu;
/**
* @brief Chat widget.
@@ -70,17 +55,14 @@
public:
HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify);
- void loadLists(const QString & nick);
- void saveLists(const QString & nick);
void setIgnoreListKick(bool enabled); ///< automatically kick people on ignore list (if possible)
- void setShowReady(bool s);
void setShowFollow(bool enabled);
- QStringList ignoreList, friendsList;
static const QString & styleSheet();
void displayError(const QString & message);
void displayNotice(const QString & message);
void displayWarning(const QString & message);
void setUser(const QString & nickname);
+ void setUsersModel(QAbstractItemModel * model);
protected:
virtual void dragEnterEvent(QDragEnterEvent * event);
@@ -95,10 +77,6 @@
static void setStyleSheet(const QString & styleSheet = "");
- void loadList(QStringList & list, const QString & file);
- void saveList(QStringList & list, const QString & file);
- void updateNickItem(QListWidgetItem *item);
- void updateNickItems();
void addLine(const QString & cssClass, QString line, bool isHighlight = false);
bool parseCommand(const QString & line);
void discardStyleSheet();
@@ -112,7 +90,6 @@
void nickAdded(const QString& nick, bool notifyNick);
void nickRemoved(const QString& nick);
void clear();
- void setReadyStatus(const QString & nick, bool isReady);
void adminAccess(bool);
signals:
@@ -128,7 +105,7 @@
QGridLayout mainLayout;
QTextBrowser* chatText;
QStringList chatStrings;
- QListWidget* chatNicks;
+ QListView* chatNicks;
SmartLineEdit* chatEditLine;
QAction * acInfo;
QAction * acKick;
@@ -137,13 +114,13 @@
QAction * acIgnore;
QAction * acFriend;
QSettings * gameSettings;
+ QMenu * m_nicksMenu;
QStringList m_helloSounds;
QString m_hilightSound;
QString m_userNick;
QString m_clickedNick;
QList m_highlights; ///< regular expressions used for highlighting
bool notify;
- bool showReady;
bool m_autoKickEnabled;
private slots:
@@ -154,9 +131,9 @@
void onFollow();
void onIgnore();
void onFriend();
- void chatNickDoubleClicked(QListWidgetItem * item);
- void chatNickSelected(int index);
+ void chatNickDoubleClicked(const QModelIndex & index);
void linkClicked(const QUrl & link);
+ void nicksContextMenuRequested(const QPoint & pos);
};
#endif // _CHAT_WIDGET_INCLUDED
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/colorwidget.cpp
--- a/QTfrontend/ui/widget/colorwidget.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/colorwidget.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -1,17 +1,17 @@
#include
#include
#include
+#include
#include "colorwidget.h"
#include "hwconsts.h"
ColorWidget::ColorWidget(QStandardItemModel *colorsModel, QWidget *parent) :
- QWidget(parent)
+ QFrame(parent)
{
m_colorsModel = colorsModel;
setColor(0);
- setStyleSheet("");
setAutoFillBackground(true);
connect(m_colorsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex)));
@@ -30,9 +30,12 @@
QStandardItem * item = m_colorsModel->item(m_color);
+ setStyleSheet(QString("border: 2px solid orange; border-radius: 8px; background: %1").arg(item->data().value().name()));
+ /*
QPalette p = palette();
p.setColor(QPalette::Window, item->data().value());
setPalette(p);
+ */
emit colorChanged(m_color);
}
@@ -53,10 +56,10 @@
switch(event->button())
{
case Qt::LeftButton:
- setColor((m_color + 1) % m_colorsModel->rowCount());
+ nextColor();
break;
case Qt::RightButton:
- setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+ previousColor();
break;
default:;
}
@@ -65,7 +68,17 @@
void ColorWidget::wheelEvent(QWheelEvent *event)
{
if(event->delta() > 0)
- setColor((m_color + 1) % m_colorsModel->rowCount());
+ previousColor();
else
- setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+ nextColor();
}
+
+void ColorWidget::nextColor()
+{
+ setColor((m_color + 1) % m_colorsModel->rowCount());
+}
+
+void ColorWidget::previousColor()
+{
+ setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/colorwidget.h
--- a/QTfrontend/ui/widget/colorwidget.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/colorwidget.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,7 +1,7 @@
#ifndef COLORWIDGET_H
#define COLORWIDGET_H
-#include
+#include
#include
namespace Ui {
@@ -10,7 +10,7 @@
class QStandardItemModel;
-class ColorWidget : public QWidget
+class ColorWidget : public QFrame
{
Q_OBJECT
@@ -35,6 +35,8 @@
protected:
void mousePressEvent(QMouseEvent * event);
void wheelEvent(QWheelEvent * event);
+ void nextColor();
+ void previousColor();
};
#endif // COLORWIDGET_H
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/drawmapwidget.cpp
--- a/QTfrontend/ui/widget/drawmapwidget.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/drawmapwidget.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -95,7 +95,14 @@
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName));
+ {
+ QMessageBox errorMsg(this);
+ errorMsg.setIcon(QMessageBox::Warning);
+ errorMsg.setWindowTitle(QMessageBox::tr("File error"));
+ errorMsg.setText(QMessageBox::tr("Cannot open '%1' for writing").arg(fileName));
+ errorMsg.setWindowModality(Qt::WindowModal);
+ errorMsg.exec();
+ }
else
file.write(qCompress(m_scene->encode()).toBase64());
}
@@ -108,7 +115,14 @@
QFile f(fileName);
if(!f.open(QIODevice::ReadOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName));
+ {
+ QMessageBox errorMsg(this);
+ errorMsg.setIcon(QMessageBox::Warning);
+ errorMsg.setWindowTitle(QMessageBox::tr("File error"));
+ errorMsg.setText(QMessageBox::tr("Cannot open '%1' for reading").arg(fileName));
+ errorMsg.setWindowModality(Qt::WindowModal);
+ errorMsg.exec();
+ }
else
m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
}
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/gamecfgwidget.cpp
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -200,6 +200,10 @@
{
QList bcfg;
int mapgen = pMapContainer->get_mapgen();
+ if (Scripts->currentIndex() > 0)
+ {
+ bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex(), GameStyleModel::ScriptRole).toString()).toUtf8();
+ }
QString currentMap = pMapContainer->getCurrentMap();
if (currentMap.size() > 0)
@@ -212,11 +216,6 @@
}
bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8();
- if (Scripts->currentIndex() > 0)
- {
- bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex(), GameStyleModel::ScriptRole).toString()).toUtf8();
- }
-
bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8();
bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8();
bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8();
@@ -271,7 +270,14 @@
{
bool illegal = ammo.size() != cDefaultAmmoStore->size();
if (illegal)
- QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme"));
+ {
+ QMessageBox illegalMsg(this);
+ illegalMsg.setIcon(QMessageBox::Warning);
+ illegalMsg.setWindowTitle(QMessageBox::tr("Error"));
+ illegalMsg.setText(QMessageBox::tr("Cannot use the ammo '%1'!").arg(name));
+ illegalMsg.setWindowModality(Qt::WindowModal);
+ illegalMsg.exec();
+ }
int pos = WeaponsName->findText(name);
if ((pos == -1) || illegal) // prevent from overriding schemes with bad ones
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/mapContainer.cpp
--- a/QTfrontend/ui/widget/mapContainer.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -29,7 +29,6 @@
#include
#include
#include
-#include
#include
#include "hwconsts.h"
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/qpushbuttonwithsound.cpp
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -1,4 +1,21 @@
-#include
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
#include
#include "qpushbuttonwithsound.h"
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/qpushbuttonwithsound.h
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,3 +1,21 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
#ifndef QPUSHBUTTONWITHSOUND_H
#define QPUSHBUTTONWITHSOUND_H
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/selectWeapon.cpp
--- a/QTfrontend/ui/widget/selectWeapon.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/selectWeapon.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -191,19 +191,15 @@
void SelWeaponWidget::save()
{
- for(int i = 0; i < cDefaultAmmos.size(); i++)
- if (!cDefaultAmmos[i].first.compare(m_name->text()))
- {
- QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first));
- return;
- }
-
+ // TODO make this return if success or not, so that the page can react
+ // properly and not goBack if saving failed
if (m_name->text() == "") return;
QString state1;
QString state2;
QString state3;
QString state4;
+ QString stateFull;
for(int i = 0; i < m_numItems; ++i)
{
@@ -217,12 +213,33 @@
int am = it == weaponItems.end() ? 0 : it.value()[3]->getItemsNum();
state4.append(QString::number(am));
}
+
+ stateFull = state1 + state2 + state3 + state4;
+
+ for(int i = 0; i < cDefaultAmmos.size(); i++)
+ {
+ if (cDefaultAmmos[i].first.compare(m_name->text()) == 0)
+ {
+ // don't show warning if no change
+ if (cDefaultAmmos[i].second.compare(stateFull) == 0)
+ return;
+
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Weapons - Warning"));
+ deniedMsg.setText(QMessageBox::tr("Cannot overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+ return;
+ }
+ }
+
if (curWeaponsName != "")
{
// remove old entry
wconf->remove(curWeaponsName);
}
- wconf->setValue(m_name->text(), state1 + state2 + state3 + state4);
+ wconf->setValue(m_name->text(), stateFull);
emit weaponsChanged();
}
@@ -244,13 +261,23 @@
for(int i = 0; i < cDefaultAmmos.size(); i++)
if (!cDefaultAmmos[i].first.compare(m_name->text()))
{
- QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set '%1'!").arg(cDefaultAmmos[i].first));
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Weapons - Warning"));
+ deniedMsg.setText(QMessageBox::tr("Cannot delete default weapon set '%1'!").arg(cDefaultAmmos[i].first));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
return;
}
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"), QMessageBox::Ok | QMessageBox::Cancel);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Weapons - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the weapon set '%1'?").arg(curWeaponsName));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
{
wconf->remove(curWeaponsName);
emit weaponsDeleted();
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/teamselect.cpp
--- a/QTfrontend/ui/widget/teamselect.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/teamselect.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -283,9 +283,9 @@
addTeam(team);
}
-bool TeamSelWidget::isPlaying(HWTeam team) const
+bool TeamSelWidget::isPlaying(const HWTeam &team) const
{
- return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end();
+ return curPlayingTeams.contains(team);
}
QList TeamSelWidget::getPlayingTeams() const
@@ -298,7 +298,7 @@
return m_curNotPlayingTeams;
}
-void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
+void TeamSelWidget::pre_changeTeamStatus(const HWTeam & team)
{
//team.setColor(framePlaying->getNextColor());
emit acceptRequested(team);
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/ui/widget/teamselect.h
--- a/QTfrontend/ui/widget/teamselect.h Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/ui/widget/teamselect.h Sun Oct 28 15:12:37 2012 +0100
@@ -43,7 +43,7 @@
void setAcceptOuter(bool acceptOuter);
void removeNetTeam(const HWTeam& team);
void resetPlayingTeams(const QList& teamslist);
- bool isPlaying(HWTeam team) const;
+ bool isPlaying(const HWTeam &team) const;
QList getPlayingTeams() const;
QList getNotPlayingTeams() const;
void setInteractivity(bool interactive);
@@ -57,14 +57,14 @@
signals:
void setEnabledGameStart(bool);
- void teamWillPlay(HWTeam team);
+ void teamWillPlay(const HWTeam& team);
void teamNotPlaying(const HWTeam& team);
void hhogsNumChanged(const HWTeam&);
void teamColorChanged(const HWTeam&);
- void acceptRequested(HWTeam team);
+ void acceptRequested(const HWTeam& team);
private slots:
- void pre_changeTeamStatus(HWTeam);
+ void pre_changeTeamStatus(const HWTeam&);
void hhNumChanged(const HWTeam& team);
void proxyTeamColorChanged(const HWTeam& team);
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/util/DataManager.cpp
--- a/QTfrontend/util/DataManager.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/util/DataManager.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -201,11 +201,9 @@
void DataManager::reload()
{
- m_gameStyleModel->loadGameStyles();
- m_hatModel->loadHats();
- m_mapModel->loadMaps();
- m_themeModel->loadThemes();
- emit updated();
+ // removed for now (also code was a bit unclean, could lead to segfault if
+ // reload() is called before all members are initialized - because currently
+ // they are initialized in the getter methods rather than the constructor)
}
void DataManager::resetColors()
diff -r 6237d2f002ba -r 2bc61f8841a1 QTfrontend/util/libav_iteraction.cpp
--- a/QTfrontend/util/libav_iteraction.cpp Sun Sep 16 23:52:36 2012 +0200
+++ b/QTfrontend/util/libav_iteraction.cpp Sun Oct 28 15:12:37 2012 +0100
@@ -19,7 +19,6 @@
#include "libav_iteraction.h"
#if VIDEOREC
-#define __STDC_CONSTANT_MACROS
extern "C"
{
#include "libavformat/avformat.h"
@@ -27,7 +26,6 @@
#include
#include
-#include
#include
#include "HWApplication.h"
@@ -272,7 +270,7 @@
QByteArray utf8path = filepath.toUtf8();
if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0)
return "";
-#if LIBAFORMAT_VERSION_MAJOR < 54
+#if LIBAVFORMAT_VERSION_MAJOR < 54
if (av_find_stream_info(pContext) < 0)
#else
if (avformat_find_stream_info(pContext, NULL) < 0)
@@ -310,7 +308,7 @@
AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0);
if (pComment)
desc += QString("\n") + pComment->value;
-#if LIBAFORMAT_VERSION_MAJOR < 54
+#if LIBAVFORMAT_VERSION_MAJOR < 54
av_close_input_file(pContext);
#else
avformat_close_input(&pContext);
diff -r 6237d2f002ba -r 2bc61f8841a1 bin/CMakeLists.txt
diff -r 6237d2f002ba -r 2bc61f8841a1 cmake_modules/FindFFMPEG.cmake
--- a/cmake_modules/FindFFMPEG.cmake Sun Sep 16 23:52:36 2012 +0200
+++ b/cmake_modules/FindFFMPEG.cmake Sun Oct 28 15:12:37 2012 +0100
@@ -31,23 +31,35 @@
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
NAMES libavcodec/avcodec.h
- PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
+ PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
+ /usr/include /usr/local/include #system level
+ /opt/local/include #macports
+ /sw/include #fink
PATH_SUFFIXES ffmpeg libav
)
find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
- PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
+ PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
+ /usr/lib /usr/local/lib #system level
+ /opt/local/lib #macports
+ /sw/lib #fink
)
find_library(FFMPEG_LIBAVFORMAT
NAMES avformat
- PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
+ PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}
+ /usr/lib /usr/local/lib #system level
+ /opt/local/lib #macports
+ /sw/lib #fink
)
find_library(FFMPEG_LIBAVUTIL
NAMES avutil
- PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
+ PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
+ /usr/lib /usr/local/lib #system level
+ /opt/local/lib #macports
+ /sw/lib #fink
)
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
@@ -62,16 +74,19 @@
${FFMPEG_LIBAVFORMAT}
${FFMPEG_LIBAVUTIL}
)
+ if (APPLE)
+ set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "bz2" "-framework CoreVideo" "-framework VideoDecodeAcceleration")
+ endif(APPLE)
endif (FFMPEG_FOUND)
if (FFMPEG_FOUND)
if (NOT FFMPEG_FIND_QUIETLY)
- message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
+ message(STATUS "Found FFMPEG/LibAV: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
endif (NOT FFMPEG_FIND_QUIETLY)
else (FFMPEG_FOUND)
if (FFMPEG_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil")
+ message(FATAL_ERROR "Could NOT find libavcodec or libavformat or libavutil")
endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND)
diff -r 6237d2f002ba -r 2bc61f8841a1 cmake_modules/FindSDL_Extras.cmake
--- a/cmake_modules/FindSDL_Extras.cmake Sun Sep 16 23:52:36 2012 +0200
+++ b/cmake_modules/FindSDL_Extras.cmake Sun Oct 28 15:12:37 2012 +0100
@@ -1,22 +1,5 @@
#if the headers are not installed, the newer apis won't be activated
-##find which version of SDL we are building against
-#find_file(sdl_h SDL_version.h ${SDL_INCLUDE_DIR})
-#if(sdl_h)
-# file(STRINGS ${sdl_h} sdl_majorversion_tmp REGEX "SDL_MAJOR_VERSION[\t' ']+[0-9]+")
-# file(STRINGS ${sdl_h} sdl_minorversion_tmp REGEX "SDL_MINOR_VERSION[\t' ']+[0-9]+")
-# file(STRINGS ${sdl_h} sdl_patchversion_tmp REGEX "SDL_PATCHLEVEL[\t' ']+[0-9]+")
-# string(REGEX MATCH ".([0-9]+)" sdl_majorversion "${sdl_majorversion_tmp}")
-# string(REGEX MATCH ".([0-9]+)" sdl_minorversion "${sdl_minorversion_tmp}")
-# string(REGEX MATCH ".([0-9]+)" sdl_patchversion "${sdl_patchversion_tmp}")
-# math(EXPR sdl_version "${sdl_majorversion}*10000 + ${sdl_minorversion}*100 + ${sdl_patchversion}")
-#
-# if(NOT (sdl_version LESS "010300"))
-# message(STATUS "Enabling SDL-1.3+ calls")
-# set(pascal_compiler_flags_cmn "-dSDL13" ${pascal_compiler_flags_cmn})
-# endif()
-#endif()
-
#find which version of SDL_mixer we have (for Mix_Init)
find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR})
if(sdlmixer_h)
@@ -29,8 +12,8 @@
math(EXPR sdlmixer_version "${sdlmixer_majorversion}*10000 + ${sdlmixer_minorversion}*100 + ${sdlmixer_patchversion}")
if(sdlmixer_version GREATER "10209")
- message(STATUS "Enabling enhanced SDL_Mixer calls")
- set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn})
+ message(STATUS "Mix_Init() is present")
+ set(pascal_flags "-dSDL_MIXER_NEWER" ${pascal_flags})
endif()
endif()
@@ -46,8 +29,8 @@
math(EXPR sdlimage_version "${sdlimage_majorversion}*10000 + ${sdlimage_minorversion}*100 + ${sdlimage_patchversion}")
if(sdlimage_version GREATER "010207")
- message(STATUS "Enabling enhanced SDL_Image calls")
- set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn})
+ message(STATUS "IMG_Init() is present")
+ set(pascal_flags "-dSDL_IMAGE_NEWER" ${pascal_flags})
endif()
endif()
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/Actions.hs
--- a/gameServer/Actions.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/Actions.hs Sun Oct 28 15:12:37 2012 +0100
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP, OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
module Actions where
import Control.Concurrent
@@ -20,7 +21,9 @@
import System.Process
import Network.Socket
-----------------------------
+#if defined(OFFICIAL_SERVER)
import OfficialServer.GameReplayStore
+#endif
import CoreTypes
import Utils
import ClientIO
@@ -50,10 +53,12 @@
| BanClient NominalDiffTime B.ByteString ClientIndex
| BanIP B.ByteString NominalDiffTime B.ByteString
| BanList
+ | Unban B.ByteString
| ChangeMaster
| RemoveClientTeams ClientIndex
| ModifyClient (ClientInfo -> ClientInfo)
| ModifyClient2 ClientIndex (ClientInfo -> ClientInfo)
+ | ModifyRoomClients (ClientInfo -> ClientInfo)
| ModifyRoom (RoomInfo -> RoomInfo)
| ModifyServerInfo (ServerInfo -> ServerInfo)
| AddRoom B.ByteString B.ByteString
@@ -151,7 +156,7 @@
mapM processAction
[
AnswerClients [chan] ["BYE", msg]
- , ModifyClient (\c -> c{logonPassed = False}) -- this will effectively hide client from others while he isn't deleted from list
+ , ModifyClient (\c -> c{nick = "", logonPassed = False}) -- this will effectively hide client from others while he isn't deleted from list
]
s <- get
@@ -181,6 +186,12 @@
io $ modifyClient rnc f ci
return ()
+processAction (ModifyRoomClients f) = do
+ rnc <- gets roomsClients
+ ri <- clientRoomA
+ roomClIDs <- io $ roomClientsIndicesM rnc ri
+ io $ mapM_ (modifyClient rnc f) roomClIDs
+
processAction (ModifyRoom f) = do
rnc <- gets roomsClients
@@ -214,7 +225,7 @@
(Just ci) <- gets clientIndex
ri <- clientRoomA
rnc <- gets roomsClients
- (gameProgress, playersNum) <- io $ room'sM rnc ((isJust . gameInfo) &&& playersIn) ri
+ playersNum <- io $ room'sM rnc playersIn ri
master <- client's isMaster
-- client <- client's id
clNick <- client's nick
@@ -237,8 +248,10 @@
}) ri
moveClientToLobby rnc ci
+
processAction ChangeMaster = do
(Just ci) <- gets clientIndex
+ proto <- client's clientProto
ri <- clientRoomA
rnc <- gets roomsClients
newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
@@ -246,20 +259,23 @@
oldRoomName <- io $ room'sM rnc name ri
oldMaster <- client's nick
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
- let newRoomName = nick newMaster
+ let newRoomName = if proto < 42 then nick newMaster else oldRoomName
mapM_ processAction [
- ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName, isRestrictedJoins = False, isRestrictedTeams = False})
- , ModifyClient2 newMasterId (\c -> c{isMaster = True})
+ ModifyRoom (\r -> r{masterID = newMasterId
+ , name = newRoomName
+ , isRestrictedJoins = False
+ , isRestrictedTeams = False
+ , readyPlayers = if isReady newMaster then readyPlayers r else readyPlayers r + 1})
+ , ModifyClient2 newMasterId (\c -> c{isMaster = True, isReady = True})
, AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
, AnswerClients thisRoomChans ["WARNING", "New room admin is " `B.append` nick newMaster]
, AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster]
- , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster]
+ , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+hr", nick newMaster]
]
- proto <- client's clientProto
- newRoom <- io $ room'sM rnc id ri
+ newRoom' <- io $ room'sM rnc id ri
chans <- liftM (map sendChan) $! sameProtoClientsS proto
- processAction $ AnswerClients chans ("ROOM" : "UPD" : oldRoomName : roomInfo (nick newMaster) newRoom)
+ processAction $ AnswerClients chans ("ROOM" : "UPD" : oldRoomName : roomInfo newRoomName newRoom')
processAction (AddRoom roomName roomPassword) = do
@@ -267,7 +283,6 @@
rnc <- gets roomsClients
proto <- client's clientProto
n <- client's nick
- chan <- client's sendChan
let rm = newRoom{
masterID = clId,
@@ -284,8 +299,6 @@
mapM_ processAction [
AnswerClients chans ("ROOM" : "ADD" : roomInfo n rm)
- , AnswerClients [chan] ["CLIENT_FLAGS", "+h", n]
- , ModifyClient (\cl -> cl{isMaster = True})
]
@@ -307,14 +320,14 @@
processAction UnreadyRoomClients = do
- rnc <- gets roomsClients
ri <- clientRoomA
roomPlayers <- roomClientsS ri
- roomClIDs <- io $ roomClientsIndicesM rnc ri
pr <- client's clientProto
- processAction $ AnswerClients (map sendChan roomPlayers) $ notReadyMessage pr (map nick roomPlayers)
- io $ mapM_ (modifyClient rnc (\cl -> cl{isReady = False})) roomClIDs
- processAction $ ModifyRoom (\r -> r{readyPlayers = 0})
+ mapM_ processAction [
+ AnswerClients (map sendChan roomPlayers) $ notReadyMessage pr . map nick . filter (not . isMaster) $ roomPlayers
+ , ModifyRoomClients (\cl -> cl{isReady = isMaster cl})
+ , ModifyRoom (\r -> r{readyPlayers = 1})
+ ]
where
notReadyMessage p nicks = if p < 38 then "NOT_READY" : nicks else "CLIENT_FLAGS" : "-r" : nicks
@@ -323,7 +336,6 @@
rnc <- gets roomsClients
ri <- clientRoomA
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
- clNick <- client's nick
answerRemovedTeams <- io $
room'sM rnc (map (\t -> AnswerClients thisRoomChans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo) ri
@@ -476,11 +488,15 @@
processAction BanList = do
ch <- client's sendChan
- bans <- gets (B.pack . unlines . map show . bans . serverInfo)
+ b <- gets (B.pack . unlines . map show . bans . serverInfo)
processAction $
- AnswerClients [ch] ["BANLIST", bans]
+ AnswerClients [ch] ["BANLIST", b]
-
+processAction (Unban entry) = do
+ processAction $ ModifyServerInfo (\s -> s{bans = filter f $ bans s})
+ where
+ f (BanByIP bip _ _) = bip == entry
+ f (BanByNick bn _ _) = bn == entry
processAction (KickRoomClient kickId) = do
modify (\s -> s{clientIndex = Just kickId})
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/CoreTypes.hs
--- a/gameServer/CoreTypes.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/CoreTypes.hs Sun Oct 28 15:12:37 2012 +0100
@@ -34,6 +34,7 @@
pingsQueue :: !Word,
isMaster :: Bool,
isReady :: !Bool,
+ isInGame :: Bool,
isAdministrator :: Bool,
clientClan :: Maybe B.ByteString,
teamsInGame :: Word
@@ -75,7 +76,12 @@
giParams :: Map.Map B.ByteString [B.ByteString]
} deriving (Show, Read)
---newGameInfo :: -> GameInfo
+newGameInfo :: [TeamInfo]
+ -> Int
+ -> Bool
+ -> Map.Map ByteString ByteString
+ -> Map.Map ByteString [ByteString]
+ -> GameInfo
newGameInfo =
GameInfo
Data.Sequence.empty
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/EngineInteraction.hs
--- a/gameServer/EngineInteraction.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/EngineInteraction.hs Sun Oct 28 15:12:37 2012 +0100
@@ -1,7 +1,6 @@
module EngineInteraction where
import qualified Data.Set as Set
-import qualified Data.List as List
import Control.Monad
import qualified Codec.Binary.Base64 as Base64
import qualified Data.ByteString.Char8 as B
@@ -31,6 +30,7 @@
legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sNpPwtghbc12345" ++ slotMessages
slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
+
gameInfo2Replay :: GameInfo -> B.ByteString
gameInfo2Replay GameInfo{roundMsgs = rm,
teamsAtStart = teams,
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/HWProtoCore.hs
--- a/gameServer/HWProtoCore.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/HWProtoCore.hs Sun Oct 28 15:12:37 2012 +0100
@@ -51,7 +51,7 @@
let clRoom = room rnc roomId
let roomMasterSign = if isMaster cl then "@" else ""
let adminSign = if isAdministrator cl then "@" else ""
- let roomInfo = if roomId /= lobbyId then B.concat [roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby"
+ let rInfo = if roomId /= lobbyId then B.concat [roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby"
let roomStatus = if isJust $ gameInfo clRoom then
if teamsInGame cl > 0 then "(playing)" else "(spectating)"
else
@@ -65,7 +65,7 @@
nick cl,
B.concat ["[", hostStr, "]"],
protoNumber2ver $ clientProto cl,
- B.concat ["[", roomInfo, "]", roomStatus]
+ B.concat ["[", rInfo, "]", roomStatus]
]
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/HWProtoInRoomState.hs Sun Oct 28 15:12:37 2012 +0100
@@ -2,7 +2,7 @@
module HWProtoInRoomState where
import qualified Data.Map as Map
-import Data.Sequence((|>), empty)
+import Data.Sequence((|>))
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B
@@ -157,14 +157,17 @@
handleCmd_inRoom ["TOGGLE_READY"] = do
cl <- thisClient
chans <- roomClientsChans
- return [
- ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
- ModifyClient (\c -> c{isReady = not $ isReady cl}),
- AnswerClients chans $ if clientProto cl < 38 then
- [if isReady cl then "NOT_READY" else "READY", nick cl]
- else
- ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl]
- ]
+ if isMaster cl then
+ return []
+ else
+ return [
+ ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
+ ModifyClient (\c -> c{isReady = not $ isReady cl}),
+ AnswerClients chans $ if clientProto cl < 38 then
+ [if isReady cl then "NOT_READY" else "READY", nick cl]
+ else
+ ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl]
+ ]
handleCmd_inRoom ["START_GAME"] = do
(ci, rnc) <- ask
@@ -172,6 +175,7 @@
rm <- thisRoom
chans <- roomClientsChans
+ let nicks = map (nick . client rnc) . roomClients rnc $ clientRoom rnc ci
let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm
if isMaster cl && playersIn rm == readyPlayers rm && not (isJust $ gameInfo rm) then
@@ -181,8 +185,10 @@
(\r -> r{
gameInfo = Just $ newGameInfo (teams rm) (length $ teams rm) allPlayersRegistered (mapParams rm) (params rm)
}
- ),
- AnswerClients chans ["RUN_GAME"]
+ )
+ , AnswerClients chans ["RUN_GAME"]
+ , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
+ , ModifyRoomClients (\c -> c{isInGame = True})
]
else
return [Warning "Less than two clans!"]
@@ -206,17 +212,23 @@
handleCmd_inRoom ["ROUNDFINISHED", correctly] = do
- clId <- asks fst
cl <- thisClient
rm <- thisRoom
+ chans <- roomClientsChans
+
let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm
+ let unsetInGameState = [AnswerClients chans ["CLIENT_FLAGS", "-g", nick cl], ModifyClient (\c -> c{isInGame = False})]
- if isJust $ gameInfo rm then
- if (isMaster cl && isCorrect) then
- return [FinishGame]
- else return $ map SendTeamRemovalMessage clTeams
+ if isInGame cl then
+ if isJust $ gameInfo rm then
+ if (isMaster cl && isCorrect) then
+ return $ FinishGame : unsetInGameState
+ else
+ return $ unsetInGameState ++ map SendTeamRemovalMessage clTeams
+ else
+ return unsetInGameState
else
- return []
+ return [] -- don't accept this message twice
where
isCorrect = correctly == "1"
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/HWProtoLobbyState.hs
--- a/gameServer/HWProtoLobbyState.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/HWProtoLobbyState.hs Sun Oct 28 15:12:37 2012 +0100
@@ -51,8 +51,10 @@
[Warning "Room exists"]
else
[
- AddRoom rName roomPassword,
- AnswerClients [sendChan cl] ["CLIENT_FLAGS", "-r", nick cl]
+ AddRoom rName roomPassword
+ , AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl]
+ , ModifyClient (\cl -> cl{isMaster = True, isReady = True})
+ , ModifyRoom (\r -> r{readyPlayers = 1})
]
@@ -131,7 +133,6 @@
handleCmd_lobby ["FOLLOW", asknick] = do
(_, rnc) <- ask
ci <- clientByNick asknick
- cl <- thisClient
let ri = clientRoom rnc $ fromJust ci
let clRoom = room rnc ri
if isNothing ci || ri == lobbyId then
@@ -156,16 +157,19 @@
return [BanClient 60 reason (fromJust banId) | isAdministrator cl && isJust banId && fromJust banId /= ci]
handleCmd_lobby ["BANIP", ip, reason, duration] = do
- (ci, _) <- ask
cl <- thisClient
return [BanIP ip (readInt_ duration) reason | isAdministrator cl]
handleCmd_lobby ["BANLIST"] = do
- (ci, _) <- ask
cl <- thisClient
return [BanList | isAdministrator cl]
+handleCmd_lobby ["UNBAN", entry] = do
+ cl <- thisClient
+ return [Unban entry | isAdministrator cl]
+
+
handleCmd_lobby ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = do
cl <- thisClient
return [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator cl]
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/NetRoutines.hs
--- a/gameServer/NetRoutines.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/NetRoutines.hs Sun Oct 28 15:12:37 2012 +0100
@@ -3,7 +3,6 @@
import Network.Socket
import Control.Concurrent.Chan
-import qualified Control.Exception as Exception
import Data.Time
import Control.Monad
import Data.Unique
@@ -41,6 +40,7 @@
False
False
False
+ False
Nothing
0
)
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/ServerCore.hs
--- a/gameServer/ServerCore.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/ServerCore.hs Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,5 @@
module ServerCore where
-import Network
import Control.Concurrent
import Control.Monad
import System.Log.Logger
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/Store.hs
--- a/gameServer/Store.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/Store.hs Sun Oct 28 15:12:37 2012 +0100
@@ -18,9 +18,9 @@
indices
) where
-import qualified Data.Array.IArray as IA
-import qualified Data.Array.IO as IOA
import qualified Data.IntSet as IntSet
+import qualified Data.Vector as V
+import qualified Data.Vector.Mutable as MV
import Data.IORef
import Control.Monad
import Control.DeepSeq
@@ -28,8 +28,8 @@
newtype ElemIndex = ElemIndex Int
deriving (Eq, Show, Read, Ord, NFData)
-newtype MStore e = MStore (IORef (IntSet.IntSet, IntSet.IntSet, IOA.IOArray Int e))
-newtype IStore e = IStore (IntSet.IntSet, IA.Array Int e)
+newtype MStore e = MStore (IORef (IntSet.IntSet, IntSet.IntSet, MV.IOVector e))
+newtype IStore e = IStore (IntSet.IntSet, V.Vector e)
firstIndex :: ElemIndex
@@ -50,7 +50,7 @@
newStore :: IO (MStore e)
newStore = do
- newar <- IOA.newArray_ (0, initialSize - 1)
+ newar <- MV.new initialSize
new <- newIORef (IntSet.empty, IntSet.fromAscList [0..initialSize - 1], newar)
return (MStore new)
@@ -58,11 +58,10 @@
growStore :: MStore e -> IO ()
growStore (MStore ref) = do
(busyElems, freeElems, arr) <- readIORef ref
- (_, m') <- IOA.getBounds arr
- let newM' = growFunc (m' + 1) - 1
- newArr <- IOA.newArray_ (0, newM')
- sequence_ [IOA.readArray arr i >>= IOA.writeArray newArr i | i <- [0..m']]
- writeIORef ref (busyElems, freeElems `IntSet.union` IntSet.fromAscList [m'+1..newM'], newArr)
+ let oldSize = MV.length arr
+ let newSize = growFunc oldSize
+ newArr <- MV.grow arr (newSize - oldSize)
+ writeIORef ref (busyElems, freeElems `IntSet.union` IntSet.fromAscList [oldSize .. newSize-1], newArr)
growIfNeeded :: MStore e -> IO ()
@@ -74,12 +73,10 @@
truncateIfNeeded :: MStore e -> IO ()
truncateIfNeeded (MStore ref) = do
(busyElems, _, arr) <- readIORef ref
- (_, m') <- IOA.getBounds arr
- let newM' = truncFunc (m' + 1) - 1
- when (newM' < m' && (not $ IntSet.null busyElems) && IntSet.findMax busyElems <= newM') $ do
- newArr <- IOA.newArray_ (0, newM')
- sequence_ [IOA.readArray arr i >>= IOA.writeArray newArr i | i <- IntSet.toList busyElems]
- writeIORef ref (busyElems, IntSet.fromAscList [0..newM'] `IntSet.difference` busyElems, newArr)
+ let oldSize = MV.length arr
+ let newSize = truncFunc oldSize
+ when (newSize < oldSize && (not $ IntSet.null busyElems) && IntSet.findMax busyElems < newSize) $ do
+ writeIORef ref (busyElems, IntSet.fromAscList [0..newSize - 1] `IntSet.difference` busyElems, MV.take newSize arr)
addElem :: MStore e -> e -> IO ElemIndex
@@ -87,7 +84,7 @@
growIfNeeded m
(busyElems, freeElems, arr) <- readIORef ref
let (!n, freeElems') = IntSet.deleteFindMin freeElems
- IOA.writeArray arr n element
+ MV.write arr n element
writeIORef ref (IntSet.insert n busyElems, freeElems', arr)
return $ ElemIndex n
@@ -95,23 +92,23 @@
removeElem :: MStore e -> ElemIndex -> IO ()
removeElem m@(MStore ref) (ElemIndex n) = do
(busyElems, freeElems, arr) <- readIORef ref
- IOA.writeArray arr n (error $ "Store: no element " ++ show n)
+ MV.write arr n (error $ "Store: no element " ++ show n)
writeIORef ref (IntSet.delete n busyElems, IntSet.insert n freeElems, arr)
truncateIfNeeded m
readElem :: MStore e -> ElemIndex -> IO e
-readElem (MStore ref) (ElemIndex n) = readIORef ref >>= \(_, _, arr) -> IOA.readArray arr n
+readElem (MStore ref) (ElemIndex n) = readIORef ref >>= \(_, _, arr) -> MV.read arr n
writeElem :: MStore e -> ElemIndex -> e -> IO ()
-writeElem (MStore ref) (ElemIndex n) el = readIORef ref >>= \(_, _, arr) -> IOA.writeArray arr n el
+writeElem (MStore ref) (ElemIndex n) el = readIORef ref >>= \(_, _, arr) -> MV.write arr n el
modifyElem :: MStore e -> (e -> e) -> ElemIndex -> IO ()
modifyElem (MStore ref) f (ElemIndex n) = do
(_, _, arr) <- readIORef ref
- IOA.readArray arr n >>= IOA.writeArray arr n . f
+ MV.read arr n >>= MV.write arr n . f
elemExists :: MStore e -> ElemIndex -> IO Bool
elemExists (MStore ref) (ElemIndex n) = do
@@ -128,13 +125,13 @@
m2i :: MStore e -> IO (IStore e)
m2i (MStore ref) = do
(a, _, c') <- readIORef ref
- c <- IOA.unsafeFreeze c'
+ c <- V.unsafeFreeze c'
return $ IStore (a, c)
i2m :: MStore e -> IStore e -> IO ()
i2m (MStore ref) (IStore (_, arr)) = do
(b, e, _) <- readIORef ref
- a <- IOA.unsafeThaw arr
+ a <- V.unsafeThaw arr
writeIORef ref (b, e, a)
withIStore :: MStore e -> (IStore e -> a) -> IO a
@@ -157,7 +154,7 @@
-- IStore code
(!) :: IStore e -> ElemIndex -> e
-(!) (IStore (_, arr)) (ElemIndex i) = (IA.!) arr i
+(!) (IStore (_, arr)) (ElemIndex i) = (V.!) arr i
indices :: IStore e -> [ElemIndex]
indices (IStore (busy, _)) = map ElemIndex $ IntSet.toList busy
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/Utils.hs
--- a/gameServer/Utils.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/Utils.hs Sun Oct 28 15:12:37 2012 +0100
@@ -4,19 +4,16 @@
import Data.Char
import Data.Word
import qualified Data.Map as Map
-import qualified Data.Set as Set
import qualified Data.Char as Char
import Numeric
import Network.Socket
import System.IO
import qualified Data.List as List
import Control.Monad
-import qualified Codec.Binary.Base64 as Base64
import qualified Data.ByteString.Lazy as BL
import qualified Text.Show.ByteString as BS
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.UTF8 as UTF8
-import qualified Data.ByteString as BW
import Data.Maybe
-------------------------------------------------
import CoreTypes
@@ -123,6 +120,8 @@
where
f = map Char.toUpper . UTF8.toString
+
+roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
roomInfo n r = [
showB $ isJust $ gameInfo r,
name r,
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/hedgewars-server.cabal
--- a/gameServer/hedgewars-server.cabal Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/hedgewars-server.cabal Sun Oct 28 15:12:37 2012 +0100
@@ -18,7 +18,7 @@
base >= 4.3,
unix,
containers,
- array,
+ vector,
bytestring,
bytestring-show,
network >= 2.3,
diff -r 6237d2f002ba -r 2bc61f8841a1 gameServer/stresstest3.hs
--- a/gameServer/stresstest3.hs Sun Sep 16 23:52:36 2012 +0200
+++ b/gameServer/stresstest3.hs Sun Oct 28 15:12:37 2012 +0100
@@ -47,7 +47,7 @@
waitPacket "CONNECTED"
sendPacket ["NICK", "test" ++ show n]
waitPacket "NICK"
- sendPacket ["PROTO", "31"]
+ sendPacket ["PROTO", "41"]
waitPacket "PROTO"
b <- waitPacket "LOBBY:JOINED"
--io $ print b
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/ArgParsers.inc
--- a/hedgewars/ArgParsers.inc Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/ArgParsers.inc Sun Oct 28 15:12:37 2012 +0100
@@ -16,20 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*)
-procedure playReplayFileWithParameters(); forward;
-
-procedure internalSetGameTypeLandPreviewFromParameters();
-begin
- if ParamStr(3) = '--stats-only' then
- playReplayFileWithParameters()
- else
- begin
- ipcPort:= StrToInt(ParamStr(2));
- GameType:= gmtLandPreview;
- if ParamStr(3) <> 'landpreview' then
- GameType:= gmtSyntax
- end
-end;
procedure internalStartGameWithParameters();
var tmp: LongInt;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/CMakeLists.txt
--- a/hedgewars/CMakeLists.txt Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/CMakeLists.txt Sun Oct 28 15:12:37 2012 +0100
@@ -3,7 +3,6 @@
find_package(SDL_net)
find_package(SDL_ttf)
find_package(SDL_mixer)
-find_package(FFMPEG)
include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake)
@@ -15,10 +14,12 @@
set(engine_sources
${hwengine_project}
+ LuaPas.pas
+ PNGh.pas
SDLh.pas
- PNGh.pas
uAI.pas
uAIActions.pas
+ uAILandMarks.pas
uAIAmmoTests.pas
uAIMisc.pas
uAmmos.pas
@@ -29,12 +30,15 @@
uCommandHandlers.pas
uConsole.pas
uConsts.pas
+ uCursor.pas
uDebug.pas
uFloat.pas
uGame.pas
uGears.pas
uGearsHandlers.pas
uGearsHandlersRope.pas
+ uGearsHedgehog.pas
+ uGearsList.pas
uGearsRender.pas
uGearsUtils.pas
uIO.pas
@@ -60,6 +64,7 @@
uStore.pas
uTeams.pas
uTextures.pas
+ uTouch.pas
uTypes.pas
uUtils.pas
uVariables.pas
@@ -127,9 +132,9 @@
set(powerpc_build "powerpc")
endif()
- #on OSX we need to provide the main() function when building as executable
+ #on OSX we need to provide the SDL_main() function when building as executable
if(NOT BUILD_ENGINE_LIBRARY)
- #let's look for the bundled sdlmain, if not found build our own
+ #let's look for the installed sdlmain file; if it is not found, let's build our own
find_package(SDL REQUIRED)
#remove the ";-framework Cocoa" from the SDL_LIBRARY variable
string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}")
@@ -137,12 +142,11 @@
find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/)
if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND")
- set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
include_directories(${SDL_INCLUDE_DIR})
add_library (SDLmain STATIC SDLMain.m)
#add a dependency to the hwengine target
set(engine_sources ${engine_sources} SDLmain)
- set(SDLMAIN_LIB "${CMAKE_BINARY_DIR}/bin/libSDLmain.a")
+ set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a")
endif()
set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags})
@@ -157,7 +161,7 @@
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
- message(STATUS "Freepascal version installed: ${fpc_vers_major}.${fpc_vers_minor}")
+ message(STATUS "Found Freepascal: ${fpc_executable} (version ${fpc_vers_major}.${fpc_vers_minor})")
math(EXPR fpc_version "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
if(fpc_version LESS "020200")
@@ -174,35 +178,31 @@
if(NOT NOPNG)
find_package(PNG)
if(${PNG_FOUND})
- message(STATUS "PNG screenshots enabled (library found at ${PNG_LIBRARY})")
set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags})
- if(APPLE) # need to explictly link with the static lib -- maybe windows too?
- string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
- set(pascal_flags "-k${PNG_LIBDIR}/libpng.a" ${pascal_flags})
+ if(APPLE) # fpc png unit doesn't pull the library (see bug 21833)
+ set(pascal_flags "-k${PNG_LIBRARY}" ${pascal_flags})
endif()
else()
- message(STATUS "PNG library not found, switching to screenshots in BMP format")
+ message(STATUS "Screenshots will be in BMP format because libpng was not found")
endif()
else()
- message(STATUS "PNG screenshots disabled per user request, using BMP format")
+ message(STATUS "Screenshots will be in BMP format per user request")
endif()
-#this command is a workaround to some inlining issues present in older
-# FreePascal versions and fixed in 2.6, That version is mandatory on OSX,
-# hence the command is not needed there
-if(NOT APPLE)
+#this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
+if(fpc_version LESS "020600")
add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
endif()
-if(NOT NO_VIDEOREC)
+if(NOT NOVIDEOREC)
+ set(FFMPEG_FIND_QUIETLY true)
+ find_package(FFMPEG)
if(${FFMPEG_FOUND})
- message(STATUS "Compiling with video recording")
include_directories(${FFMPEG_INCLUDE_DIR})
set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
- set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
IF (WIN32)
# there are some problems with linking our avwrapper as static lib, so link it as shared
add_library(avwrapper SHARED avwrapper.c)
@@ -211,13 +211,12 @@
ELSE()
add_library(avwrapper STATIC avwrapper.c)
set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
- # set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}avwrapper${CMAKE_STATIC_LIBRARY_SUFFIX}" ${pascal_flags})
ENDIF()
- if(NOT APPLE)
+ if(fpc_version LESS "020600")
add_dependencies(avwrapper ENGINECLEAN)
endif()
else()
- message(STATUS "FFMPEG library not found, video recording will be disabled")
+ message(STATUS "Could NOT find FFMPEG/LibAV, video recording will be disabled")
endif()
else()
message(STATUS "Video recording disabled by user")
@@ -261,10 +260,9 @@
add_dependencies(${engine_output_name} lua)
endif()
-if(NOT APPLE)
- if(NO_VIDEOREC OR NOT ${FFMPEG_FOUND})
- add_dependencies(${engine_output_name} ENGINECLEAN)
- endif()
+#this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
+if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
+ add_dependencies(${engine_output_name} ENGINECLEAN)
endif()
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/GSHandlers.inc Sun Oct 28 15:12:37 2012 +0100
@@ -93,7 +93,10 @@
else
begin
if (gi^.State and gstMoving) = 0 then
+ begin
+ gi^.dX.isNegative:= X r div 2 then
PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack)
@@ -195,8 +198,8 @@
// might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
- if (hwRound(Gear^.X) < LAND_WIDTH div -2)
- or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then
+ if (hwRound(Gear^.X) < min(LAND_WIDTH div -2, -2048))
+ or (hwRound(Gear^.X) > max(LAND_WIDTH * 3 div 2, 6144)) then
Gear^.State := Gear^.State or gstCollision;
if Gear^.dY.isNegative then
@@ -282,10 +285,12 @@
else
Gear^.State := Gear^.State or gstMoving;
- if (Gear^.nImpactSounds > 0) and (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0))
- or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and(((Gear^.Radius < 3) and (Gear^.dY < -_0_1))
- or ((Gear^.Radius >= 3) and ((Gear^.dX.QWordValue > _0_1.QWordValue)
- or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then
+ if (Gear^.nImpactSounds > 0) and
+ (Gear^.State and gstCollision <> 0) and
+ (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and
+ (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or
+ ((Gear^.Radius >= 3) and
+ ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true);
end;
@@ -315,14 +320,14 @@
CheckCollision(Gear);
if (Gear^.State and gstCollision) <> 0 then
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx);
- end;
+ end;
if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
begin
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
if vg <> nil then
vg^.Tint:= $FFC0C000;
- end;
+ end;
if Gear^.Timer = 0 then
begin
@@ -386,10 +391,10 @@
FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
end
end;
+ end;
+ DeleteGear(Gear);
+ exit
end;
- DeleteGear(Gear);
- exit
- end;
CalcRotationDirAngle(Gear);
@@ -716,8 +721,8 @@
exit
end;
Gear^.Pos:= 0;
- Gear^.X:= int2hwFloat(GetRandom(snowRight-snowLeft)+snowLeft);
- Gear^.Y:= int2hwFloat(LAND_HEIGHT-1300+(GetRandom(50)-25));
+ Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft);
+ Gear^.Y:= int2hwFloat(LongInt(LAND_HEIGHT + GetRandom(50)) - 1325);
Gear^.State:= Gear^.State or gstInvisible;
end
end;
@@ -984,8 +989,8 @@
// only extend if not under water
if hwRound(Bullet^.Y) < cWaterLine then
begin
- VGear^.dX := VGear^.dX + LAND_WIDTH * (VGear^.dX - VGear^.X);
- VGear^.dY := VGear^.dY + LAND_WIDTH * (VGear^.dY - VGear^.Y);
+ VGear^.dX := VGear^.dX + max(LAND_WIDTH,4096) * (VGear^.dX - VGear^.X);
+ VGear^.dY := VGear^.dY + max(LAND_WIDTH,4096) * (VGear^.dY - VGear^.Y);
end;
VGear^.Timer := 200;
@@ -1414,30 +1419,26 @@
end;
CalcRotationDirAngle(Gear);
AllInactive := false
- end
- else
- if ((GameTicks and $3F) = 25) then
- doStepFallingGear(Gear);
+ end
+ else if (GameTicks and $3F) = 25 then
+ doStepFallingGear(Gear);
if (Gear^.Health = 0) then
begin
- if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
- inc(Gear^.Damage, hwRound(Gear^.dY * _70))
-
- else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
- inc(Gear^.Damage, hwRound(Gear^.dX * _70))
-
- else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
- inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
-
- else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
- inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
+ if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
+ inc(Gear^.Damage, hwRound(Gear^.dY * _70))
+ else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
+ inc(Gear^.Damage, hwRound(Gear^.dX * _70))
+ else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
+ inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
+ else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
+ inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then
- begin
- vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
- if vg <> nil then
- vg^.Scale:= 0.5
- end;
+ begin
+ vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
+ if vg <> nil then
+ vg^.Scale:= 0.5
+ end;
if (Gear^.Damage > 35) then
begin
@@ -2172,7 +2173,7 @@
if (GameTicks and $3F) = 0 then
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
- if (hwRound(Gear^.X) > (LAND_WIDTH+2048)) or (hwRound(Gear^.X) < -2048) then
+ if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -2048) then
begin
// avoid to play forever (is this necessary?)
StopSoundChan(Gear^.SoundChannel);
@@ -2192,7 +2193,7 @@
else
begin
Gear^.Tag := -1;
- Gear^.X := int2hwFloat(LAND_WIDTH + 2048);
+ Gear^.X := int2hwFloat(max(LAND_WIDTH,4096) + 2048);
end;
Gear^.Y := int2hwFloat(topY-300);
@@ -2646,11 +2647,7 @@
procedure doStepCakeWork(Gear: PGear);
-
-const dirs: array[0..3] of TPoint = ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0));
var
- xx, yy, xxn, yyn: LongInt;
- dA: LongInt;
tdx, tdy: hwFloat;
begin
AllInactive := false;
@@ -3728,7 +3725,7 @@
// calc gear offset in portal normal vector direction
noffs:= (nx * ox + ny * oy);
- if isBullet and (noffs.Round >= Gear^.Radius) then
+ if isBullet and (noffs.Round >= Longword(Gear^.Radius)) then
continue;
// avoid gravity related loops of not really moving gear
@@ -3975,9 +3972,9 @@
end
else if (y > cWaterLine)
- or (y < -LAND_WIDTH)
- or (x > 2*LAND_WIDTH)
- or (x < -LAND_WIDTH) then
+ or (y < -max(LAND_WIDTH,4096))
+ or (x > 2*max(LAND_WIDTH,4096))
+ or (x < -max(LAND_WIDTH,4096)) then
loadNewPortalBall(Gear, true);
end;
@@ -4050,7 +4047,7 @@
iterator:= GearsList;
while iterator <> nil do
begin
- if not (iterator^.Kind in [gtPortal, gtAirAttack]) and ((iterator^.Hedgehog <> CurrentHedgehog)
+ if not (iterator^.Kind in [gtPortal, gtAirAttack, gtKnife]) and ((iterator^.Hedgehog <> CurrentHedgehog)
or ((iterator^.Message and gmAllStoppable) = 0)) then
begin
iterator^.Active:= true;
@@ -4180,7 +4177,7 @@
sdY := -sdY;
// initial angle depends on current GameTicks
- t := GameTicks mod 4096;
+ t := getRandom(4096);
// used for a work-around detection of area that is within land array, but outside borders
@@ -4289,7 +4286,7 @@
end;
procedure doStepSineGunShot(Gear: PGear);
-var
+var
HHGear: PGear;
begin
PlaySound(sndSineGun);
@@ -4658,7 +4655,7 @@
if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then
begin
- if graves.size <= Gear^.Tag then Gear^.Tag:= 0;
+ if LongInt(graves.size) <= Gear^.Tag then Gear^.Tag:= 0;
dec(hh^.Gear^.Health);
if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
hh^.Gear^.Damage:= 1;
@@ -4691,7 +4688,7 @@
// only make hat-less hedgehogs look like zombies, preserve existing hats
if resgear^.Hedgehog^.Hat = 'NoHat' then
- LoadHedgehogHat(resgear, 'Reserved/Zombie');
+ LoadHedgehogHat(resgear^.Hedgehog^, 'Reserved/Zombie');
end;
hh^.Gear^.dY := _0;
@@ -5032,8 +5029,8 @@
A frozen hog stays frozen for a certain number of turns. Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again.
*)
procedure doStepIceGun(Gear: PGear);
-var
- HHGear, iter: PGear;
+var
+ HHGear: PGear;
ndX, ndY: hwFloat;
i, t, gX, gY: LongInt;
hogs: PGearArrayS;
@@ -5117,10 +5114,10 @@
X:= HHGear^.X;
Y:= HHGear^.Y
end;
- if (gX > LAND_WIDTH*2) or
- (gX < -LAND_WIDTH) or
- (gY < -LAND_HEIGHT) or
- (gY > LAND_HEIGHT+512) then
+ if (gX > max(LAND_WIDTH,4096)*2) or
+ (gX < -max(LAND_WIDTH,4096)) or
+ (gY < -max(LAND_HEIGHT,4096)) or
+ (gY > max(LAND_HEIGHT,4096)+512) then
begin
X:= HHGear^.X;
Y:= HHGear^.Y
@@ -5200,7 +5197,7 @@
exit
end;
-// Search out a new target, as target seek time has expired, target is dead, target is out of range, or we didn't have a target
+// Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target
if (HHGear = nil) or (Gear^.Timer = 0) or
(((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) > Gear^.Angle) and
(Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle)))
@@ -5247,3 +5244,195 @@
end;
end;
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepKnife(Gear: PGear);
+var ox, oy: LongInt;
+ la: hwFloat;
+begin
+ // Gear is shrunk so it can actually escape the hog without carving into the terrain
+ if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
+ if Gear^.Timer > 0 then dec(Gear^.Timer);
+ if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
+ begin
+ DeleteCI(Gear);
+ // used for damage and impact calc. needs balancing I think
+ Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
+ doStepFallingGear(Gear);
+ AllInactive := false;
+ CalcRotationDirAngle(Gear)
+ end
+ else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
+ begin
+ ox:= 0; oy:= 0;
+ if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
+ if TestCollisionXwithGear(Gear, 1) then ox:= 1;
+ if TestCollisionXwithGear(Gear, -1) then ox:= -1;
+ if TestCollisionYwithGear(Gear, 1) <> 0 then oy:= 1;
+ if Gear^.Health > 0 then
+ PlaySound(sndRopeAttach);
+(*
+ la:= _10000;
+ if (ox <> 0) or (oy <> 0) then
+ la:= CalcSlopeNearGear(Gear, ox, oy);
+ if la = _10000 then
+ begin
+ // debug for when we couldn't get an angle
+ //AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
+*)
+ Gear^.DirAngle:= DxDy2Angle(Gear^.dX, Gear^.dY) + (random(30)-15);
+ if (Gear^.dX.isNegative and Gear^.dY.isNegative) or
+ ((not Gear^.dX.isNegative) and (not Gear^.dY.isNegative)) then Gear^.DirAngle:= Gear^.DirAngle-90;
+ // end
+ // else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent?
+ // AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle)));
+ Gear^.dX:= _0;
+ Gear^.dY:= _0;
+ Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
+ Gear^.Radius:= 20;
+ if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
+ Gear^.Radius:= 16;
+ Gear^.Health:= 0;
+ Gear^.Timer:= 500;
+ AddGearCI(Gear)
+ end
+ else if GameTicks and $3F = 0 then
+ begin
+ if (TestCollisionYwithGear(Gear, -1) = 0)
+ and (not TestCollisionXwithGear(Gear, 1))
+ and (not TestCollisionXwithGear(Gear, -1))
+ and (TestCollisionYwithGear(Gear, 1) = 0) then Gear^.State:= Gear^.State and (not gstCollision) or gstMoving;
+ end
+end;
+(*
+ This didn't end up getting used, but, who knows, might be reasonable for javellin or something
+// Make the knife initial angle based on the hog attack angle, or is that too hard?
+procedure doStepKnife(Gear: PGear);
+var t,
+ gx, gy, ga, // gear x,y,angle
+ lx, ly, la, // land x,y,angle
+ ox, oy, // x,y offset
+ w, h, // wXh of clip area
+ tx, ty // tip position in sprite
+ : LongInt;
+ surf: PSDL_Surface;
+ s: hwFloat;
+
+begin
+ Gear^.dY := Gear^.dY + cGravity;
+ if (GameFlags and gfMoreWind) <> 0 then
+ Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density;
+ Gear^.X := Gear^.X + Gear^.dX;
+ Gear^.Y := Gear^.Y + Gear^.dY;
+ CheckGearDrowning(Gear);
+ gx:= hwRound(Gear^.X);
+ gy:= hwRound(Gear^.Y);
+ if Gear^.State and gstDrowning <> 0 then exit;
+ with Gear^ do
+ begin
+ if CheckLandValue(gx, gy, $FF00) then
+ begin
+ t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10);
+
+ if t < 0 then inc(t, 4096)
+ else if 4095 < t then dec(t, 4096);
+ Angle:= t;
+
+ DirAngle:= Angle / 4096 * 360
+ end
+ else
+ begin
+//This is the set of postions for the knife.
+//Using FlipSurface and copyToXY the knife can be written to the LandPixels at 32 positions, and an appropriate line drawn in Land.
+ t:= Angle mod 1024;
+ case t div 128 of
+ 0: begin
+ ox:= 2; oy:= 5;
+ w := 25; h:= 5;
+ tx:= 0; ty:= 2
+ end;
+ 1: begin
+ ox:= 2; oy:= 15;
+ w:= 24; h:= 8;
+ tx:= 0; ty:= 7
+ end;
+ 2: begin
+ ox:= 2; oy:= 27;
+ w:= 23; h:= 12;
+ tx:= -12; ty:= -5
+ end;
+ 3: begin
+ ox:= 2; oy:= 43;
+ w:= 21; h:= 15;
+ tx:= 0; ty:= 14
+ end;
+ 4: begin
+ ox:= 29; oy:= 8;
+ w:= 19; h:= 19;
+ tx:= 0; ty:= 17
+ end;
+ 5: begin
+ ox:= 29; oy:= 32;
+ w:= 15; h:= 21;
+ tx:= 0; ty:= 20
+ end;
+ 6: begin
+ ox:= 51; oy:= 3;
+ w:= 11; h:= 23;
+ tx:= 0; ty:= 22
+ end;
+ 7: begin
+ ox:= 51; oy:= 34;
+ w:= 7; h:= 24;
+ tx:= 0; ty:= 23
+ end
+ end;
+
+ surf:= SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, RMask, GMask, BMask, AMask);
+ copyToXYFromRect(SpritesData[sprKnife].Surface, surf, ox, oy, w, h, 0, 0);
+ // try to make the knife hit point first
+ lx := 0;
+ ly := 0;
+ if CalcSlopeTangent(Gear, gx, gy, lx, ly, 255) then
+ begin
+ la:= vector2Angle(int2hwFloat(lx), int2hwFloat(ly));
+ ga:= vector2Angle(dX, dY);
+ AddFileLog('la: '+inttostr(la)+' ga: '+inttostr(ga)+' Angle: '+inttostr(Angle));
+ // change to 0 to 4096 forced by LongWord in Gear
+ if la < 0 then la:= 4096+la;
+ if ga < 0 then ga:= 4096+ga;
+ if ((Angle > ga) and (Angle < la)) or ((Angle < ga) and (Angle > la)) then
+ begin
+ if Angle >= 2048 then dec(Angle, 2048)
+ else if Angle < 2048 then inc(Angle, 2048)
+ end;
+ AddFileLog('la: '+inttostr(la)+' ga: '+inttostr(ga)+' Angle: '+inttostr(Angle))
+ end;
+ case Angle div 1024 of
+ 0: begin
+ flipSurface(surf, true);
+ flipSurface(surf, true);
+ BlitImageAndGenerateCollisionInfo(gx-(w-tx), gy-(h-ty), w, surf)
+ end;
+ 1: begin
+ flipSurface(surf, false);
+ BlitImageAndGenerateCollisionInfo(gx-(w-tx), gy-ty, w, surf)
+ end;
+ 2: begin // knife was actually drawn facing this way...
+ BlitImageAndGenerateCollisionInfo(gx-tx, gy-ty, w, surf)
+ end;
+ 3: begin
+ flipSurface(surf, true);
+ BlitImageAndGenerateCollisionInfo(gx-tx, gy-(h-ty), w, surf)
+ end
+ end;
+ SDL_FreeSurface(surf);
+ // this needs to calculate actual width/height + land clipping since update texture doesn't.
+ // i.e. this will crash if you fire near sides of map, but until I get the blit right, not going to put real values
+ UpdateLandTexture(hwRound(X)-32, 64, hwRound(Y)-32, 64, true);
+ DeleteGear(Gear);
+ exit
+ end
+ end;
+end;
+*)
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/VGSHandlers.inc
--- a/hedgewars/VGSHandlers.inc Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/VGSHandlers.inc Sun Oct 28 15:12:37 2012 +0100
@@ -157,10 +157,12 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepExpl(Gear: PVisualGear; Steps: Longword);
+var s: LongInt;
begin
-Gear^.X:= Gear^.X + Gear^.dX * Steps;
+s:= min(Steps, cExplFrameTicks);
-Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
+Gear^.X:= Gear^.X + Gear^.dX * s;
+Gear^.Y:= Gear^.Y + Gear^.dY * s;
//Gear^.dY:= Gear^.dY + cGravityf;
if Gear^.FrameTicks <= Steps then
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/hwengine.pas Sun Oct 28 15:12:37 2012 +0100
@@ -29,11 +29,13 @@
program hwengine;
{$ENDIF}
-uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler, uSound,
- uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uLandTexture, uCollisions,
+uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler,
+ uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uAILandMarks, uLandTexture, uCollisions,
SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
{$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}
- {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF}, uAILandMarks;
+ {$IFDEF USE_TOUCH_INTERFACE}, uTouch {$ENDIF}
+ {$IFDEF ANDROID}, GLUnit{$ENDIF}
+ ;
{$IFDEF HWLIBRARY}
@@ -48,7 +50,7 @@
procedure freeEverything(complete:boolean); forward;
{$ENDIF}
-////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
function DoTimer(Lag: LongInt): boolean;
var s: shortstring;
begin
@@ -59,9 +61,9 @@
gsLandGen:
begin
GenMap;
- uLandTexture.initModule;
- UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT, false);
- uAILandMarks.initModule;
+ SetLandTexture;
+ UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT, false);
+ setAILandMarks;
ParseCommand('sendlanddigest', true);
GameState:= gsStart;
end;
@@ -136,7 +138,7 @@
end;
end;
-///////////////////
+////////////////////////////////////////////////////////////////////////////////
procedure MainLoop;
var event: TSDL_Event;
PrevTime, CurrTime: Longword;
@@ -308,15 +310,14 @@
end;
{$ENDIF}
-///////////////
+////////////////////////////////////////////////////////////////////////////////
procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF};
var p: TPathType;
s: shortstring;
i: LongInt;
begin
{$IFDEF HWLIBRARY}
- cBits:= 32;
- cTimerInterval:= 8;
+ initEverything(true);
cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF};
ipcPort:= StrToInt(gameArgs[0]);
cScreenWidth:= StrToInt(gameArgs[1]);
@@ -345,7 +346,6 @@
cOrigScreenWidth:= cScreenWidth;
cOrigScreenHeight:= cScreenHeight;
- initEverything(true);
WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
AddFileLog('Prefix: "' + PathPrefix +'"');
AddFileLog('UserPrefix: "' + UserPathPrefix +'"');
@@ -443,40 +443,42 @@
freeEverything(true);
end;
+////////////////////////////////////////////////////////////////////////////////
+// As a rule of thumb, every module that is listed in either initEverything or
+// freeEverything should come in pair, even if they are stubs. Only use this
+// section for inialising variables and remeber that game args overwrite these,
+// so handle this section with care. Pay attention to the init/free order too!
procedure initEverything (complete:boolean);
begin
Randomize();
- uUtils.initModule(complete); // this opens the debug file, must be the first
- uMisc.initModule;
- uVariables.initModule;
- uConsole.initModule;
- uCommands.initModule;
- uCommandHandlers.initModule;
+ uUtils.initModule(complete); // opens the debug file, must be the first
+ uVariables.initModule; // inits all global variables
+ uConsole.initModule; // opens stdout
+ uCommands.initModule; // helps below
+ uCommandHandlers.initModule; // registers all messages from frontend
- uLand.initModule;
- uLandPainted.initModule;
- uIO.initModule;
+ uLand.initModule; // computes land
+ uLandPainted.initModule; // computes drawn land
+ uIO.initModule; // sets up sockets
if complete then
begin
-{$IFDEF ANDROID}GLUnit.init;{$ENDIF}
-{$IFDEF SDL13}uTouch.initModule;{$ENDIF}
+{$IFDEF ANDROID}GLUnit.initModule;{$ENDIF}
+{$IFDEF USE_TOUCH_INTERFACE}uTouch.initModule;{$ENDIF}
+{$IFDEF USE_VIDEO_RECORDING}uVideoRec.initModule;{$ENDIF} //stub
uAI.initModule;
- //uAIActions does not need initialization
- //uAIAmmoTests does not need initialization
uAIMisc.initModule;
+ uAILandMarks.initModule; //stub
uAmmos.initModule;
+ uCaptions.initModule;
+
uChat.initModule;
uCollisions.initModule;
- //uFloat does not need initialization
- //uGame does not need initialization
uGears.initModule;
- uInputHandler.initModule;
- //uLandGraphics does not need initialization
- //uLandObjects does not need initialization
- //uLandTemplates does not need initialization
- //uLocale does not need initialization
+ uInputHandler.initModule; //stub
+ uMisc.initModule;
+ uLandTexture.initModule; //stub
uScript.initModule;
uSound.initModule;
uStats.initModule;
@@ -484,7 +486,6 @@
uTeams.initModule;
uVisualGears.initModule;
uWorld.initModule;
- uCaptions.initModule;
end;
end;
@@ -493,9 +494,9 @@
if complete then
begin
WriteLnToConsole('Freeing resources...');
- uAI.freeModule;
+ uAI.freeModule; // AI things need to be freed first
+ uAIMisc.freeModule; //stub
uAILandMarks.freeModule;
- uAIMisc.freeModule; //stub
uCaptions.freeModule;
uWorld.freeModule;
uVisualGears.freeModule;
@@ -504,22 +505,16 @@
uStats.freeModule; //stub
uSound.freeModule;
uScript.freeModule;
- //uRandom does not need to be freed
- //uLocale does not need to be freed
- //uLandTemplates does not need to be freed
+ uMisc.freeModule;
uLandTexture.freeModule;
- //uLandObjects does not need to be freed
- //uLandGraphics does not need to be freed
uGears.freeModule;
- //uGame does not need to be freed
- //uFloat does not need to be freed
uCollisions.freeModule; //stub
uChat.freeModule;
uAmmos.freeModule;
- //uAIAmmoTests does not need to be freed
- //uAIActions does not need to be freed
- uStore.freeModule;
+ uStore.freeModule; // closes SDL
{$IFDEF USE_VIDEO_RECORDING}uVideoRec.freeModule;{$ENDIF}
+{$IFDEF USE_TOUCH_INTERFACE}uTouch.freeModule;{$ENDIF} //stub
+{$IFDEF ANDROID}GLUnit.freeModule;{$ENDIF}
end;
uIO.freeModule;
@@ -528,18 +523,17 @@
uCommandHandlers.freeModule;
uCommands.freeModule;
- uConsole.freeModule;
+ uConsole.freeModule; // closes stdout
uVariables.freeModule;
- uUtils.freeModule;
- uMisc.freeModule; // uMisc closes the debug log.
+ uUtils.freeModule; // closes debug file
end;
-/////////////////////////
+////////////////////////////////////////////////////////////////////////////////
procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF};
var Preview: TPreview;
begin
+{$IFDEF HWLIBRARY}
initEverything(false);
-{$IFDEF HWLIBRARY}
WriteLnToConsole('Preview connecting on port ' + inttostr(port));
ipcPort:= port;
InitStepsFlags:= cifRandomize;
@@ -557,7 +551,7 @@
end;
{$IFNDEF HWLIBRARY}
-/////////////////////
+////////////////////////////////////////////////////////////////////////////////
procedure DisplayUsage;
var i: LongInt;
begin
@@ -583,7 +577,7 @@
WriteLn(stdout, '');
end;
-////////////////////
+////////////////////////////////////////////////////////////////////////////////
{$INCLUDE "ArgParsers.inc"}
procedure GetParams;
@@ -591,16 +585,28 @@
if (ParamCount < 3) then
GameType:= gmtSyntax
else
- if (ParamCount = 3) and ((ParamStr(3) = '--stats-only') or (ParamStr(3) = 'landpreview')) then
- internalSetGameTypeLandPreviewFromParameters()
- else if ParamCount = cDefaultParamNum then
- internalStartGameWithParameters()
+ if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
+ begin
+ initEverything(false);
+ ipcPort:= StrToInt(ParamStr(2));
+ GameType:= gmtLandPreview;
+ exit;
+ end
+ else
+ begin
+ initEverything(true);
+ if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then
+ playReplayFileWithParameters()
+ else
+ if ParamCount = cDefaultParamNum then
+ internalStartGameWithParameters()
{$IFDEF USE_VIDEO_RECORDING}
- else if ParamCount = cVideorecParamNum then
- internalStartVideoRecordingWithParameters()
+ else if ParamCount = cVideorecParamNum then
+ internalStartVideoRecordingWithParameters()
{$ENDIF}
- else
- playReplayFileWithParameters();
+ else
+ playReplayFileWithParameters();
+ end
end;
////////////////////////////////////////////////////////////////////////////////
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/options.inc
--- a/hedgewars/options.inc Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/options.inc Sun Oct 28 15:12:37 2012 +0100
@@ -42,7 +42,6 @@
{$ENDIF}
{$IFDEF MOBILE}
- {$DEFINE SDL13}
{$DEFINE HWLIBRARY}
{$DEFINE S3D_DISABLED}
{$DEFINE GLunit:=gles11}
@@ -63,6 +62,9 @@
{$ENDIF}
{$ENDIF}
+{$IFDEF USE_TOUCH_INTERFACE}
+ {$DEFINE SDL13}
+{$ENDIF}
{$IFDEF PAS2C}
{$DEFINE NOCONSOLE}
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAI.pas
--- a/hedgewars/uAI.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAI.pas Sun Oct 28 15:12:37 2012 +0100
@@ -108,7 +108,7 @@
-procedure TestAmmos(var Actions: TActions; Me: PGear; isMoved: boolean);
+procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean);
var BotLevel: Byte;
ap: TAttackParams;
Score, i, dAngle: LongInt;
@@ -130,7 +130,7 @@
{$ENDIF}
repeat
if (CanUseAmmo[a])
- and ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0))
+ and ((not rareChecks) or ((AmmoTests[a].flags and amtest_Rare) = 0))
and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0))
then
begin
@@ -151,7 +151,7 @@
else if (ap.Angle < 0) then
AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
- if (ap.Time <> 0) then
+ if (Ammoz[a].Ammo.Propz and ammoprop_Timerable) <> 0 then
AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0);
if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
@@ -217,7 +217,7 @@
procedure Walk(Me: PGear; var Actions: TActions);
const FallPixForBranching = cHHRadius;
var
- ticks, maxticks, steps, tmp: Longword;
+ ticks, maxticks, oldticks, steps, tmp: Longword;
BaseRate, BestRate, Rate: integer;
GoInfo: TGoInfo;
CanGo: boolean;
@@ -225,9 +225,12 @@
BotLevel: Byte;
a: TAmmoType;
begin
-ticks:= 0; // avoid compiler hint
+ticks:= 0;
+oldticks:= 0; // avoid compiler hint
Stack.Count:= 0;
+clearAllMarks;
+
for a:= Low(TAmmoType) to High(TAmmoType) do
CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and (HHHasAmmo(Me^.Hedgehog^, a) > 0);
@@ -272,12 +275,18 @@
{$HINTS OFF}
CanGo:= HHGo(Me, @AltMe, GoInfo);
{$HINTS ON}
+ oldticks:= ticks;
inc(ticks, GoInfo.Ticks);
if ticks > maxticks then
break;
- if (BotLevel < 5) and (GoInfo.JumpType = jmpHJump) then // hjump support
+ if (BotLevel < 5)
+ and (GoInfo.JumpType = jmpHJump)
+ and (not checkMark(hwRound(Me^.X), hwRound(Me^.Y), markHJumped))
+ then // hjump support
+ begin
// check if we could go backwards and maybe ljump over a gap after this hjump
+ addMark(hwRound(Me^.X), hwRound(Me^.Y), markHJumped);
if Push(ticks, Actions, AltMe, Me^.Message xor 3) then
begin
with Stack.States[Pred(Stack.Count)] do
@@ -298,8 +307,13 @@
// but first check walking forward
Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message)
end;
- if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
+ end;
+ if (BotLevel < 3)
+ and (GoInfo.JumpType = jmpLJump)
+ and (not checkMark(hwRound(Me^.X), hwRound(Me^.Y), markLJumped))
+ then // ljump support
begin
+ addMark(hwRound(Me^.X), hwRound(Me^.Y), markLJumped);
// at final check where we go after jump walking backward
if Push(ticks, Actions, AltMe, Me^.Message xor 3) then
with Stack.States[Pred(Stack.Count)] do
@@ -334,11 +348,11 @@
if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then
begin
- if (steps > 4) and checkMark(hwRound(Me^.X), hwRound(Me^.Y), markWasHere) then
+ if (steps > 4) and checkMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere) then
break;
- addMark(hwRound(Me^.X), hwRound(Me^.Y), markWasHere);
-
- TestAmmos(Actions, Me, true);
+ addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere);
+
+ TestAmmos(Actions, Me, ticks shr 12 = oldticks shr 12);
end;
if GoInfo.FallPix >= FallPixForBranching then
@@ -449,7 +463,6 @@
exit;
//DeleteCI(Me); // this will break demo/netplay
-clearAllMarks;
Me^.State:= Me^.State or gstHHThinking;
Me^.Message:= 0;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAIActions.pas
--- a/hedgewars/uAIActions.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAIActions.pas Sun Oct 28 15:12:37 2012 +0100
@@ -234,7 +234,7 @@
doPut(X, Y, true);
aia_waitAngle:
- if Me^.Angle <> Abs(Param) then exit;
+ if LongInt(Me^.Angle) <> Abs(Param) then exit;
aia_waitAmmoXY:
if (CurAmmoGear <> nil) and ((hwRound(CurAmmoGear^.X) <> X) or (hwRound(CurAmmoGear^.Y) <> Y)) then exit;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAIAmmoTests.pas Sun Oct 28 15:12:37 2012 +0100
@@ -22,7 +22,7 @@
interface
uses SDLh, uConsts, uFloat, uTypes;
const
- amtest_OnTurn = $00000001; // from one position
+ amtest_Rare = $00000001; // check only several positions
amtest_NoTarget = $00000002; // each pos, but no targetting
var windSpeed: real;
@@ -77,7 +77,7 @@
(proc: @TestWhip; flags: amtest_NoTarget), // amWhip
(proc: @TestBaseballBat; flags: amtest_NoTarget), // amBaseballBat
(proc: nil; flags: 0), // amParachute
- (proc: @TestAirAttack; flags: amtest_OnTurn), // amAirAttack
+ (proc: @TestAirAttack; flags: amtest_Rare), // amAirAttack
(proc: nil; flags: 0), // amMineStrike
(proc: nil; flags: 0), // amBlowTorch
(proc: nil; flags: 0), // amGirder
@@ -86,7 +86,7 @@
(proc: nil; flags: 0), // amSwitch
(proc: @TestMortar; flags: 0), // amMortar
(proc: @TestKamikaze; flags: 0), // amKamikaze
- (proc: @TestCake; flags: amtest_OnTurn or amtest_NoTarget), // amCake
+ (proc: @TestCake; flags: amtest_Rare or amtest_NoTarget), // amCake
(proc: nil; flags: 0), // amSeduction
(proc: @TestWatermelon; flags: 0), // amWatermelon
(proc: nil; flags: 0), // amHellishBomb
@@ -117,7 +117,8 @@
(proc: nil; flags: 0), // amTardis
(proc: nil; flags: 0), // amStructure
(proc: nil; flags: 0), // amLandGun
- (proc: nil; flags: 0) // amIceGun
+ (proc: nil; flags: 0), // amIceGun
+ (proc: nil; flags: 0) // amKnife
);
const BadTurn = Low(LongInt) div 4;
@@ -227,7 +228,7 @@
EX:= trunc(x);
EY:= trunc(y);
- value:= RateShove(Me, trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall);
+ value:= RateShove(trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall);
if value = 0 then
value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
@@ -286,7 +287,6 @@
begin
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
- ap.Time:= TestTime;
ap.ExplR:= 100;
ap.ExplX:= EX;
ap.ExplY:= EY;
@@ -495,6 +495,7 @@
begin
TestMortar:= BadTurn;
ap.ExplR:= 0;
+
meX:= hwFloat2Float(Me^.X);
meY:= hwFloat2Float(Me^.Y);
@@ -601,7 +602,7 @@
d: Longword;
fallDmg, valueResult: LongInt;
begin
-if Level > 3 then exit(BadTurn);
+if Level > 4 then exit(BadTurn);
dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent;
Level:= Level; // avoid compiler hint
ap.ExplR:= 0;
@@ -611,7 +612,7 @@
x:= hwFloat2Float(Me^.X);
y:= hwFloat2Float(Me^.Y);
-if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then
+if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 20 then
exit(BadTurn);
t:= 2 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
@@ -631,14 +632,14 @@
or (y < 0)
or (trunc(x) > LAND_WIDTH)
or (trunc(y) > LAND_HEIGHT)
- or (d > 50);
+ or (d > 48);
if Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 5 then
begin
fallDmg:= TraceShoveFall(Targ.X, Targ.Y, vX * 0.00125 * 20, vY * 0.00125 * 20);
if fallDmg < 0 then
valueResult:= 204800
- else valueResult:= Max(0, (4 - d div 50) * trunc((7+fallDmg)*dmgMod) * 1024)
+ else valueResult:= Max(0, (4 - d div 12) * trunc((7 + fallDmg) * dmgMod) * 1024)
end
else
valueResult:= BadTurn;
@@ -649,7 +650,7 @@
function TestSniperRifle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
var Vx, Vy, x, y, t, dmg, dmgMod: real;
d: Longword;
- fallDmg, valueResult: LongInt;
+ fallDmg: LongInt;
begin
if Level > 3 then exit(BadTurn);
dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent;
@@ -701,6 +702,8 @@
x, y, trackFall: LongInt;
dx, dy: real;
begin
+ Targ:= Targ; // avoid compiler hint
+
if Level < 3 then trackFall:= afTrackFall
else trackFall:= 0;
@@ -718,10 +721,10 @@
dx:= sin(a / cMaxAngle * pi) * 0.5;
dy:= cos(a / cMaxAngle * pi) * 0.5;
- v1:= RateShove(Me, x - 10, y + 2
+ v1:= RateShove(x - 10, y + 2
, 32, 30, 115
, -dx, -dy, trackFall);
- v2:= RateShove(Me, x + 10, y + 2
+ v2:= RateShove(x + 10, y + 2
, 32, 30, 115
, dx, -dy, trackFall);
if (v1 > valueResult) or (v2 > valueResult) then
@@ -750,6 +753,8 @@
var valueResult, v1, v2, i: LongInt;
x, y, trackFall: LongInt;
begin
+ Targ:= Targ; // avoid compiler hint
+
if Level = 1 then trackFall:= afTrackFall
else trackFall:= 0;
@@ -762,11 +767,11 @@
v1:= 0;
for i:= 0 to 8 do
begin
- v1:= v1 + RateShove(Me, x - 5, y - 10 * i
+ v1:= v1 + RateShove(x - 5, y - 10 * i
, 19, 30, 40
, -0.45, -0.9, trackFall or afSetSkip);
end;
- v1:= v1 + RateShove(Me, x - 5, y - 90
+ v1:= v1 + RateShove(x - 5, y - 90
, 19, 30, 40
, -0.45, -0.9, trackFall);
@@ -775,11 +780,11 @@
v2:= 0;
for i:= 0 to 8 do
begin
- v2:= v2 + RateShove(Me, x + 5, y - 10 * i
+ v2:= v2 + RateShove(x + 5, y - 10 * i
, 19, 30, 40
, 0.45, -0.9, trackFall or afSetSkip);
end;
- v2:= v2 + RateShove(Me, x + 5, y - 90
+ v2:= v2 + RateShove(x + 5, y - 90
, 19, 30, 40
, 0.45, -0.9, trackFall);
@@ -806,6 +811,8 @@
var valueResult, v1, v2: LongInt;
x, y, trackFall: LongInt;
begin
+ Targ:= Targ; // avoid compiler hint
+
if Level = 1 then trackFall:= afTrackFall
else trackFall:= 0;
@@ -819,19 +826,19 @@
{first RateShove checks farthermost of two whip's AmmoShove attacks
to encourage distant attacks (damaged hog is excluded from view of second
RateShove call)}
- v1:= RateShove(Me, x - 13, y
+ v1:= RateShove(x - 13, y
, 30, 30, 25
, -1, -0.8, trackFall or afSetSkip);
v1:= v1 +
- RateShove(Me, x - 2, y
+ RateShove(x - 2, y
, 30, 30, 25
, -1, -0.8, trackFall);
// now try opposite direction
- v2:= RateShove(Me, x + 13, y
+ v2:= RateShove(x + 13, y
, 30, 30, 25
, 1, -0.8, trackFall or afSetSkip);
v2:= v2 +
- RateShove(Me, x + 2, y
+ RateShove(x + 2, y
, 30, 30, 25
, 1, -0.8, trackFall);
@@ -898,7 +905,7 @@
for i:= 0 to 512 div step - 2 do
begin
valueResult:= valueResult +
- RateShove(Me, trunc(x), trunc(y)
+ RateShove(trunc(x), trunc(y)
, 30, 30, 25
, cx, -0.9, trackFall or afSetSkip);
@@ -910,14 +917,14 @@
x:= hwFloat2Float(Me^.X);
y:= hwFloat2Float(Me^.Y);
tx:= trunc(x);
- v:= RateShove(Me, tx, trunc(y)
+ v:= RateShove(tx, trunc(y)
, 30, 30, 25
, -cx, -0.9, trackFall);
for i:= 1 to 512 div step - 2 do
begin
y:= y + dy;
v:= v +
- RateShove(Me, tx, trunc(y)
+ RateShove(tx, trunc(y)
, 30, 30, 25
, -cx, -0.9, trackFall or afSetSkip);
end
@@ -927,12 +934,12 @@
ap.Angle:= -2048;
valueResult:= v
end;
-
- v:= RateShove(Me, trunc(x), trunc(y)
+
+ v:= RateShove(trunc(x), trunc(y)
, 30, 30, 25
, cx, -0.9, trackFall);
valueResult:= valueResult + v - KillScore * friendlyfactor div 100 * 1024;
-
+
if v < 65536 then
inc(valueResult, RateExplosion(Me, trunc(x), trunc(y), 30));
@@ -943,6 +950,8 @@
var rate: LongInt;
begin
Level:= Level; // avoid compiler hint
+Targ:= Targ;
+
ap.ExplR:= 0;
ap.Time:= 0;
ap.Power:= 1;
@@ -1090,18 +1099,21 @@
function TestCake(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
var valueResult, v1, v2: LongInt;
- x, y, trackFall: LongInt;
cake: TGear;
begin
+ Targ:= Targ; // avoid compiler hint
+
if (Level > 2) then
exit(BadTurn);
+
ap.ExplR:= 0;
ap.Time:= 0;
ap.Power:= BadTurn; // use it as max score value in checkCakeWalk
- FillChar(cake, sizeof(cake), 0);
+ //FillChar(cake, sizeof(cake), 0);
cake.Radius:= 7;
cake.CollisionMask:= $FF7F;
+ cake.Hedgehog:= Me^.Hedgehog;
// check left direction
cake.Angle:= 3;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAILandMarks.pas
--- a/hedgewars/uAILandMarks.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAILandMarks.pas Sun Oct 28 15:12:37 2012 +0100
@@ -1,12 +1,16 @@
unit uAILandMarks;
interface
-const markWasHere = $01;
+const
+ markWalkedHere = $01;
+ markHJumped = $02;
+ markLJumped = $04;
procedure addMark(X, Y: LongInt; mark: byte);
function checkMark(X, Y: LongInt; mark: byte) : boolean;
procedure clearAllMarks;
procedure clearMarks(mark: byte);
+procedure setAILandMarks;
procedure initModule;
procedure freeModule;
@@ -54,8 +58,7 @@
marks[Y, X]:= marks[Y, X] and (not mark)
end;
-
-procedure initModule;
+procedure setAILandMarks;
begin
WIDTH:= LAND_WIDTH shr gr;
HEIGHT:= LAND_HEIGHT shr gr;
@@ -63,6 +66,10 @@
SetLength(marks, HEIGHT, WIDTH);
end;
+procedure initModule;
+begin
+end;
+
procedure freeModule;
begin
SetLength(marks, 0, 0);
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAIMisc.pas
--- a/hedgewars/uAIMisc.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAIMisc.pas Sun Oct 28 15:12:37 2012 +0100
@@ -66,7 +66,7 @@
function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline;
function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
-function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
+function RateShove(x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
function RateHammer(Me: PGear): LongInt;
@@ -88,9 +88,9 @@
const KillScore = 200;
var friendlyfactor: LongInt = 300;
-
+
implementation
-uses uCollisions, uVariables, uUtils, uDebug, uLandTexture;
+uses uCollisions, uVariables, uUtils, uLandTexture, uGearsUtils;
var
KnownExplosion: record
@@ -110,7 +110,9 @@
begin
for i:= 0 to cMaxHHIndex do
if (Hedgehogs[i].Gear <> nil)
- and (Hedgehogs[i].Gear <> ThinkingHH) then
+ and (Hedgehogs[i].Gear <> ThinkingHH)
+ and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage)
+ then
begin
with Targets.ar[Targets.Count], Hedgehogs[i] do
begin
@@ -119,11 +121,11 @@
Point.Y:= hwRound(Gear^.Y);
if Clan <> CurrentTeam^.Clan then
begin
- Score:= Gear^.Health;
+ Score:= Gear^.Health - Gear^.Damage;
inc(e)
end else
begin
- Score:= -Gear^.Health;
+ Score:= Gear^.Damage - Gear^.Health;
inc(f)
end
end;
@@ -364,9 +366,9 @@
end;
function TraceShoveFall(x, y, dX, dY: Real): LongInt;
-var dmg, v: LongInt;
+var dmg: LongInt;
begin
-v:= random($FFFFFFFF);
+//v:= random($FFFFFFFF);
while true do
begin
x:= x + dX;
@@ -457,7 +459,7 @@
RateExplosion:= rate;
end;
-function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
+function RateShove(x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
var i, fallDmg, dmg, rate: LongInt;
dX, dY, dmgMod: real;
begin
@@ -731,7 +733,7 @@
end;
continue
end;
-
+
// usual walk
if (Gear^.Message and gmLeft) <> 0 then
Gear^.dX:= -cLittle
@@ -740,77 +742,10 @@
Gear^.dX:= cLittle
else
exit(false);
-
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
- Gear^.Y:= Gear^.Y + _6
- end else Gear^.Y:= Gear^.Y + _5 else
- end else Gear^.Y:= Gear^.Y + _4 else
- end else Gear^.Y:= Gear^.Y + _3 else
- end else Gear^.Y:= Gear^.Y + _2 else
- end else Gear^.Y:= Gear^.Y + _1
- end;
-
- if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
- begin
- Gear^.X:= Gear^.X + int2hwFloat(hwSign(Gear^.dX));
- inc(GoInfo.Ticks, cHHStepTicks)
- end;
- // too scared to reformat this part
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
-
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
-
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
-
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
+ if MakeHedgehogsStep(Gear) then
+ inc(GoInfo.Ticks, cHHStepTicks);
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
-
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
-
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y - _6;
- Gear^.dY:= _0;
- Gear^.State:= Gear^.State or gstMoving
- end
- end
- end
- end
- end
- end
- end;
// we have moved for 1 px
if (pX <> hwRound(Gear^.X)) and ((Gear^.State and gstMoving) = 0) then
exit(true)
@@ -837,7 +772,6 @@
procedure freeModule;
begin
-
end;
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uAmmos.pas
--- a/hedgewars/uAmmos.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uAmmos.pas Sun Oct 28 15:12:37 2012 +0100
@@ -20,7 +20,7 @@
unit uAmmos;
interface
-uses uConsts, uTypes;
+uses uConsts, uTypes, uStore;
procedure initModule;
procedure freeModule;
@@ -277,6 +277,7 @@
begin
PackAmmo(Ammo, Ammoz[AmmoType].Slot);
//SwitchNotHeldAmmo(Hedgehog);
+ if CurAmmoType = amKnife then LoadHedgehogHat(Hedgehog, Hedgehog.Hat);
CurAmmoType:= amNothing
end
end
@@ -347,6 +348,7 @@
end;
TryDo(slot <= cMaxSlotIndex, 'Ammo slot index overflow', true);
CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
+ if CurAmmoType = amKnife then LoadHedgehogHat(Hedgehog, 'Reserved/chef')
end
end;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uChat.pas
--- a/hedgewars/uChat.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uChat.pas Sun Oct 28 15:12:37 2012 +0100
@@ -376,6 +376,7 @@
else
begin
// err, does anyone have any documentation on this sequence?
+ // ^^ isn't it obvious? 27 is esc, 32 is space, inbetween is "/team"
KeyPressChat(27);
KeyPressChat(47);
KeyPressChat(116);
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uCollisions.pas
--- a/hedgewars/uCollisions.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uCollisions.pas Sun Oct 28 15:12:37 2012 +0100
@@ -56,6 +56,7 @@
// returns: negative sign if going downhill to left, value is steepness (noslope/error = _0, 45° = _0_5)
function CalcSlopeBelowGear(Gear: PGear): hwFloat;
+function CalcSlopeNearGear(Gear: PGear; dirX, dirY: LongInt): hwFloat;
function CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean;
implementation
@@ -139,8 +140,8 @@
begin
// Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
if (Gear^.CollisionMask = $FF7F) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
- ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.X) - Gear^.Radius) or
- (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.X) + Gear^.Radius)) then
+ ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.X) - Gear^.Radius) or
+ (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.X) + Gear^.Radius)) then
Gear^.CollisionMask:= $FFFF;
x:= hwRound(Gear^.X);
@@ -169,8 +170,8 @@
begin
// Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
if (Gear^.CollisionMask = $FF7F) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
- ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.Y) - Gear^.Radius) or
- (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.Y) + Gear^.Radius)) then
+ ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.Y) - Gear^.Radius) or
+ (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.Y) + Gear^.Radius)) then
Gear^.CollisionMask:= $FFFF;
y:= hwRound(Gear^.Y);
@@ -237,16 +238,18 @@
for i:= 0 to Pred(Count) do
with cinfos[i] do
if (Gear <> cGear) and (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2))
- and ((mx > x) xor (Dir > 0)) then
- if ((cGear^.Kind in [gtHedgehog, gtMine]) and ((Gear^.State and gstNotKickable) = 0)) or
+ and ((mx > x) xor (Dir > 0)) and
+ (
+ ((cGear^.Kind in [gtHedgehog, gtMine, gtKnife]) and ((Gear^.State and gstNotKickable) = 0)) or
// only apply X kick if the barrel is knocked over
- ((cGear^.Kind = gtExplosives) and ((cGear^.State and gsttmpflag) <> 0)) then
+ ((cGear^.Kind = gtExplosives) and ((cGear^.State and gsttmpflag) <> 0))) then
begin
with cGear^ do
begin
dX:= Gear^.dX;
dY:= Gear^.dY * _0_5;
State:= State or gstMoving;
+ if Kind = gtKnife then State:= State and (not gstCollision);
Active:= true
end;
DeleteCI(cGear);
@@ -257,7 +260,7 @@
end;
function TestCollisionYKick(Gear: PGear; Dir: LongInt): boolean;
-var x, y, mx, my, i: LongInt;
+var x, y, mx, my, myr, i: LongInt;
flag: boolean;
begin
flag:= false;
@@ -293,12 +296,15 @@
mx:= hwRound(Gear^.X);
my:= hwRound(Gear^.Y);
+ myr:= my+Gear^.Radius;
for i:= 0 to Pred(Count) do
with cinfos[i] do
if (Gear <> cGear) and (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2))
- and ((my > y) xor (Dir > 0)) then
- if (cGear^.Kind in [gtHedgehog, gtMine, gtExplosives]) and ((Gear^.State and gstNotKickable) = 0) then
+ and ((myr > y) xor (Dir > 0)) and
+ (
+ (cGear^.Kind in [gtHedgehog, gtMine, gtKnife, gtExplosives]) and
+ ((Gear^.State and gstNotKickable) = 0)) then
begin
with cGear^ do
begin
@@ -306,6 +312,7 @@
dX:= Gear^.dX * _0_5;
dY:= Gear^.dY;
State:= State or gstMoving;
+ if Kind = gtKnife then State:= State and (not gstCollision);
Active:= true
end;
DeleteCI(cGear);
@@ -576,6 +583,99 @@
CalcSlopeTangent:= true;
end;
+function CalcSlopeNearGear(Gear: PGear; dirX, dirY: LongInt): hwFloat;
+var dx, dy: hwFloat;
+ collX, collY, i, y, x, gx, gy, sdx, sdy: LongInt;
+ isColl, bSucc: Boolean;
+begin
+
+if dirY <> 0 then
+ begin
+ y:= hwRound(Gear^.Y) + Gear^.Radius * dirY;
+ gx:= hwRound(Gear^.X);
+ collX := gx;
+ isColl:= false;
+
+ if (y and LAND_HEIGHT_MASK) = 0 then
+ begin
+ x:= hwRound(Gear^.X) - Gear^.Radius + 1;
+ i:= x + Gear^.Radius * 2 - 2;
+ repeat
+ if (x and LAND_WIDTH_MASK) = 0 then
+ if Land[y, x] <> 0 then
+ if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
+ begin
+ isColl:= true;
+ collX := x;
+ end;
+ inc(x)
+ until (x > i);
+ end;
+ end
+else
+ begin
+ x:= hwRound(Gear^.X) + Gear^.Radius * dirX;
+ gy:= hwRound(Gear^.Y);
+ collY := gy;
+ isColl:= false;
+
+ if (x and LAND_WIDTH_MASK) = 0 then
+ begin
+ y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
+ i:= y + Gear^.Radius * 2 - 2;
+ repeat
+ if (y and LAND_HEIGHT_MASK) = 0 then
+ if Land[y, x] <> 0 then
+ if (not isColl) or (abs(y-gy) < abs(collY-gy)) then
+ begin
+ isColl:= true;
+ collY := y;
+ end;
+ inc(y)
+ until (y > i);
+ end;
+ end;
+
+if isColl then
+ begin
+ // save original dx/dy
+ dx := Gear^.dX;
+ dy := Gear^.dY;
+
+ if dirY <> 0 then
+ begin
+ Gear^.dX.QWordValue:= 0;
+ Gear^.dX.isNegative:= (collX >= gx);
+ Gear^.dY:= _1*dirY
+ end
+ else
+ begin
+ Gear^.dY.QWordValue:= 0;
+ Gear^.dY.isNegative:= (collY >= gy);
+ Gear^.dX:= _1*dirX
+ end;
+
+ sdx:= 0;
+ sdy:= 0;
+ if dirY <> 0 then
+ bSucc := CalcSlopeTangent(Gear, collX, y, sdx, sdy, 0)
+ else bSucc := CalcSlopeTangent(Gear, x, collY, sdx, sdy, 0);
+
+ // restore original dx/dy
+ Gear^.dX := dx;
+ Gear^.dY := dy;
+
+ if bSucc and ((sdx <> 0) or (sdy <> 0)) then
+ begin
+ dx := int2hwFloat(sdy) / (abs(sdx) + abs(sdy));
+ dx.isNegative := (sdx * sdy) < 0;
+ exit (dx);
+ end
+ end;
+
+CalcSlopeNearGear := _0;
+end;
+
function CalcSlopeBelowGear(Gear: PGear): hwFloat;
var dx, dy: hwFloat;
collX, i, y, x, gx, sdx, sdy: LongInt;
@@ -595,7 +695,7 @@
repeat
if (x and LAND_WIDTH_MASK) = 0 then
if Land[y, x] > 255 then
- if not isColl or (abs(x-gx) < abs(collX-gx)) then
+ if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
begin
isColl:= true;
collX := x;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uCommandHandlers.pas
--- a/hedgewars/uCommandHandlers.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uCommandHandlers.pas Sun Oct 28 15:12:37 2012 +0100
@@ -37,7 +37,7 @@
'R': if ReadyTimeLeft > 1 then
begin
ReadyTimeLeft:= 1;
- if not CurrentTeam^.ExtDriven then
+ if not isExternalSource then
SendIPC('c'+s);
end
end
@@ -71,12 +71,12 @@
begin
s:= s; // avoid compiler hint
if GameState = gsConfirm then
- begin
+ begin
SendIPC(_S'Q');
GameState:= gsExit
- end
-else
- ParseCommand('chat team', true);
+ end
+ else
+ ParseCommand('chat team', true);
end;
procedure chHalt (var s: shortstring);
@@ -218,7 +218,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'L');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -231,7 +231,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'l');
with CurrentHedgehog^.Gear^ do
Message:= Message and (not (gmLeft and InputMask));
@@ -243,7 +243,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'R');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -256,7 +256,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'r');
with CurrentHedgehog^.Gear^ do
Message:= Message and (not (gmRight and InputMask));
@@ -268,7 +268,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'U');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -281,7 +281,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'u');
with CurrentHedgehog^.Gear^ do
Message:= Message and (not (gmUp and InputMask));
@@ -293,7 +293,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'D');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -306,7 +306,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'd');
with CurrentHedgehog^.Gear^ do
Message:= Message and (not (gmDown and InputMask));
@@ -318,7 +318,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'Z');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -331,7 +331,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'z');
with CurrentHedgehog^.Gear^ do
Message:= Message and (not (gmPrecise and InputMask));
@@ -343,7 +343,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'j');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -356,7 +356,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'J');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -376,7 +376,7 @@
if ((State and gstHHDriven) <> 0) then
begin
FollowGear:= CurrentHedgehog^.Gear;
- if not CurrentTeam^.ExtDriven then
+ if not isExternalSource then
SendIPC(_S'A');
Message:= Message or (gmAttack and InputMask);
ScriptCall('onAttack');
@@ -391,7 +391,7 @@
exit;
with CurrentHedgehog^.Gear^ do
begin
- if not CurrentTeam^.ExtDriven and
+ if not isExternalSource and
((Message and gmAttack) <> 0) then
SendIPC(_S'a');
Message:= Message and (not (gmAttack and InputMask));
@@ -404,7 +404,7 @@
s:= s; // avoid compiler hint
if CheckNoTeamOrHH or isPaused then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S'S');
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -428,7 +428,7 @@
gi := gi^.NextGear
end;
- if not CurrentTeam^.ExtDriven then
+ if not isExternalSource then
begin
s[0]:= #5;
s[1]:= 'N';
@@ -436,16 +436,19 @@
SendIPC(s)
end
else
- TryDo(CheckSum = lastTurnChecksum, 'Desync detected', true);
+ TryDo(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true);
+
AddFileLog('Next turn: time '+inttostr(GameTicks));
end;
procedure chTimer(var s: shortstring);
begin
-if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then
+if CheckNoTeamOrHH then
exit;
-if not CurrentTeam^.ExtDriven then
+TryDo((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true);
+
+if not isExternalSource then
SendIPC(s);
bShowFinger:= false;
with CurrentHedgehog^.Gear^ do
@@ -465,7 +468,7 @@
slot:= byte(s[1]) - 49;
if slot > cMaxSlotIndex then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
begin
ss[0]:= #1;
ss[1]:= char(byte(s[1]) + 79);
@@ -482,13 +485,12 @@
procedure chSetWeapon(var s: shortstring);
begin
- if (s[0] <> #1) or CheckNoTeamOrHH then
+ if CheckNoTeamOrHH then
exit;
- if TAmmoType(s[1]) > High(TAmmoType) then
- exit;
+ TryDo((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true);
- if not CurrentTeam^.ExtDriven then
+ if not isExternalSource then
SendIPC('w' + s);
with CurrentHedgehog^.Gear^ do
@@ -507,7 +509,7 @@
if TWave(s[1]) > High(TWave) then
exit;
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC('t' + s);
with CurrentHedgehog^.Gear^ do
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uCommands.pas
--- a/hedgewars/uCommands.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uCommands.pas Sun Oct 28 15:12:37 2012 +0100
@@ -23,13 +23,15 @@
interface
var isDeveloperMode: boolean;
+var isExternalSource: boolean;
type TCommandHandler = procedure (var params: shortstring);
procedure initModule;
procedure freeModule;
procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean);
procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
+procedure ParseCommand(CmdStr: shortstring; TrustedSource, ExternalSource: boolean);
procedure ParseTeamCommand(s: shortstring);
procedure StopMessages(Message: Longword);
@@ -44,8 +46,7 @@
Trusted, Rand: boolean;
end;
-var
- Variables: PVariable;
+var Variables: PVariable;
procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
begin
@@ -73,11 +74,17 @@
end;
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
+begin
+ ParseCommand(CmdStr, TrustedSource, false)
+end;
+
+procedure ParseCommand(CmdStr: shortstring; TrustedSource, ExternalSource: boolean);
var s: shortstring;
t: PVariable;
c: char;
begin
+isExternalSource:= ExternalSource or ((CurrentTeam <> nil) and CurrentTeam^.ExtDriven);
//WriteLnToConsole(CmdStr);
if CmdStr[0]=#0 then
exit;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uFloat.pas
--- a/hedgewars/uFloat.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uFloat.pas Sun Oct 28 15:12:37 2012 +0100
@@ -91,6 +91,7 @@
function DistanceI(const dx, dy: LongInt): hwFloat; // Same as above for integer parameters.
function AngleSin(const Angle: Longword): hwFloat;
function AngleCos(const Angle: Longword): hwFloat;
+function vector2Angle(const x, y: hwFloat): LongInt;
function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
function hwSignf(r: real): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
@@ -491,6 +492,9 @@
end;
function hwSqrt(const t: hwFloat): hwFloat;
+const pwr = 8; // even value, feel free to adjust
+ rThreshold = 1 shl (pwr + 32);
+ lThreshold = 1 shl (pwr div 2 + 32);
var l, r: QWord;
c: hwFloat;
begin
@@ -503,14 +507,24 @@
end
else
begin
- l:= $100000000;
- r:= t.QWordValue div 2 + $80000000; // r:= t / 2 + 0.5
- if r > $FFFFFFFFFFFF then
- r:= $FFFFFFFFFFFF
+ if t.QWordValue > $FFFFFFFFFFFF then // t.Round > 65535.9999
+ begin
+ l:= $10000000000; // 256
+ r:= $FFFFFFFFFFFF; // 65535.9999
+ end else
+ if t.QWordValue >= rThreshold then
+ begin
+ l:= lThreshold;
+ r:= $10000000000; // 256
+ end else
+ begin
+ l:= $100000000;
+ r:= lThreshold;
+ end;
end;
repeat
- c.QWordValue:= (l + r) div 2;
+ c.QWordValue:= (l + r) shr 1;
if hwSqr(c).QWordValue > t.QWordValue then
r:= c.QWordValue
else
@@ -573,6 +587,39 @@
else
AngleCos.QWordValue:= SinTable[Angle - 1024]
end;
+
+function vector2Angle(const x, y: hwFloat): LongInt;
+var d, nf: hwFloat;
+ l, r, c, oc: Longword;
+ n: QWord;
+begin
+ d:= _1 / Distance(x, y);
+
+ nf:= y * d;
+ n:= nf.QWordValue;
+
+ l:= 0;
+ r:= 1024;
+ c:= 0;
+
+ repeat
+ oc:= c;
+
+ c:= (l + r) shr 1;
+
+ if n >= SinTable[c] then
+ l:= c
+ else
+ r:= c;
+
+ until (oc = c);
+
+ if x.isNegative then c:= 2048 - c;
+ if y.isNegative then c:= - c;
+
+ vector2Angle:= c
+end;
+
{$ENDIF}
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGame.pas
--- a/hedgewars/uGame.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGame.pas Sun Oct 28 15:12:37 2012 +0100
@@ -28,7 +28,7 @@
////////////////////
uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, uMobile,
uVisualGears, uTypes, uVariables, uCommands, uConsts
- {$IFDEF SDL13}, uTouch{$ENDIF};
+ {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
procedure DoGameTick(Lag: LongInt);
var i: LongInt;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGears.pas Sun Oct 28 15:12:37 2012 +0100
@@ -652,9 +652,9 @@
snowRight:= max(LAND_WIDTH,4096)+512;
snowLeft:= -(snowRight-LAND_WIDTH);
-if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then
- for i:= vobCount * max(LAND_WIDTH,4096) div 2048 downto 1 do
- AddGear(GetRandom(snowRight-snowLeft)+snowLeft, LAND_HEIGHT-1300+GetRandom(750), gtFlake, 0, _0, _0, 0);
+if (not hasBorder) and ((Theme = 'Snow') or (Theme = 'Christmas')) then
+ for i:= vobCount * Longword(max(LAND_WIDTH,4096)) div 2048 downto 1 do
+ AddGear(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft, LongInt(LAND_HEIGHT + GetRandom(750)) - 1300, gtFlake, 0, _0, _0, 0);
end;
@@ -671,6 +671,7 @@
gtHedgehog,
gtMine,
gtSMine,
+ gtKnife,
gtCase,
gtTarget,
gtExplosives,
@@ -698,6 +699,7 @@
t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
t^.State:= t^.State or gstMoving;
+ if t^.Kind = gtKnife then t^.State:= t^.State and (not gstCollision);
t^.Active:= true;
FollowGear:= t
end
@@ -730,7 +732,7 @@
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
var t: PGearArray;
Gear: PGear;
- i, tmpDmg: LongInt;
+ i, j, tmpDmg: LongInt;
VGear: PVisualGear;
begin
t:= CheckGearsCollision(Ammo);
@@ -769,6 +771,7 @@
gtHedgehog,
gtMine,
gtSMine,
+ gtKnife,
gtTarget,
gtCase,
gtExplosives,
@@ -780,7 +783,28 @@
exit;
end;
if (not Gear^.Invulnerable) then
+ begin
+ if (Ammo^.Kind = gtKnife) and (tmpDmg > 0) then
+ for j:= 1 to max(1,min(3,tmpDmg div 5)) do
+ begin
+ VGear:= AddVisualGear(hwRound(Ammo^.X-((Ammo^.X-Gear^.X)/_2)), hwRound(Ammo^.Y-((Ammo^.Y-Gear^.Y)/_2)), vgtStraightShot);
+ if VGear <> nil then
+ with VGear^ do
+ begin
+ Tint:= $FFCC00FF;
+ Angle:= random(360);
+ dx:= 0.0005 * (random(100));
+ dy:= 0.0005 * (random(100));
+ if random(2) = 0 then
+ dx := -dx;
+ if random(2) = 0 then
+ dy := -dy;
+ FrameTicks:= 600+random(200);
+ State:= ord(sprStar)
+ end
+ end;
ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg, dsShove)
+ end
else
Gear^.State:= Gear^.State or gstWinner;
if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then
@@ -790,35 +814,39 @@
ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
end;
- DeleteCI(Gear);
if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then
begin
Gear^.dX:= Ammo^.dX * Power * _0_005;
Gear^.dY:= Ammo^.dY * Power * _0_005
end
- else
+ else if ((Ammo^.Kind <> gtFlame) or (Gear^.Kind = gtHedgehog)) and (Power <> 0) then
begin
Gear^.dX:= Ammo^.dX * Power * _0_01;
Gear^.dY:= Ammo^.dY * Power * _0_01
end;
- Gear^.Active:= true;
- Gear^.State:= Gear^.State or gstMoving;
-
- // move the gear upwards a bit to throw it over tiny obstacles at start
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
+ if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then
begin
- if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
- or (TestCollisionYwithGear(Gear, -1) <> 0)) then
- Gear^.Y:= Gear^.Y - _1;
- if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
- or (TestCollisionYwithGear(Gear, -1) <> 0)) then
- Gear^.Y:= Gear^.Y - _1;
- if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
- or (TestCollisionYwithGear(Gear, -1) <> 0)) then
- Gear^.Y:= Gear^.Y - _1;
+ Gear^.Active:= true;
+ DeleteCI(Gear);
+ Gear^.State:= Gear^.State or gstMoving;
+ if Gear^.Kind = gtKnife then Gear^.State:= Gear^.State and (not gstCollision);
+ // move the gear upwards a bit to throw it over tiny obstacles at start
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
+ begin
+ if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
+ or (TestCollisionYwithGear(Gear, -1) <> 0)) then
+ Gear^.Y:= Gear^.Y - _1;
+ if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
+ or (TestCollisionYwithGear(Gear, -1) <> 0)) then
+ Gear^.Y:= Gear^.Y - _1;
+ if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
+ or (TestCollisionYwithGear(Gear, -1) <> 0)) then
+ Gear^.Y:= Gear^.Y - _1;
+ end
end;
+
if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then
FollowGear:= Gear
end;
@@ -1195,7 +1223,7 @@
procedure chSkip(var s: shortstring);
begin
s:= s; // avoid compiler hint
-if not CurrentTeam^.ExtDriven then
+if not isExternalSource then
SendIPC(_S',');
uStats.Skipped;
skipFlag:= true
@@ -1341,7 +1369,8 @@
@doStepTardis,
@doStepIceGun,
@doStepAddAmmo,
- @doStepGenericFaller);
+ @doStepGenericFaller,
+ @doStepKnife);
begin
doStepHandlers:= handlers;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGearsHandlers.pas
--- a/hedgewars/uGearsHandlers.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGearsHandlers.pas Sun Oct 28 15:12:37 2012 +0100
@@ -35,12 +35,12 @@
procedure PrevAngle(Gear: PGear; dA: LongInt); inline;
begin
- Gear^.Angle := (Gear^.Angle - dA) and 3
+ Gear^.Angle := (LongInt(Gear^.Angle) - dA) and 3
end;
procedure NextAngle(Gear: PGear; dA: LongInt); inline;
begin
- Gear^.Angle := (Gear^.Angle + dA) and 3
+ Gear^.Angle := (LongInt(Gear^.Angle) + dA) and 3
end;
procedure cakeStep(Gear: PGear);
@@ -51,8 +51,8 @@
dA := hwSign(Gear^.dX);
xx := dirs[Gear^.Angle].x;
yy := dirs[Gear^.Angle].y;
- xxn := dirs[(Gear^.Angle + dA) and 3].x;
- yyn := dirs[(Gear^.Angle + dA) and 3].y;
+ xxn := dirs[(LongInt(Gear^.Angle) + dA) and 3].x;
+ yyn := dirs[(LongInt(Gear^.Angle) + dA) and 3].y;
if (xx = 0) then
if TestCollisionYwithGear(Gear, yy) <> 0 then
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGearsHedgehog.pas Sun Oct 28 15:12:37 2012 +0100
@@ -42,6 +42,7 @@
function ChangeAmmo(HHGear: PGear): boolean;
var slot, i: Longword;
ammoidx: LongInt;
+ prevAmmo: TAmmoType;
begin
ChangeAmmo:= false;
slot:= HHGear^.MsgParam;
@@ -49,6 +50,7 @@
with HHGear^.Hedgehog^ do
begin
HHGear^.Message:= HHGear^.Message and (not gmSlot);
+ prevAmmo:= CurAmmoType;
ammoidx:= 0;
if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0)
or ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0))
@@ -95,6 +97,13 @@
end;
if ammoidx >= 0 then
CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
+ if (prevAmmo <> CurAmmoType) then
+ begin
+ if CurAmmoType = amKnife then
+ LoadHedgehogHat(HHGear^.Hedgehog^, 'Reserved/chef')
+ else if prevAmmo = amKnife then
+ LoadHedgehogHat(HHGear^.Hedgehog^, Hat);
+ end
end
end;
@@ -262,6 +271,11 @@
amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
amMine: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+ amKnife: begin
+ newGear:= AddGear(hwRound(lx), hwRound(ly), gtKnife, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+ newGear^.State:= newGear^.State or gstMoving;
+ newGear^.Radius:= 6 // temporarily shrink so it doesn't instantly embed in the ground
+ end;
amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
amPortalGun: begin
@@ -309,7 +323,7 @@
newGear^.SoundChannel:= LoopSound(sndRCPlane)
end;
amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
- amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
+ amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, SignAs(cLittle, xx), _0, 0);
amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0);
amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer);
amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0);
@@ -397,7 +411,7 @@
newGear^.Target.X:= TargetPoint.X;
newGear^.Target.Y:= TargetPoint.Y
end;
- if newGear <> nil then newGear^.CollisionMask:= $FF7F;
+ if (newGear <> nil) and (newGear^.CollisionMask and $80 <> 0) then newGear^.CollisionMask:= newGear^.CollisionMask and (not $80);
// Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
if altUse then
@@ -741,7 +755,7 @@
else exit;
StepSoundTimer:= cHHStepTicks;
-
+
GHStepTicks:= cHHStepTicks;
if PrevdX <> hwSign(Gear^.dX) then
begin
@@ -752,69 +766,10 @@
Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
- begin
- Gear^.Y:= Gear^.Y - _1;
- if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
- Gear^.Y:= Gear^.Y + _6
- end else Gear^.Y:= Gear^.Y + _5 else
- end else Gear^.Y:= Gear^.Y + _4 else
- end else Gear^.Y:= Gear^.Y + _3 else
- end else Gear^.Y:= Gear^.Y + _2 else
- end else Gear^.Y:= Gear^.Y + _1
- end;
-
- if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then
- Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
-
- SetAllHHToActive;
+ if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) then
+ MakeHedgehogsStep(Gear);
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y + _1;
- if TestCollisionYwithGear(Gear, 1) = 0 then
- begin
- Gear^.Y:= Gear^.Y - _6;
- Gear^.dY:= _0;
- Gear^.State:= Gear^.State or gstMoving;
- exit
- end;
- end
- end
- end
- end
- end
- end;
+ SetAllHHToActive;
AddGearCI(Gear)
end
end;
@@ -1013,12 +968,12 @@
if (CurrentHedgehog^.Gear = Gear) then
isCursorVisible:= false
end;
-// IMO this should trigger homerun based on leftX/rightX + someval instead - that is 'knocking it out of the park'
if (not isZero(Gear^.dY)) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
begin
inc(Gear^.FlightTime);
- if Gear^.FlightTime = 3000 then
+ if (Gear^.FlightTime > 1500) and ((hwRound(Gear^.X) < leftX-250) or (hwRound(Gear^.X) > rightX+250)) then
begin
+ Gear^.FlightTime:= 0;
AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage);
PlaySound(sndHomerun)
end;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGearsList.pas
--- a/hedgewars/uGearsList.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGearsList.pas Sun Oct 28 15:12:37 2012 +0100
@@ -106,7 +106,12 @@
gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
gear^.CollisionMask:= $FFFF;
-if CurrentHedgehog <> nil then gear^.Hedgehog:= CurrentHedgehog;
+if CurrentHedgehog <> nil then
+ begin
+ gear^.Hedgehog:= CurrentHedgehog;
+ if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then
+ gear^.CollisionMask:= $FF7F
+ end;
if (Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
gear^.Z:= cHHZ+1
@@ -177,9 +182,9 @@
if State and gstTmpFlag = 0 then
begin
dx.isNegative:= GetRandom(2) = 0;
- dx.QWordValue:= $40DA*GetRandom(10000)*8;
+ dx.QWordValue:= $40DA * GetRandom(10000) * 8;
dy.isNegative:= false;
- dy.QWordValue:= $3AD3*GetRandom(7000)*8;
+ dy.QWordValue:= $3AD3 * GetRandom(7000) * 8;
if GetRandom(2) = 0 then
dx := -dx
end;
@@ -245,6 +250,10 @@
gear^.Density:= _1_6;
gear^.Timer:= 500;
end;
+ gtKnife: begin
+ gear^.Density:= _4;
+ gear^.Radius:= 16
+ end;
gtCase: begin
gear^.ImpactSound:= sndGraveImpact;
gear^.nImpactSounds:= 1;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGearsRender.pas
--- a/hedgewars/uGearsRender.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGearsRender.pas Sun Oct 28 15:12:37 2012 +0100
@@ -321,8 +321,8 @@
// reached edge of land. assume infinite beam. Extend it way out past camera
if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
begin
- tx:= round(lx + ax * (LAND_WIDTH div 2));
- ty:= round(ly + ay * (LAND_WIDTH div 2));
+ tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
+ ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
end;
//if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
@@ -628,6 +628,7 @@
amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle);
amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle);
amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle);
+ amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle);
amSeduction: begin
DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle);
DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA);
@@ -988,6 +989,7 @@
else if Gear^.Health <> 0 then
DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+ gtKnife: DrawSpriteRotatedF(sprKnife, x, y, 0, hwSign(Gear^.dX), Gear^.DirAngle);
gtCase: begin
if Gear^.Timer > 1000 then
@@ -1018,7 +1020,7 @@
if Gear^.Timer < 1833 then
begin
DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
- x, Gear^.Angle+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270);
+ x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
end
end;
gtExplosives: begin
@@ -1084,9 +1086,9 @@
endX:= x - WorldDx;
endY:= y - WorldDy;
if Gear^.Tag < 0 then
- startX:= max(LAND_WIDTH + 1024, endX + 2048)
+ startX:= max(max(LAND_WIDTH,4096) + 1024, endX + 2048)
else
- startX:= max(-LAND_WIDTH - 1024, endX - 2048);
+ startX:= max(-max(LAND_WIDTH,4096) - 1024, endX - 2048);
startY:= endY - 256;
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1))), startY + WorldDy + LongInt(round((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2)))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
end
@@ -1095,9 +1097,9 @@
startX:= x - WorldDx;
startY:= y - WorldDy;
if Gear^.Tag > 0 then
- endX:= max(LAND_WIDTH + 1024, startX + 2048)
+ endX:= max(max(LAND_WIDTH,4096) + 1024, startX + 2048)
else
- endX:= max(-LAND_WIDTH - 1024, startX - 2048);
+ endX:= max(-max(LAND_WIDTH,4096) - 1024, startX - 2048);
endY:= startY + 256;
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1)))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + LongInt(round((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY))) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
end;
@@ -1192,17 +1194,17 @@
HHGear := Gear^.Hedgehog^.Gear;
if HHGear <> nil then
begin
- i:= hwRound(hwSqr(Gear^.X-HHGear^.X)+hwSqr(Gear^.Y-HHGear^.Y));
- if RealTicks mod max(1,50-(round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used
+ i:= hwRound(hwSqr(Gear^.X - HHGear^.X) + hwSqr(Gear^.Y - HHGear^.Y));
+ if RealTicks mod max(1,50 - (round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used
begin
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
if vg <> nil then
begin
- i:= random(100)+155;
- vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or ((random(200)+55));
+ i:= random(100) + 155;
+ vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or Longword(random(200) + 55);
vg^.Angle:= random(360);
- vg^.dx:= 0.001 * (random(80));
- vg^.dy:= 0.001 * (random(80))
+ vg^.dx:= 0.001 * random(80);
+ vg^.dy:= 0.001 * random(80)
end
end;
if RealTicks mod 2 = 0 then
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uGearsUtils.pas Sun Oct 28 15:12:37 2012 +0100
@@ -41,6 +41,8 @@
procedure CheckCollision(Gear: PGear); inline;
procedure CheckCollisionWithLand(Gear: PGear); inline;
+function MakeHedgehogsStep(Gear: PGear) : boolean;
+
var doStepHandlers: array[TGearType] of TGearStepProcedure;
@@ -103,12 +105,13 @@
gtCase,
gtTarget,
gtFlame,
+ gtKnife,
gtExplosives,
gtStructure: begin
// Run the calcs only once we know we have a type that will need damage
tdX:= Gear^.X-fX;
tdY:= Gear^.Y-fY;
- if (tdX.Round + tdY.Round + 2) < dmgBase then
+ if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
dmg:= dmgBase - hwRound(Distance(tdX, tdY));
if dmg > 1 then
begin
@@ -128,6 +131,7 @@
Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, tdY)/(Gear^.Density/_3);
Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser);
+ if Gear^.Kind = gtKnife then Gear^.State:= Gear^.State and (not gstCollision);
if not Gear^.Invulnerable then
Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
Gear^.Active:= true;
@@ -142,7 +146,7 @@
// Run the calcs only once we know we have a type that will need damage
tdX:= Gear^.X-fX;
tdY:= Gear^.Y-fY;
- if (tdX.Round + tdY.Round + 2) < dmgBase then
+ if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
dmg:= dmgBase - hwRound(Distance(tdX, tdY));
if dmg > 1 then
begin
@@ -319,8 +323,9 @@
var
dAngle: real;
begin
-// Frac/Round to be kind to JS as of 2012-08-27 where there is yet no int64/uint64
- dAngle := (Gear^.dX.Round + Gear^.dY.Round) / 2 + (Gear^.dX.Frac+Gear^.dY.Frac) / $80000000;
+ // Frac/Round to be kind to JS as of 2012-08-27 where there is yet no int64/uint64
+ //dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000;
+ dAngle := (Gear^.dX.Round + Gear^.dY.Round) / 2 + (Gear^.dX.Frac/$100000000+Gear^.dY.Frac/$100000000);
if not Gear^.dX.isNegative then
Gear^.DirAngle := Gear^.DirAngle + dAngle
else
@@ -682,4 +687,73 @@
Gear^.State := Gear^.State and (not gstCollision)
end;
+function MakeHedgehogsStep(Gear: PGear) : boolean;
+begin
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
+ begin
+ Gear^.Y:= Gear^.Y - _1;
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
+ Gear^.Y:= Gear^.Y + _6
+ end else Gear^.Y:= Gear^.Y + _5 else
+ end else Gear^.Y:= Gear^.Y + _4 else
+ end else Gear^.Y:= Gear^.Y + _3 else
+ end else Gear^.Y:= Gear^.Y + _2 else
+ end else Gear^.Y:= Gear^.Y + _1
+ end;
+
+ if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
+ begin
+ Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
+ MakeHedgehogsStep:= true
+ end else
+ MakeHedgehogsStep:= false;
+
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y + _1;
+ if TestCollisionYwithGear(Gear, 1) = 0 then
+ begin
+ Gear^.Y:= Gear^.Y - _6;
+ Gear^.dY:= _0;
+ Gear^.State:= Gear^.State or gstMoving;
+ exit
+ end;
+ end
+ end
+ end
+ end
+ end
+ end;
+end;
+
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uInputHandler.pas
--- a/hedgewars/uInputHandler.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uInputHandler.pas Sun Oct 28 15:12:37 2012 +0100
@@ -426,8 +426,6 @@
procedure initModule;
begin
- wheelUp:= false;
- wheelDown:= false;
end;
procedure freeModule;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uLandTemplates.pas
--- a/hedgewars/uLandTemplates.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uLandTemplates.pas Sun Oct 28 15:12:37 2012 +0100
@@ -1756,8 +1756,60 @@
(X: 4095; Y: 0)
);
+// 3 large caverns
+const Template44Points: array[0..14] of TSDL_Rect =
+ (
+ (x: 0; y: 100; w: 1; h: 50),
+ (x: 4095; y: 100; w: 1; h: 50),
+ (x: 4095; y: 400; w: 1; h: 50),
+ (x: 0; y: 360; w: 1; h: 50),
+ (x: NTPX; y: 0; w: 1; h: 1),
+ (x: 0; y: 750; w: 1; h: 50),
+ (x: 4095; y: 750; w: 1; h: 50),
+ (x: 4095; y:1100; w: 1; h: 50),
+ (x: 0; y:1100; w: 1; h: 50),
+ (x: NTPX; y: 0; w: 1; h: 1),
+ (x: 0; y:1300; w: 1; h: 250),
+ (x: 4095; y:1300; w: 1; h: 250),
+ (x: 4095; y:1800; w: 1; h: 200),
+ (x: 0; y:1800; w: 1; h: 200),
+ (x: NTPX; y: 0; w: 1; h: 1)
+ );
+ Template44FPoints: array[0..5] of TSDL_Rect =
+ (
+ (X: 1; Y: 90; w: 0; h: 0),
+ (X: 1; Y: 500; w: 0; h: 0),
+ (X:4095; Y: 500; w: 0; h: 0),
+ (X: 1; Y:1200; w: 0; h: 0),
+ (X:4095; Y:1200; w: 0; h: 0),
+ (X: 1; Y:2010; w: 0; h: 0)
+ );
+
+// large caverns with an island
+const Template45Points: array[0..11] of TSDL_Rect =
+ (
+ (x: 500; y: 100; w: 1; h: 300),
+ (x: 3700; y: 100; w: 1; h: 300),
+ (x: 3700; y: 900; w: 200; h: 300),
+ (x: 3700; y:1700; w: 1; h: 250),
+ (x: 500; y:1700; w: 1; h: 250),
+ (x: 300; y: 900; w: 200; h: 250),
+ (x: NTPX; y: 0; w: 1; h: 1),
+ (x: 1000; y: 800; w: 1; h: 1),
+ (x: 2700; y: 800; w: 600; h: 100),
+ (x: 2700; y:1200; w: 600; h: 200),
+ (x: 1000; y:1200; w: 200; h: 200),
+ (x: NTPX; y: 0; w: 1; h: 1)
+ );
+ Template45FPoints: array[0..2] of TSDL_Rect =
+ (
+ (X: 1; Y: 1; w: 0; h: 0),
+ (X: 1; Y:2047; w: 0; h: 0),
+ (X:1005; Y: 805; w: 0; h: 0)
+ );
+
////////////////////////////////////////////////////////////////////////
-var EdgeTemplates: array[0..43] of TEdgeTemplate =
+var EdgeTemplates: array[0..45] of TEdgeTemplate =
(
(BasePoints: @Template0Points;
BasePointsCount: Succ(High(Template0Points));
@@ -2242,6 +2294,28 @@
canMirror: true; canFlip: true; isNegative: false; canInvert: false;
hasGirders: true;
MaxHedgeHogs: 48;
+ ),
+ (BasePoints: @Template44Points;
+ BasePointsCount: Succ(High(Template44Points));
+ FillPoints: @Template44FPoints;
+ FillPointsCount: Succ(High(Template44FPoints));
+ BezierizeCount: 5;
+ RandPassesCount: 3;
+ TemplateHeight: 2048; TemplateWidth: 4096;
+ canMirror: false; canFlip: false; isNegative: true; canInvert: false;
+ hasGirders: false;
+ MaxHedgeHogs: 48;
+ ),
+ (BasePoints: @Template45Points;
+ BasePointsCount: Succ(High(Template45Points));
+ FillPoints: @Template45FPoints;
+ FillPointsCount: Succ(High(Template45FPoints));
+ BezierizeCount: 5;
+ RandPassesCount: 7;
+ TemplateHeight: 2048; TemplateWidth: 4096;
+ canMirror: false; canFlip: false; isNegative: true; canInvert: false;
+ hasGirders: false;
+ MaxHedgeHogs: 48;
)
);
const SmallTemplates: array[0..2] of Longword = ( 39, 40, 42 );
@@ -2252,9 +2326,9 @@
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 43
);
-const CavernTemplates: array[0..4] of Longword = (36, 2, 3, 21, 29);
+const CavernTemplates: array[0..5] of Longword = (36, 2, 3, 21, 29, 45);
//const WackyTemplates: array[0..4] of Longword = (37, 38, 39, 40, 41);
-const WackyTemplates: array[0..3] of Longword = (37, 38, 41, 43);
+const WackyTemplates: array[0..4] of Longword = (37, 38, 41, 43, 44);
implementation
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uLandTexture.pas
--- a/hedgewars/uLandTexture.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uLandTexture.pas Sun Oct 28 15:12:37 2012 +0100
@@ -27,6 +27,7 @@
procedure UpdateLandTexture(X, Width, Y, Height: LongInt; landAdded: boolean);
procedure DrawLand(dX, dY: LongInt);
procedure ResetLand;
+procedure SetLandTexture;
implementation
uses uConsts, GLunit, uTypes, uVariables, uTextures, uDebug, uRender;
@@ -183,7 +184,7 @@
end;
-procedure initModule;
+procedure SetLandTexture;
begin
if (cReducedQuality and rqBlurryLand) = 0 then
begin
@@ -199,6 +200,10 @@
SetLength(LandTextures, LANDTEXARW, LANDTEXARH);
end;
+procedure initModule;
+begin
+end;
+
procedure ResetLand;
var x, y: LongInt;
begin
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uMisc.pas
--- a/hedgewars/uMisc.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uMisc.pas Sun Oct 28 15:12:37 2012 +0100
@@ -206,9 +206,9 @@
for i0:= 0 to k-1 do
for j0:= 0 to k-1 do
begin
- r+= img[4*(width*(i*k+i0) + j*k+j0)+0];
- g+= img[4*(width*(i*k+i0) + j*k+j0)+1];
- b+= img[4*(width*(i*k+i0) + j*k+j0)+2];
+ inc(r, img[4*(width*(i*k+i0) + j*k+j0)+0]);
+ inc(g, img[4*(width*(i*k+i0) + j*k+j0)+1]);
+ inc(b, img[4*(width*(i*k+i0) + j*k+j0)+2]);
end;
img[4*(w*i + j)+0]:= r div (k*k);
img[4*(w*i + j)+1]:= g div (k*k);
@@ -311,7 +311,6 @@
procedure freeModule;
begin
- recordFileName:= '';
SDL_FreeFormat(conversionFormat);
end;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uScript.pas
--- a/hedgewars/uScript.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uScript.pas Sun Oct 28 15:12:37 2012 +0100
@@ -46,7 +46,7 @@
function ScriptExists(fname : shortstring) : boolean;
-function ParseCommandOverride(key, value : shortstring) : shortstring;
+//function ParseCommandOverride(key, value : shortstring) : shortstring; This did not work out well
procedure initModule;
procedure freeModule;
@@ -196,7 +196,7 @@
for i:= 1 to c do s[i]:= t[i-1];
s[0]:= char(c);
- ParseCommand(s, true);
+ ParseCommand(s, true, true);
end
else
@@ -647,6 +647,39 @@
lc_setgearpos:= 0
end;
+function lc_getgearcollisionmask(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 1 then
+ begin
+ LuaError('Lua: Wrong number of parameters passed to GetGearCollisionMask!');
+ lua_pushnil(L); // return value on stack (nil)
+ end
+ else
+ begin
+ gear:= GearByUID(lua_tointeger(L, 1));
+ if gear <> nil then
+ lua_pushinteger(L, gear^.CollisionMask)
+ else
+ lua_pushnil(L);
+ end;
+ lc_getgearcollisionmask:= 1
+end;
+
+function lc_setgearcollisionmask(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 2 then
+ LuaError('Lua: Wrong number of parameters passed to SetGearCollisionMask!')
+ else
+ begin
+ gear:= GearByUID(lua_tointeger(L, 1));
+ if gear <> nil then
+ gear^.CollisionMask:= lua_tointeger(L, 2);
+ end;
+ lc_setgearcollisionmask:= 0
+end;
+
function lc_gethoglevel(L : Plua_State): LongInt; Cdecl;
var gear : PGear;
begin
@@ -1273,11 +1306,11 @@
end
else
begin
- ParseCommand('addteam x ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true);
- ParseCommand('grave ' + lua_tostring(L, 3), true);
- ParseCommand('fort ' + lua_tostring(L, 4), true);
- ParseCommand('voicepack ' + lua_tostring(L, 5), true);
- if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true);
+ ParseCommand('addteam x ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true, true);
+ ParseCommand('grave ' + lua_tostring(L, 3), true, true);
+ ParseCommand('fort ' + lua_tostring(L, 4), true, true);
+ ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
+ if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
CurrentTeam^.Binds:= DefaultBinds
// fails on x64
//lua_pushinteger(L, LongInt(CurrentTeam));
@@ -1296,8 +1329,8 @@
else
begin
temp:= lua_tostring(L, 4);
- ParseCommand('addhh ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 3) + ' ' + lua_tostring(L, 1), true);
- ParseCommand('hat ' + temp, true);
+ ParseCommand('addhh ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 3) + ' ' + lua_tostring(L, 1), true, true);
+ ParseCommand('hat ' + temp, true, true);
lua_pushinteger(L, CurrentHedgehog^.Gear^.uid);
end;
lc_addhog:= 1;
@@ -1636,7 +1669,7 @@
if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
hat:= lua_tostring(L, 2);
gear^.Hedgehog^.Hat:= hat;
- LoadHedgehogHat(gear, hat);
+ LoadHedgehogHat(gear^.Hedgehog^, hat);
end;
lc_sethoghat:= 0;
end;
@@ -1708,7 +1741,7 @@
i := 0;
while (i < hiddenHedgehogsNumber) do
begin
- if hiddenHedgehogs[i]^.gearHidden^.uid = lua_tointeger(L, 1) then
+ if hiddenHedgehogs[i]^.gearHidden^.uid = LongWord(lua_tointeger(L, 1)) then
begin
hog := hiddenHedgehogs[i];
RestoreHog(hog);
@@ -1838,7 +1871,7 @@
ScriptCall('onGameInit');
// pop game variables
-ParseCommand('seed ' + ScriptGetString('Seed'), true);
+ParseCommand('seed ' + ScriptGetString('Seed'), true, true);
cTemplateFilter := ScriptGetInteger('TemplateFilter');
LuaTemplateNumber:= ScriptGetInteger('TemplateNumber');
cMapGen := ScriptGetInteger('MapGen');
@@ -1859,9 +1892,10 @@
cWaterRise := ScriptGetInteger('WaterRise');
cHealthDecrease := ScriptGetInteger('HealthDecrease');
-ParseCommand('map ' + ScriptGetString('Map'), true);
+if cMapName <> ScriptGetString('Map') then
+ ParseCommand('map ' + ScriptGetString('Map'), true, true);
if ScriptGetString('Theme') <> '' then
- ParseCommand('theme ' + ScriptGetString('Theme'), true);
+ ParseCommand('theme ' + ScriptGetString('Theme'), true, true);
LuaGoals:= ScriptGetString('Goals');
// Support lua changing the ammo layout - assume all hogs have same ammo, note this might leave a few ammo stores lying around.
@@ -1983,6 +2017,7 @@
GetGlobals;
end;
+(*
function ParseCommandOverride(key, value : shortstring) : shortstring;
begin
ParseCommandOverride:= value;
@@ -2002,6 +2037,7 @@
lua_pop(luaState, 1)
end;
end;
+*)
function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
begin
@@ -2327,6 +2363,8 @@
lua_register(luaState, _P'SetGearMessage', @lc_setgearmessage);
lua_register(luaState, _P'GetGearPos', @lc_getgearpos);
lua_register(luaState, _P'SetGearPos', @lc_setgearpos);
+lua_register(luaState, _P'GetGearCollisionMask', @lc_getgearcollisionmask);
+lua_register(luaState, _P'SetGearCollisionMask', @lc_setgearcollisionmask);
lua_register(luaState, _P'GetRandom', @lc_getrandom);
lua_register(luaState, _P'SetWind', @lc_setwind);
lua_register(luaState, _P'GetDataPath', @lc_getdatapath);
@@ -2414,7 +2452,7 @@
fname:= fname; // avoid hint
ScriptExists:= false
end;
-
+(*
function ParseCommandOverride(key, value : shortstring) : shortstring;
begin
// avoid hints
@@ -2422,6 +2460,7 @@
value:= value;
ParseCommandOverride:= ''
end;
+*)
procedure ScriptOnScreenResize;
begin
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uSound.pas
--- a/hedgewars/uSound.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uSound.pas Sun Oct 28 15:12:37 2012 +0100
@@ -47,7 +47,7 @@
// Obvious music commands for music track
procedure SetMusic(enabled: boolean); // Enable/disable music.
-procedure SetMusicName(musicname: shortstring); // Enable/disable music and set name of the file to play.
+procedure SetMusicName(musicname: shortstring); // Set name of the file to play.
procedure PlayMusic; // Play music from the start.
procedure PauseMusic; // Pause music.
procedure ResumeMusic; // Resume music from pause point.
@@ -95,7 +95,7 @@
// MISC
// Set the initial volume
-procedure SetVolume(volume: LongInt);
+procedure SetVolume(vol: LongInt);
// Modifies the sound volume of the game by voldelta and returns the new volume level.
function ChangeVolume(voldelta: LongInt): LongInt;
@@ -114,7 +114,7 @@
lastChan: array [TSound] of LongInt;
voicepacks: array[0..cMaxTeams] of TVoicepack;
defVoicepack: PVoicepack;
- Mus: PMixMusic = nil; // music pointer
+ Mus: PMixMusic; // music pointer
MusicFN: shortstring; // music file name
isMusicEnabled: boolean;
isSoundEnabled: boolean;
@@ -445,15 +445,15 @@
SDLTry(Mix_FadeInMusic(Mus, -1, 3000) <> -1, false)
end;
-procedure SetVolume(volume: LongInt);
+procedure SetVolume(vol: LongInt);
begin
- cInitVolume:= volume;
+ cInitVolume:= vol;
end;
function ChangeVolume(voldelta: LongInt): LongInt;
begin
ChangeVolume:= 0;
- if (not isSoundEnabled) or (voldelta = 0) then
+ if (not isSoundEnabled) or ((voldelta = 0) and not (cInitVolume = 0)) then
exit;
inc(Volume, voldelta);
@@ -494,7 +494,7 @@
procedure MuteAudio;
begin
if (not isSoundEnabled) then
- exit;
+ exit;
if (isAudioMuted) then
begin
@@ -514,12 +514,10 @@
procedure SetMusic(enabled: boolean);
begin
isMusicEnabled:= enabled;
- MusicFN:= '';
end;
procedure SetMusicName(musicname: shortstring);
begin
- isMusicEnabled:= not (musicname = '');
MusicFN:= musicname;
end;
@@ -587,9 +585,13 @@
RegisterVariable('mute' , @chMute , true );
MusicFN:='';
+ Mus:= nil;
+ isMusicEnabled:= true;
+ isSoundEnabled:= true;
isAudioMuted:= false;
isSEBackup:= isSoundEnabled;
Volume:= 0;
+ cInitVolume:= 100;
defVoicepack:= AskForVoicepack('Default');
for i:= Low(TSound) to High(TSound) do
@@ -602,7 +604,7 @@
voicepacks[t].chunks[i]:= nil;
(* on MOBILE SDL_mixer has to be compiled against Tremor (USE_OGG_TREMOR)
- or sound files bigger than 32k will lockup the game*)
+ or sound files bigger than 32k will lockup the game *)
for i:= Low(TSound) to High(TSound) do
defVoicepack^.chunks[i]:= nil;
@@ -612,11 +614,6 @@
begin
if isSoundEnabled then
ReleaseSound(true);
- // koda still needs to fix this properly. when he rearranged things, he made these variables get
- // reset after argparsers picks them up
- isMusicEnabled:= true;
- isSoundEnabled:= true;
- cInitVolume:= 100;
end;
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uStats.pas
--- a/hedgewars/uStats.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uStats.pas Sun Oct 28 15:12:37 2012 +0100
@@ -315,7 +315,6 @@
procedure freeModule;
begin
-
end;
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uStore.pas
--- a/hedgewars/uStore.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uStore.pas Sun Oct 28 15:12:37 2012 +0100
@@ -40,7 +40,7 @@
// like LoadDataImage but uses altFile as fallback-filename if file cannot be loaded
function LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
-procedure LoadHedgehogHat(HHGear: PGear; newHat: shortstring);
+procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
procedure SetupOpenGL;
procedure SetScale(f: GLfloat);
function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
@@ -101,7 +101,6 @@
var t: LongInt;
tmpsurf, texsurf: PSDL_Surface;
Color, i: Longword;
- s: shortstring;
begin
tmpsurf:= LoadDataImage(ptGraphics, cCHFileName, ifAlpha or ifCritical);
@@ -245,9 +244,9 @@
if Hat <> 'NoHat' then
begin
if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
- LoadHedgehogHat(Gear, 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
+ LoadHedgehogHat(Hedgehogs[i], 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
else
- LoadHedgehogHat(Gear, Hat);
+ LoadHedgehogHat(Hedgehogs[i], Hat);
end
end;
end;
@@ -641,19 +640,20 @@
LoadDataImageAltFile:= tmpsurf;
end;
-procedure LoadHedgehogHat(HHGear: PGear; newHat: shortstring);
+procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
var texsurf: PSDL_Surface;
begin
texsurf:= LoadDataImage(ptHats, newHat, ifNone);
-
+AddFileLog('Hat => '+newHat);
// only do something if the hat could be loaded
if texsurf <> nil then
begin
+AddFileLog('Got Hat');
// free the mem of any previously assigned texture
- FreeTexture(HHGear^.Hedgehog^.HatTex);
+ FreeTexture(HH.HatTex);
// assign new hat to hedgehog
- HHGear^.Hedgehog^.HatTex:= Surface2Tex(texsurf, true);
+ HH.HatTex:= Surface2Tex(texsurf, true);
// cleanup: free temporary surface mem
SDL_FreeSurface(texsurf)
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uTeams.pas Sun Oct 28 15:12:37 2012 +0100
@@ -20,8 +20,10 @@
unit uTeams;
interface
-uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound,
- uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
+uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit,
+ uSound, uStore, uTypes
+ {$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
+
procedure initModule;
procedure freeModule;
@@ -39,7 +41,8 @@
implementation
uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript,
- uGearsUtils, uGearsList{$IFDEF SDL13}, uTouch{$ENDIF};
+ uGearsUtils, uGearsList
+ {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
var MaxTeamHealth: LongInt;
GameOver: boolean;
@@ -247,6 +250,7 @@
Z:= cCurrHHZ;
State:= gstHHDriven;
Active:= true;
+ Power:= 0;
LastDamage:= nil
end;
RemoveGearFromList(Gear);
@@ -628,12 +632,16 @@
var oldCI, newCI: boolean;
oldHH: PHedgehog;
begin
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then
+ LoadHedgehogHat(CurrentHedgehog^, CurrentHedgehog^.Hat);
oldCI:= (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.CollisionIndex >= 0);
newCI:= (newHog^.Gear <> nil) and (newHog^.Gear^.CollisionIndex >= 0);
if oldCI then DeleteCI(CurrentHedgehog^.Gear);
if newCI then DeleteCI(newHog^.Gear);
oldHH:= CurrentHedgehog;
CurrentHedgehog:= newHog;
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then
+ LoadHedgehogHat(CurrentHedgehog^, 'Reserved/chef');
if oldCI then AddGearCI(oldHH^.Gear);
if newCI then AddGearCI(newHog^.Gear)
end;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uTouch.pas
--- a/hedgewars/uTouch.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uTouch.pas Sun Oct 28 15:12:37 2012 +0100
@@ -22,10 +22,11 @@
interface
-uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld, uMobile;
+uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, GLUnit, uTypes, uCaptions, uAmmos, uWorld, uMobile;
procedure initModule;
+procedure freeModule;
procedure ProcessTouch;
procedure NewTurnBeginning;
@@ -643,5 +644,9 @@
halfRectSize:= rectSize shl 1;
end;
+procedure freeModule;
+begin
+end;
+
begin
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uTypes.pas
--- a/hedgewars/uTypes.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uTypes.pas Sun Oct 28 15:12:37 2012 +0100
@@ -86,7 +86,7 @@
sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
- sprSlider, sprBotlevels
+ sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar
);
// Gears that interact with other Gears and/or Land
@@ -102,7 +102,8 @@
gtSniperRifleShot, gtJetpack, gtMolotov, gtBirdy, // 44
gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 50
gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 55
- gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis, gtIceGun, gtAddAmmo, gtGenericFaller); // 62
+ gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis, // 61
+ gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife); // 65
// Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -150,7 +151,7 @@
amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
- amResurrector, amDrillStrike, amSnowball, amTardis, amStructure, amLandGun, amIceGun); // 54
+ amResurrector, amDrillStrike, amSnowball, amTardis, amStructure, amLandGun, amIceGun, amKnife); // 54
// Different kind of crates that e.g. hedgehogs can pick up
TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
@@ -409,7 +410,7 @@
sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb,
sidSineGun, sidFlamethrower,sidSMine, sidHammer, sidResurrector,
sidDrillStrike, sidSnowball, sidNothing, sidTardis,
- sidStructure, sidLandGun, sidIceGun);
+ sidStructure, sidLandGun, sidIceGun, sidKnife);
TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uVariables.pas
--- a/hedgewars/uVariables.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uVariables.pas Sun Oct 28 15:12:37 2012 +0100
@@ -25,45 +25,44 @@
var
/////// init flags ///////
- cMinScreenWidth : LongInt = 640;
- cMinScreenHeight : LongInt = 480;
- cScreenWidth : LongInt = 1024;
- cScreenHeight : LongInt = 768;
- cOrigScreenWidth : LongInt = 1024;
- cOrigScreenHeight : LongInt = 768;
- cNewScreenWidth : LongInt = 1024;
- cNewScreenHeight : LongInt = 768;
- cScreenResizeDelay : LongWord = 0;
- cBits : LongInt = 32;
- ipcPort : Word = 0;
- cFullScreen : boolean = false;
- cLocaleFName : shortstring = 'en.txt';
- cLocale : shortstring = 'en';
- cTimerInterval : LongInt = 8;
- PathPrefix : shortstring = './';
- UserPathPrefix : shortstring = './';
- cShowFPS : boolean = false;
- cFlattenFlakes : boolean = false;
- cFlattenClouds : boolean = false;
- cAltDamage : boolean = true;
- cReducedQuality : LongWord = rqNone;
- UserNick : shortstring = '';
- recordFileName : shortstring = '';
- cReadyDelay : Longword = 5000;
- cStereoMode : TStereoMode = smNone;
- cOnlyStats : boolean = False;
+ cMinScreenWidth : LongInt;
+ cMinScreenHeight : LongInt;
+ cScreenWidth : LongInt;
+ cScreenHeight : LongInt;
+ cOrigScreenWidth : LongInt;
+ cOrigScreenHeight : LongInt;
+ cNewScreenWidth : LongInt;
+ cNewScreenHeight : LongInt;
+ cScreenResizeDelay : LongWord;
+ cBits : LongInt;
+ ipcPort : Word;
+ cFullScreen : boolean;
+ cLocaleFName : shortstring;
+ cLocale : shortstring;
+ cTimerInterval : LongInt;
+ PathPrefix : shortstring;
+ UserPathPrefix : shortstring;
+ cShowFPS : boolean;
+ cFlattenFlakes : boolean;
+ cFlattenClouds : boolean;
+ cAltDamage : boolean;
+ cReducedQuality : LongWord;
+ UserNick : shortstring;
+ recordFileName : shortstring;
+ cReadyDelay : Longword;
+ cStereoMode : TStereoMode;
+ cOnlyStats : boolean;
{$IFDEF USE_VIDEO_RECORDING}
- RecPrefix : shortstring;
- cAVFormat : shortstring;
- cVideoCodec : shortstring;
+ RecPrefix : shortstring;
+ cAVFormat : shortstring;
+ cVideoCodec : shortstring;
cVideoFramerateNum : LongInt;
cVideoFramerateDen : LongInt;
cVideoQuality : LongInt;
- cAudioCodec : shortstring;
+ cAudioCodec : shortstring;
{$ENDIF}
//////////////////////////
- cMapName : shortstring = '';
-
+ cMapName : shortstring;
isCursorVisible : boolean;
isInLag : boolean;
isPaused : boolean;
@@ -111,7 +110,7 @@
cWaterLine : Word;
cGearScrEdgesDist: LongInt;
- isAudioMuted : boolean;
+ isAudioMuted : boolean;
// originally typed consts
ExplosionBorderColor: LongWord;
@@ -661,7 +660,17 @@
(FileName: 'slider'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 3; Height: 17; imageWidth: 3; imageHeight: 17; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprSlider
(FileName: 'botlevels'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
- Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprBotlevels
+ Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprBotlevels
+ (* (FileName: 'amKnife'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandKnife*)
+ (FileName: 'amCleaver'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 64; Height: 64; imageWidth: 64; imageHeight: 64; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: false),// sprHandKnife
+ (*(FileName: 'knife'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 29; Height: 14; imageWidth: 64; imageHeight: 64; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprKnife*)
+ (FileName: 'cleaver'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 64; Height: 64; imageWidth: 64; imageHeight: 128; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprKnife
+ (FileName: 'star'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 12; Height: 12; imageWidth: 12; imageHeight: 12; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprStar
);
const
@@ -2095,7 +2104,8 @@
Probability: 100;
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or
- ammoprop_NeedUpDown; //FIXME: enable multishoot at altuse, until then removed ammoprop_AltUse
+ ammoprop_AltUse or
+ ammoprop_NeedUpDown;
Count: 1;
NumPerTurn: 1;
Timer: 0;
@@ -2312,7 +2322,7 @@
AmmoType: amIceGun;
AttackVoice: sndNone;
Bounciness: 1000);
- Slot: 6;
+ Slot: 9;
TimeAfterTurn: 0;
minAngle: 0;
maxAngle: 0;
@@ -2321,7 +2331,32 @@
PosCount: 1;
PosSprite: sprWater;
ejectX: 0; //20;
- ejectY: -3)
+ ejectY: -3),
+// Knife
+ (NameId: sidKnife;
+ NameTex: nil;
+ Probability: 100;
+ NumberInCase: 1;
+ Ammo: (Propz: ammoprop_Power or
+ ammoprop_AltUse or
+ ammoprop_NeedUpDown;
+ Count: 1;
+ NumPerTurn: 1;
+ Timer: 0;
+ Pos: 0;
+ AmmoType: amKnife;
+ AttackVoice: sndNone;
+ Bounciness: 1000);
+ Slot: 6;
+ TimeAfterTurn: 3000;
+ minAngle: 0;
+ maxAngle: 0;
+ isDamaging: true;
+ SkipTurns: 0;
+ PosCount: 1;
+ PosSprite: sprWater;
+ ejectX: 0;
+ ejectY: 0)
);
const
@@ -2391,6 +2426,7 @@
(* gtIceGun *) , amIceGun
(* gtAddAmmo *) , amNothing
(* gtGenericFaller *) , amNothing
+(* gtKnife *) , amKnife
);
var
@@ -2474,8 +2510,6 @@
vobSDVelocity, vobSDFallSpeed: LongInt;
hideAmmoMenu: boolean;
- wheelUp: boolean;
- wheelDown: boolean;
ControllerNumControllers: Integer;
ControllerEnabled: Integer;
@@ -2506,6 +2540,32 @@
procedure initModule;
begin
+ // initialisation flags - they are going to be overwritten by args or by msgs
+ cScreenWidth := 1024;
+ cScreenHeight := 768;
+ cBits := 32;
+ ipcPort := 0;
+ cFullScreen := false;
+ cLocaleFName := 'en.txt';
+ cLocale := 'en';
+ cTimerInterval := 8;
+ PathPrefix := './';
+ UserPathPrefix := './';
+ cShowFPS := false;
+ cFlattenFlakes := false;
+ cFlattenClouds := false;
+ cAltDamage := true;
+ cReducedQuality := rqNone;
+ UserNick := '';
+ recordFileName := '';
+ cScriptName := '';
+ cReadyDelay := 5000;
+ cStereoMode := smNone;
+ GrayScale := false;
+
+ cFlattenFlakes := false;
+ cFlattenClouds := false;
+ cOnlyStats := False;
lastVisualGearByUID:= nil;
lastGearByUID:= nil;
@@ -2540,8 +2600,10 @@
SDWaterColorArray[2].a := 255;
SDWaterColorArray[1]:= SDWaterColorArray[0];
SDWaterColorArray[3]:= SDWaterColorArray[2];
-
+ SDWaterOpacity:= $80;
SDTint:= $80;
+ ExplosionBorderColor:= $FF808080;
+ WaterOpacity:= $80;
cDrownSpeed.QWordValue := 257698038; // 0.06
cDrownSpeedf := 0.06;
@@ -2591,7 +2653,6 @@
cExplosives := 2;
GameState := Low(TGameState);
-// GameType := gmtLocal;
zoom := cDefaultZoomLevel;
ZoomValue := cDefaultZoomLevel;
WeaponTooltipTex:= nil;
@@ -2638,11 +2699,18 @@
vobSDVelocity:= 15;
vobSDFallSpeed:= 250;
- ExplosionBorderColor:= $FF808080;
- WaterOpacity:= $80;
- SDWaterOpacity:= $80;
+ cMinScreenWidth := 640;
+ cMinScreenHeight := 480;
+ cScreenWidth := 1024;
+ cScreenHeight := 768;
+ cOrigScreenWidth := 1024;
+ cOrigScreenHeight := 768;
+ cNewScreenWidth := 1024;
+ cNewScreenHeight := 768;
+ cScreenResizeDelay := 0;
LuaGoals:= '';
+ cMapName:= '';
LuaTemplateNumber:= 0;
hiddenHedgehogsNumber:=0;
@@ -2650,27 +2718,6 @@
procedure freeModule;
begin
- // re-init flags so they will always contain safe values
- cScreenWidth := 1024;
- cScreenHeight := 768;
- cBits := 32;
- ipcPort := 0;
- cFullScreen := false;
- cLocaleFName := 'en.txt';
- cTimerInterval := 8;
- PathPrefix := './';
- UserPathPrefix := './';
- cShowFPS := false;
- cFlattenFlakes := false;
- cFlattenClouds := false;
- cAltDamage := true;
- cReducedQuality := rqNone;
- UserNick := '';
- recordFileName := '';
- cScriptName := '';
- cReadyDelay := 5000;
- cStereoMode := smNone;
- GrayScale := false;
end;
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uVideoRec.pas
--- a/hedgewars/uVideoRec.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uVideoRec.pas Sun Oct 28 15:12:37 2012 +0100
@@ -30,6 +30,11 @@
{$IFNDEF WIN32}
{$LINKLIB ../bin/libavwrapper.a}
{$ENDIF}
+{$IFDEF DARWIN}
+ {$LINKLIB bz2}
+ {$LINKFRAMEWORK CoreVideo}
+ {$LINKFRAMEWORK VideoDecodeAcceleration}
+{$ENDIF}
interface
@@ -44,6 +49,7 @@
procedure StopPreRecording;
procedure SaveCameraPosition;
+procedure initModule;
procedure freeModule;
implementation
@@ -96,23 +102,26 @@
// store some description in output file
desc:= '';
if UserNick <> '' then
- desc+= 'Player: ' + UserNick + #10;
+ desc:= desc + 'Player: ' + UserNick + #10;
if recordFileName <> '' then
- desc+= 'Record: ' + recordFileName + #10;
+ desc:= desc + 'Record: ' + recordFileName + #10;
if cMapName <> '' then
- desc+= 'Map: ' + cMapName + #10;
+ desc:= desc + 'Map: ' + cMapName + #10;
if Theme <> '' then
- desc+= 'Theme: ' + Theme + #10;
- desc+= 'prefix[' + RecPrefix + ']prefix';
- desc+= #0;
+ desc:= desc + 'Theme: ' + Theme + #10;
+ desc:= desc + 'prefix[' + RecPrefix + ']prefix';
+
+ filename:= UserPathPrefix + '/VideoTemp/' + RecPrefix;
+ soundFilePath:= UserPathPrefix + '/VideoTemp/' + RecPrefix + '.sw';
- filename:= UserPathPrefix + '/VideoTemp/' + RecPrefix + #0;
- soundFilePath:= UserPathPrefix + '/VideoTemp/' + RecPrefix + '.sw' + #0;
- cAVFormat+= #0;
- cAudioCodec+= #0;
- cVideoCodec+= #0;
- AVWrapper_Init(@AddFileLogRaw, @filename[1], @desc[1], @soundFilePath[1], @cAVFormat[1], @cVideoCodec[1], @cAudioCodec[1],
- cScreenWidth, cScreenHeight, cVideoFramerateNum, cVideoFramerateDen, cVideoQuality);
+ AVWrapper_Init(@AddFileLogRaw
+ , PChar(ansistring(filename))
+ , PChar(ansistring(desc))
+ , PChar(ansistring(soundFilePath))
+ , PChar(ansistring(cAVFormat))
+ , PChar(ansistring(cVideoCodec))
+ , PChar(ansistring(cAudioCodec))
+ , cScreenWidth, cScreenHeight, cVideoFramerateNum, cVideoFramerateDen, cVideoQuality);
numPixels:= cScreenWidth*cScreenHeight;
YCbCr_Planes[0]:= GetMem(numPixels);
@@ -358,6 +367,10 @@
BlockWrite(cameraFile, frame, 1);
end;
+procedure initModule;
+begin
+end;
+
procedure freeModule;
begin
if flagPrerecording then
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uVisualGears.pas
--- a/hedgewars/uVisualGears.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uVisualGears.pas Sun Oct 28 15:12:37 2012 +0100
@@ -987,10 +987,10 @@
else vg:= vg^.NextGear;
end;
if ((GameFlags and gfBorder) <> 0) or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then
- for i:= 0 to Pred(vobSDCount * cScreenSpace div LAND_WIDTH) do
+ for i:= 0 to Pred(vobSDCount * cScreenSpace div 4096) do
AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
else
- for i:= 0 to Pred((vobSDCount * cScreenSpace div LAND_WIDTH) div 3) do
+ for i:= 0 to Pred((vobSDCount * cScreenSpace div 4096) div 3) do
AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
end;
diff -r 6237d2f002ba -r 2bc61f8841a1 hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas Sun Sep 16 23:52:36 2012 +0200
+++ b/hedgewars/uWorld.pas Sun Oct 28 15:12:37 2012 +0100
@@ -43,25 +43,27 @@
implementation
uses
- uStore,
- uMisc,
- uIO,
- uLocale,
- uSound,
- uAmmos,
- uVisualGears,
- uChat,
- uLandTexture,
- GLunit,
- uVariables,
- uUtils,
- uTextures,
- uRender,
- uCaptions,
- uCursor,
- uCommands,
- uMobile,
- uVideoRec
+ uStore
+ , uMisc
+ , uIO
+ , uLocale
+ , uSound
+ , uAmmos
+ , uVisualGears
+ , uChat
+ , uLandTexture
+ , GLunit
+ , uVariables
+ , uUtils
+ , uTextures
+ , uRender
+ , uCaptions
+ , uCursor
+ , uCommands
+ , uMobile
+{$IFDEF USE_VIDEO_RECORDING}
+ , uVideoRec
+{$ENDIF}
;
var cWaveWidth, cWaveHeight: LongInt;
@@ -627,11 +629,7 @@
Pos:= -1;
Slot:= -1;
{$IFDEF USE_LANDSCAPE_AMMOMENU}
- {$IFDEF USE_AM_NUMCOLUMN}
-c:= 0;
- {$ELSE}
c:= -1;
- {$ENDIF}
for i:= 0 to cMaxSlotIndex do
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
begin
@@ -645,8 +643,8 @@
if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
begin
if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and
- (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
- (CursorPoint.X >= AmmoRect.x + ( c * (AMSlotSize+1))) and
+ (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
+ (CursorPoint.X > AmmoRect.x + ( c * (AMSlotSize+1))) and
(CursorPoint.X <= AmmoRect.x + ((c+1) * (AMSlotSize+1))) then
begin
Slot:= i;
@@ -661,11 +659,7 @@
end;
end;
{$ELSE}
- {$IFDEF USE_AM_NUMCOLUMN}
c:= -1;
- {$ELSE}
-c:= 0;
- {$ENDIF}
for i:= 0 to cMaxSlotIndex do
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
begin
@@ -679,8 +673,8 @@
if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
begin
if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c * (AMSlotSize+1))) and
- (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and
- (CursorPoint.X >= AmmoRect.x + ( g * (AMSlotSize+1))) and
+ (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and
+ (CursorPoint.X > AmmoRect.x + ( g * (AMSlotSize+1))) and
(CursorPoint.X <= AmmoRect.x + ((g+1) * (AMSlotSize+1))) then
begin
Slot:= i;
@@ -1166,28 +1160,6 @@
DrawWater(255, 0);
-// Attack bar
- if CurrentTeam <> nil then
- case AttackBar of
-(* 1: begin
- r:= StuffPoz[sPowerBar];
- {$WARNINGS OFF}
- r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor;
- {$WARNINGS ON}
- DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
- end;*)
- 2: with CurrentHedgehog^ do
- begin
- tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
- tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
- for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
- DrawSprite(sprPower,
- hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
- hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
- i)
- end
- end;
-
DrawVisualGears(1);
DrawGears;
DrawVisualGears(6);
@@ -1391,6 +1363,29 @@
Tint($FF,$FF,$FF,$FF);
end;
+// Attack bar
+ if CurrentTeam <> nil then
+ case AttackBar of
+(* 1: begin
+ r:= StuffPoz[sPowerBar];
+ {$WARNINGS OFF}
+ r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor;
+ {$WARNINGS ON}
+ DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
+ end;*)
+ 2: with CurrentHedgehog^ do
+ begin
+ tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
+ tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
+ for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
+ DrawSprite(sprPower,
+ hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
+ hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
+ i)
+ end
+ end;
+
+
// Lag alert
if isInLag then
DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
@@ -1638,7 +1633,7 @@
var PrevSentPointTime: LongWord = 0;
procedure MoveCamera;
-var EdgesDist, wdy, shs,z: LongInt;
+var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt;
begin
{$IFNDEF MOBILE}
if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
@@ -1670,14 +1665,30 @@
if (AMState = AMShowingUp) or (AMState = AMShowing) then
begin
- if CursorPoint.X < AmmoRect.x then//check left
- CursorPoint.X:= AmmoRect.x;
- if CursorPoint.X > AmmoRect.x + AmmoRect.w then//check right
- CursorPoint.X:= AmmoRect.x + AmmoRect.w;
- if CursorPoint.Y > cScreenHeight - AmmoRect.y then//check top
- CursorPoint.Y:= cScreenHeight - AmmoRect.y;
- if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 2) then//check bottom
- CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 2);
+{$IFDEF USE_LANDSCAPE_AMMOMENU}
+ amNumOffsetX:= 0;
+ {$IFDEF USE_AM_NUMCOLUMN}
+ amNumOffsetY:= AMSlotSize;
+ {$ELSE}
+ amNumOffsetY:= 0;
+ {$ENDIF}
+{$ELSE}
+ amNumOffsetY:= 0;
+ {$IFDEF USE_AM_NUMCOLUMN}
+ amNumOffsetX:= AMSlotSize;
+ {$ELSE}
+ amNumOffsetX:= 0;
+ {$ENDIF}
+
+{$ENDIF}
+ if CursorPoint.X < AmmoRect.x + amNumOffsetX + 3 then//check left
+ CursorPoint.X:= AmmoRect.x + amNumOffsetX + 3;
+ if CursorPoint.X > AmmoRect.x + AmmoRect.w - 3 then//check right
+ CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
+ if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top
+ CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
+ if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5) then//check bottom
+ CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5);
prevPoint:= CursorPoint;
//if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
exit
@@ -1791,6 +1802,10 @@
begin
if (not cHasFocus) and (GameState <> gsConfirm) then
ParseCommand('quit', true);
+{$IFDEF MOBILE}
+// when created SDL receives an exposure event that calls UndampenAudio at full power, muting audio
+exit;
+{$ENDIF}
{$IFDEF USE_VIDEO_RECORDING}
// do not change volume during prerecording as it will affect sound in video file
@@ -1878,19 +1893,12 @@
stereoDepth:= 0;
AMState:= AMHidden;
isFirstFrame:= true;
+ stereoDepth:= stereoDepth; // avoid hint
end;
procedure freeModule;
begin
- stereoDepth:= stereoDepth; // avoid hint
- FreeTexture(fpsTexture);
- fpsTexture:= nil;
- FreeTexture(timeTexture);
- timeTexture:= nil;
- FreeTexture(missionTex);
- missionTex:= nil;
- FreeTexture(recTexture);
- recTexture:= nil;
+ ResetWorldTex();
end;
end.
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/liblua/CMakeLists.txt
--- a/misc/liblua/CMakeLists.txt Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/liblua/CMakeLists.txt Sun Oct 28 15:12:37 2012 +0100
@@ -1,7 +1,6 @@
#this file is included only when system Lua library is not found
file(GLOB lua_src *.c *.h)
-set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
if(WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
@@ -14,6 +13,7 @@
else(WIN32)
add_definitions(-DLUA_USE_LINUX)
add_library(lua STATIC ${lua_src})
+ set(LUA_LIBRARY lua)
endif(WIN32)
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/Android.mk
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/Makefile.am
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/Version_script.in
--- a/misc/libtremor/tremor/Version_script.in Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Export file for libvorbisidec
-#
-# Only the symbols listed in the global section will be callable from
-# applications linking to libvorbisidec.
-#
-
-@PACKAGE@.so.1
-{
- global:
- ov_clear;
- ov_open;
- ov_open_callbacks;
- ov_test;
- ov_test_callbacks;
- ov_test_open;
- ov_bitrate;
- ov_bitrate_instant;
- ov_streams;
- ov_seekable;
- ov_serialnumber;
- ov_raw_total;
- ov_pcm_total;
- ov_time_total;
- ov_raw_seek;
- ov_pcm_seek;
- ov_pcm_seek_page;
- ov_time_seek;
- ov_time_seek_page;
- ov_raw_tell;
- ov_pcm_tell;
- ov_time_tell;
- ov_info;
- ov_comment;
- ov_read;
-
- vorbis_info_init;
- vorbis_info_clear;
- vorbis_info_blocksize;
- vorbis_comment_init;
- vorbis_comment_add;
- vorbis_comment_add_tag;
- vorbis_comment_query;
- vorbis_comment_query_count;
- vorbis_comment_clear;
-
- local:
- *;
-};
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/autogen.sh
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/backends.h
--- a/misc/libtremor/tremor/backends.h Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: backend and mapping structures
-
- ********************************************************************/
-
-/* this is exposed up here because we need it for static modes.
- Lookups for each backend aren't exposed because there's no reason
- to do so */
-
-#ifndef _vorbis_backend_h_
-#define _vorbis_backend_h_
-
-#include "codec_internal.h"
-
-/* this would all be simpler/shorter with templates, but.... */
-/* Transform backend generic *************************************/
-
-/* only mdct right now. Flesh it out more if we ever transcend mdct
- in the transform domain */
-
-/* Floor backend generic *****************************************/
-typedef struct{
- vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
- vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
- vorbis_info_floor *);
- void (*free_info) (vorbis_info_floor *);
- void (*free_look) (vorbis_look_floor *);
- void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
- int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
- void *buffer,ogg_int32_t *);
-} vorbis_func_floor;
-
-typedef struct{
- int order;
- long rate;
- long barkmap;
-
- int ampbits;
- int ampdB;
-
- int numbooks; /* <= 16 */
- int books[16];
-
-} vorbis_info_floor0;
-
-#define VIF_POSIT 63
-#define VIF_CLASS 16
-#define VIF_PARTS 31
-typedef struct{
- int partitions; /* 0 to 31 */
- int partitionclass[VIF_PARTS]; /* 0 to 15 */
-
- int class_dim[VIF_CLASS]; /* 1 to 8 */
- int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<
-#include
-#include
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-
-#include "window.h"
-#include "registry.h"
-#include "misc.h"
-
-static int ilog(unsigned int v){
- int ret=0;
- if(v)--v;
- while(v){
- ret++;
- v>>=1;
- }
- return(ret);
-}
-
-/* pcm accumulator examples (not exhaustive):
-
- <-------------- lW ---------------->
- <--------------- W ---------------->
-: .....|..... _______________ |
-: .''' | '''_--- | |\ |
-:.....''' |_____--- '''......| | \_______|
-:.................|__________________|_______|__|______|
- |<------ Sl ------>| > Sr < |endW
- |beginSl |endSl | |endSr
- |beginW |endlW |beginSr
-
-
- |< lW >|
- <--------------- W ---------------->
- | | .. ______________ |
- | | ' `/ | ---_ |
- |___.'___/`. | ---_____|
- |_______|__|_______|_________________|
- | >|Sl|< |<------ Sr ----->|endW
- | | |endSl |beginSr |endSr
- |beginW | |endlW
- mult[0] |beginSl mult[n]
-
- <-------------- lW ----------------->
- |<--W-->|
-: .............. ___ | |
-: .''' |`/ \ | |
-:.....''' |/`....\|...|
-:.........................|___|___|___|
- |Sl |Sr |endW
- | | |endSr
- | |beginSr
- | |endSl
- |beginSl
- |beginW
-*/
-
-/* block abstraction setup *********************************************/
-
-#ifndef WORD_ALIGN
-#define WORD_ALIGN 8
-#endif
-
-int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
- memset(vb,0,sizeof(*vb));
- vb->vd=v;
- vb->localalloc=0;
- vb->localstore=NULL;
-
- return(0);
-}
-
-void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
- bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
- if(bytes+vb->localtop>vb->localalloc){
- /* can't just _ogg_realloc... there are outstanding pointers */
- if(vb->localstore){
- struct alloc_chain *link=(struct alloc_chain *)_ogg_malloc(sizeof(*link));
- vb->totaluse+=vb->localtop;
- link->next=vb->reap;
- link->ptr=vb->localstore;
- vb->reap=link;
- }
- /* highly conservative */
- vb->localalloc=bytes;
- vb->localstore=_ogg_malloc(vb->localalloc);
- vb->localtop=0;
- }
- {
- void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
- vb->localtop+=bytes;
- return ret;
- }
-}
-
-/* reap the chain, pull the ripcord */
-void _vorbis_block_ripcord(vorbis_block *vb){
- /* reap the chain */
- struct alloc_chain *reap=vb->reap;
- while(reap){
- struct alloc_chain *next=reap->next;
- _ogg_free(reap->ptr);
- memset(reap,0,sizeof(*reap));
- _ogg_free(reap);
- reap=next;
- }
- /* consolidate storage */
- if(vb->totaluse){
- vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
- vb->localalloc+=vb->totaluse;
- vb->totaluse=0;
- }
-
- /* pull the ripcord */
- vb->localtop=0;
- vb->reap=NULL;
-}
-
-int vorbis_block_clear(vorbis_block *vb){
- _vorbis_block_ripcord(vb);
- if(vb->localstore)_ogg_free(vb->localstore);
-
- memset(vb,0,sizeof(*vb));
- return(0);
-}
-
-static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
- int i;
- codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
- private_state *b=NULL;
-
- memset(v,0,sizeof(*v));
- b=(private_state *)(v->backend_state=_ogg_calloc(1,sizeof(*b)));
-
- v->vi=vi;
- b->modebits=ilog(ci->modes);
-
- /* Vorbis I uses only window type 0 */
- b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2);
- b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
-
- /* finish the codebooks */
- if(!ci->fullbooks){
- ci->fullbooks=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
- for(i=0;ibooks;i++){
- vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
- /* decode codebooks are now standalone after init */
- vorbis_staticbook_destroy(ci->book_param[i]);
- ci->book_param[i]=NULL;
- }
- }
-
- v->pcm_storage=ci->blocksizes[1];
- v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
- v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
- for(i=0;ichannels;i++)
- v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
-
- /* all 1 (large block) or 0 (small block) */
- /* explicitly set for the sake of clarity */
- v->lW=0; /* previous window size */
- v->W=0; /* current window size */
-
- /* initialize all the mapping/backend lookups */
- b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
- for(i=0;imodes;i++){
- int mapnum=ci->mode_param[i]->mapping;
- int maptype=ci->map_type[mapnum];
- b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
- ci->map_param[mapnum]);
- }
- return(0);
-}
-
-int vorbis_synthesis_restart(vorbis_dsp_state *v){
- vorbis_info *vi=v->vi;
- codec_setup_info *ci;
-
- if(!v->backend_state)return -1;
- if(!vi)return -1;
- ci=vi->codec_setup;
- if(!ci)return -1;
-
- v->centerW=ci->blocksizes[1]/2;
- v->pcm_current=v->centerW;
-
- v->pcm_returned=-1;
- v->granulepos=-1;
- v->sequence=-1;
- ((private_state *)(v->backend_state))->sample_count=-1;
-
- return(0);
-}
-
-int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
- _vds_init(v,vi);
- vorbis_synthesis_restart(v);
-
- return(0);
-}
-
-void vorbis_dsp_clear(vorbis_dsp_state *v){
- int i;
- if(v){
- vorbis_info *vi=v->vi;
- codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
- private_state *b=(private_state *)v->backend_state;
-
- if(v->pcm){
- for(i=0;ichannels;i++)
- if(v->pcm[i])_ogg_free(v->pcm[i]);
- _ogg_free(v->pcm);
- if(v->pcmret)_ogg_free(v->pcmret);
- }
-
- /* free mode lookups; these are actually vorbis_look_mapping structs */
- if(ci){
- for(i=0;imodes;i++){
- int mapnum=ci->mode_param[i]->mapping;
- int maptype=ci->map_type[mapnum];
- if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
- }
- }
-
- if(b){
- if(b->mode)_ogg_free(b->mode);
- _ogg_free(b);
- }
-
- memset(v,0,sizeof(*v));
- }
-}
-
-/* Unlike in analysis, the window is only partially applied for each
- block. The time domain envelope is not yet handled at the point of
- calling (as it relies on the previous block). */
-
-int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
- vorbis_info *vi=v->vi;
- codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
- private_state *b=v->backend_state;
- int i,j;
-
- if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
-
- v->lW=v->W;
- v->W=vb->W;
- v->nW=-1;
-
- if((v->sequence==-1)||
- (v->sequence+1 != vb->sequence)){
- v->granulepos=-1; /* out of sequence; lose count */
- b->sample_count=-1;
- }
-
- v->sequence=vb->sequence;
-
- if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
- was called on block */
- int n=ci->blocksizes[v->W]/2;
- int n0=ci->blocksizes[0]/2;
- int n1=ci->blocksizes[1]/2;
-
- int thisCenter;
- int prevCenter;
-
- if(v->centerW){
- thisCenter=n1;
- prevCenter=0;
- }else{
- thisCenter=0;
- prevCenter=n1;
- }
-
- /* v->pcm is now used like a two-stage double buffer. We don't want
- to have to constantly shift *or* adjust memory usage. Don't
- accept a new block until the old is shifted out */
-
- /* overlap/add PCM */
-
- for(j=0;jchannels;j++){
- /* the overlap/add section */
- if(v->lW){
- if(v->W){
- /* large/large */
- ogg_int32_t *pcm=v->pcm[j]+prevCenter;
- ogg_int32_t *p=vb->pcm[j];
- for(i=0;ipcm[j]+prevCenter+n1/2-n0/2;
- ogg_int32_t *p=vb->pcm[j];
- for(i=0;iW){
- /* small/large */
- ogg_int32_t *pcm=v->pcm[j]+prevCenter;
- ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
- for(i=0;ipcm[j]+prevCenter;
- ogg_int32_t *p=vb->pcm[j];
- for(i=0;ipcm[j]+thisCenter;
- ogg_int32_t *p=vb->pcm[j]+n;
- for(i=0;icenterW)
- v->centerW=0;
- else
- v->centerW=n1;
-
- /* deal with initial packet state; we do this using the explicit
- pcm_returned==-1 flag otherwise we're sensitive to first block
- being short or long */
-
- if(v->pcm_returned==-1){
- v->pcm_returned=thisCenter;
- v->pcm_current=thisCenter;
- }else{
- v->pcm_returned=prevCenter;
- v->pcm_current=prevCenter+
- ci->blocksizes[v->lW]/4+
- ci->blocksizes[v->W]/4;
- }
-
- }
-
- /* track the frame number... This is for convenience, but also
- making sure our last packet doesn't end with added padding. If
- the last packet is partial, the number of samples we'll have to
- return will be past the vb->granulepos.
-
- This is not foolproof! It will be confused if we begin
- decoding at the last page after a seek or hole. In that case,
- we don't have a starting point to judge where the last frame
- is. For this reason, vorbisfile will always try to make sure
- it reads the last two marked pages in proper sequence */
-
- if(b->sample_count==-1){
- b->sample_count=0;
- }else{
- b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
- }
-
- if(v->granulepos==-1){
- if(vb->granulepos!=-1){ /* only set if we have a position to set to */
-
- v->granulepos=vb->granulepos;
-
- /* is this a short page? */
- if(b->sample_count>v->granulepos){
- /* corner case; if this is both the first and last audio page,
- then spec says the end is cut, not beginning */
- if(vb->eofflag){
- /* trim the end */
- /* no preceeding granulepos; assume we started at zero (we'd
- have to in a short single-page stream) */
- /* granulepos could be -1 due to a seek, but that would result
- in a long coun`t, not short count */
-
- v->pcm_current-=(b->sample_count-v->granulepos);
- }else{
- /* trim the beginning */
- v->pcm_returned+=(b->sample_count-v->granulepos);
- if(v->pcm_returned>v->pcm_current)
- v->pcm_returned=v->pcm_current;
- }
-
- }
-
- }
- }else{
- v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
- if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
-
- if(v->granulepos>vb->granulepos){
- long extra=v->granulepos-vb->granulepos;
-
- if(extra)
- if(vb->eofflag){
- /* partial last frame. Strip the extra samples off */
- v->pcm_current-=extra;
- } /* else {Shouldn't happen *unless* the bitstream is out of
- spec. Either way, believe the bitstream } */
- } /* else {Shouldn't happen *unless* the bitstream is out of
- spec. Either way, believe the bitstream } */
- v->granulepos=vb->granulepos;
- }
- }
-
- /* Update, cleanup */
-
- if(vb->eofflag)v->eofflag=1;
- return(0);
-}
-
-/* pcm==NULL indicates we just want the pending samples, no more */
-int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){
- vorbis_info *vi=v->vi;
- if(v->pcm_returned>-1 && v->pcm_returnedpcm_current){
- if(pcm){
- int i;
- for(i=0;ichannels;i++)
- v->pcmret[i]=v->pcm[i]+v->pcm_returned;
- *pcm=v->pcmret;
- }
- return(v->pcm_current-v->pcm_returned);
- }
- return(0);
-}
-
-int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
- if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
- v->pcm_returned+=bytes;
- return(0);
-}
-
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/block.h
--- a/misc/libtremor/tremor/block.h Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: shared block functions
-
- ********************************************************************/
-
-#ifndef _V_BLOCK_
-#define _V_BLOCK_
-
-#include "ivorbiscodec.h"
-
-extern void _vorbis_block_ripcord(vorbis_block *vb);
-extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
-
-#endif
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/codebook.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/codebook.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/codec_internal.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/config_types.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/configure.in
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/floor0.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/floor1.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/framing.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/info.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/ivorbiscodec.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/ivorbisfile.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/lsp_lookup.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/mapping0.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/mdct.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/mdct.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/misc.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/os.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/os_types.h
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/registry.c
--- a/misc/libtremor/tremor/registry.c Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: registry for floor, res backends and channel mappings
-
- ********************************************************************/
-
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "misc.h"
-
-
-/* seems like major overkill now; the backend numbers will grow into
- the infrastructure soon enough */
-
-extern vorbis_func_floor floor0_exportbundle;
-extern vorbis_func_floor floor1_exportbundle;
-extern vorbis_func_residue residue0_exportbundle;
-extern vorbis_func_residue residue1_exportbundle;
-extern vorbis_func_residue residue2_exportbundle;
-extern vorbis_func_mapping mapping0_exportbundle;
-
-vorbis_func_floor *_floor_P[]={
- &floor0_exportbundle,
- &floor1_exportbundle,
-};
-
-vorbis_func_residue *_residue_P[]={
- &residue0_exportbundle,
- &residue1_exportbundle,
- &residue2_exportbundle,
-};
-
-vorbis_func_mapping *_mapping_P[]={
- &mapping0_exportbundle,
-};
-
-
-
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/registry.h
--- a/misc/libtremor/tremor/registry.h Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: registry for time, floor, res backends and channel mappings
-
- ********************************************************************/
-
-#ifndef _V_REG_H_
-#define _V_REG_H_
-
-#define VI_TRANSFORMB 1
-#define VI_WINDOWB 1
-#define VI_TIMEB 1
-#define VI_FLOORB 2
-#define VI_RESB 3
-#define VI_MAPB 1
-
-#include "backends.h"
-
-#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
-# define EXTERN __declspec(dllimport) extern
-#else
-# define EXTERN extern
-#endif
-
-EXTERN vorbis_func_floor *_floor_P[];
-EXTERN vorbis_func_residue *_residue_P[];
-EXTERN vorbis_func_mapping *_mapping_P[];
-
-#endif
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/res012.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/sharedbook.c
--- a/misc/libtremor/tremor/sharedbook.c Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,439 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: basic shared codebook operations
-
- ********************************************************************/
-
-#include
-#include
-#include
-#include "ogg.h"
-#include "misc.h"
-#include "ivorbiscodec.h"
-#include "codebook.h"
-
-/**** pack/unpack helpers ******************************************/
-int _ilog(unsigned int v){
- int ret=0;
- while(v){
- ret++;
- v>>=1;
- }
- return(ret);
-}
-
-/* 32 bit float (not IEEE; nonnormalized mantissa +
- biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
- Why not IEEE? It's just not that important here. */
-
-#define VQ_FEXP 10
-#define VQ_FMAN 21
-#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
-
-static ogg_int32_t _float32_unpack(long val,int *point){
- long mant=val&0x1fffff;
- int sign=val&0x80000000;
- long exp =(val&0x7fe00000L)>>VQ_FMAN;
-
- exp-=(VQ_FMAN-1)+VQ_FEXP_BIAS;
-
- if(mant){
- while(!(mant&0x40000000)){
- mant<<=1;
- exp-=1;
- }
-
- if(sign)mant= -mant;
- }else{
- sign=0;
- exp=-9999;
- }
-
- *point=exp;
- return mant;
-}
-
-/* given a list of word lengths, generate a list of codewords. Works
- for length ordered or unordered, always assigns the lowest valued
- codewords first. Extended to handle unused entries (length 0) */
-ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
- long i,j,count=0;
- ogg_uint32_t marker[33];
- ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
- memset(marker,0,sizeof(marker));
-
- for(i=0;i0){
- ogg_uint32_t entry=marker[length];
-
- /* when we claim a node for an entry, we also claim the nodes
- below it (pruning off the imagined tree that may have dangled
- from it) as well as blocking the use of any nodes directly
- above for leaves */
-
- /* update ourself */
- if(length<32 && (entry>>length)){
- /* error condition; the lengths must specify an overpopulated tree */
- _ogg_free(r);
- return(NULL);
- }
- r[count++]=entry;
-
- /* Look to see if the next shorter marker points to the node
- above. if so, update it and repeat. */
- {
- for(j=length;j>0;j--){
-
- if(marker[j]&1){
- /* have to jump branches */
- if(j==1)
- marker[1]++;
- else
- marker[j]=marker[j-1]<<1;
- break; /* invariant says next upper marker would already
- have been moved if it was on the same path */
- }
- marker[j]++;
- }
- }
-
- /* prune the tree; the implicit invariant says all the longer
- markers were dangling from our just-taken node. Dangle them
- from our *new* node. */
- for(j=length+1;j<33;j++)
- if((marker[j]>>1) == entry){
- entry=marker[j];
- marker[j]=marker[j-1]<<1;
- }else
- break;
- }else
- if(sparsecount==0)count++;
- }
-
- /* bitreverse the words because our bitwise packer/unpacker is LSb
- endian */
- for(i=0,count=0;i>j)&1;
- }
-
- if(sparsecount){
- if(l[i])
- r[count++]=temp;
- }else
- r[count++]=temp;
- }
-
- return(r);
-}
-
-/* there might be a straightforward one-line way to do the below
- that's portable and totally safe against roundoff, but I haven't
- thought of it. Therefore, we opt on the side of caution */
-long _book_maptype1_quantvals(const static_codebook *b){
- /* get us a starting hint, we'll polish it below */
- int bits=_ilog(b->entries);
- int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
-
- while(1){
- long acc=1;
- long acc1=1;
- int i;
- for(i=0;idim;i++){
- acc*=vals;
- acc1*=vals+1;
- }
- if(acc<=b->entries && acc1>b->entries){
- return(vals);
- }else{
- if(acc>b->entries){
- vals--;
- }else{
- vals++;
- }
- }
- }
-}
-
-/* different than what _book_unquantize does for mainline:
- we repack the book in a fixed point format that shares the same
- binary point. Upon first use, we can shift point if needed */
-
-/* we need to deal with two map types: in map type 1, the values are
- generated algorithmically (each column of the vector counts through
- the values in the quant vector). in map type 2, all the values came
- in in an explicit list. Both value lists must be unpacked */
-
-ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
- int *maxpoint){
- long j,k,count=0;
- if(b->maptype==1 || b->maptype==2){
- int quantvals;
- int minpoint,delpoint;
- ogg_int32_t mindel=_float32_unpack(b->q_min,&minpoint);
- ogg_int32_t delta=_float32_unpack(b->q_delta,&delpoint);
- ogg_int32_t *r=(ogg_int32_t *)_ogg_calloc(n*b->dim,sizeof(*r));
- int *rp=(int *)_ogg_calloc(n*b->dim,sizeof(*rp));
-
- *maxpoint=minpoint;
-
- /* maptype 1 and 2 both use a quantized value vector, but
- different sizes */
- switch(b->maptype){
- case 1:
- /* most of the time, entries%dimensions == 0, but we need to be
- well defined. We define that the possible vales at each
- scalar is values == entries/dim. If entries%dim != 0, we'll
- have 'too few' values (values*dimentries;j++){
- if((sparsemap && b->lengthlist[j]) || !sparsemap){
- ogg_int32_t last=0;
- int lastpoint=0;
- int indexdiv=1;
- for(k=0;kdim;k++){
- int index= (j/indexdiv)%quantvals;
- int point=0;
- int val=VFLOAT_MULTI(delta,delpoint,
- abs(b->quantlist[index]),&point);
-
- val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
- val=VFLOAT_ADD(last,lastpoint,val,point,&point);
-
- if(b->q_sequencep){
- last=val;
- lastpoint=point;
- }
-
- if(sparsemap){
- r[sparsemap[count]*b->dim+k]=val;
- rp[sparsemap[count]*b->dim+k]=point;
- }else{
- r[count*b->dim+k]=val;
- rp[count*b->dim+k]=point;
- }
- if(*maxpointentries;j++){
- if((sparsemap && b->lengthlist[j]) || !sparsemap){
- ogg_int32_t last=0;
- int lastpoint=0;
-
- for(k=0;kdim;k++){
- int point=0;
- int val=VFLOAT_MULTI(delta,delpoint,
- abs(b->quantlist[j*b->dim+k]),&point);
-
- val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
- val=VFLOAT_ADD(last,lastpoint,val,point,&point);
-
- if(b->q_sequencep){
- last=val;
- lastpoint=point;
- }
-
- if(sparsemap){
- r[sparsemap[count]*b->dim+k]=val;
- rp[sparsemap[count]*b->dim+k]=point;
- }else{
- r[count*b->dim+k]=val;
- rp[count*b->dim+k]=point;
- }
- if(*maxpointdim;j++)
- if(rp[j]<*maxpoint)
- r[j]>>=*maxpoint-rp[j];
-
- _ogg_free(rp);
- return(r);
- }
- return(NULL);
-}
-
-void vorbis_staticbook_clear(static_codebook *b){
- if(b->quantlist)_ogg_free(b->quantlist);
- if(b->lengthlist)_ogg_free(b->lengthlist);
- memset(b,0,sizeof(*b));
-
-}
-
-void vorbis_staticbook_destroy(static_codebook *b){
- vorbis_staticbook_clear(b);
- _ogg_free(b);
-}
-
-void vorbis_book_clear(codebook *b){
- /* static book is not cleared; we're likely called on the lookup and
- the static codebook belongs to the info struct */
- if(b->valuelist)_ogg_free(b->valuelist);
- if(b->codelist)_ogg_free(b->codelist);
-
- if(b->dec_index)_ogg_free(b->dec_index);
- if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
- if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
-
- memset(b,0,sizeof(*b));
-}
-
-static ogg_uint32_t bitreverse(ogg_uint32_t x){
- x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
- x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
- x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
- x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
- return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
-}
-
-static int sort32a(const void *a,const void *b){
- return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
- (**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
-}
-
-/* decode codebook arrangement is more heavily optimized than encode */
-int vorbis_book_init_decode(codebook *c,const static_codebook *s){
- int i,j,n=0,tabn;
- int *sortindex;
- memset(c,0,sizeof(*c));
-
- /* count actually used entries */
- for(i=0;ientries;i++)
- if(s->lengthlist[i]>0)
- n++;
-
- c->entries=s->entries;
- c->used_entries=n;
- c->dim=s->dim;
-
- if(n>0){
- /* two different remappings go on here.
-
- First, we collapse the likely sparse codebook down only to
- actually represented values/words. This collapsing needs to be
- indexed as map-valueless books are used to encode original entry
- positions as integers.
-
- Second, we reorder all vectors, including the entry index above,
- by sorted bitreversed codeword to allow treeless decode. */
-
- /* perform sort */
- ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
- ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
-
- if(codes==NULL)goto err_out;
-
- for(i=0;icodelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
- /* the index is a reverse index */
- for(i=0;icodelist[sortindex[i]]=codes[i];
- _ogg_free(codes);
-
-
-
- c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
- c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
-
- for(n=0,i=0;ientries;i++)
- if(s->lengthlist[i]>0)
- c->dec_index[sortindex[n++]]=i;
-
- c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
- for(n=0,i=0;ientries;i++)
- if(s->lengthlist[i]>0)
- c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
-
- c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
- if(c->dec_firsttablen<5)c->dec_firsttablen=5;
- if(c->dec_firsttablen>8)c->dec_firsttablen=8;
-
- tabn=1<dec_firsttablen;
- c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
- c->dec_maxlength=0;
-
- for(i=0;idec_maxlengthdec_codelengths[i])
- c->dec_maxlength=c->dec_codelengths[i];
- if(c->dec_codelengths[i]<=c->dec_firsttablen){
- ogg_uint32_t orig=bitreverse(c->codelist[i]);
- for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
- c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1;
- }
- }
-
- /* now fill in 'unused' entries in the firsttable with hi/lo search
- hints for the non-direct-hits */
- {
- ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
- long lo=0,hi=0;
-
- for(i=0;idec_firsttablen);
- if(c->dec_firsttable[bitreverse(word)]==0){
- while((lo+1)codelist[lo+1]<=word)lo++;
- while( hi=(c->codelist[hi]&mask))hi++;
-
- /* we only actually have 15 bits per hint to play with here.
- In order to overflow gracefully (nothing breaks, efficiency
- just drops), encode as the difference from the extremes. */
- {
- unsigned long loval=lo;
- unsigned long hival=n-hi;
-
- if(loval>0x7fff)loval=0x7fff;
- if(hival>0x7fff)hival=0x7fff;
- c->dec_firsttable[bitreverse(word)]=
- 0x80000000UL | (loval<<15) | hival;
- }
- }
- }
- }
- }
-
- return(0);
- err_out:
- vorbis_book_clear(c);
- return(-1);
-}
-
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/synthesis.c
--- a/misc/libtremor/tremor/synthesis.c Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.4 2003/03/29 03:07:21 xiphmont Exp $
-
- ********************************************************************/
-
-#include
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "misc.h"
-#include "block.h"
-
-int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
- vorbis_dsp_state *vd=vb->vd;
- private_state *b=(private_state *)vd->backend_state;
- vorbis_info *vi=vd->vi;
- codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
- oggpack_buffer *opb=&vb->opb;
- int type,mode,i;
-
- /* first things first. Make sure decode is ready */
- _vorbis_block_ripcord(vb);
- oggpack_readinit(opb,op->packet);
-
- /* Check the packet type */
- if(oggpack_read(opb,1)!=0){
- /* Oops. This is not an audio data packet */
- return(OV_ENOTAUDIO);
- }
-
- /* read our mode and pre/post windowsize */
- mode=oggpack_read(opb,b->modebits);
- if(mode==-1)return(OV_EBADPACKET);
-
- vb->mode=mode;
- vb->W=ci->mode_param[mode]->blockflag;
- if(vb->W){
- vb->lW=oggpack_read(opb,1);
- vb->nW=oggpack_read(opb,1);
- if(vb->nW==-1) return(OV_EBADPACKET);
- }else{
- vb->lW=0;
- vb->nW=0;
- }
-
- /* more setup */
- vb->granulepos=op->granulepos;
- vb->sequence=op->packetno-3; /* first block is third packet */
- vb->eofflag=op->e_o_s;
-
- if(decodep){
- /* alloc pcm passback storage */
- vb->pcmend=ci->blocksizes[vb->W];
- vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
- for(i=0;ichannels;i++)
- vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
-
- /* unpack_header enforces range checking */
- type=ci->map_type[ci->mode_param[mode]->mapping];
-
- return(_mapping_P[type]->inverse(vb,b->mode[mode]));
- }else{
- /* no pcm */
- vb->pcmend=0;
- vb->pcm=NULL;
-
- return(0);
- }
-}
-
-long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
- codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
- oggpack_buffer opb;
- int mode;
-
- oggpack_readinit(&opb,op->packet);
-
- /* Check the packet type */
- if(oggpack_read(&opb,1)!=0){
- /* Oops. This is not an audio data packet */
- return(OV_ENOTAUDIO);
- }
-
- {
- int modebits=0;
- int v=ci->modes;
- while(v>1){
- modebits++;
- v>>=1;
- }
-
- /* read our mode and pre/post windowsize */
- mode=oggpack_read(&opb,modebits);
- }
- if(mode==-1)return(OV_EBADPACKET);
- return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
-}
-
-
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/vorbisfile.c
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/libtremor/tremor/window.c
--- a/misc/libtremor/tremor/window.c Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
- * *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: window functions
-
- ********************************************************************/
-
-#include
-#include
-#include "misc.h"
-#include "window.h"
-#include "window_lookup.h"
-
-const void *_vorbis_window(int type, int left){
-
- switch(type){
- case 0:
-
- switch(left){
- case 32:
- return vwin64;
- case 64:
- return vwin128;
- case 128:
- return vwin256;
- case 256:
- return vwin512;
- case 512:
- return vwin1024;
- case 1024:
- return vwin2048;
- case 2048:
- return vwin4096;
- case 4096:
- return vwin8192;
- default:
- return(0);
- }
- break;
- default:
- return(0);
- }
-}
-
-void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
- long *blocksizes,
- int lW,int W,int nW){
-
- LOOKUP_T *window[2]={window_p[0],window_p[1]};
- long n=blocksizes[W];
- long ln=blocksizes[lW];
- long rn=blocksizes[nW];
-
- long leftbegin=n/4-ln/4;
- long leftend=leftbegin+ln/2;
-
- long rightbegin=n/2+n/4-rn/4;
- long rightend=rightbegin+rn/2;
-
- int i,p;
-
- for(i=0;i loc.txt
+# Update locale files - run in Locale
+for i in *.lua;do cat ../loc.txt | while read f;do STR=$(echo "$f" | sed 's/loc("//;s/")\s*$//;s/"/\\"/g');MAPS=$(grep -F -l -- "loc(\"${STR}\")" ../*/*/*.lua ../*/*/*/*.lua | sed 's/.*\/\([^\/]*\)\/map.lua/\1/;s/.*Campaign\/\([^\/]*\)\//\1:/;s/.*\///;s/.lua//;s/ /_/g' | xargs | sed 's/ /, /g');C=$(echo $MAPS | sed 's/,/\n/' | wc -l);grep -Fq -- "[\"${STR}\"]" $i;if(($?));then if((C>0));then echo "-- [\"${STR}\"] = \"\", -- $MAPS" >> $i;else echo "-- [\"${STR}\"] = \"\"," >> $i;fi;fi;done;done
+# sort - run in Locale
+for i in *.lua;do rm temphead temptail templua;cat $i | grep -Ev "}|{" | grep -Ev "^[[:space:]]*$" | sort > templua;echo "locale = {" > temphead;echo " }" > temptail;cat temphead templua temptail > $i;done
+# drop unused - run in Locale
+cat stub.lua | grep '"] =' | while read f;do PHRASE=$(echo "$f" | sed 's/[^[]*\["//;s/"] =.*//;s/"/\\"/g');CNT=$(grep -Frc "loc(\"$PHRASE\")" ../*/*/*.lua ../*/*/*/*.lua | grep -v ":0" | wc -l);if(($CNT==0));then echo "|$PHRASE|";sed -i "s/.*\[\"$PHRASE\"].*//" *.lua;fi;done
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/Hedgewars.lnk
Binary file misc/winutils/Hedgewars.lnk has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/Hedgewars_x64.lnk
Binary file misc/winutils/Hedgewars_x64.lnk has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/Hedgewars_x86.lnk
Binary file misc/winutils/Hedgewars_x86.lnk has changed
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL.h
--- a/misc/winutils/include/SDL.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_active.h
--- a/misc/winutils/include/SDL_active.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_active.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_audio.h
--- a/misc/winutils/include/SDL_audio.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_audio.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_byteorder.h
--- a/misc/winutils/include/SDL_byteorder.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_byteorder.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_cdrom.h
--- a/misc/winutils/include/SDL_cdrom.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_cdrom.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_config.h
--- a/misc/winutils/include/SDL_config.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_config.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,7 +1,6 @@
-/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,288 +23,23 @@
#ifndef _SDL_config_h
#define _SDL_config_h
-/* This is a set of defines to configure the SDL features */
-
-/* General platform specific identifiers */
#include "SDL_platform.h"
-/* Make sure that this isn't included by Visual C++ */
-#ifdef _MSC_VER
-#error You should copy include/SDL_config.h.default to include/SDL_config.h
-#endif
-
-/* C language features */
-/* #undef const */
-/* #undef inline */
-/* #undef volatile */
-
-/* C datatypes */
-/* #undef size_t */
-/* #undef int8_t */
-/* #undef uint8_t */
-/* #undef int16_t */
-/* #undef uint16_t */
-/* #undef int32_t */
-/* #undef uint32_t */
-/* #undef int64_t */
-/* #undef uint64_t */
-/* #undef uintptr_t */
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Endianness */
-#define SDL_BYTEORDER 1234
-
-/* Comment this if you want to build without any C library requirements */
-#define HAVE_LIBC 1
-#if HAVE_LIBC
-
-/* Useful headers */
-/* #undef HAVE_ALLOCA_H */
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-/* #undef HAVE_ICONV_H */
-#define HAVE_SIGNAL_H 1
-/* #undef HAVE_ALTIVEC_H */
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-/* #undef HAVE_ALLOCA */
-#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
-#define HAVE_GETENV 1
-#define HAVE_PUTENV 1
-/* #undef HAVE_UNSETENV */
-#endif
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-/* #undef HAVE_BCOPY */
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-/* #undef HAVE_MEMCMP */
-#define HAVE_STRLEN 1
-/* #undef HAVE_STRLCPY */
-/* #undef HAVE_STRLCAT */
-#define HAVE_STRDUP 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-/* #undef HAVE_INDEX */
-/* #undef HAVE_RINDEX */
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-/* #undef HAVE__UITOA */
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE__I64TOA 1
-#define HAVE__UI64TOA 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-/* #undef HAVE_STRTOD */
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* #undef HAVE_ICONV */
-/* #undef HAVE_SIGACTION */
-/* #undef HAVE_SETJMP */
-/* #undef HAVE_NANOSLEEP */
-/* #undef HAVE_CLOCK_GETTIME */
-/* #undef HAVE_GETPAGESIZE */
-/* #undef HAVE_MPROTECT */
-
+/* Add any platform that doesn't build using the configure system */
+#if defined(__DREAMCAST__)
+#include "SDL_config_dreamcast.h"
+#elif defined(__MACOS__)
+#include "SDL_config_macos.h"
+#elif defined(__MACOSX__)
+#include "SDL_config_macosx.h"
+#elif defined(__SYMBIAN32__)
+#include "SDL_config_symbian.h" /* must be before win32! */
+#elif defined(__WIN32__)
+#include "SDL_config_win32.h"
+#elif defined(__OS2__)
+#include "SDL_config_os2.h"
#else
-/* We may need some replacement for stdarg.h here */
-#include
-#endif /* HAVE_LIBC */
-
-/* Allow disabling of core subsystems */
-/* #undef SDL_AUDIO_DISABLED */
-/* #undef SDL_CDROM_DISABLED */
-/* #undef SDL_CPUINFO_DISABLED */
-/* #undef SDL_EVENTS_DISABLED */
-/* #undef SDL_FILE_DISABLED */
-/* #undef SDL_JOYSTICK_DISABLED */
-/* #undef SDL_LOADSO_DISABLED */
-/* #undef SDL_THREADS_DISABLED */
-/* #undef SDL_TIMERS_DISABLED */
-/* #undef SDL_VIDEO_DISABLED */
-
-/* Enable various audio drivers */
-/* #undef SDL_AUDIO_DRIVER_ALSA */
-/* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_ARTS */
-/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_BAUDIO */
-/* #undef SDL_AUDIO_DRIVER_BSD */
-/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
-/* #undef SDL_AUDIO_DRIVER_DART */
-/* #undef SDL_AUDIO_DRIVER_DC */
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-/* #undef SDL_AUDIO_DRIVER_DMEDIA */
-#define SDL_AUDIO_DRIVER_DSOUND 1
-/* #undef SDL_AUDIO_DRIVER_PULSE */
-/* #undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_ESD */
-/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_MINT */
-/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */
-/* #undef SDL_AUDIO_DRIVER_NAS */
-/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_OSS */
-/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
-/* #undef SDL_AUDIO_DRIVER_PAUD */
-/* #undef SDL_AUDIO_DRIVER_QNXNTO */
-/* #undef SDL_AUDIO_DRIVER_SNDMGR */
-/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
-#define SDL_AUDIO_DRIVER_WAVEOUT 1
-
-/* Enable various cdrom drivers */
-/* #undef SDL_CDROM_AIX */
-/* #undef SDL_CDROM_BEOS */
-/* #undef SDL_CDROM_BSDI */
-/* #undef SDL_CDROM_DC */
-/* #undef SDL_CDROM_DUMMY */
-/* #undef SDL_CDROM_FREEBSD */
-/* #undef SDL_CDROM_LINUX */
-/* #undef SDL_CDROM_MACOS */
-/* #undef SDL_CDROM_MACOSX */
-/* #undef SDL_CDROM_MINT */
-/* #undef SDL_CDROM_OPENBSD */
-/* #undef SDL_CDROM_OS2 */
-/* #undef SDL_CDROM_OSF */
-/* #undef SDL_CDROM_QNX */
-#define SDL_CDROM_WIN32 1
-
-/* Enable various input drivers */
-/* #undef SDL_INPUT_LINUXEV */
-/* #undef SDL_INPUT_TSLIB */
-/* #undef SDL_JOYSTICK_BEOS */
-/* #undef SDL_JOYSTICK_DC */
-/* #undef SDL_JOYSTICK_DUMMY */
-/* #undef SDL_JOYSTICK_IOKIT */
-/* #undef SDL_JOYSTICK_LINUX */
-/* #undef SDL_JOYSTICK_MACOS */
-/* #undef SDL_JOYSTICK_MINT */
-/* #undef SDL_JOYSTICK_OS2 */
-/* #undef SDL_JOYSTICK_RISCOS */
-#define SDL_JOYSTICK_WINMM 1
-/* #undef SDL_JOYSTICK_USBHID */
-/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
-
-/* Enable various shared object loading systems */
-/* #undef SDL_LOADSO_BEOS */
-/* #undef SDL_LOADSO_DLCOMPAT */
-/* #undef SDL_LOADSO_DLOPEN */
-/* #undef SDL_LOADSO_DUMMY */
-/* #undef SDL_LOADSO_LDG */
-/* #undef SDL_LOADSO_MACOS */
-/* #undef SDL_LOADSO_OS2 */
-#define SDL_LOADSO_WIN32 1
-
-/* Enable various threading systems */
-/* #undef SDL_THREAD_BEOS */
-/* #undef SDL_THREAD_DC */
-/* #undef SDL_THREAD_OS2 */
-/* #undef SDL_THREAD_PTH */
-/* #undef SDL_THREAD_PTHREAD */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
-/* #undef SDL_THREAD_SPROC */
-#define SDL_THREAD_WIN32 1
-
-/* Enable various timer systems */
-/* #undef SDL_TIMER_BEOS */
-/* #undef SDL_TIMER_DC */
-/* #undef SDL_TIMER_DUMMY */
-/* #undef SDL_TIMER_MACOS */
-/* #undef SDL_TIMER_MINT */
-/* #undef SDL_TIMER_OS2 */
-/* #undef SDL_TIMER_RISCOS */
-/* #undef SDL_TIMER_UNIX */
-#define SDL_TIMER_WIN32 1
-/* #undef SDL_TIMER_WINCE */
-
-/* Enable various video drivers */
-/* #undef SDL_VIDEO_DRIVER_AALIB */
-/* #undef SDL_VIDEO_DRIVER_BWINDOW */
-/* #undef SDL_VIDEO_DRIVER_CACA */
-/* #undef SDL_VIDEO_DRIVER_DC */
-#define SDL_VIDEO_DRIVER_DDRAW 1
-/* #undef SDL_VIDEO_DRIVER_DGA */
-/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
-/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-/* #undef SDL_VIDEO_DRIVER_FBCON */
-/* #undef SDL_VIDEO_DRIVER_GAPI */
-/* #undef SDL_VIDEO_DRIVER_GEM */
-/* #undef SDL_VIDEO_DRIVER_GGI */
-/* #undef SDL_VIDEO_DRIVER_IPOD */
-/* #undef SDL_VIDEO_DRIVER_NANOX */
-/* #undef SDL_VIDEO_DRIVER_OS2FS */
-/* #undef SDL_VIDEO_DRIVER_PHOTON */
-/* #undef SDL_VIDEO_DRIVER_PICOGUI */
-/* #undef SDL_VIDEO_DRIVER_PS2GS */
-/* #undef SDL_VIDEO_DRIVER_PS3 */
-/* #undef SDL_VIDEO_DRIVER_QTOPIA */
-/* #undef SDL_VIDEO_DRIVER_QUARTZ */
-/* #undef SDL_VIDEO_DRIVER_RISCOS */
-/* #undef SDL_VIDEO_DRIVER_SVGALIB */
-/* #undef SDL_VIDEO_DRIVER_TOOLBOX */
-/* #undef SDL_VIDEO_DRIVER_VGL */
-#define SDL_VIDEO_DRIVER_WINDIB 1
-/* #undef SDL_VIDEO_DRIVER_WSCONS */
-/* #undef SDL_VIDEO_DRIVER_X11 */
-/* #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER */
-/* #undef SDL_VIDEO_DRIVER_X11_VIDMODE */
-/* #undef SDL_VIDEO_DRIVER_X11_XINERAMA */
-/* #undef SDL_VIDEO_DRIVER_X11_XME */
-/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_XV */
-/* #undef SDL_VIDEO_DRIVER_XBIOS */
-
-/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-/* #undef SDL_VIDEO_OPENGL_GLX */
-#define SDL_VIDEO_OPENGL_WGL 1
-/* #undef SDL_VIDEO_OPENGL_OSMESA */
-/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
-
-/* Disable screensaver */
-#define SDL_VIDEO_DISABLE_SCREENSAVER 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#define SDL_HERMES_BLITTERS 1
-/* #undef SDL_ALTIVEC_BLITTERS */
+#include "SDL_config_minimal.h"
+#endif /* platform config */
#endif /* _SDL_config_h */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_config_win32.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/SDL_config_win32.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,183 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2012 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#ifndef _SDL_config_win32_h
+#define _SDL_config_win32_h
+
+#include "SDL_platform.h"
+
+/* This is a set of defines to configure the SDL features */
+
+#if defined(__GNUC__) || defined(__DMC__)
+#define HAVE_STDINT_H 1
+#elif defined(_MSC_VER)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
+#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
+#define DWORD_PTR DWORD
+#endif
+#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
+#define LONG_PTR LONG
+#endif
+#else /* !__GNUC__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __GNUC__ || _MSC_VER */
+#define SDL_HAS_64BIT_TYPE 1
+
+/* Enabled for SDL 1.2 (binary compatibility) */
+#define HAVE_LIBC 1
+#ifdef HAVE_LIBC
+/* Useful headers */
+#define HAVE_STDIO_H 1
+#define STDC_HEADERS 1
+#define HAVE_STRING_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+#ifndef _WIN32_WCE
+#define HAVE_SIGNAL_H 1
+#endif
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+#define HAVE__STRUPR 1
+#define HAVE__STRLWR 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_ITOA 1
+#define HAVE__LTOA 1
+#define HAVE__ULTOA 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE_SSCANF 1
+#else
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#endif
+
+/* Enable various audio drivers */
+#ifndef _WIN32_WCE
+#define SDL_AUDIO_DRIVER_DSOUND 1
+#endif
+#define SDL_AUDIO_DRIVER_WAVEOUT 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various cdrom drivers */
+#ifdef _WIN32_WCE
+#define SDL_CDROM_DISABLED 1
+#else
+#define SDL_CDROM_WIN32 1
+#endif
+
+/* Enable various input drivers */
+#ifdef _WIN32_WCE
+#define SDL_JOYSTICK_DISABLED 1
+#else
+#define SDL_JOYSTICK_WINMM 1
+#endif
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WIN32 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_WIN32 1
+
+/* Enable various timer systems */
+#ifdef _WIN32_WCE
+#define SDL_TIMER_WINCE 1
+#else
+#define SDL_TIMER_WIN32 1
+#endif
+
+/* Enable various video drivers */
+#ifdef _WIN32_WCE
+#define SDL_VIDEO_DRIVER_GAPI 1
+#endif
+#ifndef _WIN32_WCE
+#define SDL_VIDEO_DRIVER_DDRAW 1
+#endif
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_WINDIB 1
+
+/* Enable OpenGL support */
+#ifndef _WIN32_WCE
+#define SDL_VIDEO_OPENGL 1
+#define SDL_VIDEO_OPENGL_WGL 1
+#endif
+
+/* Disable screensaver */
+#define SDL_VIDEO_DISABLE_SCREENSAVER 1
+
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
+
+#endif /* _SDL_config_win32_h */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_cpuinfo.h
--- a/misc/winutils/include/SDL_cpuinfo.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_cpuinfo.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_endian.h
--- a/misc/winutils/include/SDL_endian.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_endian.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -39,6 +39,10 @@
/*@}*/
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
+#ifdef __linux__
+#include
+#define SDL_BYTEORDER __BYTE_ORDER
+#else /* __linux __ */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
@@ -48,6 +52,7 @@
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
+#endif /* __linux __ */
#endif /* !SDL_BYTEORDER */
@@ -86,7 +91,7 @@
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
return result;
}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
+#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
@@ -94,7 +99,7 @@
}
#else
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
- return((x<<8)|(x>>8));
+ return SDL_static_cast(Uint16, ((x<<8)|(x>>8)));
}
#endif
@@ -121,7 +126,7 @@
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
return result;
}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
+#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
@@ -129,7 +134,7 @@
}
#else
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
- return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
+ return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)));
}
#endif
@@ -166,7 +171,7 @@
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
- return(x);
+ return (x);
}
#endif
#else
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_error.h
--- a/misc/winutils/include/SDL_error.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_error.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_events.h
--- a/misc/winutils/include/SDL_events.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_events.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_getenv.h
--- a/misc/winutils/include/SDL_getenv.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_getenv.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_joystick.h
--- a/misc/winutils/include/SDL_joystick.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_joystick.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_keyboard.h
--- a/misc/winutils/include/SDL_keyboard.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_keyboard.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_keysym.h
--- a/misc/winutils/include/SDL_keysym.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_keysym.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_loadso.h
--- a/misc/winutils/include/SDL_loadso.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_loadso.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_main.h
--- a/misc/winutils/include/SDL_main.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_main.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_mixer.h
--- a/misc/winutils/include/SDL_mixer.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_mixer.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,26 +1,25 @@
/*
- SDL_mixer: An audio mixer library based on the SDL library
- Copyright (C) 1997-2004 Sam Lantinga
+ SDL_mixer: An audio mixer library based on the SDL library
+ Copyright (C) 1997-2012 Sam Lantinga
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
*/
-/* $Id: SDL_mixer.h,v 1.30 2004/01/04 17:37:04 slouken Exp $ */
+/* $Id$ */
#ifndef _SDL_MIXER_H
#define _SDL_MIXER_H
@@ -28,7 +27,7 @@
#include "SDL_types.h"
#include "SDL_rwops.h"
#include "SDL_audio.h"
-#include "SDL_byteorder.h"
+#include "SDL_endian.h"
#include "SDL_version.h"
#include "begin_code.h"
@@ -41,7 +40,7 @@
*/
#define SDL_MIXER_MAJOR_VERSION 1
#define SDL_MIXER_MINOR_VERSION 2
-#define SDL_MIXER_PATCHLEVEL 6
+#define SDL_MIXER_PATCHLEVEL 12
/* This macro can be used to fill a version structure with the compile-time
* version of the SDL_mixer library.
@@ -65,6 +64,24 @@
*/
extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void);
+typedef enum
+{
+ MIX_INIT_FLAC = 0x00000001,
+ MIX_INIT_MOD = 0x00000002,
+ MIX_INIT_MP3 = 0x00000004,
+ MIX_INIT_OGG = 0x00000008,
+ MIX_INIT_FLUIDSYNTH = 0x00000010
+} MIX_InitFlags;
+
+/* Loads dynamic libraries and prepares them for use. Flags should be
+ one or more flags from MIX_InitFlags OR'd together.
+ It returns the flags successfully initialized, or 0 on failure.
+ */
+extern DECLSPEC int SDLCALL Mix_Init(int flags);
+
+/* Unloads libraries loaded with Mix_Init */
+extern DECLSPEC void SDLCALL Mix_Quit(void);
+
/* The default mixer has 8 simultaneous mixing channels */
#ifndef MIX_CHANNELS
@@ -82,7 +99,7 @@
#define MIX_MAX_VOLUME 128 /* Volume of a chunk */
/* The internal format for an audio chunk */
-typedef struct {
+typedef struct Mix_Chunk {
int allocated;
Uint8 *abuf;
Uint32 alen;
@@ -103,7 +120,10 @@
MUS_MOD,
MUS_MID,
MUS_OGG,
- MUS_MP3
+ MUS_MP3,
+ MUS_MP3_MAD,
+ MUS_FLAC,
+ MUS_MODPLUG
} Mix_MusicType;
/* The internal format for a music chunk interpreted via mikmod */
@@ -130,11 +150,12 @@
#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);
-#ifdef USE_RWOPS /* This hasn't been hooked into music.c yet */
-/* Load a music file from an SDL_RWop object (MikMod-specific currently)
+/* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw);
-#endif
+
+/* Load a music file from an SDL_RWop object assuming a specific format */
+extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW(SDL_RWops *rw, Mix_MusicType type, int freesrc);
/* Load a wave file of the mixer format from a memory buffer */
extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem);
@@ -146,6 +167,30 @@
extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk);
extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music);
+/* Get a list of chunk/music decoders that this build of SDL_mixer provides.
+ This list can change between builds AND runs of the program, if external
+ libraries that add functionality become available.
+ You must successfully call Mix_OpenAudio() before calling these functions.
+ This API is only available in SDL_mixer 1.2.9 and later.
+
+ // usage...
+ int i;
+ const int total = Mix_GetNumChunkDecoders();
+ for (i = 0; i < total; i++)
+ printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i));
+
+ Appearing in this list doesn't promise your specific audio file will
+ decode...but it's handy to know if you have, say, a functioning Timidity
+ install.
+
+ These return values are static, read-only data; do not modify or free it.
+ The pointers remain valid until you call Mix_CloseAudio().
+*/
+extern DECLSPEC int SDLCALL Mix_GetNumChunkDecoders(void);
+extern DECLSPEC const char * SDLCALL Mix_GetChunkDecoder(int index);
+extern DECLSPEC int SDLCALL Mix_GetNumMusicDecoders(void);
+extern DECLSPEC const char * SDLCALL Mix_GetMusicDecoder(int index);
+
/* Find out the music format of a mixer music, or the currently playing
music, if 'music' is NULL.
*/
@@ -183,7 +228,7 @@
extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
-/* Special Effects API by ryan c. gordon. (icculus@linuxgames.com) */
+/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */
#define MIX_CHANNEL_POST -2
@@ -545,8 +590,8 @@
/* Set the current position in the music stream.
This returns 0 if successful, or -1 if it failed or isn't implemented.
This function is only implemented for MOD music formats (set pattern
- order number) and for OGG music (set position in seconds), at the
- moment.
+ order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set
+ position in seconds), at the moment.
*/
extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
@@ -563,6 +608,11 @@
extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value);
extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void);
+/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */
+extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths);
+extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void);
+extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (*function)(const char*, void*), void *data);
+
/* Get the Mix_Chunk currently associated with a mixer channel
Returns NULL if it's an invalid channel, or there's no chunk associated.
*/
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_mouse.h
--- a/misc/winutils/include/SDL_mouse.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_mouse.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_mutex.h
--- a/misc/winutils/include/SDL_mutex.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_mutex.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_opengl.h
--- a/misc/winutils/include/SDL_opengl.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_opengl.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -3108,21 +3108,35 @@
#ifndef GL_VERSION_1_5
/* GL types for handling large vertex buffer objects */
+#ifdef __APPLE__
+typedef long GLintptr;
+typedef long GLsizeiptr;
+#else
typedef ptrdiff_t GLintptr;
typedef ptrdiff_t GLsizeiptr;
#endif
+#endif
#ifndef GL_ARB_vertex_buffer_object
/* GL types for handling large vertex buffer objects */
+#ifdef __APPLE__
+typedef long GLintptrARB;
+typedef long GLsizeiptrARB;
+#else
typedef ptrdiff_t GLintptrARB;
typedef ptrdiff_t GLsizeiptrARB;
#endif
+#endif
#ifndef GL_ARB_shader_objects
/* GL types for handling shader object handles and program/shader text */
typedef char GLcharARB; /* native character */
+#if defined(__APPLE__)
+typedef void *GLhandleARB; /* shader object handle */
+#else
typedef unsigned int GLhandleARB; /* shader object handle */
#endif
+#endif
/* GL types for "half" precision (s10e5) float data in host memory */
#ifndef GL_ARB_half_float_pixel
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_platform.h
--- a/misc/winutils/include/SDL_platform.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_platform.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_quit.h
--- a/misc/winutils/include/SDL_quit.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_quit.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_rwops.h
--- a/misc/winutils/include/SDL_rwops.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_rwops.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_stdinc.h
--- a/misc/winutils/include/SDL_stdinc.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_stdinc.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_syswm.h
--- a/misc/winutils/include/SDL_syswm.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_syswm.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -203,12 +203,13 @@
/**
* This function gives you custom hooks into the window manager information.
* It fills the structure pointed to by 'info' with custom information and
- * returns 1 if the function is implemented. If it's not implemented, or
- * the version member of the 'info' structure is invalid, it returns 0.
+ * returns 0 if the function is not implemented, 1 if the function is
+ * implemented and no error occurred, and -1 if the version member of
+ * the 'info' structure is not filled in or not supported.
*
* You typically use this function like this:
* @code
- * SDL_SysWMInfo info;
+ * SDL_SysWMinfo info;
* SDL_VERSION(&info.version);
* if ( SDL_GetWMInfo(&info) ) { ... }
* @endcode
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_thread.h
--- a/misc/winutils/include/SDL_thread.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_thread.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -68,11 +68,6 @@
#ifdef __OS2__
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
typedef void (*pfnSDL_CurrentEndThread)(void);
-#elif __GNUC__
-typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
#else
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
unsigned (__stdcall *func)(void *), void *arg,
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_timer.h
--- a/misc/winutils/include/SDL_timer.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_timer.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_types.h
--- a/misc/winutils/include/SDL_types.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_types.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_version.h
--- a/misc/winutils/include/SDL_version.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_version.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@
/*@{*/
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
-#define SDL_PATCHLEVEL 14
+#define SDL_PATCHLEVEL 15
/*@}*/
typedef struct SDL_version {
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/SDL_video.h
--- a/misc/winutils/include/SDL_video.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/SDL_video.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/begin_code.h
--- a/misc/winutils/include/begin_code.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/begin_code.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -43,7 +43,7 @@
#ifndef DECLSPEC
# if defined(__BEOS__) || defined(__HAIKU__)
# if defined(__GNUC__)
-# define DECLSPEC __declspec(dllexport)
+# define DECLSPEC
# else
# define DECLSPEC __declspec(export)
# endif
@@ -132,7 +132,12 @@
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
+#ifdef _M_X64
+/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
+#pragma pack(push,8)
+#else
#pragma pack(push,4)
+#endif
#elif (defined(__MWERKS__) && defined(__MACOS__))
#pragma options align=mac68k4byte
#pragma enumsalwaysint on
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/close_code.h
--- a/misc/winutils/include/close_code.h Sun Sep 16 23:52:36 2012 +0200
+++ b/misc/winutils/include/close_code.h Sun Oct 28 15:12:37 2012 +0100
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2012 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/doxyfile
--- a/misc/winutils/include/doxyfile Sun Sep 16 23:52:36 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,946 +0,0 @@
-# Doxyfile 1.2.16
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = SDL
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 1.2.14
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = docs
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
-# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean,
-# Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovene,
-# Spanish, Swedish and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these class will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
-STRIP_FROM_PATH =
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower case letters. If set to YES upper case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are adviced to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
-INHERIT_DOCS = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consist of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = include
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl
-
-FILE_PATTERNS = *.h
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command , where
-# is the value of the INPUT_FILTER tag, and is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
-INPUT_FILTER =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse.
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the Html help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
-# or Internet explorer 4.0+). Note that for large projects the tree generation
-# can take a very long time. In such cases it is better to disable this feature.
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = YES
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = YES
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_XML = NO
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 SDLCALL= SNDDECLSPEC=
-
-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line and do not end with a semicolon. Such function macros are typically
-# used for boiler-plate code, and will confuse the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tagfiles.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermedate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
-CGI_NAME = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
-CGI_URL =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
-DOC_URL =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
-DOC_ABSPATH =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
-BIN_ABSPATH = /usr/local/bin/
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
-EXT_DOC_PATHS =
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/avcodec.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/avcodec.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,4604 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AVCODEC_H
+#define AVCODEC_AVCODEC_H
+
+/**
+ * @file
+ * external API header
+ */
+
+#include
+#include "libavutil/samplefmt.h"
+#include "libavutil/avutil.h"
+#include "libavutil/cpu.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
+
+#include "libavcodec/version.h"
+/**
+ * @defgroup libavc Encoding/Decoding Library
+ * @{
+ *
+ * @defgroup lavc_decoding Decoding
+ * @{
+ * @}
+ *
+ * @defgroup lavc_encoding Encoding
+ * @{
+ * @}
+ *
+ * @defgroup lavc_codec Codecs
+ * @{
+ * @defgroup lavc_codec_native Native Codecs
+ * @{
+ * @}
+ * @defgroup lavc_codec_wrappers External library wrappers
+ * @{
+ * @}
+ * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
+ * @{
+ * @}
+ * @}
+ * @defgroup lavc_internal Internal
+ * @{
+ * @}
+ * @}
+ *
+ */
+
+/**
+ * @defgroup lavc_core Core functions/structures.
+ * @ingroup libavc
+ *
+ * Basic definitions, functions for querying libavcodec capabilities,
+ * allocating core structures, etc.
+ * @{
+ */
+
+
+/**
+ * Identify the syntax and semantics of the bitstream.
+ * The principle is roughly:
+ * Two decoders with the same ID can decode the same streams.
+ * Two encoders with the same ID can encode compatible streams.
+ * There may be slight deviations from the principle due to implementation
+ * details.
+ *
+ * If you add a codec ID to this list, add it so that
+ * 1. no value of a existing codec ID changes (that would break ABI),
+ * 2. it is as close as possible to similar codecs.
+ *
+ * After adding new codec IDs, do not forget to add an entry to the codec
+ * descriptor list and bump libavcodec minor version.
+ */
+enum AVCodecID {
+ AV_CODEC_ID_NONE,
+
+ /* video codecs */
+ AV_CODEC_ID_MPEG1VIDEO,
+ AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+ AV_CODEC_ID_MPEG2VIDEO_XVMC,
+ AV_CODEC_ID_H261,
+ AV_CODEC_ID_H263,
+ AV_CODEC_ID_RV10,
+ AV_CODEC_ID_RV20,
+ AV_CODEC_ID_MJPEG,
+ AV_CODEC_ID_MJPEGB,
+ AV_CODEC_ID_LJPEG,
+ AV_CODEC_ID_SP5X,
+ AV_CODEC_ID_JPEGLS,
+ AV_CODEC_ID_MPEG4,
+ AV_CODEC_ID_RAWVIDEO,
+ AV_CODEC_ID_MSMPEG4V1,
+ AV_CODEC_ID_MSMPEG4V2,
+ AV_CODEC_ID_MSMPEG4V3,
+ AV_CODEC_ID_WMV1,
+ AV_CODEC_ID_WMV2,
+ AV_CODEC_ID_H263P,
+ AV_CODEC_ID_H263I,
+ AV_CODEC_ID_FLV1,
+ AV_CODEC_ID_SVQ1,
+ AV_CODEC_ID_SVQ3,
+ AV_CODEC_ID_DVVIDEO,
+ AV_CODEC_ID_HUFFYUV,
+ AV_CODEC_ID_CYUV,
+ AV_CODEC_ID_H264,
+ AV_CODEC_ID_INDEO3,
+ AV_CODEC_ID_VP3,
+ AV_CODEC_ID_THEORA,
+ AV_CODEC_ID_ASV1,
+ AV_CODEC_ID_ASV2,
+ AV_CODEC_ID_FFV1,
+ AV_CODEC_ID_4XM,
+ AV_CODEC_ID_VCR1,
+ AV_CODEC_ID_CLJR,
+ AV_CODEC_ID_MDEC,
+ AV_CODEC_ID_ROQ,
+ AV_CODEC_ID_INTERPLAY_VIDEO,
+ AV_CODEC_ID_XAN_WC3,
+ AV_CODEC_ID_XAN_WC4,
+ AV_CODEC_ID_RPZA,
+ AV_CODEC_ID_CINEPAK,
+ AV_CODEC_ID_WS_VQA,
+ AV_CODEC_ID_MSRLE,
+ AV_CODEC_ID_MSVIDEO1,
+ AV_CODEC_ID_IDCIN,
+ AV_CODEC_ID_8BPS,
+ AV_CODEC_ID_SMC,
+ AV_CODEC_ID_FLIC,
+ AV_CODEC_ID_TRUEMOTION1,
+ AV_CODEC_ID_VMDVIDEO,
+ AV_CODEC_ID_MSZH,
+ AV_CODEC_ID_ZLIB,
+ AV_CODEC_ID_QTRLE,
+ AV_CODEC_ID_SNOW,
+ AV_CODEC_ID_TSCC,
+ AV_CODEC_ID_ULTI,
+ AV_CODEC_ID_QDRAW,
+ AV_CODEC_ID_VIXL,
+ AV_CODEC_ID_QPEG,
+ AV_CODEC_ID_PNG,
+ AV_CODEC_ID_PPM,
+ AV_CODEC_ID_PBM,
+ AV_CODEC_ID_PGM,
+ AV_CODEC_ID_PGMYUV,
+ AV_CODEC_ID_PAM,
+ AV_CODEC_ID_FFVHUFF,
+ AV_CODEC_ID_RV30,
+ AV_CODEC_ID_RV40,
+ AV_CODEC_ID_VC1,
+ AV_CODEC_ID_WMV3,
+ AV_CODEC_ID_LOCO,
+ AV_CODEC_ID_WNV1,
+ AV_CODEC_ID_AASC,
+ AV_CODEC_ID_INDEO2,
+ AV_CODEC_ID_FRAPS,
+ AV_CODEC_ID_TRUEMOTION2,
+ AV_CODEC_ID_BMP,
+ AV_CODEC_ID_CSCD,
+ AV_CODEC_ID_MMVIDEO,
+ AV_CODEC_ID_ZMBV,
+ AV_CODEC_ID_AVS,
+ AV_CODEC_ID_SMACKVIDEO,
+ AV_CODEC_ID_NUV,
+ AV_CODEC_ID_KMVC,
+ AV_CODEC_ID_FLASHSV,
+ AV_CODEC_ID_CAVS,
+ AV_CODEC_ID_JPEG2000,
+ AV_CODEC_ID_VMNC,
+ AV_CODEC_ID_VP5,
+ AV_CODEC_ID_VP6,
+ AV_CODEC_ID_VP6F,
+ AV_CODEC_ID_TARGA,
+ AV_CODEC_ID_DSICINVIDEO,
+ AV_CODEC_ID_TIERTEXSEQVIDEO,
+ AV_CODEC_ID_TIFF,
+ AV_CODEC_ID_GIF,
+ AV_CODEC_ID_DXA,
+ AV_CODEC_ID_DNXHD,
+ AV_CODEC_ID_THP,
+ AV_CODEC_ID_SGI,
+ AV_CODEC_ID_C93,
+ AV_CODEC_ID_BETHSOFTVID,
+ AV_CODEC_ID_PTX,
+ AV_CODEC_ID_TXD,
+ AV_CODEC_ID_VP6A,
+ AV_CODEC_ID_AMV,
+ AV_CODEC_ID_VB,
+ AV_CODEC_ID_PCX,
+ AV_CODEC_ID_SUNRAST,
+ AV_CODEC_ID_INDEO4,
+ AV_CODEC_ID_INDEO5,
+ AV_CODEC_ID_MIMIC,
+ AV_CODEC_ID_RL2,
+ AV_CODEC_ID_ESCAPE124,
+ AV_CODEC_ID_DIRAC,
+ AV_CODEC_ID_BFI,
+ AV_CODEC_ID_CMV,
+ AV_CODEC_ID_MOTIONPIXELS,
+ AV_CODEC_ID_TGV,
+ AV_CODEC_ID_TGQ,
+ AV_CODEC_ID_TQI,
+ AV_CODEC_ID_AURA,
+ AV_CODEC_ID_AURA2,
+ AV_CODEC_ID_V210X,
+ AV_CODEC_ID_TMV,
+ AV_CODEC_ID_V210,
+ AV_CODEC_ID_DPX,
+ AV_CODEC_ID_MAD,
+ AV_CODEC_ID_FRWU,
+ AV_CODEC_ID_FLASHSV2,
+ AV_CODEC_ID_CDGRAPHICS,
+ AV_CODEC_ID_R210,
+ AV_CODEC_ID_ANM,
+ AV_CODEC_ID_BINKVIDEO,
+ AV_CODEC_ID_IFF_ILBM,
+ AV_CODEC_ID_IFF_BYTERUN1,
+ AV_CODEC_ID_KGV1,
+ AV_CODEC_ID_YOP,
+ AV_CODEC_ID_VP8,
+ AV_CODEC_ID_PICTOR,
+ AV_CODEC_ID_ANSI,
+ AV_CODEC_ID_A64_MULTI,
+ AV_CODEC_ID_A64_MULTI5,
+ AV_CODEC_ID_R10K,
+ AV_CODEC_ID_MXPEG,
+ AV_CODEC_ID_LAGARITH,
+ AV_CODEC_ID_PRORES,
+ AV_CODEC_ID_JV,
+ AV_CODEC_ID_DFA,
+ AV_CODEC_ID_WMV3IMAGE,
+ AV_CODEC_ID_VC1IMAGE,
+ AV_CODEC_ID_UTVIDEO,
+ AV_CODEC_ID_BMV_VIDEO,
+ AV_CODEC_ID_VBLE,
+ AV_CODEC_ID_DXTORY,
+ AV_CODEC_ID_V410,
+ AV_CODEC_ID_XWD,
+ AV_CODEC_ID_CDXL,
+ AV_CODEC_ID_XBM,
+ AV_CODEC_ID_ZEROCODEC,
+ AV_CODEC_ID_MSS1,
+ AV_CODEC_ID_MSA1,
+ AV_CODEC_ID_TSCC2,
+ AV_CODEC_ID_MTS2,
+ AV_CODEC_ID_CLLC,
+ AV_CODEC_ID_MSS2,
+
+ /* various PCM "codecs" */
+ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ AV_CODEC_ID_PCM_S16LE = 0x10000,
+ AV_CODEC_ID_PCM_S16BE,
+ AV_CODEC_ID_PCM_U16LE,
+ AV_CODEC_ID_PCM_U16BE,
+ AV_CODEC_ID_PCM_S8,
+ AV_CODEC_ID_PCM_U8,
+ AV_CODEC_ID_PCM_MULAW,
+ AV_CODEC_ID_PCM_ALAW,
+ AV_CODEC_ID_PCM_S32LE,
+ AV_CODEC_ID_PCM_S32BE,
+ AV_CODEC_ID_PCM_U32LE,
+ AV_CODEC_ID_PCM_U32BE,
+ AV_CODEC_ID_PCM_S24LE,
+ AV_CODEC_ID_PCM_S24BE,
+ AV_CODEC_ID_PCM_U24LE,
+ AV_CODEC_ID_PCM_U24BE,
+ AV_CODEC_ID_PCM_S24DAUD,
+ AV_CODEC_ID_PCM_ZORK,
+ AV_CODEC_ID_PCM_S16LE_PLANAR,
+ AV_CODEC_ID_PCM_DVD,
+ AV_CODEC_ID_PCM_F32BE,
+ AV_CODEC_ID_PCM_F32LE,
+ AV_CODEC_ID_PCM_F64BE,
+ AV_CODEC_ID_PCM_F64LE,
+ AV_CODEC_ID_PCM_BLURAY,
+ AV_CODEC_ID_PCM_LXF,
+ AV_CODEC_ID_S302M,
+ AV_CODEC_ID_PCM_S8_PLANAR,
+
+ /* various ADPCM codecs */
+ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
+ AV_CODEC_ID_ADPCM_IMA_WAV,
+ AV_CODEC_ID_ADPCM_IMA_DK3,
+ AV_CODEC_ID_ADPCM_IMA_DK4,
+ AV_CODEC_ID_ADPCM_IMA_WS,
+ AV_CODEC_ID_ADPCM_IMA_SMJPEG,
+ AV_CODEC_ID_ADPCM_MS,
+ AV_CODEC_ID_ADPCM_4XM,
+ AV_CODEC_ID_ADPCM_XA,
+ AV_CODEC_ID_ADPCM_ADX,
+ AV_CODEC_ID_ADPCM_EA,
+ AV_CODEC_ID_ADPCM_G726,
+ AV_CODEC_ID_ADPCM_CT,
+ AV_CODEC_ID_ADPCM_SWF,
+ AV_CODEC_ID_ADPCM_YAMAHA,
+ AV_CODEC_ID_ADPCM_SBPRO_4,
+ AV_CODEC_ID_ADPCM_SBPRO_3,
+ AV_CODEC_ID_ADPCM_SBPRO_2,
+ AV_CODEC_ID_ADPCM_THP,
+ AV_CODEC_ID_ADPCM_IMA_AMV,
+ AV_CODEC_ID_ADPCM_EA_R1,
+ AV_CODEC_ID_ADPCM_EA_R3,
+ AV_CODEC_ID_ADPCM_EA_R2,
+ AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
+ AV_CODEC_ID_ADPCM_IMA_EA_EACS,
+ AV_CODEC_ID_ADPCM_EA_XAS,
+ AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
+ AV_CODEC_ID_ADPCM_IMA_ISS,
+ AV_CODEC_ID_ADPCM_G722,
+ AV_CODEC_ID_ADPCM_IMA_APC,
+
+ /* AMR */
+ AV_CODEC_ID_AMR_NB = 0x12000,
+ AV_CODEC_ID_AMR_WB,
+
+ /* RealAudio codecs*/
+ AV_CODEC_ID_RA_144 = 0x13000,
+ AV_CODEC_ID_RA_288,
+
+ /* various DPCM codecs */
+ AV_CODEC_ID_ROQ_DPCM = 0x14000,
+ AV_CODEC_ID_INTERPLAY_DPCM,
+ AV_CODEC_ID_XAN_DPCM,
+ AV_CODEC_ID_SOL_DPCM,
+
+ /* audio codecs */
+ AV_CODEC_ID_MP2 = 0x15000,
+ AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ AV_CODEC_ID_AAC,
+ AV_CODEC_ID_AC3,
+ AV_CODEC_ID_DTS,
+ AV_CODEC_ID_VORBIS,
+ AV_CODEC_ID_DVAUDIO,
+ AV_CODEC_ID_WMAV1,
+ AV_CODEC_ID_WMAV2,
+ AV_CODEC_ID_MACE3,
+ AV_CODEC_ID_MACE6,
+ AV_CODEC_ID_VMDAUDIO,
+ AV_CODEC_ID_FLAC,
+ AV_CODEC_ID_MP3ADU,
+ AV_CODEC_ID_MP3ON4,
+ AV_CODEC_ID_SHORTEN,
+ AV_CODEC_ID_ALAC,
+ AV_CODEC_ID_WESTWOOD_SND1,
+ AV_CODEC_ID_GSM, ///< as in Berlin toast format
+ AV_CODEC_ID_QDM2,
+ AV_CODEC_ID_COOK,
+ AV_CODEC_ID_TRUESPEECH,
+ AV_CODEC_ID_TTA,
+ AV_CODEC_ID_SMACKAUDIO,
+ AV_CODEC_ID_QCELP,
+ AV_CODEC_ID_WAVPACK,
+ AV_CODEC_ID_DSICINAUDIO,
+ AV_CODEC_ID_IMC,
+ AV_CODEC_ID_MUSEPACK7,
+ AV_CODEC_ID_MLP,
+ AV_CODEC_ID_GSM_MS, /* as found in WAV */
+ AV_CODEC_ID_ATRAC3,
+ AV_CODEC_ID_VOXWARE,
+ AV_CODEC_ID_APE,
+ AV_CODEC_ID_NELLYMOSER,
+ AV_CODEC_ID_MUSEPACK8,
+ AV_CODEC_ID_SPEEX,
+ AV_CODEC_ID_WMAVOICE,
+ AV_CODEC_ID_WMAPRO,
+ AV_CODEC_ID_WMALOSSLESS,
+ AV_CODEC_ID_ATRAC3P,
+ AV_CODEC_ID_EAC3,
+ AV_CODEC_ID_SIPR,
+ AV_CODEC_ID_MP1,
+ AV_CODEC_ID_TWINVQ,
+ AV_CODEC_ID_TRUEHD,
+ AV_CODEC_ID_MP4ALS,
+ AV_CODEC_ID_ATRAC1,
+ AV_CODEC_ID_BINKAUDIO_RDFT,
+ AV_CODEC_ID_BINKAUDIO_DCT,
+ AV_CODEC_ID_AAC_LATM,
+ AV_CODEC_ID_QDMC,
+ AV_CODEC_ID_CELT,
+ AV_CODEC_ID_G723_1,
+ AV_CODEC_ID_G729,
+ AV_CODEC_ID_8SVX_EXP,
+ AV_CODEC_ID_8SVX_FIB,
+ AV_CODEC_ID_BMV_AUDIO,
+ AV_CODEC_ID_RALF,
+ AV_CODEC_ID_IAC,
+ AV_CODEC_ID_ILBC,
+ AV_CODEC_ID_OPUS,
+
+ /* subtitle codecs */
+ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
+ AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
+ AV_CODEC_ID_DVB_SUBTITLE,
+ AV_CODEC_ID_TEXT, ///< raw UTF-8 text
+ AV_CODEC_ID_XSUB,
+ AV_CODEC_ID_SSA,
+ AV_CODEC_ID_MOV_TEXT,
+ AV_CODEC_ID_HDMV_PGS_SUBTITLE,
+ AV_CODEC_ID_DVB_TELETEXT,
+ AV_CODEC_ID_SRT,
+
+ /* other specific kind of codecs (generally used for attachments) */
+ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
+ AV_CODEC_ID_TTF = 0x18000,
+
+ AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
+
+ AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+ * stream (only used by libavformat) */
+ AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+ * stream (only used by libavformat) */
+ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
+
+#if FF_API_CODEC_ID
+#include "old_codec_ids.h"
+#endif
+};
+
+#if FF_API_CODEC_ID
+#define CodecID AVCodecID
+#endif
+
+/**
+ * This struct describes the properties of a single codec described by an
+ * AVCodecID.
+ * @see avcodec_get_descriptor()
+ */
+typedef struct AVCodecDescriptor {
+ enum AVCodecID id;
+ enum AVMediaType type;
+ /**
+ * Name of the codec described by this descriptor. It is non-empty and
+ * unique for each codec descriptor. It should contain alphanumeric
+ * characters and '_' only.
+ */
+ const char *name;
+ /**
+ * A more descriptive name for this codec. May be NULL.
+ */
+ const char *long_name;
+ /**
+ * Codec properties, a combination of AV_CODEC_PROP_* flags.
+ */
+ int props;
+} AVCodecDescriptor;
+
+/**
+ * Codec uses only intra compression.
+ * Video codecs only.
+ */
+#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
+/**
+ * Codec supports lossy compression. Audio and video codecs only.
+ * @note a codec may support both lossy and lossless
+ * compression modes
+ */
+#define AV_CODEC_PROP_LOSSY (1 << 1)
+/**
+ * Codec supports lossless compression. Audio and video codecs only.
+ */
+#define AV_CODEC_PROP_LOSSLESS (1 << 2)
+
+#if FF_API_OLD_DECODE_AUDIO
+/* in bytes */
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+#endif
+
+/**
+ * @ingroup lavc_decoding
+ * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
+ * This is mainly needed because some optimized bitstream readers read
+ * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged
+ * MPEG bitstreams could cause overread and segfault.
+ */
+#define FF_INPUT_BUFFER_PADDING_SIZE 8
+
+/**
+ * @ingroup lavc_encoding
+ * minimum encoding buffer size
+ * Used to avoid some checks during header writing.
+ */
+#define FF_MIN_BUFFER_SIZE 16384
+
+
+/**
+ * @ingroup lavc_encoding
+ * motion estimation type.
+ */
+enum Motion_Est_ID {
+ ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
+ ME_FULL,
+ ME_LOG,
+ ME_PHODS,
+ ME_EPZS, ///< enhanced predictive zonal search
+ ME_X1, ///< reserved for experiments
+ ME_HEX, ///< hexagon based search
+ ME_UMH, ///< uneven multi-hexagon search
+ ME_ITER, ///< iterative search
+ ME_TESA, ///< transformed exhaustive search algorithm
+};
+
+/**
+ * @ingroup lavc_decoding
+ */
+enum AVDiscard{
+ /* We leave some space between them for extensions (drop some
+ * keyframes for intra-only or drop just some bidir frames). */
+ AVDISCARD_NONE =-16, ///< discard nothing
+ AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
+ AVDISCARD_NONREF = 8, ///< discard all non reference
+ AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
+ AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
+ AVDISCARD_ALL = 48, ///< discard all
+};
+
+enum AVColorPrimaries{
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED = 2,
+ AVCOL_PRI_BT470M = 4,
+ AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
+ AVCOL_PRI_FILM = 8,
+ AVCOL_PRI_NB , ///< Not part of ABI
+};
+
+enum AVColorTransferCharacteristic{
+ AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED = 2,
+ AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
+ AVCOL_TRC_SMPTE240M = 7,
+ AVCOL_TRC_NB , ///< Not part of ABI
+};
+
+enum AVColorSpace{
+ AVCOL_SPC_RGB = 0,
+ AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ AVCOL_SPC_UNSPECIFIED = 2,
+ AVCOL_SPC_FCC = 4,
+ AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
+ AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
+ AVCOL_SPC_SMPTE240M = 7,
+ AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_NB , ///< Not part of ABI
+};
+
+enum AVColorRange{
+ AVCOL_RANGE_UNSPECIFIED = 0,
+ AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
+ AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
+ AVCOL_RANGE_NB , ///< Not part of ABI
+};
+
+/**
+ * X X 3 4 X X are luma samples,
+ * 1 2 1-6 are possible chroma positions
+ * X X 5 6 X 0 is undefined/unknown position
+ */
+enum AVChromaLocation{
+ AVCHROMA_LOC_UNSPECIFIED = 0,
+ AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default
+ AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263
+ AVCHROMA_LOC_TOPLEFT = 3, ///< DV
+ AVCHROMA_LOC_TOP = 4,
+ AVCHROMA_LOC_BOTTOMLEFT = 5,
+ AVCHROMA_LOC_BOTTOM = 6,
+ AVCHROMA_LOC_NB , ///< Not part of ABI
+};
+
+enum AVAudioServiceType {
+ AV_AUDIO_SERVICE_TYPE_MAIN = 0,
+ AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
+ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
+ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
+ AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
+ AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
+ AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
+ AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
+ AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
+ AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
+};
+
+/**
+ * @ingroup lavc_encoding
+ */
+typedef struct RcOverride{
+ int start_frame;
+ int end_frame;
+ int qscale; // If this is 0 then quality_factor will be used instead.
+ float quality_factor;
+} RcOverride;
+
+#define FF_MAX_B_FRAMES 16
+
+/* encoding support
+ These flags can be passed in AVCodecContext.flags before initialization.
+ Note: Not everything is supported yet.
+*/
+
+#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
+#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
+#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
+#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
+#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
+/**
+ * The parent program guarantees that the input for B-frames containing
+ * streams is not written to for at least s->max_b_frames+1 frames, if
+ * this is not set the input will be copied.
+ */
+#define CODEC_FLAG_INPUT_PRESERVED 0x0100
+#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
+#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
+#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
+#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
+#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
+#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
+ location instead of only at frame boundaries. */
+#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
+#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
+#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
+#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
+#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
+/* Fx : Flag for h263+ extra options */
+#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
+#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
+#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
+#define CODEC_FLAG_CLOSED_GOP 0x80000000
+#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
+#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
+#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
+#if FF_API_MPV_GLOBAL_OPTS
+#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
+#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
+#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
+#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
+#endif
+#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
+
+/* Unsupported options :
+ * Syntax Arithmetic coding (SAC)
+ * Reference Picture Selection
+ * Independent Segment Decoding */
+/* /Fx */
+/* codec capabilities */
+
+#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
+/**
+ * Codec uses get_buffer() for allocating buffers and supports custom allocators.
+ * If not set, it might not use get_buffer() at all or use operations that
+ * assume the buffer was allocated by avcodec_default_get_buffer.
+ */
+#define CODEC_CAP_DR1 0x0002
+#define CODEC_CAP_TRUNCATED 0x0008
+/* Codec can export data for HW decoding (XvMC). */
+#define CODEC_CAP_HWACCEL 0x0010
+/**
+ * Encoder or decoder requires flushing with NULL input at the end in order to
+ * give the complete and correct output.
+ *
+ * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
+ * with NULL data. The user can still send NULL data to the public encode
+ * or decode function, but libavcodec will not pass it along to the codec
+ * unless this flag is set.
+ *
+ * Decoders:
+ * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
+ * avpkt->size=0 at the end to get the delayed data until the decoder no longer
+ * returns frames.
+ *
+ * Encoders:
+ * The encoder needs to be fed with NULL data at the end of encoding until the
+ * encoder no longer returns data.
+ *
+ * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
+ * flag also means that the encoder must set the pts and duration for
+ * each output packet. If this flag is not set, the pts and duration will
+ * be determined by libavcodec from the input frame.
+ */
+#define CODEC_CAP_DELAY 0x0020
+/**
+ * Codec can be fed a final frame with a smaller size.
+ * This can be used to prevent truncation of the last audio samples.
+ */
+#define CODEC_CAP_SMALL_LAST_FRAME 0x0040
+/**
+ * Codec can export data for HW decoding (VDPAU).
+ */
+#define CODEC_CAP_HWACCEL_VDPAU 0x0080
+/**
+ * Codec can output multiple frames per AVPacket
+ * Normally demuxers return one frame at a time, demuxers which do not do
+ * are connected to a parser to split what they return into proper frames.
+ * This flag is reserved to the very rare category of codecs which have a
+ * bitstream that cannot be split into frames without timeconsuming
+ * operations like full decoding. Demuxers carring such bitstreams thus
+ * may return multiple frames in a packet. This has many disadvantages like
+ * prohibiting stream copy in many cases thus it should only be considered
+ * as a last resort.
+ */
+#define CODEC_CAP_SUBFRAMES 0x0100
+/**
+ * Codec is experimental and is thus avoided in favor of non experimental
+ * encoders
+ */
+#define CODEC_CAP_EXPERIMENTAL 0x0200
+/**
+ * Codec should fill in channel configuration and samplerate instead of container
+ */
+#define CODEC_CAP_CHANNEL_CONF 0x0400
+/**
+ * Codec is able to deal with negative linesizes
+ */
+#define CODEC_CAP_NEG_LINESIZES 0x0800
+/**
+ * Codec supports frame-level multithreading.
+ */
+#define CODEC_CAP_FRAME_THREADS 0x1000
+/**
+ * Codec supports slice-based (or partition-based) multithreading.
+ */
+#define CODEC_CAP_SLICE_THREADS 0x2000
+/**
+ * Codec supports changed parameters at any point.
+ */
+#define CODEC_CAP_PARAM_CHANGE 0x4000
+/**
+ * Codec supports avctx->thread_count == 0 (auto).
+ */
+#define CODEC_CAP_AUTO_THREADS 0x8000
+/**
+ * Audio encoder supports receiving a different number of samples in each call.
+ */
+#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
+
+//The following defines may change, don't expect compatibility if you use them.
+#define MB_TYPE_INTRA4x4 0x0001
+#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
+#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
+#define MB_TYPE_16x16 0x0008
+#define MB_TYPE_16x8 0x0010
+#define MB_TYPE_8x16 0x0020
+#define MB_TYPE_8x8 0x0040
+#define MB_TYPE_INTERLACED 0x0080
+#define MB_TYPE_DIRECT2 0x0100 //FIXME
+#define MB_TYPE_ACPRED 0x0200
+#define MB_TYPE_GMC 0x0400
+#define MB_TYPE_SKIP 0x0800
+#define MB_TYPE_P0L0 0x1000
+#define MB_TYPE_P1L0 0x2000
+#define MB_TYPE_P0L1 0x4000
+#define MB_TYPE_P1L1 0x8000
+#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
+#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
+#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
+#define MB_TYPE_QUANT 0x00010000
+#define MB_TYPE_CBP 0x00020000
+//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
+
+/**
+ * Pan Scan area.
+ * This specifies the area which should be displayed.
+ * Note there may be multiple such areas for one frame.
+ */
+typedef struct AVPanScan{
+ /**
+ * id
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int id;
+
+ /**
+ * width and height in 1/16 pel
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int width;
+ int height;
+
+ /**
+ * position of the top left corner in 1/16 pel for up to 3 fields/frames
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int16_t position[3][2];
+}AVPanScan;
+
+#define FF_QSCALE_TYPE_MPEG1 0
+#define FF_QSCALE_TYPE_MPEG2 1
+#define FF_QSCALE_TYPE_H264 2
+#define FF_QSCALE_TYPE_VP56 3
+
+#define FF_BUFFER_TYPE_INTERNAL 1
+#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
+#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
+#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
+
+#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
+#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
+#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
+#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
+
+/**
+ * @defgroup lavc_packet AVPacket
+ *
+ * Types and functions for working with AVPacket.
+ * @{
+ */
+enum AVPacketSideDataType {
+ AV_PKT_DATA_PALETTE,
+ AV_PKT_DATA_NEW_EXTRADATA,
+
+ /**
+ * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
+ * @code
+ * u32le param_flags
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
+ * s32le channel_count
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
+ * u64le channel_layout
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
+ * s32le sample_rate
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
+ * s32le width
+ * s32le height
+ * @endcode
+ */
+ AV_PKT_DATA_PARAM_CHANGE,
+
+ /**
+ * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
+ * structures with info about macroblocks relevant to splitting the
+ * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
+ * That is, it does not necessarily contain info about all macroblocks,
+ * as long as the distance between macroblocks in the info is smaller
+ * than the target payload size.
+ * Each MB info structure is 12 bytes, and is laid out as follows:
+ * @code
+ * u32le bit offset from the start of the packet
+ * u8 current quantizer at the start of the macroblock
+ * u8 GOB number
+ * u16le macroblock address within the GOB
+ * u8 horizontal MV predictor
+ * u8 vertical MV predictor
+ * u8 horizontal MV predictor for block number 3
+ * u8 vertical MV predictor for block number 3
+ * @endcode
+ */
+ AV_PKT_DATA_H263_MB_INFO,
+};
+
+typedef struct AVPacket {
+ /**
+ * Presentation timestamp in AVStream->time_base units; the time at which
+ * the decompressed packet will be presented to the user.
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
+ * pts MUST be larger or equal to dts as presentation cannot happen before
+ * decompression, unless one wants to view hex dumps. Some formats misuse
+ * the terms dts and pts/cts to mean something different. Such timestamps
+ * must be converted to true pts/dts before they are stored in AVPacket.
+ */
+ int64_t pts;
+ /**
+ * Decompression timestamp in AVStream->time_base units; the time at which
+ * the packet is decompressed.
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
+ */
+ int64_t dts;
+ uint8_t *data;
+ int size;
+ int stream_index;
+ /**
+ * A combination of AV_PKT_FLAG values
+ */
+ int flags;
+ /**
+ * Additional packet data that can be provided by the container.
+ * Packet can contain several types of side information.
+ */
+ struct {
+ uint8_t *data;
+ int size;
+ enum AVPacketSideDataType type;
+ } *side_data;
+ int side_data_elems;
+
+ /**
+ * Duration of this packet in AVStream->time_base units, 0 if unknown.
+ * Equals next_pts - this_pts in presentation order.
+ */
+ int duration;
+ void (*destruct)(struct AVPacket *);
+ void *priv;
+ int64_t pos; ///< byte position in stream, -1 if unknown
+
+ /**
+ * Time difference in AVStream->time_base units from the pts of this
+ * packet to the point at which the output from the decoder has converged
+ * independent from the availability of previous frames. That is, the
+ * frames are virtually identical no matter if decoding started from
+ * the very first frame or from this keyframe.
+ * Is AV_NOPTS_VALUE if unknown.
+ * This field is not the display duration of the current packet.
+ * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
+ * set.
+ *
+ * The purpose of this field is to allow seeking in streams that have no
+ * keyframes in the conventional sense. It corresponds to the
+ * recovery point SEI in H.264 and match_time_delta in NUT. It is also
+ * essential for some types of subtitle streams to ensure that all
+ * subtitles are correctly displayed after seeking.
+ */
+ int64_t convergence_duration;
+} AVPacket;
+#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
+#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
+
+enum AVSideDataParamChangeFlags {
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
+ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
+ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
+};
+/**
+ * @}
+ */
+
+/**
+ * Audio Video Frame.
+ * New fields can be added to the end of AVFRAME with minor version
+ * bumps. Removal, reordering and changes to existing fields require
+ * a major version bump.
+ * sizeof(AVFrame) must not be used outside libav*.
+ */
+typedef struct AVFrame {
+#define AV_NUM_DATA_POINTERS 8
+ /**
+ * pointer to the picture/channel planes.
+ * This might be different from the first allocated byte
+ * - encoding: Set by user
+ * - decoding: set by AVCodecContext.get_buffer()
+ */
+ uint8_t *data[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Size, in bytes, of the data for each picture/channel plane.
+ *
+ * For audio, only linesize[0] may be set. For planar audio, each channel
+ * plane must be the same size.
+ *
+ * - encoding: Set by user
+ * - decoding: set by AVCodecContext.get_buffer()
+ */
+ int linesize[AV_NUM_DATA_POINTERS];
+
+ /**
+ * pointers to the data planes/channels.
+ *
+ * For video, this should simply point to data[].
+ *
+ * For planar audio, each channel has a separate data pointer, and
+ * linesize[0] contains the size of each channel buffer.
+ * For packed audio, there is just one data pointer, and linesize[0]
+ * contains the total size of the buffer for all channels.
+ *
+ * Note: Both data and extended_data will always be set by get_buffer(),
+ * but for planar audio with more channels that can fit in data,
+ * extended_data must be used by the decoder in order to access all
+ * channels.
+ *
+ * encoding: set by user
+ * decoding: set by AVCodecContext.get_buffer()
+ */
+ uint8_t **extended_data;
+
+ /**
+ * width and height of the video frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int width, height;
+
+ /**
+ * number of audio samples (per channel) described by this frame
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ int nb_samples;
+
+ /**
+ * format of the frame, -1 if unknown or unset
+ * Values correspond to enum AVPixelFormat for video frames,
+ * enum AVSampleFormat for audio)
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int format;
+
+ /**
+ * 1 -> keyframe, 0-> not
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int key_frame;
+
+ /**
+ * Picture type of the frame, see ?_TYPE below.
+ * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
+ * - decoding: Set by libavcodec.
+ */
+ enum AVPictureType pict_type;
+
+ /**
+ * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
+ * This isn't used by libavcodec unless the default get/release_buffer() is used.
+ * - encoding:
+ * - decoding:
+ */
+ uint8_t *base[AV_NUM_DATA_POINTERS];
+
+ /**
+ * sample aspect ratio for the video frame, 0/1 if unknown/unspecified
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ AVRational sample_aspect_ratio;
+
+ /**
+ * presentation timestamp in time_base units (time when frame should be shown to user)
+ * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
+ * - encoding: MUST be set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int64_t pts;
+
+ /**
+ * reordered pts from the last AVPacket that has been input into the decoder
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_pts;
+
+ /**
+ * dts from the last AVPacket that has been input into the decoder
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_dts;
+
+ /**
+ * picture number in bitstream order
+ * - encoding: set by
+ * - decoding: Set by libavcodec.
+ */
+ int coded_picture_number;
+ /**
+ * picture number in display order
+ * - encoding: set by
+ * - decoding: Set by libavcodec.
+ */
+ int display_picture_number;
+
+ /**
+ * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
+ * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
+ * - decoding: Set by libavcodec.
+ */
+ int quality;
+
+ /**
+ * is this picture used as reference
+ * The values for this are the same as the MpegEncContext.picture_structure
+ * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
+ * Set to 4 for delayed, non-reference frames.
+ * - encoding: unused
+ * - decoding: Set by libavcodec. (before get_buffer() call)).
+ */
+ int reference;
+
+ /**
+ * QP table
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int8_t *qscale_table;
+ /**
+ * QP store stride
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int qstride;
+
+ /**
+ *
+ */
+ int qscale_type;
+
+ /**
+ * mbskip_table[mb]>=1 if MB didn't change
+ * stride= mb_width = (width+15)>>4
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ uint8_t *mbskip_table;
+
+ /**
+ * motion vector table
+ * @code
+ * example:
+ * int mv_sample_log2= 4 - motion_subsample_log2;
+ * int mb_width= (width+15)>>4;
+ * int mv_stride= (mb_width << mv_sample_log2) + 1;
+ * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];
+ * @endcode
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int16_t (*motion_val[2])[2];
+
+ /**
+ * macroblock type table
+ * mb_type_base + mb_width + 2
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ uint32_t *mb_type;
+
+ /**
+ * DCT coefficients
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ short *dct_coeff;
+
+ /**
+ * motion reference frame index
+ * the order in which these are stored can depend on the codec.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int8_t *ref_index[2];
+
+ /**
+ * for some private data of the user
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ void *opaque;
+
+ /**
+ * error
+ * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.
+ * - decoding: unused
+ */
+ uint64_t error[AV_NUM_DATA_POINTERS];
+
+ /**
+ * type of the buffer (to keep track of who has to deallocate data[*])
+ * - encoding: Set by the one who allocates it.
+ * - decoding: Set by the one who allocates it.
+ * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.
+ */
+ int type;
+
+ /**
+ * When decoding, this signals how much the picture must be delayed.
+ * extra_delay = repeat_pict / (2*fps)
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int repeat_pict;
+
+ /**
+ * The content of the picture is interlaced.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec. (default 0)
+ */
+ int interlaced_frame;
+
+ /**
+ * If the content is interlaced, is top field displayed first.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int top_field_first;
+
+ /**
+ * Tell user application that palette has changed from previous frame.
+ * - encoding: ??? (no palette-enabled encoder yet)
+ * - decoding: Set by libavcodec. (default 0).
+ */
+ int palette_has_changed;
+
+ /**
+ * codec suggestion on buffer type if != 0
+ * - encoding: unused
+ * - decoding: Set by libavcodec. (before get_buffer() call)).
+ */
+ int buffer_hints;
+
+ /**
+ * Pan scan.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ AVPanScan *pan_scan;
+
+ /**
+ * reordered opaque 64bit (generally an integer or a double precision float
+ * PTS but can be anything).
+ * The user sets AVCodecContext.reordered_opaque to represent the input at
+ * that time,
+ * the decoder reorders values as needed and sets AVFrame.reordered_opaque
+ * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
+ * @deprecated in favor of pkt_pts
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t reordered_opaque;
+
+ /**
+ * hardware accelerator private data (Libav-allocated)
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ void *hwaccel_picture_private;
+
+ /**
+ * the AVCodecContext which ff_thread_get_buffer() was last called on
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ struct AVCodecContext *owner;
+
+ /**
+ * used by multithreading to store frame-specific info
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ void *thread_opaque;
+
+ /**
+ * log2 of the size of the block which a single vector in motion_val represents:
+ * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ uint8_t motion_subsample_log2;
+
+ /**
+ * Sample rate of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+ int sample_rate;
+
+ /**
+ * Channel layout of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+ uint64_t channel_layout;
+} AVFrame;
+
+struct AVCodecInternal;
+
+enum AVFieldOrder {
+ AV_FIELD_UNKNOWN,
+ AV_FIELD_PROGRESSIVE,
+ AV_FIELD_TT, //< Top coded_first, top displayed first
+ AV_FIELD_BB, //< Bottom coded first, bottom displayed first
+ AV_FIELD_TB, //< Top coded first, bottom displayed first
+ AV_FIELD_BT, //< Bottom coded first, top displayed first
+};
+
+/**
+ * main external API structure.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVCodecContext) must not be used outside libav*.
+ */
+typedef struct AVCodecContext {
+ /**
+ * information on struct for av_log
+ * - set by avcodec_alloc_context3
+ */
+ const AVClass *av_class;
+ int log_level_offset;
+
+ enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
+ const struct AVCodec *codec;
+ char codec_name[32];
+ enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
+
+ /**
+ * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
+ * This is used to work around some encoder bugs.
+ * A demuxer should set this to what is stored in the field used to identify the codec.
+ * If there are multiple such fields in a container then the demuxer should choose the one
+ * which maximizes the information about the used codec.
+ * If the codec tag field in a container is larger than 32 bits then the demuxer should
+ * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
+ * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
+ * first.
+ * - encoding: Set by user, if not then the default based on codec_id will be used.
+ * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
+ */
+ unsigned int codec_tag;
+
+ /**
+ * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
+ * This is used to work around some encoder bugs.
+ * - encoding: unused
+ * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
+ */
+ unsigned int stream_codec_tag;
+
+#if FF_API_SUB_ID
+ /**
+ * @deprecated this field is unused
+ */
+ attribute_deprecated int sub_id;
+#endif
+
+ void *priv_data;
+
+ /**
+ * Private context used for internal data.
+ *
+ * Unlike priv_data, this is not codec-specific. It is used in general
+ * libavcodec functions.
+ */
+ struct AVCodecInternal *internal;
+
+ /**
+ * Private data of the user, can be used to carry app specific stuff.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ void *opaque;
+
+ /**
+ * the average bitrate
+ * - encoding: Set by user; unused for constant quantizer encoding.
+ * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
+ */
+ int bit_rate;
+
+ /**
+ * number of bits the bitstream is allowed to diverge from the reference.
+ * the reference can be CBR (for CBR pass1) or VBR (for pass2)
+ * - encoding: Set by user; unused for constant quantizer encoding.
+ * - decoding: unused
+ */
+ int bit_rate_tolerance;
+
+ /**
+ * Global quality for codecs which cannot change it per frame.
+ * This should be proportional to MPEG-1/2/4 qscale.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int global_quality;
+
+ /**
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int compression_level;
+#define FF_COMPRESSION_DEFAULT -1
+
+ /**
+ * CODEC_FLAG_*.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int flags;
+
+ /**
+ * CODEC_FLAG2_*
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int flags2;
+
+ /**
+ * some codecs need / can use extradata like Huffman tables.
+ * mjpeg: Huffman tables
+ * rv10: additional flags
+ * mpeg4: global headers (they can be in the bitstream or here)
+ * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
+ * than extradata_size to avoid prolems if it is read with the bitstream reader.
+ * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
+ * - encoding: Set/allocated/freed by libavcodec.
+ * - decoding: Set/allocated/freed by user.
+ */
+ uint8_t *extradata;
+ int extradata_size;
+
+ /**
+ * This is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented. For fixed-fps content,
+ * timebase should be 1/framerate and timestamp increments should be
+ * identically 1.
+ * - encoding: MUST be set by user.
+ * - decoding: Set by libavcodec.
+ */
+ AVRational time_base;
+
+ /**
+ * For some codecs, the time base is closer to the field rate than the frame rate.
+ * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
+ * if no telecine is used ...
+ *
+ * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
+ */
+ int ticks_per_frame;
+
+ /**
+ * Encoder delay.
+ *
+ * Video:
+ * Number of frames the decoded output will be delayed relative to the
+ * encoded input.
+ *
+ * Audio:
+ * For encoding, this is the number of "priming" samples added to the
+ * beginning of the stream. The decoded output will be delayed by this
+ * many samples relative to the input to the encoder. Note that this
+ * field is purely informational and does not directly affect the pts
+ * output by the encoder, which should always be based on the actual
+ * presentation time, including any delay.
+ * For decoding, this is the number of samples the decoder needs to
+ * output before the decoder's output is valid. When seeking, you should
+ * start decoding this many samples prior to your desired seek point.
+ *
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int delay;
+
+
+ /* video only */
+ /**
+ * picture width / height.
+ * - encoding: MUST be set by user.
+ * - decoding: Set by libavcodec.
+ * Note: For compatibility it is possible to set this instead of
+ * coded_width/height before decoding.
+ */
+ int width, height;
+
+ /**
+ * Bitstream width / height, may be different from width/height.
+ * - encoding: unused
+ * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
+ */
+ int coded_width, coded_height;
+
+#define FF_ASPECT_EXTENDED 15
+
+ /**
+ * the number of pictures in a group of pictures, or 0 for intra_only
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int gop_size;
+
+ /**
+ * Pixel format, see AV_PIX_FMT_xxx.
+ * May be set by the demuxer if known from headers.
+ * May be overriden by the decoder if it knows better.
+ * - encoding: Set by user.
+ * - decoding: Set by user if known, overridden by libavcodec if known
+ */
+ enum AVPixelFormat pix_fmt;
+
+ /**
+ * Motion estimation algorithm used for video coding.
+ * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
+ * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
+ * - encoding: MUST be set by user.
+ * - decoding: unused
+ */
+ int me_method;
+
+ /**
+ * If non NULL, 'draw_horiz_band' is called by the libavcodec
+ * decoder to draw a horizontal band. It improves cache usage. Not
+ * all codecs can do that. You must check the codec capabilities
+ * beforehand.
+ * When multithreading is used, it may be called from multiple threads
+ * at the same time; threads might draw different parts of the same AVFrame,
+ * or multiple AVFrames, and there is no guarantee that slices will be drawn
+ * in order.
+ * The function is also used by hardware acceleration APIs.
+ * It is called at least once during frame decoding to pass
+ * the data needed for hardware render.
+ * In that mode instead of pixel data, AVFrame points to
+ * a structure specific to the acceleration API. The application
+ * reads the structure and can change some fields to indicate progress
+ * or mark state.
+ * - encoding: unused
+ * - decoding: Set by user.
+ * @param height the height of the slice
+ * @param y the y position of the slice
+ * @param type 1->top field, 2->bottom field, 3->frame
+ * @param offset offset into the AVFrame.data from which the slice should be read
+ */
+ void (*draw_horiz_band)(struct AVCodecContext *s,
+ const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
+ int y, int type, int height);
+
+ /**
+ * callback to negotiate the pixelFormat
+ * @param fmt is the list of formats which are supported by the codec,
+ * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
+ * The first is always the native one.
+ * @return the chosen format
+ * - encoding: unused
+ * - decoding: Set by user, if not set the native format will be chosen.
+ */
+ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
+
+ /**
+ * maximum number of B-frames between non-B-frames
+ * Note: The output will be delayed by max_b_frames+1 relative to the input.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int max_b_frames;
+
+ /**
+ * qscale factor between IP and B-frames
+ * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
+ * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float b_quant_factor;
+
+ /** obsolete FIXME remove */
+ int rc_strategy;
+#define FF_RC_STRATEGY_XVID 1
+
+ int b_frame_strategy;
+
+#if FF_API_MPV_GLOBAL_OPTS
+ /**
+ * luma single coefficient elimination threshold
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ attribute_deprecated int luma_elim_threshold;
+
+ /**
+ * chroma single coeff elimination threshold
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ attribute_deprecated int chroma_elim_threshold;
+#endif
+
+ /**
+ * qscale offset between IP and B-frames
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float b_quant_offset;
+
+ /**
+ * Size of the frame reordering buffer in the decoder.
+ * For MPEG-2 it is 1 IPB or 0 low delay IP.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int has_b_frames;
+
+ /**
+ * 0-> h263 quant 1-> mpeg quant
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mpeg_quant;
+
+ /**
+ * qscale factor between P and I-frames
+ * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
+ * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float i_quant_factor;
+
+ /**
+ * qscale offset between P and I-frames
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float i_quant_offset;
+
+ /**
+ * luminance masking (0-> disabled)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float lumi_masking;
+
+ /**
+ * temporary complexity masking (0-> disabled)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float temporal_cplx_masking;
+
+ /**
+ * spatial complexity masking (0-> disabled)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float spatial_cplx_masking;
+
+ /**
+ * p block masking (0-> disabled)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float p_masking;
+
+ /**
+ * darkness masking (0-> disabled)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float dark_masking;
+
+ /**
+ * slice count
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by user (or 0).
+ */
+ int slice_count;
+ /**
+ * prediction method (needed for huffyuv)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int prediction_method;
+#define FF_PRED_LEFT 0
+#define FF_PRED_PLANE 1
+#define FF_PRED_MEDIAN 2
+
+ /**
+ * slice offsets in the frame in bytes
+ * - encoding: Set/allocated by libavcodec.
+ * - decoding: Set/allocated by user (or NULL).
+ */
+ int *slice_offset;
+
+ /**
+ * sample aspect ratio (0 if unknown)
+ * That is the width of a pixel divided by the height of the pixel.
+ * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ AVRational sample_aspect_ratio;
+
+ /**
+ * motion estimation comparison function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_cmp;
+ /**
+ * subpixel motion estimation comparison function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_sub_cmp;
+ /**
+ * macroblock comparison function (not supported yet)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mb_cmp;
+ /**
+ * interlaced DCT comparison function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int ildct_cmp;
+#define FF_CMP_SAD 0
+#define FF_CMP_SSE 1
+#define FF_CMP_SATD 2
+#define FF_CMP_DCT 3
+#define FF_CMP_PSNR 4
+#define FF_CMP_BIT 5
+#define FF_CMP_RD 6
+#define FF_CMP_ZERO 7
+#define FF_CMP_VSAD 8
+#define FF_CMP_VSSE 9
+#define FF_CMP_NSSE 10
+#define FF_CMP_W53 11
+#define FF_CMP_W97 12
+#define FF_CMP_DCTMAX 13
+#define FF_CMP_DCT264 14
+#define FF_CMP_CHROMA 256
+
+ /**
+ * ME diamond size & shape
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int dia_size;
+
+ /**
+ * amount of previous MV predictors (2a+1 x 2a+1 square)
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int last_predictor_count;
+
+ /**
+ * prepass for motion estimation
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int pre_me;
+
+ /**
+ * motion estimation prepass comparison function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_pre_cmp;
+
+ /**
+ * ME prepass diamond size & shape
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int pre_dia_size;
+
+ /**
+ * subpel ME quality
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_subpel_quality;
+
+ /**
+ * DTG active format information (additional aspect ratio
+ * information only used in DVB MPEG-2 transport streams)
+ * 0 if not set.
+ *
+ * - encoding: unused
+ * - decoding: Set by decoder.
+ */
+ int dtg_active_format;
+#define FF_DTG_AFD_SAME 8
+#define FF_DTG_AFD_4_3 9
+#define FF_DTG_AFD_16_9 10
+#define FF_DTG_AFD_14_9 11
+#define FF_DTG_AFD_4_3_SP_14_9 13
+#define FF_DTG_AFD_16_9_SP_14_9 14
+#define FF_DTG_AFD_SP_4_3 15
+
+ /**
+ * maximum motion estimation search range in subpel units
+ * If 0 then no limit.
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_range;
+
+ /**
+ * intra quantizer bias
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int intra_quant_bias;
+#define FF_DEFAULT_QUANT_BIAS 999999
+
+ /**
+ * inter quantizer bias
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int inter_quant_bias;
+
+#if FF_API_COLOR_TABLE_ID
+ /**
+ * color table ID
+ * - encoding: unused
+ * - decoding: Which clrtable should be used for 8bit RGB images.
+ * Tables have to be stored somewhere. FIXME
+ */
+ attribute_deprecated int color_table_id;
+#endif
+
+ /**
+ * slice flags
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int slice_flags;
+#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
+#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
+#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
+
+ /**
+ * XVideo Motion Acceleration
+ * - encoding: forbidden
+ * - decoding: set by decoder
+ */
+ int xvmc_acceleration;
+
+ /**
+ * macroblock decision mode
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mb_decision;
+#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
+#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
+#define FF_MB_DECISION_RD 2 ///< rate distortion
+
+ /**
+ * custom intra quantization matrix
+ * - encoding: Set by user, can be NULL.
+ * - decoding: Set by libavcodec.
+ */
+ uint16_t *intra_matrix;
+
+ /**
+ * custom inter quantization matrix
+ * - encoding: Set by user, can be NULL.
+ * - decoding: Set by libavcodec.
+ */
+ uint16_t *inter_matrix;
+
+ /**
+ * scene change detection threshold
+ * 0 is default, larger means fewer detected scene changes.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int scenechange_threshold;
+
+ /**
+ * noise reduction strength
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int noise_reduction;
+
+#if FF_API_INTER_THRESHOLD
+ /**
+ * @deprecated this field is unused
+ */
+ attribute_deprecated int inter_threshold;
+#endif
+
+#if FF_API_MPV_GLOBAL_OPTS
+ /**
+ * @deprecated use mpegvideo private options instead
+ */
+ attribute_deprecated int quantizer_noise_shaping;
+#endif
+
+ /**
+ * Motion estimation threshold below which no motion estimation is
+ * performed, but instead the user specified motion vectors are used.
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_threshold;
+
+ /**
+ * Macroblock threshold below which the user specified macroblock types will be used.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mb_threshold;
+
+ /**
+ * precision of the intra DC coefficient - 8
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int intra_dc_precision;
+
+ /**
+ * Number of macroblock rows at the top which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int skip_top;
+
+ /**
+ * Number of macroblock rows at the bottom which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int skip_bottom;
+
+ /**
+ * Border processing masking, raises the quantizer for mbs on the borders
+ * of the picture.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float border_masking;
+
+ /**
+ * minimum MB lagrange multipler
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mb_lmin;
+
+ /**
+ * maximum MB lagrange multipler
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mb_lmax;
+
+ /**
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int me_penalty_compensation;
+
+ /**
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int bidir_refine;
+
+ /**
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int brd_scale;
+
+ /**
+ * minimum GOP size
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int keyint_min;
+
+ /**
+ * number of reference frames
+ * - encoding: Set by user.
+ * - decoding: Set by lavc.
+ */
+ int refs;
+
+ /**
+ * chroma qp offset from luma
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int chromaoffset;
+
+ /**
+ * Multiplied by qscale for each frame and added to scene_change_score.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int scenechange_factor;
+
+ /**
+ *
+ * Note: Value depends upon the compare function used for fullpel ME.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int mv0_threshold;
+
+ /**
+ * Adjust sensitivity of b_frame_strategy 1.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int b_sensitivity;
+
+ /**
+ * Chromaticity coordinates of the source primaries.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorPrimaries color_primaries;
+
+ /**
+ * Color Transfer Characteristic.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorTransferCharacteristic color_trc;
+
+ /**
+ * YUV colorspace type.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorSpace colorspace;
+
+ /**
+ * MPEG vs JPEG YUV range.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorRange color_range;
+
+ /**
+ * This defines the location of chroma samples.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVChromaLocation chroma_sample_location;
+
+ /**
+ * Number of slices.
+ * Indicates number of picture subdivisions. Used for parallelized
+ * decoding.
+ * - encoding: Set by user
+ * - decoding: unused
+ */
+ int slices;
+
+ /** Field order
+ * - encoding: set by libavcodec
+ * - decoding: Set by libavcodec
+ */
+ enum AVFieldOrder field_order;
+
+ /* audio only */
+ int sample_rate; ///< samples per second
+ int channels; ///< number of audio channels
+
+ /**
+ * audio sample format
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ enum AVSampleFormat sample_fmt; ///< sample format
+
+ /* The following data should not be initialized. */
+ /**
+ * Samples per packet, initialized when calling 'init'.
+ */
+ int frame_size;
+
+ /**
+ * Frame counter, set by libavcodec.
+ *
+ * - decoding: total number of frames returned from the decoder so far.
+ * - encoding: total number of frames passed to the encoder so far.
+ *
+ * @note the counter is not incremented if encoding/decoding resulted in
+ * an error.
+ */
+ int frame_number;
+
+ /**
+ * number of bytes per packet if constant and known or 0
+ * Used by some WAV based audio codecs.
+ */
+ int block_align;
+
+ /**
+ * Audio cutoff bandwidth (0 means "automatic")
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int cutoff;
+
+#if FF_API_REQUEST_CHANNELS
+ /**
+ * Decoder should decode to this many channels if it can (0 for default)
+ * - encoding: unused
+ * - decoding: Set by user.
+ * @deprecated Deprecated in favor of request_channel_layout.
+ */
+ int request_channels;
+#endif
+
+ /**
+ * Audio channel layout.
+ * - encoding: set by user.
+ * - decoding: set by libavcodec.
+ */
+ uint64_t channel_layout;
+
+ /**
+ * Request decoder to use this channel layout if it can (0 for default)
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ uint64_t request_channel_layout;
+
+ /**
+ * Type of service that the audio stream conveys.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ enum AVAudioServiceType audio_service_type;
+
+ /**
+ * Used to request a sample format from the decoder.
+ * - encoding: unused.
+ * - decoding: Set by user.
+ */
+ enum AVSampleFormat request_sample_fmt;
+
+ /**
+ * Called at the beginning of each frame to get a buffer for it.
+ *
+ * The function will set AVFrame.data[], AVFrame.linesize[].
+ * AVFrame.extended_data[] must also be set, but it should be the same as
+ * AVFrame.data[] except for planar audio with more channels than can fit
+ * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
+ * many data pointers as it can hold.
+ *
+ * if CODEC_CAP_DR1 is not set then get_buffer() must call
+ * avcodec_default_get_buffer() instead of providing buffers allocated by
+ * some other means.
+ *
+ * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
+ * need it. avcodec_default_get_buffer() aligns the output buffer properly,
+ * but if get_buffer() is overridden then alignment considerations should
+ * be taken into account.
+ *
+ * @see avcodec_default_get_buffer()
+ *
+ * Video:
+ *
+ * If pic.reference is set then the frame will be read later by libavcodec.
+ * avcodec_align_dimensions2() should be used to find the required width and
+ * height, as they normally need to be rounded up to the next multiple of 16.
+ *
+ * If frame multithreading is used and thread_safe_callbacks is set,
+ * it may be called from a different thread, but not from more than one at
+ * once. Does not need to be reentrant.
+ *
+ * @see release_buffer(), reget_buffer()
+ * @see avcodec_align_dimensions2()
+ *
+ * Audio:
+ *
+ * Decoders request a buffer of a particular size by setting
+ * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
+ * however, utilize only part of the buffer by setting AVFrame.nb_samples
+ * to a smaller value in the output frame.
+ *
+ * Decoders cannot use the buffer after returning from
+ * avcodec_decode_audio4(), so they will not call release_buffer(), as it
+ * is assumed to be released immediately upon return.
+ *
+ * As a convenience, av_samples_get_buffer_size() and
+ * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
+ * functions to find the required data size and to fill data pointers and
+ * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
+ * since all planes must be the same size.
+ *
+ * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec, user can override.
+ */
+ int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
+
+ /**
+ * Called to release buffers which were allocated with get_buffer.
+ * A released buffer can be reused in get_buffer().
+ * pic.data[*] must be set to NULL.
+ * May be called from a different thread if frame multithreading is used,
+ * but not by more than one thread at once, so does not need to be reentrant.
+ * - encoding: unused
+ * - decoding: Set by libavcodec, user can override.
+ */
+ void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
+
+ /**
+ * Called at the beginning of a frame to get cr buffer for it.
+ * Buffer type (size, hints) must be the same. libavcodec won't check it.
+ * libavcodec will pass previous buffer in pic, function should return
+ * same buffer or new buffer with old frame "painted" into it.
+ * If pic.data[0] == NULL must behave like get_buffer().
+ * if CODEC_CAP_DR1 is not set then reget_buffer() must call
+ * avcodec_default_reget_buffer() instead of providing buffers allocated by
+ * some other means.
+ * - encoding: unused
+ * - decoding: Set by libavcodec, user can override.
+ */
+ int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
+
+
+ /* - encoding parameters */
+ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
+ float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
+
+ /**
+ * minimum quantizer
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int qmin;
+
+ /**
+ * maximum quantizer
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int qmax;
+
+ /**
+ * maximum quantizer difference between frames
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int max_qdiff;
+
+ /**
+ * ratecontrol qmin qmax limiting method
+ * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float rc_qsquish;
+
+ float rc_qmod_amp;
+ int rc_qmod_freq;
+
+ /**
+ * decoder bitstream buffer size
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int rc_buffer_size;
+
+ /**
+ * ratecontrol override, see RcOverride
+ * - encoding: Allocated/set/freed by user.
+ * - decoding: unused
+ */
+ int rc_override_count;
+ RcOverride *rc_override;
+
+ /**
+ * rate control equation
+ * - encoding: Set by user
+ * - decoding: unused
+ */
+ const char *rc_eq;
+
+ /**
+ * maximum bitrate
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int rc_max_rate;
+
+ /**
+ * minimum bitrate
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int rc_min_rate;
+
+ float rc_buffer_aggressivity;
+
+ /**
+ * initial complexity for pass1 ratecontrol
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ float rc_initial_cplx;
+
+ /**
+ * Ratecontrol attempt to use, at maximum, of what can be used without an underflow.
+ * - encoding: Set by user.
+ * - decoding: unused.
+ */
+ float rc_max_available_vbv_use;
+
+ /**
+ * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow.
+ * - encoding: Set by user.
+ * - decoding: unused.
+ */
+ float rc_min_vbv_overflow_use;
+
+ /**
+ * Number of bits which should be loaded into the rc buffer before decoding starts.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int rc_initial_buffer_occupancy;
+
+#define FF_CODER_TYPE_VLC 0
+#define FF_CODER_TYPE_AC 1
+#define FF_CODER_TYPE_RAW 2
+#define FF_CODER_TYPE_RLE 3
+#define FF_CODER_TYPE_DEFLATE 4
+ /**
+ * coder type
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int coder_type;
+
+ /**
+ * context model
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int context_model;
+
+ /**
+ * minimum Lagrange multipler
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int lmin;
+
+ /**
+ * maximum Lagrange multipler
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int lmax;
+
+ /**
+ * frame skip threshold
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int frame_skip_threshold;
+
+ /**
+ * frame skip factor
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int frame_skip_factor;
+
+ /**
+ * frame skip exponent
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int frame_skip_exp;
+
+ /**
+ * frame skip comparison function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int frame_skip_cmp;
+
+ /**
+ * trellis RD quantization
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int trellis;
+
+ /**
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int min_prediction_order;
+
+ /**
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int max_prediction_order;
+
+ /**
+ * GOP timecode frame start number, in non drop frame format
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int64_t timecode_frame_start;
+
+ /* The RTP callback: This function is called */
+ /* every time the encoder has a packet to send. */
+ /* It depends on the encoder if the data starts */
+ /* with a Start Code (it should). H.263 does. */
+ /* mb_nb contains the number of macroblocks */
+ /* encoded in the RTP payload. */
+ void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
+
+ int rtp_payload_size; /* The size of the RTP payload: the coder will */
+ /* do its best to deliver a chunk with size */
+ /* below rtp_payload_size, the chunk will start */
+ /* with a start code on some codecs like H.263. */
+ /* This doesn't take account of any particular */
+ /* headers inside the transmitted RTP payload. */
+
+ /* statistics, used for 2-pass encoding */
+ int mv_bits;
+ int header_bits;
+ int i_tex_bits;
+ int p_tex_bits;
+ int i_count;
+ int p_count;
+ int skip_count;
+ int misc_bits;
+
+ /**
+ * number of bits used for the previously encoded frame
+ * - encoding: Set by libavcodec.
+ * - decoding: unused
+ */
+ int frame_bits;
+
+ /**
+ * pass1 encoding statistics output buffer
+ * - encoding: Set by libavcodec.
+ * - decoding: unused
+ */
+ char *stats_out;
+
+ /**
+ * pass2 encoding statistics input buffer
+ * Concatenated stuff from stats_out of pass1 should be placed here.
+ * - encoding: Allocated/set/freed by user.
+ * - decoding: unused
+ */
+ char *stats_in;
+
+ /**
+ * Work around bugs in encoders which sometimes cannot be detected automatically.
+ * - encoding: Set by user
+ * - decoding: Set by user
+ */
+ int workaround_bugs;
+#define FF_BUG_AUTODETECT 1 ///< autodetection
+#define FF_BUG_OLD_MSMPEG4 2
+#define FF_BUG_XVID_ILACE 4
+#define FF_BUG_UMP4 8
+#define FF_BUG_NO_PADDING 16
+#define FF_BUG_AMV 32
+#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
+#define FF_BUG_QPEL_CHROMA 64
+#define FF_BUG_STD_QPEL 128
+#define FF_BUG_QPEL_CHROMA2 256
+#define FF_BUG_DIRECT_BLOCKSIZE 512
+#define FF_BUG_EDGE 1024
+#define FF_BUG_HPEL_CHROMA 2048
+#define FF_BUG_DC_CLIP 4096
+#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
+#define FF_BUG_TRUNCATED 16384
+
+ /**
+ * strictly follow the standard (MPEG4, ...).
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ * Setting this to STRICT or higher means the encoder and decoder will
+ * generally do stupid things, whereas setting it to unofficial or lower
+ * will mean the encoder might produce output that is not supported by all
+ * spec-compliant decoders. Decoders don't differentiate between normal,
+ * unofficial and experimental (that is, they always try to decode things
+ * when they can) unless they are explicitly asked to behave stupidly
+ * (=strictly conform to the specs)
+ */
+ int strict_std_compliance;
+#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
+#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
+#define FF_COMPLIANCE_NORMAL 0
+#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
+
+ /**
+ * error concealment flags
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int error_concealment;
+#define FF_EC_GUESS_MVS 1
+#define FF_EC_DEBLOCK 2
+
+ /**
+ * debug
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int debug;
+#define FF_DEBUG_PICT_INFO 1
+#define FF_DEBUG_RC 2
+#define FF_DEBUG_BITSTREAM 4
+#define FF_DEBUG_MB_TYPE 8
+#define FF_DEBUG_QP 16
+#define FF_DEBUG_MV 32
+#define FF_DEBUG_DCT_COEFF 0x00000040
+#define FF_DEBUG_SKIP 0x00000080
+#define FF_DEBUG_STARTCODE 0x00000100
+#define FF_DEBUG_PTS 0x00000200
+#define FF_DEBUG_ER 0x00000400
+#define FF_DEBUG_MMCO 0x00000800
+#define FF_DEBUG_BUGS 0x00001000
+#define FF_DEBUG_VIS_QP 0x00002000
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
+#define FF_DEBUG_BUFFERS 0x00008000
+#define FF_DEBUG_THREADS 0x00010000
+
+ /**
+ * debug
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int debug_mv;
+#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
+#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
+
+ /**
+ * Error recognition; may misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int err_recognition;
+#define AV_EF_CRCCHECK (1<<0)
+#define AV_EF_BITSTREAM (1<<1)
+#define AV_EF_BUFFER (1<<2)
+#define AV_EF_EXPLODE (1<<3)
+
+ /**
+ * opaque 64bit number (generally a PTS) that will be reordered and
+ * output in AVFrame.reordered_opaque
+ * @deprecated in favor of pkt_pts
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int64_t reordered_opaque;
+
+ /**
+ * Hardware accelerator in use
+ * - encoding: unused.
+ * - decoding: Set by libavcodec
+ */
+ struct AVHWAccel *hwaccel;
+
+ /**
+ * Hardware accelerator context.
+ * For some hardware accelerators, a global context needs to be
+ * provided by the user. In that case, this holds display-dependent
+ * data Libav cannot instantiate itself. Please refer to the
+ * Libav HW accelerator documentation to know how to fill this
+ * is. e.g. for VA API, this is a struct vaapi_context.
+ * - encoding: unused
+ * - decoding: Set by user
+ */
+ void *hwaccel_context;
+
+ /**
+ * error
+ * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
+ * - decoding: unused
+ */
+ uint64_t error[AV_NUM_DATA_POINTERS];
+
+ /**
+ * DCT algorithm, see FF_DCT_* below
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int dct_algo;
+#define FF_DCT_AUTO 0
+#define FF_DCT_FASTINT 1
+#define FF_DCT_INT 2
+#define FF_DCT_MMX 3
+#define FF_DCT_ALTIVEC 5
+#define FF_DCT_FAAN 6
+
+ /**
+ * IDCT algorithm, see FF_IDCT_* below.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int idct_algo;
+#define FF_IDCT_AUTO 0
+#define FF_IDCT_INT 1
+#define FF_IDCT_SIMPLE 2
+#define FF_IDCT_SIMPLEMMX 3
+#if FF_API_LIBMPEG2
+#define FF_IDCT_LIBMPEG2MMX 4
+#endif
+#if FF_API_MMI
+#define FF_IDCT_MMI 5
+#endif
+#define FF_IDCT_ARM 7
+#define FF_IDCT_ALTIVEC 8
+#define FF_IDCT_SH4 9
+#define FF_IDCT_SIMPLEARM 10
+#define FF_IDCT_H264 11
+#define FF_IDCT_VP3 12
+#define FF_IDCT_IPP 13
+#define FF_IDCT_XVIDMMX 14
+#define FF_IDCT_CAVS 15
+#define FF_IDCT_SIMPLEARMV5TE 16
+#define FF_IDCT_SIMPLEARMV6 17
+#define FF_IDCT_SIMPLEVIS 18
+#define FF_IDCT_WMV2 19
+#define FF_IDCT_FAAN 20
+#define FF_IDCT_EA 21
+#define FF_IDCT_SIMPLENEON 22
+#define FF_IDCT_SIMPLEALPHA 23
+#define FF_IDCT_BINK 24
+
+#if FF_API_DSP_MASK
+ /**
+ * Unused.
+ * @deprecated use av_set_cpu_flags_mask() instead.
+ */
+ attribute_deprecated unsigned dsp_mask;
+#endif
+
+ /**
+ * bits per sample/pixel from the demuxer (needed for huffyuv).
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by user.
+ */
+ int bits_per_coded_sample;
+
+ /**
+ * Bits per sample/pixel of internal libavcodec pixel/sample format.
+ * - encoding: set by user.
+ * - decoding: set by libavcodec.
+ */
+ int bits_per_raw_sample;
+
+ /**
+ * low resolution decoding, 1-> 1/2 size, 2->1/4 size
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ attribute_deprecated int lowres;
+
+ /**
+ * the picture in the bitstream
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ AVFrame *coded_frame;
+
+ /**
+ * thread count
+ * is used to decide how many independent tasks should be passed to execute()
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int thread_count;
+
+ /**
+ * Which multithreading methods to use.
+ * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
+ * so clients which cannot provide future frames should not use it.
+ *
+ * - encoding: Set by user, otherwise the default is used.
+ * - decoding: Set by user, otherwise the default is used.
+ */
+ int thread_type;
+#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
+#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
+
+ /**
+ * Which multithreading methods are in use by the codec.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int active_thread_type;
+
+ /**
+ * Set by the client if its custom get_buffer() callback can be called
+ * synchronously from another thread, which allows faster multithreaded decoding.
+ * draw_horiz_band() will be called from other threads regardless of this setting.
+ * Ignored if the default get_buffer() is used.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int thread_safe_callbacks;
+
+ /**
+ * The codec may call this to execute several independent things.
+ * It will return only after finishing all tasks.
+ * The user may replace this with some multithreaded implementation,
+ * the default implementation will execute the parts serially.
+ * @param count the number of things to execute
+ * - encoding: Set by libavcodec, user can override.
+ * - decoding: Set by libavcodec, user can override.
+ */
+ int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
+
+ /**
+ * The codec may call this to execute several independent things.
+ * It will return only after finishing all tasks.
+ * The user may replace this with some multithreaded implementation,
+ * the default implementation will execute the parts serially.
+ * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
+ * @param c context passed also to func
+ * @param count the number of things to execute
+ * @param arg2 argument passed unchanged to func
+ * @param ret return values of executed functions, must have space for "count" values. May be NULL.
+ * @param func function that will be called count times, with jobnr from 0 to count-1.
+ * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
+ * two instances of func executing at the same time will have the same threadnr.
+ * @return always 0 currently, but code should handle a future improvement where when any call to func
+ * returns < 0 no further calls to func may be done and < 0 is returned.
+ * - encoding: Set by libavcodec, user can override.
+ * - decoding: Set by libavcodec, user can override.
+ */
+ int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
+
+ /**
+ * thread opaque
+ * Can be used by execute() to store some per AVCodecContext stuff.
+ * - encoding: set by execute()
+ * - decoding: set by execute()
+ */
+ void *thread_opaque;
+
+ /**
+ * noise vs. sse weight for the nsse comparsion function
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int nsse_weight;
+
+ /**
+ * profile
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int profile;
+#define FF_PROFILE_UNKNOWN -99
+#define FF_PROFILE_RESERVED -100
+
+#define FF_PROFILE_AAC_MAIN 0
+#define FF_PROFILE_AAC_LOW 1
+#define FF_PROFILE_AAC_SSR 2
+#define FF_PROFILE_AAC_LTP 3
+#define FF_PROFILE_AAC_HE 4
+#define FF_PROFILE_AAC_HE_V2 28
+#define FF_PROFILE_AAC_LD 22
+#define FF_PROFILE_AAC_ELD 38
+
+#define FF_PROFILE_DTS 20
+#define FF_PROFILE_DTS_ES 30
+#define FF_PROFILE_DTS_96_24 40
+#define FF_PROFILE_DTS_HD_HRA 50
+#define FF_PROFILE_DTS_HD_MA 60
+
+#define FF_PROFILE_MPEG2_422 0
+#define FF_PROFILE_MPEG2_HIGH 1
+#define FF_PROFILE_MPEG2_SS 2
+#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
+#define FF_PROFILE_MPEG2_MAIN 4
+#define FF_PROFILE_MPEG2_SIMPLE 5
+
+#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
+#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
+
+#define FF_PROFILE_H264_BASELINE 66
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
+#define FF_PROFILE_H264_MAIN 77
+#define FF_PROFILE_H264_EXTENDED 88
+#define FF_PROFILE_H264_HIGH 100
+#define FF_PROFILE_H264_HIGH_10 110
+#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_422 122
+#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_444 144
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
+#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_CAVLC_444 44
+
+#define FF_PROFILE_VC1_SIMPLE 0
+#define FF_PROFILE_VC1_MAIN 1
+#define FF_PROFILE_VC1_COMPLEX 2
+#define FF_PROFILE_VC1_ADVANCED 3
+
+#define FF_PROFILE_MPEG4_SIMPLE 0
+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
+#define FF_PROFILE_MPEG4_CORE 2
+#define FF_PROFILE_MPEG4_MAIN 3
+#define FF_PROFILE_MPEG4_N_BIT 4
+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
+#define FF_PROFILE_MPEG4_HYBRID 8
+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
+#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
+#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
+#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
+
+ /**
+ * level
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int level;
+#define FF_LEVEL_UNKNOWN -99
+
+ /**
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ enum AVDiscard skip_loop_filter;
+
+ /**
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ enum AVDiscard skip_idct;
+
+ /**
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ enum AVDiscard skip_frame;
+
+ /**
+ * Header containing style information for text subtitles.
+ * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
+ * [Script Info] and [V4+ Styles] section, plus the [Events] line and
+ * the Format line following. It shouldn't include any Dialogue line.
+ * - encoding: Set/allocated/freed by user (before avcodec_open2())
+ * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
+ */
+ uint8_t *subtitle_header;
+ int subtitle_header_size;
+
+ /**
+ * Simulates errors in the bitstream to test error concealment.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int error_rate;
+
+ /**
+ * Current packet as passed into the decoder, to avoid having
+ * to pass the packet into every function. Currently only valid
+ * inside lavc and get/release_buffer callbacks.
+ * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
+ * - encoding: unused
+ */
+ AVPacket *pkt;
+
+ /**
+ * VBV delay coded in the last frame (in periods of a 27 MHz clock).
+ * Used for compliant TS muxing.
+ * - encoding: Set by libavcodec.
+ * - decoding: unused.
+ */
+ uint64_t vbv_delay;
+} AVCodecContext;
+
+/**
+ * AVProfile.
+ */
+typedef struct AVProfile {
+ int profile;
+ const char *name; ///< short name for the profile
+} AVProfile;
+
+typedef struct AVCodecDefault AVCodecDefault;
+
+struct AVSubtitle;
+
+/**
+ * AVCodec.
+ */
+typedef struct AVCodec {
+ /**
+ * Name of the codec implementation.
+ * The name is globally unique among encoders and among decoders (but an
+ * encoder and a decoder can share the same name).
+ * This is the primary way to find a codec from the user perspective.
+ */
+ const char *name;
+ /**
+ * Descriptive name for the codec, meant to be more human readable than name.
+ * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
+ */
+ const char *long_name;
+ enum AVMediaType type;
+ enum AVCodecID id;
+ /**
+ * Codec capabilities.
+ * see CODEC_CAP_*
+ */
+ int capabilities;
+ const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
+ const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
+ const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
+ const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
+ const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
+ attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
+ const AVClass *priv_class; ///< AVClass for the private context
+ const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavcodec and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ int priv_data_size;
+ struct AVCodec *next;
+ /**
+ * @name Frame-level threading support functions
+ * @{
+ */
+ /**
+ * If defined, called on thread contexts when they are created.
+ * If the codec allocates writable tables in init(), re-allocate them here.
+ * priv_data will be set to a copy of the original.
+ */
+ int (*init_thread_copy)(AVCodecContext *);
+ /**
+ * Copy necessary context variables from a previous thread context to the current one.
+ * If not defined, the next thread will start automatically; otherwise, the codec
+ * must call ff_thread_finish_setup().
+ *
+ * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
+ */
+ int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
+ /** @} */
+
+ /**
+ * Private codec-specific defaults.
+ */
+ const AVCodecDefault *defaults;
+
+ /**
+ * Initialize codec static data, called from avcodec_register().
+ */
+ void (*init_static_data)(struct AVCodec *codec);
+
+ int (*init)(AVCodecContext *);
+ int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
+ const struct AVSubtitle *sub);
+ /**
+ * Encode data to an AVPacket.
+ *
+ * @param avctx codec context
+ * @param avpkt output AVPacket (may contain a user-provided buffer)
+ * @param[in] frame AVFrame containing the raw data to be encoded
+ * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
+ * non-empty packet was returned in avpkt.
+ * @return 0 on success, negative error code on failure
+ */
+ int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
+ int *got_packet_ptr);
+ int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
+ int (*close)(AVCodecContext *);
+ /**
+ * Flush buffers.
+ * Will be called when seeking
+ */
+ void (*flush)(AVCodecContext *);
+} AVCodec;
+
+/**
+ * AVHWAccel.
+ */
+typedef struct AVHWAccel {
+ /**
+ * Name of the hardware accelerated codec.
+ * The name is globally unique among encoders and among decoders (but an
+ * encoder and a decoder can share the same name).
+ */
+ const char *name;
+
+ /**
+ * Type of codec implemented by the hardware accelerator.
+ *
+ * See AVMEDIA_TYPE_xxx
+ */
+ enum AVMediaType type;
+
+ /**
+ * Codec implemented by the hardware accelerator.
+ *
+ * See AV_CODEC_ID_xxx
+ */
+ enum AVCodecID id;
+
+ /**
+ * Supported pixel format.
+ *
+ * Only hardware accelerated formats are supported here.
+ */
+ enum AVPixelFormat pix_fmt;
+
+ /**
+ * Hardware accelerated codec capabilities.
+ * see FF_HWACCEL_CODEC_CAP_*
+ */
+ int capabilities;
+
+ struct AVHWAccel *next;
+
+ /**
+ * Called at the beginning of each frame or field picture.
+ *
+ * Meaningful frame information (codec specific) is guaranteed to
+ * be parsed at this point. This function is mandatory.
+ *
+ * Note that buf can be NULL along with buf_size set to 0.
+ * Otherwise, this means the whole frame is available at this point.
+ *
+ * @param avctx the codec context
+ * @param buf the frame data buffer base
+ * @param buf_size the size of the frame in bytes
+ * @return zero if successful, a negative value otherwise
+ */
+ int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
+
+ /**
+ * Callback for each slice.
+ *
+ * Meaningful slice information (codec specific) is guaranteed to
+ * be parsed at this point. This function is mandatory.
+ *
+ * @param avctx the codec context
+ * @param buf the slice data buffer base
+ * @param buf_size the size of the slice in bytes
+ * @return zero if successful, a negative value otherwise
+ */
+ int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
+
+ /**
+ * Called at the end of each frame or field picture.
+ *
+ * The whole picture is parsed at this point and can now be sent
+ * to the hardware accelerator. This function is mandatory.
+ *
+ * @param avctx the codec context
+ * @return zero if successful, a negative value otherwise
+ */
+ int (*end_frame)(AVCodecContext *avctx);
+
+ /**
+ * Size of HW accelerator private data.
+ *
+ * Private data is allocated with av_mallocz() before
+ * AVCodecContext.get_buffer() and deallocated after
+ * AVCodecContext.release_buffer().
+ */
+ int priv_data_size;
+} AVHWAccel;
+
+/**
+ * @defgroup lavc_picture AVPicture
+ *
+ * Functions for working with AVPicture
+ * @{
+ */
+
+/**
+ * four components are given, that's all.
+ * the last component is alpha
+ */
+typedef struct AVPicture {
+ uint8_t *data[AV_NUM_DATA_POINTERS];
+ int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
+} AVPicture;
+
+/**
+ * @}
+ */
+
+#define AVPALETTE_SIZE 1024
+#define AVPALETTE_COUNT 256
+
+enum AVSubtitleType {
+ SUBTITLE_NONE,
+
+ SUBTITLE_BITMAP, ///< A bitmap, pict will be set
+
+ /**
+ * Plain text, the text field must be set by the decoder and is
+ * authoritative. ass and pict fields may contain approximations.
+ */
+ SUBTITLE_TEXT,
+
+ /**
+ * Formatted text, the ass field must be set by the decoder and is
+ * authoritative. pict and text fields may contain approximations.
+ */
+ SUBTITLE_ASS,
+};
+
+typedef struct AVSubtitleRect {
+ int x; ///< top left corner of pict, undefined when pict is not set
+ int y; ///< top left corner of pict, undefined when pict is not set
+ int w; ///< width of pict, undefined when pict is not set
+ int h; ///< height of pict, undefined when pict is not set
+ int nb_colors; ///< number of colors in pict, undefined when pict is not set
+
+ /**
+ * data+linesize for the bitmap of this subtitle.
+ * can be set for text/ass as well once they where rendered
+ */
+ AVPicture pict;
+ enum AVSubtitleType type;
+
+ char *text; ///< 0 terminated plain UTF-8 text
+
+ /**
+ * 0 terminated ASS/SSA compatible event line.
+ * The pressentation of this is unaffected by the other values in this
+ * struct.
+ */
+ char *ass;
+} AVSubtitleRect;
+
+typedef struct AVSubtitle {
+ uint16_t format; /* 0 = graphics */
+ uint32_t start_display_time; /* relative to packet pts, in ms */
+ uint32_t end_display_time; /* relative to packet pts, in ms */
+ unsigned num_rects;
+ AVSubtitleRect **rects;
+ int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
+} AVSubtitle;
+
+/**
+ * If c is NULL, returns the first registered codec,
+ * if c is non-NULL, returns the next registered codec after c,
+ * or NULL if c is the last one.
+ */
+AVCodec *av_codec_next(const AVCodec *c);
+
+/**
+ * Return the LIBAVCODEC_VERSION_INT constant.
+ */
+unsigned avcodec_version(void);
+
+/**
+ * Return the libavcodec build-time configuration.
+ */
+const char *avcodec_configuration(void);
+
+/**
+ * Return the libavcodec license.
+ */
+const char *avcodec_license(void);
+
+/**
+ * Register the codec codec and initialize libavcodec.
+ *
+ * @warning either this function or avcodec_register_all() must be called
+ * before any other libavcodec functions.
+ *
+ * @see avcodec_register_all()
+ */
+void avcodec_register(AVCodec *codec);
+
+/**
+ * Register all the codecs, parsers and bitstream filters which were enabled at
+ * configuration time. If you do not call this function you can select exactly
+ * which formats you want to support, by using the individual registration
+ * functions.
+ *
+ * @see avcodec_register
+ * @see av_register_codec_parser
+ * @see av_register_bitstream_filter
+ */
+void avcodec_register_all(void);
+
+/**
+ * Allocate an AVCodecContext and set its fields to default values. The
+ * resulting struct can be deallocated by calling avcodec_close() on it followed
+ * by av_free().
+ *
+ * @param codec if non-NULL, allocate private data and initialize defaults
+ * for the given codec. It is illegal to then call avcodec_open2()
+ * with a different codec.
+ * If NULL, then the codec-specific defaults won't be initialized,
+ * which may result in suboptimal default settings (this is
+ * important mainly for encoders, e.g. libx264).
+ *
+ * @return An AVCodecContext filled with default values or NULL on failure.
+ * @see avcodec_get_context_defaults
+ */
+AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
+
+/**
+ * Set the fields of the given AVCodecContext to default values corresponding
+ * to the given codec (defaults may be codec-dependent).
+ *
+ * Do not call this function if a non-NULL codec has been passed
+ * to avcodec_alloc_context3() that allocated this AVCodecContext.
+ * If codec is non-NULL, it is illegal to call avcodec_open2() with a
+ * different codec on this AVCodecContext.
+ */
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
+
+/**
+ * Get the AVClass for AVCodecContext. It can be used in combination with
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
+ *
+ * @see av_opt_find().
+ */
+const AVClass *avcodec_get_class(void);
+
+/**
+ * Copy the settings of the source AVCodecContext into the destination
+ * AVCodecContext. The resulting destination codec context will be
+ * unopened, i.e. you are required to call avcodec_open2() before you
+ * can use this AVCodecContext to decode/encode video/audio data.
+ *
+ * @param dest target codec context, should be initialized with
+ * avcodec_alloc_context3(), but otherwise uninitialized
+ * @param src source codec context
+ * @return AVERROR() on error (e.g. memory allocation error), 0 on success
+ */
+int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
+
+/**
+ * Allocate an AVFrame and set its fields to default values. The resulting
+ * struct must be freed using avcodec_free_frame().
+ *
+ * @return An AVFrame filled with default values or NULL on failure.
+ * @see avcodec_get_frame_defaults
+ */
+AVFrame *avcodec_alloc_frame(void);
+
+/**
+ * Set the fields of the given AVFrame to default values.
+ *
+ * @param frame The AVFrame of which the fields should be set to default values.
+ */
+void avcodec_get_frame_defaults(AVFrame *frame);
+
+/**
+ * Free the frame and any dynamically allocated objects in it,
+ * e.g. extended_data.
+ *
+ * @param frame frame to be freed. The pointer will be set to NULL.
+ *
+ * @warning this function does NOT free the data buffers themselves
+ * (it does not know how, since they might have been allocated with
+ * a custom get_buffer()).
+ */
+void avcodec_free_frame(AVFrame **frame);
+
+/**
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
+ * function the context has to be allocated with avcodec_alloc_context3().
+ *
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
+ * retrieving a codec.
+ *
+ * @warning This function is not thread safe!
+ *
+ * @code
+ * avcodec_register_all();
+ * av_dict_set(&opts, "b", "2.5M", 0);
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
+ * if (!codec)
+ * exit(1);
+ *
+ * context = avcodec_alloc_context3(codec);
+ *
+ * if (avcodec_open2(context, codec, opts) < 0)
+ * exit(1);
+ * @endcode
+ *
+ * @param avctx The context to initialize.
+ * @param codec The codec to open this context for. If a non-NULL codec has been
+ * previously passed to avcodec_alloc_context3() or
+ * avcodec_get_context_defaults3() for this context, then this
+ * parameter MUST be either NULL or equal to the previously passed
+ * codec.
+ * @param options A dictionary filled with AVCodecContext and codec-private options.
+ * On return this object will be filled with options that were not found.
+ *
+ * @return zero on success, a negative value on error
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
+ * av_dict_set(), av_opt_find().
+ */
+int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
+
+/**
+ * Close a given AVCodecContext and free all the data associated with it
+ * (but not the AVCodecContext itself).
+ *
+ * Calling this function on an AVCodecContext that hasn't been opened will free
+ * the codec-specific data allocated in avcodec_alloc_context3() /
+ * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
+ * do nothing.
+ */
+int avcodec_close(AVCodecContext *avctx);
+
+/**
+ * Free all allocated data in the given subtitle struct.
+ *
+ * @param sub AVSubtitle to free.
+ */
+void avsubtitle_free(AVSubtitle *sub);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavc_packet
+ * @{
+ */
+
+/**
+ * Default packet destructor.
+ */
+void av_destruct_packet(AVPacket *pkt);
+
+/**
+ * Initialize optional fields of a packet with default values.
+ *
+ * Note, this does not touch the data and size members, which have to be
+ * initialized separately.
+ *
+ * @param pkt packet
+ */
+void av_init_packet(AVPacket *pkt);
+
+/**
+ * Allocate the payload of a packet and initialize its fields with
+ * default values.
+ *
+ * @param pkt packet
+ * @param size wanted payload size
+ * @return 0 if OK, AVERROR_xxx otherwise
+ */
+int av_new_packet(AVPacket *pkt, int size);
+
+/**
+ * Reduce packet size, correctly zeroing padding
+ *
+ * @param pkt packet
+ * @param size new size
+ */
+void av_shrink_packet(AVPacket *pkt, int size);
+
+/**
+ * Increase packet size, correctly zeroing padding
+ *
+ * @param pkt packet
+ * @param grow_by number of bytes by which to increase the size of the packet
+ */
+int av_grow_packet(AVPacket *pkt, int grow_by);
+
+/**
+ * @warning This is a hack - the packet memory allocation stuff is broken. The
+ * packet is allocated if it was not really allocated.
+ */
+int av_dup_packet(AVPacket *pkt);
+
+/**
+ * Free a packet.
+ *
+ * @param pkt packet to free
+ */
+void av_free_packet(AVPacket *pkt);
+
+/**
+ * Allocate new information of a packet.
+ *
+ * @param pkt packet
+ * @param type side information type
+ * @param size side information size
+ * @return pointer to fresh allocated data or NULL otherwise
+ */
+uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int size);
+
+/**
+ * Shrink the already allocated side data buffer
+ *
+ * @param pkt packet
+ * @param type side information type
+ * @param size new side information size
+ * @return 0 on success, < 0 on failure
+ */
+int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int size);
+
+/**
+ * Get side information from packet.
+ *
+ * @param pkt packet
+ * @param type desired side information type
+ * @param size pointer for side information size to store (optional)
+ * @return pointer to data if present or NULL otherwise
+ */
+uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int *size);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavc_decoding
+ * @{
+ */
+
+/**
+ * Find a registered decoder with a matching codec ID.
+ *
+ * @param id AVCodecID of the requested decoder
+ * @return A decoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_decoder(enum AVCodecID id);
+
+/**
+ * Find a registered decoder with the specified name.
+ *
+ * @param name name of the requested decoder
+ * @return A decoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_decoder_by_name(const char *name);
+
+int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
+void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
+int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
+
+/**
+ * Return the amount of padding in pixels which the get_buffer callback must
+ * provide around the edge of the image for codecs which do not have the
+ * CODEC_FLAG_EMU_EDGE flag.
+ *
+ * @return Required padding in pixels.
+ */
+unsigned avcodec_get_edge_width(void);
+
+/**
+ * Modify width and height values so that they will result in a memory
+ * buffer that is acceptable for the codec if you do not use any horizontal
+ * padding.
+ *
+ * May only be used if a codec with CODEC_CAP_DR1 has been opened.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
+
+/**
+ * Modify width and height values so that they will result in a memory
+ * buffer that is acceptable for the codec if you also ensure that all
+ * line sizes are a multiple of the respective linesize_align[i].
+ *
+ * May only be used if a codec with CODEC_CAP_DR1 has been opened.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
+ int linesize_align[AV_NUM_DATA_POINTERS]);
+
+#if FF_API_OLD_DECODE_AUDIO
+/**
+ * Wrapper function which calls avcodec_decode_audio4.
+ *
+ * @deprecated Use avcodec_decode_audio4 instead.
+ *
+ * Decode the audio frame of size avpkt->size from avpkt->data into samples.
+ * Some decoders may support multiple frames in a single AVPacket, such
+ * decoders would then just decode the first frame. In this case,
+ * avcodec_decode_audio3 has to be called again with an AVPacket that contains
+ * the remaining data in order to decode the second frame etc.
+ * If no frame
+ * could be outputted, frame_size_ptr is zero. Otherwise, it is the
+ * decompressed frame size in bytes.
+ *
+ * @warning You must set frame_size_ptr to the allocated size of the
+ * output buffer before calling avcodec_decode_audio3().
+ *
+ * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
+ * the actual read bytes because some optimized bitstream readers read 32 or 64
+ * bits at once and could read over the end.
+ *
+ * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that
+ * no overreading happens for damaged MPEG streams.
+ *
+ * @warning You must not provide a custom get_buffer() when using
+ * avcodec_decode_audio3(). Doing so will override it with
+ * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead,
+ * which does allow the application to provide a custom get_buffer().
+ *
+ * @note You might have to align the input buffer avpkt->data and output buffer
+ * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
+ * necessary at all, on others it won't work at all if not aligned and on others
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum and
+ * samples should be 16 byte aligned unless the CPU doesn't need it
+ * (AltiVec and SSE do).
+ *
+ * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
+ * between input and output, these need to be fed with avpkt->data=NULL,
+ * avpkt->size=0 at the end to return the remaining frames.
+ *
+ * @param avctx the codec context
+ * @param[out] samples the output buffer, sample type in avctx->sample_fmt
+ * If the sample format is planar, each channel plane will
+ * be the same size, with no padding between channels.
+ * @param[in,out] frame_size_ptr the output buffer size in bytes
+ * @param[in] avpkt The input AVPacket containing the input buffer.
+ * You can create such packet with av_init_packet() and by then setting
+ * data and size, some decoders might in addition need other fields.
+ * All decoders are designed to use the least fields possible though.
+ * @return On error a negative value is returned, otherwise the number of bytes
+ * used or zero if no frame data was decompressed (used) from the input AVPacket.
+ */
+attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
+ int *frame_size_ptr,
+ AVPacket *avpkt);
+#endif
+
+/**
+ * Decode the audio frame of size avpkt->size from avpkt->data into frame.
+ *
+ * Some decoders may support multiple frames in a single AVPacket. Such
+ * decoders would then just decode the first frame. In this case,
+ * avcodec_decode_audio4 has to be called again with an AVPacket containing
+ * the remaining data in order to decode the second frame, etc...
+ * Even if no frames are returned, the packet needs to be fed to the decoder
+ * with remaining data until it is completely consumed or an error occurs.
+ *
+ * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
+ * larger than the actual read bytes because some optimized bitstream
+ * readers read 32 or 64 bits at once and could read over the end.
+ *
+ * @note You might have to align the input buffer. The alignment requirements
+ * depend on the CPU and the decoder.
+ *
+ * @param avctx the codec context
+ * @param[out] frame The AVFrame in which to store decoded audio samples.
+ * Decoders request a buffer of a particular size by setting
+ * AVFrame.nb_samples prior to calling get_buffer(). The
+ * decoder may, however, only utilize part of the buffer by
+ * setting AVFrame.nb_samples to a smaller value in the
+ * output frame.
+ * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
+ * non-zero.
+ * @param[in] avpkt The input AVPacket containing the input buffer.
+ * At least avpkt->data and avpkt->size should be set. Some
+ * decoders might also require additional fields to be set.
+ * @return A negative error code is returned if an error occurred during
+ * decoding, otherwise the number of bytes consumed from the input
+ * AVPacket is returned.
+ */
+int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
+ int *got_frame_ptr, AVPacket *avpkt);
+
+/**
+ * Decode the video frame of size avpkt->size from avpkt->data into picture.
+ * Some decoders may support multiple frames in a single AVPacket, such
+ * decoders would then just decode the first frame.
+ *
+ * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
+ * the actual read bytes because some optimized bitstream readers read 32 or 64
+ * bits at once and could read over the end.
+ *
+ * @warning The end of the input buffer buf should be set to 0 to ensure that
+ * no overreading happens for damaged MPEG streams.
+ *
+ * @note You might have to align the input buffer avpkt->data.
+ * The alignment requirements depend on the CPU: on some CPUs it isn't
+ * necessary at all, on others it won't work at all if not aligned and on others
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum.
+ *
+ * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
+ * between input and output, these need to be fed with avpkt->data=NULL,
+ * avpkt->size=0 at the end to return the remaining frames.
+ *
+ * @param avctx the codec context
+ * @param[out] picture The AVFrame in which the decoded video frame will be stored.
+ * Use avcodec_alloc_frame to get an AVFrame, the codec will
+ * allocate memory for the actual bitmap.
+ * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit.
+ * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder
+ * decodes and the decoder tells the user once it does not need the data anymore,
+ * the user app can at this point free/reuse/keep the memory as it sees fit.
+ *
+ * @param[in] avpkt The input AVpacket containing the input buffer.
+ * You can create such packet with av_init_packet() and by then setting
+ * data and size, some decoders might in addition need other fields like
+ * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
+ * fields possible.
+ * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
+ * @return On error a negative value is returned, otherwise the number of bytes
+ * used or zero if no frame could be decompressed.
+ */
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
+ int *got_picture_ptr,
+ AVPacket *avpkt);
+
+/**
+ * Decode a subtitle message.
+ * Return a negative value on error, otherwise return the number of bytes used.
+ * If no subtitle could be decompressed, got_sub_ptr is zero.
+ * Otherwise, the subtitle is stored in *sub.
+ * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for
+ * simplicity, because the performance difference is expect to be negligible
+ * and reusing a get_buffer written for video codecs would probably perform badly
+ * due to a potentially very different allocation pattern.
+ *
+ * @param avctx the codec context
+ * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be
+ freed with avsubtitle_free if *got_sub_ptr is set.
+ * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
+ * @param[in] avpkt The input AVPacket containing the input buffer.
+ */
+int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
+ int *got_sub_ptr,
+ AVPacket *avpkt);
+
+/**
+ * @defgroup lavc_parsing Frame parsing
+ * @{
+ */
+
+typedef struct AVCodecParserContext {
+ void *priv_data;
+ struct AVCodecParser *parser;
+ int64_t frame_offset; /* offset of the current frame */
+ int64_t cur_offset; /* current offset
+ (incremented by each av_parser_parse()) */
+ int64_t next_frame_offset; /* offset of the next frame */
+ /* video info */
+ int pict_type; /* XXX: Put it back in AVCodecContext. */
+ /**
+ * This field is used for proper frame duration computation in lavf.
+ * It signals, how much longer the frame duration of the current frame
+ * is compared to normal frame duration.
+ *
+ * frame_duration = (1 + repeat_pict) * time_base
+ *
+ * It is used by codecs like H.264 to display telecined material.
+ */
+ int repeat_pict; /* XXX: Put it back in AVCodecContext. */
+ int64_t pts; /* pts of the current frame */
+ int64_t dts; /* dts of the current frame */
+
+ /* private data */
+ int64_t last_pts;
+ int64_t last_dts;
+ int fetch_timestamp;
+
+#define AV_PARSER_PTS_NB 4
+ int cur_frame_start_index;
+ int64_t cur_frame_offset[AV_PARSER_PTS_NB];
+ int64_t cur_frame_pts[AV_PARSER_PTS_NB];
+ int64_t cur_frame_dts[AV_PARSER_PTS_NB];
+
+ int flags;
+#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
+#define PARSER_FLAG_ONCE 0x0002
+/// Set if the parser has a valid file offset
+#define PARSER_FLAG_FETCHED_OFFSET 0x0004
+
+ int64_t offset; ///< byte offset from starting packet start
+ int64_t cur_frame_end[AV_PARSER_PTS_NB];
+
+ /**
+ * Set by parser to 1 for key frames and 0 for non-key frames.
+ * It is initialized to -1, so if the parser doesn't set this flag,
+ * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
+ * will be used.
+ */
+ int key_frame;
+
+ /**
+ * Time difference in stream time base units from the pts of this
+ * packet to the point at which the output from the decoder has converged
+ * independent from the availability of previous frames. That is, the
+ * frames are virtually identical no matter if decoding started from
+ * the very first frame or from this keyframe.
+ * Is AV_NOPTS_VALUE if unknown.
+ * This field is not the display duration of the current frame.
+ * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
+ * set.
+ *
+ * The purpose of this field is to allow seeking in streams that have no
+ * keyframes in the conventional sense. It corresponds to the
+ * recovery point SEI in H.264 and match_time_delta in NUT. It is also
+ * essential for some types of subtitle streams to ensure that all
+ * subtitles are correctly displayed after seeking.
+ */
+ int64_t convergence_duration;
+
+ // Timestamp generation support:
+ /**
+ * Synchronization point for start of timestamp generation.
+ *
+ * Set to >0 for sync point, 0 for no sync point and <0 for undefined
+ * (default).
+ *
+ * For example, this corresponds to presence of H.264 buffering period
+ * SEI message.
+ */
+ int dts_sync_point;
+
+ /**
+ * Offset of the current timestamp against last timestamp sync point in
+ * units of AVCodecContext.time_base.
+ *
+ * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
+ * contain a valid timestamp offset.
+ *
+ * Note that the timestamp of sync point has usually a nonzero
+ * dts_ref_dts_delta, which refers to the previous sync point. Offset of
+ * the next frame after timestamp sync point will be usually 1.
+ *
+ * For example, this corresponds to H.264 cpb_removal_delay.
+ */
+ int dts_ref_dts_delta;
+
+ /**
+ * Presentation delay of current frame in units of AVCodecContext.time_base.
+ *
+ * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
+ * contain valid non-negative timestamp delta (presentation time of a frame
+ * must not lie in the past).
+ *
+ * This delay represents the difference between decoding and presentation
+ * time of the frame.
+ *
+ * For example, this corresponds to H.264 dpb_output_delay.
+ */
+ int pts_dts_delta;
+
+ /**
+ * Position of the packet in file.
+ *
+ * Analogous to cur_frame_pts/dts
+ */
+ int64_t cur_frame_pos[AV_PARSER_PTS_NB];
+
+ /**
+ * Byte position of currently parsed frame in stream.
+ */
+ int64_t pos;
+
+ /**
+ * Previous frame byte position.
+ */
+ int64_t last_pos;
+
+ /**
+ * Duration of the current frame.
+ * For audio, this is in units of 1 / AVCodecContext.sample_rate.
+ * For all other types, this is in units of AVCodecContext.time_base.
+ */
+ int duration;
+} AVCodecParserContext;
+
+typedef struct AVCodecParser {
+ int codec_ids[5]; /* several codec IDs are permitted */
+ int priv_data_size;
+ int (*parser_init)(AVCodecParserContext *s);
+ int (*parser_parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*parser_close)(AVCodecParserContext *s);
+ int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+ struct AVCodecParser *next;
+} AVCodecParser;
+
+AVCodecParser *av_parser_next(AVCodecParser *c);
+
+void av_register_codec_parser(AVCodecParser *parser);
+AVCodecParserContext *av_parser_init(int codec_id);
+
+/**
+ * Parse a packet.
+ *
+ * @param s parser context.
+ * @param avctx codec context.
+ * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
+ * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
+ * @param buf input buffer.
+ * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output).
+ * @param pts input presentation timestamp.
+ * @param dts input decoding timestamp.
+ * @param pos input byte position in stream.
+ * @return the number of bytes of the input bitstream used.
+ *
+ * Example:
+ * @code
+ * while(in_len){
+ * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
+ * in_data, in_len,
+ * pts, dts, pos);
+ * in_data += len;
+ * in_len -= len;
+ *
+ * if(size)
+ * decode_frame(data, size);
+ * }
+ * @endcode
+ */
+int av_parser_parse2(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size,
+ int64_t pts, int64_t dts,
+ int64_t pos);
+
+int av_parser_change(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size, int keyframe);
+void av_parser_close(AVCodecParserContext *s);
+
+/**
+ * @}
+ * @}
+ */
+
+/**
+ * @addtogroup lavc_encoding
+ * @{
+ */
+
+/**
+ * Find a registered encoder with a matching codec ID.
+ *
+ * @param id AVCodecID of the requested encoder
+ * @return An encoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_encoder(enum AVCodecID id);
+
+/**
+ * Find a registered encoder with the specified name.
+ *
+ * @param name name of the requested encoder
+ * @return An encoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_encoder_by_name(const char *name);
+
+#if FF_API_OLD_ENCODE_AUDIO
+/**
+ * Encode an audio frame from samples into buf.
+ *
+ * @deprecated Use avcodec_encode_audio2 instead.
+ *
+ * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
+ * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
+ * will know how much space is needed because it depends on the value passed
+ * in buf_size as described below. In that case a lower value can be used.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer
+ * @param[in] buf_size the output buffer size
+ * @param[in] samples the input buffer containing the samples
+ * The number of samples read from this buffer is frame_size*channels,
+ * both of which are defined in avctx.
+ * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
+ * samples read from samples is equal to:
+ * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
+ * This also implies that av_get_bits_per_sample() must not return 0 for these
+ * codecs.
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used to encode the data read from the input buffer.
+ */
+int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
+ uint8_t *buf, int buf_size,
+ const short *samples);
+#endif
+
+/**
+ * Encode a frame of audio.
+ *
+ * Takes input samples from frame and writes the next output packet, if
+ * available, to avpkt. The output packet does not necessarily contain data for
+ * the most recent frame, as encoders can delay, split, and combine input frames
+ * internally as needed.
+ *
+ * @param avctx codec context
+ * @param avpkt output AVPacket.
+ * The user can supply an output buffer by setting
+ * avpkt->data and avpkt->size prior to calling the
+ * function, but if the size of the user-provided data is not
+ * large enough, encoding will fail. All other AVPacket fields
+ * will be reset by the encoder using av_init_packet(). If
+ * avpkt->data is NULL, the encoder will allocate it.
+ * The encoder will set avpkt->size to the size of the
+ * output packet.
+ *
+ * If this function fails or produces no output, avpkt will be
+ * freed using av_free_packet() (i.e. avpkt->destruct will be
+ * called to free the user supplied buffer).
+ * @param[in] frame AVFrame containing the raw audio data to be encoded.
+ * May be NULL when flushing an encoder that has the
+ * CODEC_CAP_DELAY capability set.
+ * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
+ * can have any number of samples.
+ * If it is not set, frame->nb_samples must be equal to
+ * avctx->frame_size for all frames except the last.
+ * The final frame may be smaller than avctx->frame_size.
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
+ * output packet is non-empty, and to 0 if it is
+ * empty. If the function returns an error, the
+ * packet can be assumed to be invalid, and the
+ * value of got_packet_ptr is undefined and should
+ * not be used.
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
+
+#if FF_API_OLD_ENCODE_VIDEO
+/**
+ * @deprecated use avcodec_encode_video2() instead.
+ *
+ * Encode a video frame from pict into buf.
+ * The input picture should be
+ * stored using a specific format, namely avctx.pix_fmt.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer for the bitstream of encoded frame
+ * @param[in] buf_size the size of the output buffer in bytes
+ * @param[in] pict the input picture to encode
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used from the output buffer.
+ */
+attribute_deprecated
+int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVFrame *pict);
+#endif
+
+/**
+ * Encode a frame of video.
+ *
+ * Takes input raw video data from frame and writes the next output packet, if
+ * available, to avpkt. The output packet does not necessarily contain data for
+ * the most recent frame, as encoders can delay and reorder input frames
+ * internally as needed.
+ *
+ * @param avctx codec context
+ * @param avpkt output AVPacket.
+ * The user can supply an output buffer by setting
+ * avpkt->data and avpkt->size prior to calling the
+ * function, but if the size of the user-provided data is not
+ * large enough, encoding will fail. All other AVPacket fields
+ * will be reset by the encoder using av_init_packet(). If
+ * avpkt->data is NULL, the encoder will allocate it.
+ * The encoder will set avpkt->size to the size of the
+ * output packet. The returned data (if any) belongs to the
+ * caller, he is responsible for freeing it.
+ *
+ * If this function fails or produces no output, avpkt will be
+ * freed using av_free_packet() (i.e. avpkt->destruct will be
+ * called to free the user supplied buffer).
+ * @param[in] frame AVFrame containing the raw video data to be encoded.
+ * May be NULL when flushing an encoder that has the
+ * CODEC_CAP_DELAY capability set.
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
+ * output packet is non-empty, and to 0 if it is
+ * empty. If the function returns an error, the
+ * packet can be assumed to be invalid, and the
+ * value of got_packet_ptr is undefined and should
+ * not be used.
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
+
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVSubtitle *sub);
+
+
+/**
+ * @}
+ */
+
+#if FF_API_AVCODEC_RESAMPLE
+/**
+ * @defgroup lavc_resample Audio resampling
+ * @ingroup libavc
+ * @deprecated use libavresample instead
+ *
+ * @{
+ */
+struct ReSampleContext;
+struct AVResampleContext;
+
+typedef struct ReSampleContext ReSampleContext;
+
+/**
+ * Initialize audio resampling context.
+ *
+ * @param output_channels number of output channels
+ * @param input_channels number of input channels
+ * @param output_rate output sample rate
+ * @param input_rate input sample rate
+ * @param sample_fmt_out requested output sample format
+ * @param sample_fmt_in input sample format
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear if 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ * @return allocated ReSampleContext, NULL if error occurred
+ */
+attribute_deprecated
+ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
+ int output_rate, int input_rate,
+ enum AVSampleFormat sample_fmt_out,
+ enum AVSampleFormat sample_fmt_in,
+ int filter_length, int log2_phase_count,
+ int linear, double cutoff);
+
+attribute_deprecated
+int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
+
+/**
+ * Free resample context.
+ *
+ * @param s a non-NULL pointer to a resample context previously
+ * created with av_audio_resample_init()
+ */
+attribute_deprecated
+void audio_resample_close(ReSampleContext *s);
+
+
+/**
+ * Initialize an audio resampler.
+ * Note, if either rate is not an integer then simply scale both rates up so they are.
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear If 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ */
+attribute_deprecated
+struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
+
+/**
+ * Resample an array of samples using a previously configured context.
+ * @param src an array of unconsumed samples
+ * @param consumed the number of samples of src which have been consumed are returned here
+ * @param src_size the number of unconsumed samples available
+ * @param dst_size the amount of space in samples available in dst
+ * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
+ * @return the number of samples written in dst or -1 if an error occurred
+ */
+attribute_deprecated
+int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
+
+
+/**
+ * Compensate samplerate/timestamp drift. The compensation is done by changing
+ * the resampler parameters, so no audible clicks or similar distortions occur
+ * @param compensation_distance distance in output samples over which the compensation should be performed
+ * @param sample_delta number of output samples which should be output less
+ *
+ * example: av_resample_compensate(c, 10, 500)
+ * here instead of 510 samples only 500 samples would be output
+ *
+ * note, due to rounding the actual compensation might be slightly different,
+ * especially if the compensation_distance is large and the in_rate used during init is small
+ */
+attribute_deprecated
+void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
+attribute_deprecated
+void av_resample_close(struct AVResampleContext *c);
+
+/**
+ * @}
+ */
+#endif
+
+/**
+ * @addtogroup lavc_picture
+ * @{
+ */
+
+/**
+ * Allocate memory for a picture. Call avpicture_free() to free it.
+ *
+ * @see avpicture_fill()
+ *
+ * @param picture the picture to be filled in
+ * @param pix_fmt the format of the picture
+ * @param width the width of the picture
+ * @param height the height of the picture
+ * @return zero if successful, a negative value if not
+ */
+int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Free a picture previously allocated by avpicture_alloc().
+ * The data buffer used by the AVPicture is freed, but the AVPicture structure
+ * itself is not.
+ *
+ * @param picture the AVPicture to be freed
+ */
+void avpicture_free(AVPicture *picture);
+
+/**
+ * Fill in the AVPicture fields.
+ * The fields of the given AVPicture are filled in by using the 'ptr' address
+ * which points to the image data buffer. Depending on the specified picture
+ * format, one or multiple image data pointers and line sizes will be set.
+ * If a planar format is specified, several pointers will be set pointing to
+ * the different picture planes and the line sizes of the different planes
+ * will be stored in the lines_sizes array.
+ * Call with ptr == NULL to get the required size for the ptr buffer.
+ *
+ * To allocate the buffer and fill in the AVPicture fields in one call,
+ * use avpicture_alloc().
+ *
+ * @param picture AVPicture whose fields are to be filled in
+ * @param ptr Buffer which will contain or contains the actual image data
+ * @param pix_fmt The format in which the picture data is stored.
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ * @return size of the image data in bytes
+ */
+int avpicture_fill(AVPicture *picture, uint8_t *ptr,
+ enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Copy pixel data from an AVPicture into a buffer.
+ * The data is stored compactly, without any gaps for alignment or padding
+ * which may be applied by avpicture_fill().
+ *
+ * @see avpicture_get_size()
+ *
+ * @param[in] src AVPicture containing image data
+ * @param[in] pix_fmt The format in which the picture data is stored.
+ * @param[in] width the width of the image in pixels.
+ * @param[in] height the height of the image in pixels.
+ * @param[out] dest A buffer into which picture data will be copied.
+ * @param[in] dest_size The size of 'dest'.
+ * @return The number of bytes written to dest, or a negative value (error code) on error.
+ */
+int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt,
+ int width, int height,
+ unsigned char *dest, int dest_size);
+
+/**
+ * Calculate the size in bytes that a picture of the given width and height
+ * would occupy if stored in the given picture format.
+ * Note that this returns the size of a compact representation as generated
+ * by avpicture_layout(), which can be smaller than the size required for e.g.
+ * avpicture_fill().
+ *
+ * @param pix_fmt the given picture format
+ * @param width the width of the image
+ * @param height the height of the image
+ * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
+ */
+int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * deinterlace - if not supported return -1
+ */
+int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height);
+/**
+ * Copy image src to dst. Wraps av_picture_data_copy() above.
+ */
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Crop image top and left side.
+ */
+int av_picture_crop(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int top_band, int left_band);
+
+/**
+ * Pad image.
+ */
+int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
+ int padtop, int padbottom, int padleft, int padright, int *color);
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup lavc_misc Utility functions
+ * @ingroup libavc
+ *
+ * Miscellaneous utility functions related to both encoding and decoding
+ * (or neither).
+ * @{
+ */
+
+/**
+ * @defgroup lavc_misc_pixfmt Pixel formats
+ *
+ * Functions for working with pixel formats.
+ * @{
+ */
+
+void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
+
+/**
+ * Return a value representing the fourCC code associated to the
+ * pixel format pix_fmt, or 0 if no associated fourCC code can be
+ * found.
+ */
+unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
+
+#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
+#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
+#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
+#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
+#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
+#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
+
+/**
+ * Compute what kind of losses will occur when converting from one specific
+ * pixel format to another.
+ * When converting from one pixel format to another, information loss may occur.
+ * For example, when converting from RGB24 to GRAY, the color information will
+ * be lost. Similarly, other losses occur when converting from some formats to
+ * other formats. These losses can involve loss of chroma, but also loss of
+ * resolution, loss of color depth, loss due to the color space conversion, loss
+ * of the alpha bits or loss due to color quantization.
+ * avcodec_get_fix_fmt_loss() informs you about the various types of losses
+ * which will occur when converting from one pixel format to another.
+ *
+ * @param[in] dst_pix_fmt destination pixel format
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @return Combination of flags informing you what kind of losses will occur.
+ */
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
+ int has_alpha);
+
+#if FF_API_FIND_BEST_PIX_FMT
+/**
+ * @deprecated use avcodec_find_best_pix_fmt2() instead.
+ *
+ * Find the best pixel format to convert to given a certain source pixel
+ * format. When converting from one pixel format to another, information loss
+ * may occur. For example, when converting from RGB24 to GRAY, the color
+ * information will be lost. Similarly, other losses occur when converting from
+ * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
+ * the given pixel formats should be used to suffer the least amount of loss.
+ * The pixel formats from which it chooses one, are determined by the
+ * pix_fmt_mask parameter.
+ *
+ * @code
+ * src_pix_fmt = AV_PIX_FMT_YUV420P;
+ * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24);
+ * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
+ * @endcode
+ *
+ * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
+ */
+attribute_deprecated
+enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+#endif /* FF_API_FIND_BEST_PIX_FMT */
+
+/**
+ * Find the best pixel format to convert to given a certain source pixel
+ * format. When converting from one pixel format to another, information loss
+ * may occur. For example, when converting from RGB24 to GRAY, the color
+ * information will be lost. Similarly, other losses occur when converting from
+ * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of
+ * the given pixel formats should be used to suffer the least amount of loss.
+ * The pixel formats from which it chooses one, are determined by the
+ * pix_fmt_list parameter.
+ *
+ *
+ * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
+ */
+enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
+ enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
+
+/**
+ * @}
+ */
+
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
+
+/**
+ * Put a string representing the codec tag codec_tag in buf.
+ *
+ * @param buf_size size in bytes of buf
+ * @return the length of the string that would have been generated if
+ * enough space had been available, excluding the trailing null
+ */
+size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
+
+void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
+
+/**
+ * Return a name for the specified profile, if available.
+ *
+ * @param codec the codec that is searched for the given profile
+ * @param profile the profile value for which a name is requested
+ * @return A name for the profile if found, NULL otherwise.
+ */
+const char *av_get_profile_name(const AVCodec *codec, int profile);
+
+int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
+int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
+//FIXME func typedef
+
+/**
+ * Fill audio frame data and linesize.
+ * AVFrame extended_data channel pointers are allocated if necessary for
+ * planar audio.
+ *
+ * @param frame the AVFrame
+ * frame->nb_samples must be set prior to calling the
+ * function. This function fills in frame->data,
+ * frame->extended_data, frame->linesize[0].
+ * @param nb_channels channel count
+ * @param sample_fmt sample format
+ * @param buf buffer to use for frame data
+ * @param buf_size size of buffer
+ * @param align plane size sample alignment (0 = default)
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
+ enum AVSampleFormat sample_fmt, const uint8_t *buf,
+ int buf_size, int align);
+
+/**
+ * Flush buffers, should be called when seeking or when switching to a different stream.
+ */
+void avcodec_flush_buffers(AVCodecContext *avctx);
+
+void avcodec_default_free_buffers(AVCodecContext *s);
+
+/**
+ * Return codec bits per sample.
+ *
+ * @param[in] codec_id the codec
+ * @return Number of bits per sample or zero if unknown for the given codec.
+ */
+int av_get_bits_per_sample(enum AVCodecID codec_id);
+
+/**
+ * Return codec bits per sample.
+ * Only return non-zero if the bits per sample is exactly correct, not an
+ * approximation.
+ *
+ * @param[in] codec_id the codec
+ * @return Number of bits per sample or zero if unknown for the given codec.
+ */
+int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
+
+/**
+ * Return audio frame duration.
+ *
+ * @param avctx codec context
+ * @param frame_bytes size of the frame, or 0 if unknown
+ * @return frame duration, in samples, if known. 0 if not able to
+ * determine.
+ */
+int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
+
+
+typedef struct AVBitStreamFilterContext {
+ void *priv_data;
+ struct AVBitStreamFilter *filter;
+ AVCodecParserContext *parser;
+ struct AVBitStreamFilterContext *next;
+} AVBitStreamFilterContext;
+
+
+typedef struct AVBitStreamFilter {
+ const char *name;
+ int priv_data_size;
+ int (*filter)(AVBitStreamFilterContext *bsfc,
+ AVCodecContext *avctx, const char *args,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size, int keyframe);
+ void (*close)(AVBitStreamFilterContext *bsfc);
+ struct AVBitStreamFilter *next;
+} AVBitStreamFilter;
+
+void av_register_bitstream_filter(AVBitStreamFilter *bsf);
+AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
+int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
+ AVCodecContext *avctx, const char *args,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size, int keyframe);
+void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
+
+AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
+
+/* memory */
+
+/**
+ * Reallocate the given block if it is not large enough, otherwise do nothing.
+ *
+ * @see av_realloc
+ */
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
+ * Allocate a buffer, reusing the given one if large enough.
+ *
+ * Contrary to av_fast_realloc the current buffer contents might not be
+ * preserved and on error the old buffer is freed, thus no special
+ * handling to avoid memleaks is necessary.
+ *
+ * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
+ * @param size size of the buffer *ptr points to
+ * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
+ * *size 0 if an error occurred.
+ */
+void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
+ * Allocate a buffer with padding, reusing the given one if large enough.
+ *
+ * Same behaviour av_fast_malloc but the buffer has additional
+ * FF_INPUT_PADDING_SIZE at the end which will always memset to 0.
+ *
+ */
+void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
+ * Encode extradata length to a buffer. Used by xiph codecs.
+ *
+ * @param s buffer to write to; must be at least (v/255+1) bytes long
+ * @param v size of extradata in bytes
+ * @return number of bytes written to the buffer.
+ */
+unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
+
+/**
+ * Log a generic warning message about a missing feature. This function is
+ * intended to be used internally by Libav (libavcodec, libavformat, etc.)
+ * only, and would normally not be used by applications.
+ * @param[in] avc a pointer to an arbitrary struct of which the first field is
+ * a pointer to an AVClass struct
+ * @param[in] feature string containing the name of the missing feature
+ * @param[in] want_sample indicates if samples are wanted which exhibit this feature.
+ * If want_sample is non-zero, additional verbage will be added to the log
+ * message which tells the user how to report samples to the development
+ * mailing list.
+ */
+void av_log_missing_feature(void *avc, const char *feature, int want_sample);
+
+/**
+ * Log a generic warning message asking for a sample. This function is
+ * intended to be used internally by Libav (libavcodec, libavformat, etc.)
+ * only, and would normally not be used by applications.
+ * @param[in] avc a pointer to an arbitrary struct of which the first field is
+ * a pointer to an AVClass struct
+ * @param[in] msg string containing an optional message, or NULL if no message
+ */
+void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
+
+/**
+ * Register the hardware accelerator hwaccel.
+ */
+void av_register_hwaccel(AVHWAccel *hwaccel);
+
+/**
+ * If hwaccel is NULL, returns the first registered hardware accelerator,
+ * if hwaccel is non-NULL, returns the next registered hardware accelerator
+ * after hwaccel, or NULL if hwaccel is the last one.
+ */
+AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
+
+
+/**
+ * Lock operation used by lockmgr
+ */
+enum AVLockOp {
+ AV_LOCK_CREATE, ///< Create a mutex
+ AV_LOCK_OBTAIN, ///< Lock the mutex
+ AV_LOCK_RELEASE, ///< Unlock the mutex
+ AV_LOCK_DESTROY, ///< Free mutex resources
+};
+
+/**
+ * Register a user provided lock manager supporting the operations
+ * specified by AVLockOp. mutex points to a (void *) where the
+ * lockmgr should store/get a pointer to a user allocated mutex. It's
+ * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
+ *
+ * @param cb User defined callback. Note: Libav may invoke calls to this
+ * callback during the call to av_lockmgr_register().
+ * Thus, the application must be prepared to handle that.
+ * If cb is set to NULL the lockmgr will be unregistered.
+ * Also note that during unregistration the previously registered
+ * lockmgr callback may also be invoked.
+ */
+int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
+
+/**
+ * Get the type of the given codec.
+ */
+enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
+
+/**
+ * @return a positive value if s is open (i.e. avcodec_open2() was called on it
+ * with no corresponding avcodec_close()), 0 otherwise.
+ */
+int avcodec_is_open(AVCodecContext *s);
+
+/**
+ * @return a non-zero number if codec is an encoder, zero otherwise
+ */
+int av_codec_is_encoder(const AVCodec *codec);
+
+/**
+ * @return a non-zero number if codec is a decoder, zero otherwise
+ */
+int av_codec_is_decoder(const AVCodec *codec);
+
+/**
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
+
+/**
+ * Iterate over all codec descriptors known to libavcodec.
+ *
+ * @param prev previous descriptor. NULL to get the first descriptor.
+ *
+ * @return next descriptor or NULL after the last descriptor
+ */
+const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
+
+/**
+ * @return codec descriptor with the given name or NULL if no such descriptor
+ * exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_AVCODEC_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/avfft.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/avfft.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,116 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AVFFT_H
+#define AVCODEC_AVFFT_H
+
+/**
+ * @file
+ * @ingroup lavc_fft
+ * FFT functions
+ */
+
+/**
+ * @defgroup lavc_fft FFT functions
+ * @ingroup lavc_misc
+ *
+ * @{
+ */
+
+typedef float FFTSample;
+
+typedef struct FFTComplex {
+ FFTSample re, im;
+} FFTComplex;
+
+typedef struct FFTContext FFTContext;
+
+/**
+ * Set up a complex FFT.
+ * @param nbits log2 of the length of the input array
+ * @param inverse if 0 perform the forward transform, if 1 perform the inverse
+ */
+FFTContext *av_fft_init(int nbits, int inverse);
+
+/**
+ * Do the permutation needed BEFORE calling ff_fft_calc().
+ */
+void av_fft_permute(FFTContext *s, FFTComplex *z);
+
+/**
+ * Do a complex FFT with the parameters defined in av_fft_init(). The
+ * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
+ */
+void av_fft_calc(FFTContext *s, FFTComplex *z);
+
+void av_fft_end(FFTContext *s);
+
+FFTContext *av_mdct_init(int nbits, int inverse, double scale);
+void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
+void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
+void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
+void av_mdct_end(FFTContext *s);
+
+/* Real Discrete Fourier Transform */
+
+enum RDFTransformType {
+ DFT_R2C,
+ IDFT_C2R,
+ IDFT_R2C,
+ DFT_C2R,
+};
+
+typedef struct RDFTContext RDFTContext;
+
+/**
+ * Set up a real FFT.
+ * @param nbits log2 of the length of the input array
+ * @param trans the type of transform
+ */
+RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
+void av_rdft_calc(RDFTContext *s, FFTSample *data);
+void av_rdft_end(RDFTContext *s);
+
+/* Discrete Cosine Transform */
+
+typedef struct DCTContext DCTContext;
+
+enum DCTTransformType {
+ DCT_II = 0,
+ DCT_III,
+ DCT_I,
+ DST_I,
+};
+
+/**
+ * Set up DCT.
+ * @param nbits size of the input array:
+ * (1 << nbits) for DCT-II, DCT-III and DST-I
+ * (1 << nbits) + 1 for DCT-I
+ *
+ * @note the first element of the input of DST-I is ignored
+ */
+DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
+void av_dct_calc(DCTContext *s, FFTSample *data);
+void av_dct_end (DCTContext *s);
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_AVFFT_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/dxva2.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/dxva2.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,88 @@
+/*
+ * DXVA2 HW acceleration
+ *
+ * copyright (c) 2009 Laurent Aimar
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_DXVA_H
+#define AVCODEC_DXVA_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_dxva2
+ * Public libavcodec DXVA2 header.
+ */
+
+#include
+
+#include
+#include
+
+/**
+ * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
+#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
+
+/**
+ * This structure is used to provides the necessary configurations and data
+ * to the DXVA2 Libav HWAccel implementation.
+ *
+ * The application must make it available as AVCodecContext.hwaccel_context.
+ */
+struct dxva_context {
+ /**
+ * DXVA2 decoder object
+ */
+ IDirectXVideoDecoder *decoder;
+
+ /**
+ * DXVA2 configuration used to create the decoder
+ */
+ const DXVA2_ConfigPictureDecode *cfg;
+
+ /**
+ * The number of surface in the surface array
+ */
+ unsigned surface_count;
+
+ /**
+ * The array of Direct3D surfaces used to create the decoder
+ */
+ LPDIRECT3DSURFACE9 *surface;
+
+ /**
+ * A bit field configuring the workarounds needed for using the decoder
+ */
+ uint64_t workaround;
+
+ /**
+ * Private to the Libav AVHWAccel implementation
+ */
+ unsigned report_id;
+};
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_DXVA_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/old_codec_ids.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/old_codec_ids.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,366 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_OLD_CODEC_IDS_H
+#define AVCODEC_OLD_CODEC_IDS_H
+
+/*
+ * This header exists to prevent new codec IDs from being accidentally added to
+ * the deprecated list.
+ * Do not include it directly. It will be removed on next major bump
+ *
+ * Do not add new items to this list. Use the AVCodecID enum instead.
+ */
+
+ CODEC_ID_NONE = AV_CODEC_ID_NONE,
+
+ /* video codecs */
+ CODEC_ID_MPEG1VIDEO,
+ CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+ CODEC_ID_MPEG2VIDEO_XVMC,
+ CODEC_ID_H261,
+ CODEC_ID_H263,
+ CODEC_ID_RV10,
+ CODEC_ID_RV20,
+ CODEC_ID_MJPEG,
+ CODEC_ID_MJPEGB,
+ CODEC_ID_LJPEG,
+ CODEC_ID_SP5X,
+ CODEC_ID_JPEGLS,
+ CODEC_ID_MPEG4,
+ CODEC_ID_RAWVIDEO,
+ CODEC_ID_MSMPEG4V1,
+ CODEC_ID_MSMPEG4V2,
+ CODEC_ID_MSMPEG4V3,
+ CODEC_ID_WMV1,
+ CODEC_ID_WMV2,
+ CODEC_ID_H263P,
+ CODEC_ID_H263I,
+ CODEC_ID_FLV1,
+ CODEC_ID_SVQ1,
+ CODEC_ID_SVQ3,
+ CODEC_ID_DVVIDEO,
+ CODEC_ID_HUFFYUV,
+ CODEC_ID_CYUV,
+ CODEC_ID_H264,
+ CODEC_ID_INDEO3,
+ CODEC_ID_VP3,
+ CODEC_ID_THEORA,
+ CODEC_ID_ASV1,
+ CODEC_ID_ASV2,
+ CODEC_ID_FFV1,
+ CODEC_ID_4XM,
+ CODEC_ID_VCR1,
+ CODEC_ID_CLJR,
+ CODEC_ID_MDEC,
+ CODEC_ID_ROQ,
+ CODEC_ID_INTERPLAY_VIDEO,
+ CODEC_ID_XAN_WC3,
+ CODEC_ID_XAN_WC4,
+ CODEC_ID_RPZA,
+ CODEC_ID_CINEPAK,
+ CODEC_ID_WS_VQA,
+ CODEC_ID_MSRLE,
+ CODEC_ID_MSVIDEO1,
+ CODEC_ID_IDCIN,
+ CODEC_ID_8BPS,
+ CODEC_ID_SMC,
+ CODEC_ID_FLIC,
+ CODEC_ID_TRUEMOTION1,
+ CODEC_ID_VMDVIDEO,
+ CODEC_ID_MSZH,
+ CODEC_ID_ZLIB,
+ CODEC_ID_QTRLE,
+ CODEC_ID_SNOW,
+ CODEC_ID_TSCC,
+ CODEC_ID_ULTI,
+ CODEC_ID_QDRAW,
+ CODEC_ID_VIXL,
+ CODEC_ID_QPEG,
+ CODEC_ID_PNG,
+ CODEC_ID_PPM,
+ CODEC_ID_PBM,
+ CODEC_ID_PGM,
+ CODEC_ID_PGMYUV,
+ CODEC_ID_PAM,
+ CODEC_ID_FFVHUFF,
+ CODEC_ID_RV30,
+ CODEC_ID_RV40,
+ CODEC_ID_VC1,
+ CODEC_ID_WMV3,
+ CODEC_ID_LOCO,
+ CODEC_ID_WNV1,
+ CODEC_ID_AASC,
+ CODEC_ID_INDEO2,
+ CODEC_ID_FRAPS,
+ CODEC_ID_TRUEMOTION2,
+ CODEC_ID_BMP,
+ CODEC_ID_CSCD,
+ CODEC_ID_MMVIDEO,
+ CODEC_ID_ZMBV,
+ CODEC_ID_AVS,
+ CODEC_ID_SMACKVIDEO,
+ CODEC_ID_NUV,
+ CODEC_ID_KMVC,
+ CODEC_ID_FLASHSV,
+ CODEC_ID_CAVS,
+ CODEC_ID_JPEG2000,
+ CODEC_ID_VMNC,
+ CODEC_ID_VP5,
+ CODEC_ID_VP6,
+ CODEC_ID_VP6F,
+ CODEC_ID_TARGA,
+ CODEC_ID_DSICINVIDEO,
+ CODEC_ID_TIERTEXSEQVIDEO,
+ CODEC_ID_TIFF,
+ CODEC_ID_GIF,
+ CODEC_ID_DXA,
+ CODEC_ID_DNXHD,
+ CODEC_ID_THP,
+ CODEC_ID_SGI,
+ CODEC_ID_C93,
+ CODEC_ID_BETHSOFTVID,
+ CODEC_ID_PTX,
+ CODEC_ID_TXD,
+ CODEC_ID_VP6A,
+ CODEC_ID_AMV,
+ CODEC_ID_VB,
+ CODEC_ID_PCX,
+ CODEC_ID_SUNRAST,
+ CODEC_ID_INDEO4,
+ CODEC_ID_INDEO5,
+ CODEC_ID_MIMIC,
+ CODEC_ID_RL2,
+ CODEC_ID_ESCAPE124,
+ CODEC_ID_DIRAC,
+ CODEC_ID_BFI,
+ CODEC_ID_CMV,
+ CODEC_ID_MOTIONPIXELS,
+ CODEC_ID_TGV,
+ CODEC_ID_TGQ,
+ CODEC_ID_TQI,
+ CODEC_ID_AURA,
+ CODEC_ID_AURA2,
+ CODEC_ID_V210X,
+ CODEC_ID_TMV,
+ CODEC_ID_V210,
+ CODEC_ID_DPX,
+ CODEC_ID_MAD,
+ CODEC_ID_FRWU,
+ CODEC_ID_FLASHSV2,
+ CODEC_ID_CDGRAPHICS,
+ CODEC_ID_R210,
+ CODEC_ID_ANM,
+ CODEC_ID_BINKVIDEO,
+ CODEC_ID_IFF_ILBM,
+ CODEC_ID_IFF_BYTERUN1,
+ CODEC_ID_KGV1,
+ CODEC_ID_YOP,
+ CODEC_ID_VP8,
+ CODEC_ID_PICTOR,
+ CODEC_ID_ANSI,
+ CODEC_ID_A64_MULTI,
+ CODEC_ID_A64_MULTI5,
+ CODEC_ID_R10K,
+ CODEC_ID_MXPEG,
+ CODEC_ID_LAGARITH,
+ CODEC_ID_PRORES,
+ CODEC_ID_JV,
+ CODEC_ID_DFA,
+ CODEC_ID_WMV3IMAGE,
+ CODEC_ID_VC1IMAGE,
+ CODEC_ID_UTVIDEO,
+ CODEC_ID_BMV_VIDEO,
+ CODEC_ID_VBLE,
+ CODEC_ID_DXTORY,
+ CODEC_ID_V410,
+ CODEC_ID_XWD,
+ CODEC_ID_CDXL,
+ CODEC_ID_XBM,
+ CODEC_ID_ZEROCODEC,
+ CODEC_ID_MSS1,
+ CODEC_ID_MSA1,
+ CODEC_ID_TSCC2,
+ CODEC_ID_MTS2,
+ CODEC_ID_CLLC,
+
+ /* various PCM "codecs" */
+ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ CODEC_ID_PCM_S16LE = 0x10000,
+ CODEC_ID_PCM_S16BE,
+ CODEC_ID_PCM_U16LE,
+ CODEC_ID_PCM_U16BE,
+ CODEC_ID_PCM_S8,
+ CODEC_ID_PCM_U8,
+ CODEC_ID_PCM_MULAW,
+ CODEC_ID_PCM_ALAW,
+ CODEC_ID_PCM_S32LE,
+ CODEC_ID_PCM_S32BE,
+ CODEC_ID_PCM_U32LE,
+ CODEC_ID_PCM_U32BE,
+ CODEC_ID_PCM_S24LE,
+ CODEC_ID_PCM_S24BE,
+ CODEC_ID_PCM_U24LE,
+ CODEC_ID_PCM_U24BE,
+ CODEC_ID_PCM_S24DAUD,
+ CODEC_ID_PCM_ZORK,
+ CODEC_ID_PCM_S16LE_PLANAR,
+ CODEC_ID_PCM_DVD,
+ CODEC_ID_PCM_F32BE,
+ CODEC_ID_PCM_F32LE,
+ CODEC_ID_PCM_F64BE,
+ CODEC_ID_PCM_F64LE,
+ CODEC_ID_PCM_BLURAY,
+ CODEC_ID_PCM_LXF,
+ CODEC_ID_S302M,
+ CODEC_ID_PCM_S8_PLANAR,
+
+ /* various ADPCM codecs */
+ CODEC_ID_ADPCM_IMA_QT = 0x11000,
+ CODEC_ID_ADPCM_IMA_WAV,
+ CODEC_ID_ADPCM_IMA_DK3,
+ CODEC_ID_ADPCM_IMA_DK4,
+ CODEC_ID_ADPCM_IMA_WS,
+ CODEC_ID_ADPCM_IMA_SMJPEG,
+ CODEC_ID_ADPCM_MS,
+ CODEC_ID_ADPCM_4XM,
+ CODEC_ID_ADPCM_XA,
+ CODEC_ID_ADPCM_ADX,
+ CODEC_ID_ADPCM_EA,
+ CODEC_ID_ADPCM_G726,
+ CODEC_ID_ADPCM_CT,
+ CODEC_ID_ADPCM_SWF,
+ CODEC_ID_ADPCM_YAMAHA,
+ CODEC_ID_ADPCM_SBPRO_4,
+ CODEC_ID_ADPCM_SBPRO_3,
+ CODEC_ID_ADPCM_SBPRO_2,
+ CODEC_ID_ADPCM_THP,
+ CODEC_ID_ADPCM_IMA_AMV,
+ CODEC_ID_ADPCM_EA_R1,
+ CODEC_ID_ADPCM_EA_R3,
+ CODEC_ID_ADPCM_EA_R2,
+ CODEC_ID_ADPCM_IMA_EA_SEAD,
+ CODEC_ID_ADPCM_IMA_EA_EACS,
+ CODEC_ID_ADPCM_EA_XAS,
+ CODEC_ID_ADPCM_EA_MAXIS_XA,
+ CODEC_ID_ADPCM_IMA_ISS,
+ CODEC_ID_ADPCM_G722,
+ CODEC_ID_ADPCM_IMA_APC,
+
+ /* AMR */
+ CODEC_ID_AMR_NB = 0x12000,
+ CODEC_ID_AMR_WB,
+
+ /* RealAudio codecs*/
+ CODEC_ID_RA_144 = 0x13000,
+ CODEC_ID_RA_288,
+
+ /* various DPCM codecs */
+ CODEC_ID_ROQ_DPCM = 0x14000,
+ CODEC_ID_INTERPLAY_DPCM,
+ CODEC_ID_XAN_DPCM,
+ CODEC_ID_SOL_DPCM,
+
+ /* audio codecs */
+ CODEC_ID_MP2 = 0x15000,
+ CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ CODEC_ID_AAC,
+ CODEC_ID_AC3,
+ CODEC_ID_DTS,
+ CODEC_ID_VORBIS,
+ CODEC_ID_DVAUDIO,
+ CODEC_ID_WMAV1,
+ CODEC_ID_WMAV2,
+ CODEC_ID_MACE3,
+ CODEC_ID_MACE6,
+ CODEC_ID_VMDAUDIO,
+ CODEC_ID_FLAC,
+ CODEC_ID_MP3ADU,
+ CODEC_ID_MP3ON4,
+ CODEC_ID_SHORTEN,
+ CODEC_ID_ALAC,
+ CODEC_ID_WESTWOOD_SND1,
+ CODEC_ID_GSM, ///< as in Berlin toast format
+ CODEC_ID_QDM2,
+ CODEC_ID_COOK,
+ CODEC_ID_TRUESPEECH,
+ CODEC_ID_TTA,
+ CODEC_ID_SMACKAUDIO,
+ CODEC_ID_QCELP,
+ CODEC_ID_WAVPACK,
+ CODEC_ID_DSICINAUDIO,
+ CODEC_ID_IMC,
+ CODEC_ID_MUSEPACK7,
+ CODEC_ID_MLP,
+ CODEC_ID_GSM_MS, /* as found in WAV */
+ CODEC_ID_ATRAC3,
+ CODEC_ID_VOXWARE,
+ CODEC_ID_APE,
+ CODEC_ID_NELLYMOSER,
+ CODEC_ID_MUSEPACK8,
+ CODEC_ID_SPEEX,
+ CODEC_ID_WMAVOICE,
+ CODEC_ID_WMAPRO,
+ CODEC_ID_WMALOSSLESS,
+ CODEC_ID_ATRAC3P,
+ CODEC_ID_EAC3,
+ CODEC_ID_SIPR,
+ CODEC_ID_MP1,
+ CODEC_ID_TWINVQ,
+ CODEC_ID_TRUEHD,
+ CODEC_ID_MP4ALS,
+ CODEC_ID_ATRAC1,
+ CODEC_ID_BINKAUDIO_RDFT,
+ CODEC_ID_BINKAUDIO_DCT,
+ CODEC_ID_AAC_LATM,
+ CODEC_ID_QDMC,
+ CODEC_ID_CELT,
+ CODEC_ID_G723_1,
+ CODEC_ID_G729,
+ CODEC_ID_8SVX_EXP,
+ CODEC_ID_8SVX_FIB,
+ CODEC_ID_BMV_AUDIO,
+ CODEC_ID_RALF,
+ CODEC_ID_IAC,
+ CODEC_ID_ILBC,
+
+ /* subtitle codecs */
+ CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
+ CODEC_ID_DVD_SUBTITLE = 0x17000,
+ CODEC_ID_DVB_SUBTITLE,
+ CODEC_ID_TEXT, ///< raw UTF-8 text
+ CODEC_ID_XSUB,
+ CODEC_ID_SSA,
+ CODEC_ID_MOV_TEXT,
+ CODEC_ID_HDMV_PGS_SUBTITLE,
+ CODEC_ID_DVB_TELETEXT,
+ CODEC_ID_SRT,
+
+ /* other specific kind of codecs (generally used for attachments) */
+ CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
+ CODEC_ID_TTF = 0x18000,
+
+ CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
+
+ CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+ * stream (only used by libavformat) */
+ CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+ * stream (only used by libavformat) */
+ CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
+
+#endif /* AVCODEC_OLD_CODEC_IDS_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/vaapi.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/vaapi.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,173 @@
+/*
+ * Video Acceleration API (shared data between Libav and the video player)
+ * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
+ *
+ * Copyright (C) 2008-2009 Splitted-Desktop Systems
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VAAPI_H
+#define AVCODEC_VAAPI_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_vaapi
+ * Public libavcodec VA API header.
+ */
+
+#include
+
+/**
+ * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
+ * @ingroup lavc_codec_hwaccel
+ * @{
+ */
+
+/**
+ * This structure is used to share data between the Libav library and
+ * the client video application.
+ * This shall be zero-allocated and available as
+ * AVCodecContext.hwaccel_context. All user members can be set once
+ * during initialization or through each AVCodecContext.get_buffer()
+ * function call. In any case, they must be valid prior to calling
+ * decoding functions.
+ */
+struct vaapi_context {
+ /**
+ * Window system dependent data
+ *
+ * - encoding: unused
+ * - decoding: Set by user
+ */
+ void *display;
+
+ /**
+ * Configuration ID
+ *
+ * - encoding: unused
+ * - decoding: Set by user
+ */
+ uint32_t config_id;
+
+ /**
+ * Context ID (video decode pipeline)
+ *
+ * - encoding: unused
+ * - decoding: Set by user
+ */
+ uint32_t context_id;
+
+ /**
+ * VAPictureParameterBuffer ID
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint32_t pic_param_buf_id;
+
+ /**
+ * VAIQMatrixBuffer ID
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint32_t iq_matrix_buf_id;
+
+ /**
+ * VABitPlaneBuffer ID (for VC-1 decoding)
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint32_t bitplane_buf_id;
+
+ /**
+ * Slice parameter/data buffer IDs
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint32_t *slice_buf_ids;
+
+ /**
+ * Number of effective slice buffer IDs to send to the HW
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ unsigned int n_slice_buf_ids;
+
+ /**
+ * Size of pre-allocated slice_buf_ids
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ unsigned int slice_buf_ids_alloc;
+
+ /**
+ * Pointer to VASliceParameterBuffers
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ void *slice_params;
+
+ /**
+ * Size of a VASliceParameterBuffer element
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ unsigned int slice_param_size;
+
+ /**
+ * Size of pre-allocated slice_params
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ unsigned int slice_params_alloc;
+
+ /**
+ * Number of slices currently filled in
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ unsigned int slice_count;
+
+ /**
+ * Pointer to slice data buffer base
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ const uint8_t *slice_data;
+
+ /**
+ * Current size of slice data
+ *
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint32_t slice_data_size;
+};
+
+/* @} */
+
+#endif /* AVCODEC_VAAPI_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/vda.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/vda.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,217 @@
+/*
+ * VDA HW acceleration
+ *
+ * copyright (c) 2011 Sebastien Zwickert
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VDA_H
+#define AVCODEC_VDA_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_vda
+ * Public libavcodec VDA header.
+ */
+
+#include "libavcodec/version.h"
+
+#if FF_API_VDA_ASYNC
+#include
+#endif
+
+#include
+
+// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
+// http://openradar.appspot.com/8026390
+#undef __GNUC_STDC_INLINE__
+
+#define Picture QuickdrawPicture
+#include
+#undef Picture
+
+/**
+ * @defgroup lavc_codec_hwaccel_vda VDA
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
+#if FF_API_VDA_ASYNC
+/**
+ * This structure is used to store decoded frame information and data.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+typedef struct vda_frame {
+ /**
+ * The PTS of the frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ int64_t pts;
+
+ /**
+ * The CoreVideo buffer that contains the decoded data.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ CVPixelBufferRef cv_buffer;
+
+ /**
+ * A pointer to the next frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ struct vda_frame *next_frame;
+} vda_frame;
+#endif
+
+/**
+ * This structure is used to provide the necessary configurations and data
+ * to the VDA Libav HWAccel implementation.
+ *
+ * The application must make it available as AVCodecContext.hwaccel_context.
+ */
+struct vda_context {
+ /**
+ * VDA decoder object.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ VDADecoder decoder;
+
+ /**
+ * The Core Video pixel buffer that contains the current image data.
+ *
+ * encoding: unused
+ * decoding: Set by libavcodec. Unset by user.
+ */
+ CVPixelBufferRef cv_buffer;
+
+ /**
+ * Use the hardware decoder in synchronous mode.
+ *
+ * encoding: unused
+ * decoding: Set by user.
+ */
+ int use_sync_decoding;
+
+#if FF_API_VDA_ASYNC
+ /**
+ * VDA frames queue ordered by presentation timestamp.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ vda_frame *queue;
+
+ /**
+ * Mutex for locking queue operations.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ pthread_mutex_t queue_mutex;
+#endif
+
+ /**
+ * The frame width.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
+ int width;
+
+ /**
+ * The frame height.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
+ int height;
+
+ /**
+ * The frame format.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
+ int format;
+
+ /**
+ * The pixel format for output image buffers.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
+ OSType cv_pix_fmt_type;
+
+ /**
+ * The current bitstream buffer.
+ */
+ uint8_t *priv_bitstream;
+
+ /**
+ * The current size of the bitstream.
+ */
+ int priv_bitstream_size;
+
+ /**
+ * The reference size used for fast reallocation.
+ */
+ int priv_allocated_size;
+};
+
+/** Create the video decoder. */
+int ff_vda_create_decoder(struct vda_context *vda_ctx,
+ uint8_t *extradata,
+ int extradata_size);
+
+/** Destroy the video decoder. */
+int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
+
+#if FF_API_VDA_ASYNC
+/**
+ * Return the top frame of the queue.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx);
+
+/**
+ * Release the given frame.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+void ff_vda_release_vda_frame(vda_frame *frame);
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_VDA_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/vdpau.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/vdpau.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,94 @@
+/*
+ * The Video Decode and Presentation API for UNIX (VDPAU) is used for
+ * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
+ *
+ * Copyright (C) 2008 NVIDIA
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VDPAU_H
+#define AVCODEC_VDPAU_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_vdpau
+ * Public libavcodec VDPAU header.
+ */
+
+
+/**
+ * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
+ * @ingroup lavc_codec_hwaccel
+ *
+ * VDPAU hardware acceleration has two modules
+ * - VDPAU decoding
+ * - VDPAU presentation
+ *
+ * The VDPAU decoding module parses all headers using Libav
+ * parsing mechanisms and uses VDPAU for the actual decoding.
+ *
+ * As per the current implementation, the actual decoding
+ * and rendering (API calls) are done as part of the VDPAU
+ * presentation (vo_vdpau.c) module.
+ *
+ * @{
+ */
+
+#include
+#include
+
+/** @brief The videoSurface is used for rendering. */
+#define FF_VDPAU_STATE_USED_FOR_RENDER 1
+
+/**
+ * @brief The videoSurface is needed for reference/prediction.
+ * The codec manipulates this.
+ */
+#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
+
+/**
+ * @brief This structure is used as a callback between the Libav
+ * decoder (vd_) and presentation (vo_) module.
+ * This is used for defining a video frame containing surface,
+ * picture parameter, bitstream information etc which are passed
+ * between the Libav decoder and its clients.
+ */
+struct vdpau_render_state {
+ VdpVideoSurface surface; ///< Used as rendered surface, never changed.
+
+ int state; ///< Holds FF_VDPAU_STATE_* values.
+
+ /** picture parameter information for all supported codecs */
+ union VdpPictureInfo {
+ VdpPictureInfoH264 h264;
+ VdpPictureInfoMPEG1Or2 mpeg;
+ VdpPictureInfoVC1 vc1;
+ VdpPictureInfoMPEG4Part2 mpeg4;
+ } info;
+
+ /** Describe size/location of the compressed video data.
+ Set to 0 when freeing bitstream_buffers. */
+ int bitstream_buffers_allocated;
+ int bitstream_buffers_used;
+ /** The user is responsible for freeing this buffer using av_freep(). */
+ VdpBitstreamBuffer *bitstream_buffers;
+};
+
+/* @}*/
+
+#endif /* AVCODEC_VDPAU_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/version.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/version.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,95 @@
+/*
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VERSION_H
+#define AVCODEC_VERSION_H
+
+/**
+ * @file
+ * @ingroup libavc
+ * Libavcodec version macros.
+ */
+
+#define LIBAVCODEC_VERSION_MAJOR 54
+#define LIBAVCODEC_VERSION_MINOR 31
+#define LIBAVCODEC_VERSION_MICRO 0
+
+#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
+
+#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#ifndef FF_API_REQUEST_CHANNELS
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_OLD_DECODE_AUDIO
+#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_OLD_ENCODE_AUDIO
+#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_OLD_ENCODE_VIDEO
+#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_MPV_GLOBAL_OPTS
+#define FF_API_MPV_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_COLOR_TABLE_ID
+#define FF_API_COLOR_TABLE_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_INTER_THRESHOLD
+#define FF_API_INTER_THRESHOLD (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_SUB_ID
+#define FF_API_SUB_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_DSP_MASK
+#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_FIND_BEST_PIX_FMT
+#define FF_API_FIND_BEST_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_CODEC_ID
+#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_VDA_ASYNC
+#define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_AVCODEC_RESAMPLE
+#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_LIBMPEG2
+#define FF_API_LIBMPEG2 (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_MMI
+#define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavcodec/xvmc.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavcodec/xvmc.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2003 Ivan Kalvachev
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_XVMC_H
+#define AVCODEC_XVMC_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_xvmc
+ * Public libavcodec XvMC header.
+ */
+
+#include
+
+#include "avcodec.h"
+
+/**
+ * @defgroup lavc_codec_hwaccel_xvmc XvMC
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
+#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
+ the number is 1337 speak for the letters IDCT MCo (motion compensation) */
+
+struct xvmc_pix_fmt {
+ /** The field contains the special constant value AV_XVMC_ID.
+ It is used as a test that the application correctly uses the API,
+ and that there is no corruption caused by pixel routines.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ int xvmc_id;
+
+ /** Pointer to the block array allocated by XvMCCreateBlocks().
+ The array has to be freed by XvMCDestroyBlocks().
+ Each group of 64 values represents one data block of differential
+ pixel information (in MoCo mode) or coefficients for IDCT.
+ - application - set the pointer during initialization
+ - libavcodec - fills coefficients/pixel data into the array
+ */
+ short* data_blocks;
+
+ /** Pointer to the macroblock description array allocated by
+ XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
+ - application - set the pointer during initialization
+ - libavcodec - fills description data into the array
+ */
+ XvMCMacroBlock* mv_blocks;
+
+ /** Number of macroblock descriptions that can be stored in the mv_blocks
+ array.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ int allocated_mv_blocks;
+
+ /** Number of blocks that can be stored at once in the data_blocks array.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ int allocated_data_blocks;
+
+ /** Indicate that the hardware would interpret data_blocks as IDCT
+ coefficients and perform IDCT on them.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ int idct;
+
+ /** In MoCo mode it indicates that intra macroblocks are assumed to be in
+ unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ int unsigned_intra;
+
+ /** Pointer to the surface allocated by XvMCCreateSurface().
+ It has to be freed by XvMCDestroySurface() on application exit.
+ It identifies the frame and its state on the video hardware.
+ - application - set during initialization
+ - libavcodec - unchanged
+ */
+ XvMCSurface* p_surface;
+
+/** Set by the decoder before calling ff_draw_horiz_band(),
+ needed by the XvMCRenderSurface function. */
+//@{
+ /** Pointer to the surface used as past reference
+ - application - unchanged
+ - libavcodec - set
+ */
+ XvMCSurface* p_past_surface;
+
+ /** Pointer to the surface used as future reference
+ - application - unchanged
+ - libavcodec - set
+ */
+ XvMCSurface* p_future_surface;
+
+ /** top/bottom field or frame
+ - application - unchanged
+ - libavcodec - set
+ */
+ unsigned int picture_structure;
+
+ /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
+ - application - unchanged
+ - libavcodec - set
+ */
+ unsigned int flags;
+//}@
+
+ /** Number of macroblock descriptions in the mv_blocks array
+ that have already been passed to the hardware.
+ - application - zeroes it on get_buffer().
+ A successful ff_draw_horiz_band() may increment it
+ with filled_mb_block_num or zero both.
+ - libavcodec - unchanged
+ */
+ int start_mv_blocks_num;
+
+ /** Number of new macroblock descriptions in the mv_blocks array (after
+ start_mv_blocks_num) that are filled by libavcodec and have to be
+ passed to the hardware.
+ - application - zeroes it on get_buffer() or after successful
+ ff_draw_horiz_band().
+ - libavcodec - increment with one of each stored MB
+ */
+ int filled_mv_blocks_num;
+
+ /** Number of the next free data block; one data block consists of
+ 64 short values in the data_blocks array.
+ All blocks before this one have already been claimed by placing their
+ position into the corresponding block description structure field,
+ that are part of the mv_blocks array.
+ - application - zeroes it on get_buffer().
+ A successful ff_draw_horiz_band() may zero it together
+ with start_mb_blocks_num.
+ - libavcodec - each decoded macroblock increases it by the number
+ of coded blocks it contains.
+ */
+ int next_free_data_block_num;
+};
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_XVMC_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavformat/avformat.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavformat/avformat.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,1740 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_AVFORMAT_H
+#define AVFORMAT_AVFORMAT_H
+
+/**
+ * @file
+ * @ingroup libavf
+ * Main libavformat public API header
+ */
+
+/**
+ * @defgroup libavf I/O and Muxing/Demuxing Library
+ * @{
+ *
+ * Libavformat (lavf) is a library for dealing with various media container
+ * formats. Its main two purposes are demuxing - i.e. splitting a media file
+ * into component streams, and the reverse process of muxing - writing supplied
+ * data in a specified container format. It also has an @ref lavf_io
+ * "I/O module" which supports a number of protocols for accessing the data (e.g.
+ * file, tcp, http and others). Before using lavf, you need to call
+ * av_register_all() to register all compiled muxers, demuxers and protocols.
+ * Unless you are absolutely sure you won't use libavformat's network
+ * capabilities, you should also call avformat_network_init().
+ *
+ * A supported input format is described by an AVInputFormat struct, conversely
+ * an output format is described by AVOutputFormat. You can iterate over all
+ * registered input/output formats using the av_iformat_next() /
+ * av_oformat_next() functions. The protocols layer is not part of the public
+ * API, so you can only get the names of supported protocols with the
+ * avio_enum_protocols() function.
+ *
+ * Main lavf structure used for both muxing and demuxing is AVFormatContext,
+ * which exports all information about the file being read or written. As with
+ * most Libav structures, its size is not part of public ABI, so it cannot be
+ * allocated on stack or directly with av_malloc(). To create an
+ * AVFormatContext, use avformat_alloc_context() (some functions, like
+ * avformat_open_input() might do that for you).
+ *
+ * Most importantly an AVFormatContext contains:
+ * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat
+ * "output" format. It is either autodetected or set by user for input;
+ * always set by user for output.
+ * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all
+ * elementary streams stored in the file. AVStreams are typically referred to
+ * using their index in this array.
+ * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or
+ * set by user for input, always set by user for output (unless you are dealing
+ * with an AVFMT_NOFILE format).
+ *
+ * @section lavf_options Passing options to (de)muxers
+ * Lavf allows to configure muxers and demuxers using the @ref avoptions
+ * mechanism. Generic (format-independent) libavformat options are provided by
+ * AVFormatContext, they can be examined from a user program by calling
+ * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass
+ * from avformat_get_class()). Private (format-specific) options are provided by
+ * AVFormatContext.priv_data if and only if AVInputFormat.priv_class /
+ * AVOutputFormat.priv_class of the corresponding format struct is non-NULL.
+ * Further options may be provided by the @ref AVFormatContext.pb "I/O context",
+ * if its AVClass is non-NULL, and the protocols layer. See the discussion on
+ * nesting in @ref avoptions documentation to learn how to access those.
+ *
+ * @defgroup lavf_decoding Demuxing
+ * @{
+ * Demuxers read a media file and split it into chunks of data (@em packets). A
+ * @ref AVPacket "packet" contains one or more encoded frames which belongs to a
+ * single elementary stream. In the lavf API this process is represented by the
+ * avformat_open_input() function for opening a file, av_read_frame() for
+ * reading a single packet and finally avformat_close_input(), which does the
+ * cleanup.
+ *
+ * @section lavf_decoding_open Opening a media file
+ * The minimum information required to open a file is its URL or filename, which
+ * is passed to avformat_open_input(), as in the following code:
+ * @code
+ * const char *url = "in.mp3";
+ * AVFormatContext *s = NULL;
+ * int ret = avformat_open_input(&s, url, NULL, NULL);
+ * if (ret < 0)
+ * abort();
+ * @endcode
+ * The above code attempts to allocate an AVFormatContext, open the
+ * specified file (autodetecting the format) and read the header, exporting the
+ * information stored there into s. Some formats do not have a header or do not
+ * store enough information there, so it is recommended that you call the
+ * avformat_find_stream_info() function which tries to read and decode a few
+ * frames to find missing information.
+ *
+ * In some cases you might want to preallocate an AVFormatContext yourself with
+ * avformat_alloc_context() and do some tweaking on it before passing it to
+ * avformat_open_input(). One such case is when you want to use custom functions
+ * for reading input data instead of lavf internal I/O layer.
+ * To do that, create your own AVIOContext with avio_alloc_context(), passing
+ * your reading callbacks to it. Then set the @em pb field of your
+ * AVFormatContext to newly created AVIOContext.
+ *
+ * Since the format of the opened file is in general not known until after
+ * avformat_open_input() has returned, it is not possible to set demuxer private
+ * options on a preallocated context. Instead, the options should be passed to
+ * avformat_open_input() wrapped in an AVDictionary:
+ * @code
+ * AVDictionary *options = NULL;
+ * av_dict_set(&options, "video_size", "640x480", 0);
+ * av_dict_set(&options, "pixel_format", "rgb24", 0);
+ *
+ * if (avformat_open_input(&s, url, NULL, &options) < 0)
+ * abort();
+ * av_dict_free(&options);
+ * @endcode
+ * This code passes the private options 'video_size' and 'pixel_format' to the
+ * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it
+ * cannot know how to interpret raw video data otherwise. If the format turns
+ * out to be something different than raw video, those options will not be
+ * recognized by the demuxer and therefore will not be applied. Such unrecognized
+ * options are then returned in the options dictionary (recognized options are
+ * consumed). The calling program can handle such unrecognized options as it
+ * wishes, e.g.
+ * @code
+ * AVDictionaryEntry *e;
+ * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
+ * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
+ * abort();
+ * }
+ * @endcode
+ *
+ * After you have finished reading the file, you must close it with
+ * avformat_close_input(). It will free everything associated with the file.
+ *
+ * @section lavf_decoding_read Reading from an opened file
+ * Reading data from an opened AVFormatContext is done by repeatedly calling
+ * av_read_frame() on it. Each call, if successful, will return an AVPacket
+ * containing encoded data for one AVStream, identified by
+ * AVPacket.stream_index. This packet may be passed straight into the libavcodec
+ * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or
+ * avcodec_decode_subtitle2() if the caller wishes to decode the data.
+ *
+ * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be
+ * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for
+ * pts/dts, 0 for duration) if the stream does not provide them. The timing
+ * information will be in AVStream.time_base units, i.e. it has to be
+ * multiplied by the timebase to convert them to seconds.
+ *
+ * The packet data belongs to the demuxer and is invalid after the next call to
+ * av_read_frame(). The user must free the packet with av_free_packet() before
+ * calling av_read_frame() again or closing the file.
+ *
+ * @section lavf_decoding_seek Seeking
+ * @}
+ *
+ * @defgroup lavf_encoding Muxing
+ * @{
+ * @}
+ *
+ * @defgroup lavf_io I/O Read/Write
+ * @{
+ * @}
+ *
+ * @defgroup lavf_codec Demuxers
+ * @{
+ * @defgroup lavf_codec_native Native Demuxers
+ * @{
+ * @}
+ * @defgroup lavf_codec_wrappers External library wrappers
+ * @{
+ * @}
+ * @}
+ * @defgroup lavf_protos I/O Protocols
+ * @{
+ * @}
+ * @defgroup lavf_internal Internal
+ * @{
+ * @}
+ * @}
+ *
+ */
+
+#include
+#include /* FILE */
+#include "libavcodec/avcodec.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+
+#include "avio.h"
+#include "libavformat/version.h"
+
+#if FF_API_AV_GETTIME
+#include "libavutil/time.h"
+#endif
+
+struct AVFormatContext;
+
+
+/**
+ * @defgroup metadata_api Public Metadata API
+ * @{
+ * @ingroup libavf
+ * The metadata API allows libavformat to export metadata tags to a client
+ * application when demuxing. Conversely it allows a client application to
+ * set metadata when muxing.
+ *
+ * Metadata is exported or set as pairs of key/value strings in the 'metadata'
+ * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs
+ * using the @ref lavu_dict "AVDictionary" API. Like all strings in Libav,
+ * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata
+ * exported by demuxers isn't checked to be valid UTF-8 in most cases.
+ *
+ * Important concepts to keep in mind:
+ * - Keys are unique; there can never be 2 tags with the same key. This is
+ * also meant semantically, i.e., a demuxer should not knowingly produce
+ * several keys that are literally different but semantically identical.
+ * E.g., key=Author5, key=Author6. In this example, all authors must be
+ * placed in the same tag.
+ * - Metadata is flat, not hierarchical; there are no subtags. If you
+ * want to store, e.g., the email address of the child of producer Alice
+ * and actor Bob, that could have key=alice_and_bobs_childs_email_address.
+ * - Several modifiers can be applied to the tag name. This is done by
+ * appending a dash character ('-') and the modifier name in the order
+ * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
+ * - language -- a tag whose value is localized for a particular language
+ * is appended with the ISO 639-2/B 3-letter language code.
+ * For example: Author-ger=Michael, Author-eng=Mike
+ * The original/default language is in the unqualified "Author" tag.
+ * A demuxer should set a default if it sets any translated tag.
+ * - sorting -- a modified version of a tag that should be used for
+ * sorting will have '-sort' appended. E.g. artist="The Beatles",
+ * artist-sort="Beatles, The".
+ *
+ * - Demuxers attempt to export metadata in a generic format, however tags
+ * with no generic equivalents are left as they are stored in the container.
+ * Follows a list of generic tag names:
+ *
+ @verbatim
+ album -- name of the set this work belongs to
+ album_artist -- main creator of the set/album, if different from artist.
+ e.g. "Various Artists" for compilation albums.
+ artist -- main creator of the work
+ comment -- any additional description of the file.
+ composer -- who composed the work, if different from artist.
+ copyright -- name of copyright holder.
+ creation_time-- date when the file was created, preferably in ISO 8601.
+ date -- date when the work was created, preferably in ISO 8601.
+ disc -- number of a subset, e.g. disc in a multi-disc collection.
+ encoder -- name/settings of the software/hardware that produced the file.
+ encoded_by -- person/group who created the file.
+ filename -- original name of the file.
+ genre -- .
+ language -- main language in which the work is performed, preferably
+ in ISO 639-2 format. Multiple languages can be specified by
+ separating them with commas.
+ performer -- artist who performed the work, if different from artist.
+ E.g for "Also sprach Zarathustra", artist would be "Richard
+ Strauss" and performer "London Philharmonic Orchestra".
+ publisher -- name of the label/publisher.
+ service_name -- name of the service in broadcasting (channel name).
+ service_provider -- name of the service provider in broadcasting.
+ title -- name of the work.
+ track -- number of this work in the set, can be in form current/total.
+ variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
+ @endverbatim
+ *
+ * Look in the examples section for an application example how to use the Metadata API.
+ *
+ * @}
+ */
+
+/* packet functions */
+
+
+/**
+ * Allocate and read the payload of a packet and initialize its
+ * fields with default values.
+ *
+ * @param pkt packet
+ * @param size desired payload size
+ * @return >0 (read size) if OK, AVERROR_xxx otherwise
+ */
+int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
+
+
+/**
+ * Read data and append it to the current content of the AVPacket.
+ * If pkt->size is 0 this is identical to av_get_packet.
+ * Note that this uses av_grow_packet and thus involves a realloc
+ * which is inefficient. Thus this function should only be used
+ * when there is no reasonable way to know (an upper bound of)
+ * the final size.
+ *
+ * @param pkt packet
+ * @param size amount of data to read
+ * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
+ * will not be lost even if an error occurs.
+ */
+int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
+
+/*************************************************/
+/* fractional numbers for exact pts handling */
+
+/**
+ * The exact value of the fractional number is: 'val + num / den'.
+ * num is assumed to be 0 <= num < den.
+ */
+typedef struct AVFrac {
+ int64_t val, num, den;
+} AVFrac;
+
+/*************************************************/
+/* input/output formats */
+
+struct AVCodecTag;
+
+/**
+ * This structure contains the data a format has to probe a file.
+ */
+typedef struct AVProbeData {
+ const char *filename;
+ unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */
+ int buf_size; /**< Size of buf except extra allocated bytes */
+} AVProbeData;
+
+#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
+#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
+
+/// Demuxer will use avio_open, no opened file should be provided by the caller.
+#define AVFMT_NOFILE 0x0001
+#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */
+#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */
+#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for
+ raw picture data. */
+#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */
+#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */
+#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */
+#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */
+#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */
+#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */
+#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */
+#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */
+#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */
+#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
+#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */
+#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly
+ increasing timestamps, but they must
+ still be monotonic */
+
+/**
+ * @addtogroup lavf_encoding
+ * @{
+ */
+typedef struct AVOutputFormat {
+ const char *name;
+ /**
+ * Descriptive name for the format, meant to be more human-readable
+ * than name. You should use the NULL_IF_CONFIG_SMALL() macro
+ * to define it.
+ */
+ const char *long_name;
+ const char *mime_type;
+ const char *extensions; /**< comma-separated filename extensions */
+ /* output support */
+ enum AVCodecID audio_codec; /**< default audio codec */
+ enum AVCodecID video_codec; /**< default video codec */
+ enum AVCodecID subtitle_codec; /**< default subtitle codec */
+ /**
+ * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
+ * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
+ * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
+ * AVFMT_TS_NONSTRICT
+ */
+ int flags;
+
+ /**
+ * List of supported codec_id-codec_tag pairs, ordered by "better
+ * choice first". The arrays are all terminated by AV_CODEC_ID_NONE.
+ */
+ const struct AVCodecTag * const *codec_tag;
+
+
+ const AVClass *priv_class; ///< AVClass for the private context
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVOutputFormat *next;
+ /**
+ * size of private data so that it can be allocated in the wrapper
+ */
+ int priv_data_size;
+
+ int (*write_header)(struct AVFormatContext *);
+ /**
+ * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,
+ * pkt can be NULL in order to flush data buffered in the muxer.
+ * When flushing, return 0 if there still is more data to flush,
+ * or 1 if everything was flushed and there is no more buffered
+ * data.
+ */
+ int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
+ int (*write_trailer)(struct AVFormatContext *);
+ /**
+ * Currently only used to set pixel format if not YUV420P.
+ */
+ int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
+ AVPacket *in, int flush);
+ /**
+ * Test if the given codec can be stored in this container.
+ *
+ * @return 1 if the codec is supported, 0 if it is not.
+ * A negative number if unknown.
+ */
+ int (*query_codec)(enum AVCodecID id, int std_compliance);
+} AVOutputFormat;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavf_decoding
+ * @{
+ */
+typedef struct AVInputFormat {
+ /**
+ * A comma separated list of short names for the format. New names
+ * may be appended with a minor bump.
+ */
+ const char *name;
+
+ /**
+ * Descriptive name for the format, meant to be more human-readable
+ * than name. You should use the NULL_IF_CONFIG_SMALL() macro
+ * to define it.
+ */
+ const char *long_name;
+
+ /**
+ * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+ * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+ * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+ */
+ int flags;
+
+ /**
+ * If extensions are defined, then no probe is done. You should
+ * usually not use extension format guessing because it is not
+ * reliable enough
+ */
+ const char *extensions;
+
+ const struct AVCodecTag * const *codec_tag;
+
+ const AVClass *priv_class; ///< AVClass for the private context
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVInputFormat *next;
+
+ /**
+ * Raw demuxers store their codec ID here.
+ */
+ int raw_codec_id;
+
+ /**
+ * Size of private data so that it can be allocated in the wrapper.
+ */
+ int priv_data_size;
+
+ /**
+ * Tell if a given file has a chance of being parsed as this format.
+ * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
+ * big so you do not have to check for that unless you need more.
+ */
+ int (*read_probe)(AVProbeData *);
+
+ /**
+ * Read the format header and initialize the AVFormatContext
+ * structure. Return 0 if OK. Only used in raw format right
+ * now. 'avformat_new_stream' should be called to create new streams.
+ */
+ int (*read_header)(struct AVFormatContext *);
+
+ /**
+ * Read one packet and put it in 'pkt'. pts and flags are also
+ * set. 'avformat_new_stream' can be called only if the flag
+ * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a
+ * background thread).
+ * @return 0 on success, < 0 on error.
+ * When returning an error, pkt must not have been allocated
+ * or must be freed before returning
+ */
+ int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
+
+ /**
+ * Close the stream. The AVFormatContext and AVStreams are not
+ * freed by this function
+ */
+ int (*read_close)(struct AVFormatContext *);
+
+ /**
+ * Seek to a given timestamp relative to the frames in
+ * stream component stream_index.
+ * @param stream_index Must not be -1.
+ * @param flags Selects which direction should be preferred if no exact
+ * match is available.
+ * @return >= 0 on success (but not necessarily the new offset)
+ */
+ int (*read_seek)(struct AVFormatContext *,
+ int stream_index, int64_t timestamp, int flags);
+
+ /**
+ * Get the next timestamp in stream[stream_index].time_base units.
+ * @return the timestamp or AV_NOPTS_VALUE if an error occurred
+ */
+ int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
+ int64_t *pos, int64_t pos_limit);
+
+ /**
+ * Start/resume playing - only meaningful if using a network-based format
+ * (RTSP).
+ */
+ int (*read_play)(struct AVFormatContext *);
+
+ /**
+ * Pause playing - only meaningful if using a network-based format
+ * (RTSP).
+ */
+ int (*read_pause)(struct AVFormatContext *);
+
+ /**
+ * Seek to timestamp ts.
+ * Seeking will be done so that the point from which all active streams
+ * can be presented successfully will be closest to ts and within min/max_ts.
+ * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
+ */
+ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
+} AVInputFormat;
+/**
+ * @}
+ */
+
+enum AVStreamParseType {
+ AVSTREAM_PARSE_NONE,
+ AVSTREAM_PARSE_FULL, /**< full parsing and repack */
+ AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */
+ AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
+ AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */
+};
+
+typedef struct AVIndexEntry {
+ int64_t pos;
+ int64_t timestamp;
+#define AVINDEX_KEYFRAME 0x0001
+ int flags:2;
+ int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment).
+ int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
+} AVIndexEntry;
+
+#define AV_DISPOSITION_DEFAULT 0x0001
+#define AV_DISPOSITION_DUB 0x0002
+#define AV_DISPOSITION_ORIGINAL 0x0004
+#define AV_DISPOSITION_COMMENT 0x0008
+#define AV_DISPOSITION_LYRICS 0x0010
+#define AV_DISPOSITION_KARAOKE 0x0020
+
+/**
+ * Track should be used during playback by default.
+ * Useful for subtitle track that should be displayed
+ * even when user did not explicitly ask for subtitles.
+ */
+#define AV_DISPOSITION_FORCED 0x0040
+#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */
+#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */
+#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */
+/**
+ * The stream is stored in the file as an attached picture/"cover art" (e.g.
+ * APIC frame in ID3v2). The single packet associated with it will be returned
+ * among the first few packets read from the file unless seeking takes place.
+ * It can also be accessed at any time in AVStream.attached_pic.
+ */
+#define AV_DISPOSITION_ATTACHED_PIC 0x0400
+
+/**
+ * Stream structure.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVStream) must not be used outside libav*.
+ */
+typedef struct AVStream {
+ int index; /**< stream index in AVFormatContext */
+ /**
+ * Format-specific stream ID.
+ * decoding: set by libavformat
+ * encoding: set by the user
+ */
+ int id;
+ /**
+ * Codec context associated with this stream. Allocated and freed by
+ * libavformat.
+ *
+ * - decoding: The demuxer exports codec information stored in the headers
+ * here.
+ * - encoding: The user sets codec information, the muxer writes it to the
+ * output. Mandatory fields as specified in AVCodecContext
+ * documentation must be set even if this AVCodecContext is
+ * not actually used for encoding.
+ */
+ AVCodecContext *codec;
+#if FF_API_R_FRAME_RATE
+ /**
+ * Real base framerate of the stream.
+ * This is the lowest framerate with which all timestamps can be
+ * represented accurately (it is the least common multiple of all
+ * framerates in the stream). Note, this value is just a guess!
+ * For example, if the time base is 1/90000 and all frames have either
+ * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
+ */
+ AVRational r_frame_rate;
+#endif
+ void *priv_data;
+
+ /**
+ * encoding: pts generation when outputting stream
+ */
+ struct AVFrac pts;
+
+ /**
+ * This is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented.
+ *
+ * decoding: set by libavformat
+ * encoding: set by libavformat in avformat_write_header. The muxer may use the
+ * user-provided value of @ref AVCodecContext.time_base "codec->time_base"
+ * as a hint.
+ */
+ AVRational time_base;
+
+ /**
+ * Decoding: pts of the first frame of the stream, in stream time base.
+ * Only set this if you are absolutely 100% sure that the value you set
+ * it to really is the pts of the first frame.
+ * This may be undefined (AV_NOPTS_VALUE).
+ */
+ int64_t start_time;
+
+ /**
+ * Decoding: duration of the stream, in stream time base.
+ * If a source file does not specify a duration, but does specify
+ * a bitrate, this value will be estimated from bitrate and file size.
+ */
+ int64_t duration;
+
+ int64_t nb_frames; ///< number of frames in this stream if known or 0
+
+ int disposition; /**< AV_DISPOSITION_* bit field */
+
+ enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
+
+ /**
+ * sample aspect ratio (0 if unknown)
+ * - encoding: Set by user.
+ * - decoding: Set by libavformat.
+ */
+ AVRational sample_aspect_ratio;
+
+ AVDictionary *metadata;
+
+ /**
+ * Average framerate
+ */
+ AVRational avg_frame_rate;
+
+ /**
+ * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
+ * will contain the attached picture.
+ *
+ * decoding: set by libavformat, must not be modified by the caller.
+ * encoding: unused
+ */
+ AVPacket attached_pic;
+
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+
+ /**
+ * Stream information used internally by av_find_stream_info()
+ */
+#define MAX_STD_TIMEBASES (60*12+5)
+ struct {
+#if FF_API_R_FRAME_RATE
+ int64_t last_dts;
+ int64_t duration_gcd;
+ int duration_count;
+ double duration_error[MAX_STD_TIMEBASES];
+#endif
+ int nb_decoded_frames;
+ int found_decoder;
+
+ /**
+ * Those are used for average framerate estimation.
+ */
+ int64_t fps_first_dts;
+ int fps_first_dts_idx;
+ int64_t fps_last_dts;
+ int fps_last_dts_idx;
+
+ } *info;
+
+ int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
+
+ // Timestamp generation support:
+ /**
+ * Timestamp corresponding to the last dts sync point.
+ *
+ * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
+ * a DTS is received from the underlying container. Otherwise set to
+ * AV_NOPTS_VALUE by default.
+ */
+ int64_t reference_dts;
+ int64_t first_dts;
+ int64_t cur_dts;
+ int64_t last_IP_pts;
+ int last_IP_duration;
+
+ /**
+ * Number of packets to buffer for codec probing
+ */
+#define MAX_PROBE_PACKETS 2500
+ int probe_packets;
+
+ /**
+ * Number of frames that have been demuxed during av_find_stream_info()
+ */
+ int codec_info_nb_frames;
+
+ /* av_read_frame() support */
+ enum AVStreamParseType need_parsing;
+ struct AVCodecParserContext *parser;
+
+ /**
+ * last packet in packet_buffer for this stream when muxing.
+ */
+ struct AVPacketList *last_in_packet_buffer;
+ AVProbeData probe_data;
+#define MAX_REORDER_DELAY 16
+ int64_t pts_buffer[MAX_REORDER_DELAY+1];
+
+ AVIndexEntry *index_entries; /**< Only used if the format does not
+ support seeking natively. */
+ int nb_index_entries;
+ unsigned int index_entries_allocated_size;
+} AVStream;
+
+#define AV_PROGRAM_RUNNING 1
+
+/**
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVProgram) must not be used outside libav*.
+ */
+typedef struct AVProgram {
+ int id;
+ int flags;
+ enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller
+ unsigned int *stream_index;
+ unsigned int nb_stream_indexes;
+ AVDictionary *metadata;
+} AVProgram;
+
+#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present
+ (streams are added dynamically) */
+
+typedef struct AVChapter {
+ int id; ///< unique ID to identify the chapter
+ AVRational time_base; ///< time base in which the start/end timestamps are specified
+ int64_t start, end; ///< chapter start/end time in time_base units
+ AVDictionary *metadata;
+} AVChapter;
+
+/**
+ * Format I/O context.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVFormatContext) must not be used outside libav*, use
+ * avformat_alloc_context() to create an AVFormatContext.
+ */
+typedef struct AVFormatContext {
+ /**
+ * A class for logging and AVOptions. Set by avformat_alloc_context().
+ * Exports (de)muxer private options if they exist.
+ */
+ const AVClass *av_class;
+
+ /**
+ * Can only be iformat or oformat, not both at the same time.
+ *
+ * decoding: set by avformat_open_input().
+ * encoding: set by the user.
+ */
+ struct AVInputFormat *iformat;
+ struct AVOutputFormat *oformat;
+
+ /**
+ * Format private data. This is an AVOptions-enabled struct
+ * if and only if iformat/oformat.priv_class is not NULL.
+ */
+ void *priv_data;
+
+ /**
+ * I/O context.
+ *
+ * decoding: either set by the user before avformat_open_input() (then
+ * the user must close it manually) or set by avformat_open_input().
+ * encoding: set by the user.
+ *
+ * Do NOT set this field if AVFMT_NOFILE flag is set in
+ * iformat/oformat.flags. In such a case, the (de)muxer will handle
+ * I/O in some other way and this field will be NULL.
+ */
+ AVIOContext *pb;
+
+ /* stream info */
+ int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
+
+ /**
+ * A list of all streams in the file. New streams are created with
+ * avformat_new_stream().
+ *
+ * decoding: streams are created by libavformat in avformat_open_input().
+ * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also
+ * appear in av_read_frame().
+ * encoding: streams are created by the user before avformat_write_header().
+ */
+ unsigned int nb_streams;
+ AVStream **streams;
+
+ char filename[1024]; /**< input or output filename */
+
+ /**
+ * Decoding: position of the first frame of the component, in
+ * AV_TIME_BASE fractional seconds. NEVER set this value directly:
+ * It is deduced from the AVStream values.
+ */
+ int64_t start_time;
+
+ /**
+ * Decoding: duration of the stream, in AV_TIME_BASE fractional
+ * seconds. Only set this value if you know none of the individual stream
+ * durations and also do not set any of them. This is deduced from the
+ * AVStream values if not set.
+ */
+ int64_t duration;
+
+ /**
+ * Decoding: total stream bitrate in bit/s, 0 if not
+ * available. Never set it directly if the file_size and the
+ * duration are known as Libav can compute it automatically.
+ */
+ int bit_rate;
+
+ unsigned int packet_size;
+ int max_delay;
+
+ int flags;
+#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames.
+#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index.
+#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input.
+#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
+#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
+#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
+#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible
+#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
+#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
+
+ /**
+ * decoding: size of data to probe; encoding: unused.
+ */
+ unsigned int probesize;
+
+ /**
+ * decoding: maximum time (in AV_TIME_BASE units) during which the input should
+ * be analyzed in avformat_find_stream_info().
+ */
+ int max_analyze_duration;
+
+ const uint8_t *key;
+ int keylen;
+
+ unsigned int nb_programs;
+ AVProgram **programs;
+
+ /**
+ * Forced video codec_id.
+ * Demuxing: Set by user.
+ */
+ enum AVCodecID video_codec_id;
+
+ /**
+ * Forced audio codec_id.
+ * Demuxing: Set by user.
+ */
+ enum AVCodecID audio_codec_id;
+
+ /**
+ * Forced subtitle codec_id.
+ * Demuxing: Set by user.
+ */
+ enum AVCodecID subtitle_codec_id;
+
+ /**
+ * Maximum amount of memory in bytes to use for the index of each stream.
+ * If the index exceeds this size, entries will be discarded as
+ * needed to maintain a smaller size. This can lead to slower or less
+ * accurate seeking (depends on demuxer).
+ * Demuxers for which a full in-memory index is mandatory will ignore
+ * this.
+ * muxing : unused
+ * demuxing: set by user
+ */
+ unsigned int max_index_size;
+
+ /**
+ * Maximum amount of memory in bytes to use for buffering frames
+ * obtained from realtime capture devices.
+ */
+ unsigned int max_picture_buffer;
+
+ unsigned int nb_chapters;
+ AVChapter **chapters;
+
+ AVDictionary *metadata;
+
+ /**
+ * Start time of the stream in real world time, in microseconds
+ * since the unix epoch (00:00 1st January 1970). That is, pts=0
+ * in the stream was captured at this real world time.
+ * - encoding: Set by user.
+ * - decoding: Unused.
+ */
+ int64_t start_time_realtime;
+
+ /**
+ * decoding: number of frames used to probe fps
+ */
+ int fps_probe_size;
+
+ /**
+ * Error recognition; higher values will detect more errors but may
+ * misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int error_recognition;
+
+ /**
+ * Custom interrupt callbacks for the I/O layer.
+ *
+ * decoding: set by the user before avformat_open_input().
+ * encoding: set by the user before avformat_write_header()
+ * (mainly useful for AVFMT_NOFILE formats). The callback
+ * should also be passed to avio_open2() if it's used to
+ * open the file.
+ */
+ AVIOInterruptCB interrupt_callback;
+
+ /**
+ * Flags to enable debugging.
+ */
+ int debug;
+#define FF_FDEBUG_TS 0x0001
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+
+ /**
+ * This buffer is only needed when packets were already buffered but
+ * not decoded, for example to get the codec parameters in MPEG
+ * streams.
+ */
+ struct AVPacketList *packet_buffer;
+ struct AVPacketList *packet_buffer_end;
+
+ /* av_seek_frame() support */
+ int64_t data_offset; /**< offset of the first packet */
+
+ /**
+ * Raw packets from the demuxer, prior to parsing and decoding.
+ * This buffer is used for buffering packets until the codec can
+ * be identified, as parsing cannot be done without knowing the
+ * codec.
+ */
+ struct AVPacketList *raw_packet_buffer;
+ struct AVPacketList *raw_packet_buffer_end;
+ /**
+ * Packets split by the parser get queued here.
+ */
+ struct AVPacketList *parse_queue;
+ struct AVPacketList *parse_queue_end;
+ /**
+ * Remaining size available for raw_packet_buffer, in bytes.
+ */
+#define RAW_PACKET_BUFFER_SIZE 2500000
+ int raw_packet_buffer_remaining_size;
+} AVFormatContext;
+
+typedef struct AVPacketList {
+ AVPacket pkt;
+ struct AVPacketList *next;
+} AVPacketList;
+
+
+/**
+ * @defgroup lavf_core Core functions
+ * @ingroup libavf
+ *
+ * Functions for querying libavformat capabilities, allocating core structures,
+ * etc.
+ * @{
+ */
+
+/**
+ * Return the LIBAVFORMAT_VERSION_INT constant.
+ */
+unsigned avformat_version(void);
+
+/**
+ * Return the libavformat build-time configuration.
+ */
+const char *avformat_configuration(void);
+
+/**
+ * Return the libavformat license.
+ */
+const char *avformat_license(void);
+
+/**
+ * Initialize libavformat and register all the muxers, demuxers and
+ * protocols. If you do not call this function, then you can select
+ * exactly which formats you want to support.
+ *
+ * @see av_register_input_format()
+ * @see av_register_output_format()
+ * @see av_register_protocol()
+ */
+void av_register_all(void);
+
+void av_register_input_format(AVInputFormat *format);
+void av_register_output_format(AVOutputFormat *format);
+
+/**
+ * Do global initialization of network components. This is optional,
+ * but recommended, since it avoids the overhead of implicitly
+ * doing the setup for each session.
+ *
+ * Calling this function will become mandatory if using network
+ * protocols at some major version bump.
+ */
+int avformat_network_init(void);
+
+/**
+ * Undo the initialization done by avformat_network_init.
+ */
+int avformat_network_deinit(void);
+
+/**
+ * If f is NULL, returns the first registered input format,
+ * if f is non-NULL, returns the next registered input format after f
+ * or NULL if f is the last one.
+ */
+AVInputFormat *av_iformat_next(AVInputFormat *f);
+
+/**
+ * If f is NULL, returns the first registered output format,
+ * if f is non-NULL, returns the next registered output format after f
+ * or NULL if f is the last one.
+ */
+AVOutputFormat *av_oformat_next(AVOutputFormat *f);
+
+/**
+ * Allocate an AVFormatContext.
+ * avformat_free_context() can be used to free the context and everything
+ * allocated by the framework within it.
+ */
+AVFormatContext *avformat_alloc_context(void);
+
+/**
+ * Free an AVFormatContext and all its streams.
+ * @param s context to free
+ */
+void avformat_free_context(AVFormatContext *s);
+
+/**
+ * Get the AVClass for AVFormatContext. It can be used in combination with
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
+ *
+ * @see av_opt_find().
+ */
+const AVClass *avformat_get_class(void);
+
+/**
+ * Add a new stream to a media file.
+ *
+ * When demuxing, it is called by the demuxer in read_header(). If the
+ * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
+ * be called in read_packet().
+ *
+ * When muxing, should be called by the user before avformat_write_header().
+ *
+ * @param c If non-NULL, the AVCodecContext corresponding to the new stream
+ * will be initialized to use this codec. This is needed for e.g. codec-specific
+ * defaults to be set, so codec should be provided if it is known.
+ *
+ * @return newly created stream or NULL on error.
+ */
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
+
+AVProgram *av_new_program(AVFormatContext *s, int id);
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup lavf_decoding
+ * @{
+ */
+
+/**
+ * Find AVInputFormat based on the short name of the input format.
+ */
+AVInputFormat *av_find_input_format(const char *short_name);
+
+/**
+ * Guess the file format.
+ *
+ * @param is_opened Whether the file is already opened; determines whether
+ * demuxers with or without AVFMT_NOFILE are probed.
+ */
+AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
+
+/**
+ * Guess the file format.
+ *
+ * @param is_opened Whether the file is already opened; determines whether
+ * demuxers with or without AVFMT_NOFILE are probed.
+ * @param score_max A probe score larger that this is required to accept a
+ * detection, the variable is set to the actual detection
+ * score afterwards.
+ * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
+ * to retry with a larger probe buffer.
+ */
+AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
+
+/**
+ * Probe a bytestream to determine the input format. Each time a probe returns
+ * with a score that is too low, the probe buffer size is increased and another
+ * attempt is made. When the maximum probe size is reached, the input format
+ * with the highest score is returned.
+ *
+ * @param pb the bytestream to probe
+ * @param fmt the input format is put here
+ * @param filename the filename of the stream
+ * @param logctx the log context
+ * @param offset the offset within the bytestream to probe from
+ * @param max_probe_size the maximum probe buffer size (zero for default)
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code otherwise
+ */
+int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
+ const char *filename, void *logctx,
+ unsigned int offset, unsigned int max_probe_size);
+
+/**
+ * Open an input stream and read the header. The codecs are not opened.
+ * The stream must be closed with av_close_input_file().
+ *
+ * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context).
+ * May be a pointer to NULL, in which case an AVFormatContext is allocated by this
+ * function and written into ps.
+ * Note that a user-supplied AVFormatContext will be freed on failure.
+ * @param filename Name of the stream to open.
+ * @param fmt If non-NULL, this parameter forces a specific input format.
+ * Otherwise the format is autodetected.
+ * @param options A dictionary filled with AVFormatContext and demuxer-private options.
+ * On return this parameter will be destroyed and replaced with a dict containing
+ * options that were not found. May be NULL.
+ *
+ * @return 0 on success, a negative AVERROR on failure.
+ *
+ * @note If you want to use custom IO, preallocate the format context and set its pb field.
+ */
+int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
+
+/**
+ * Read packets of a media file to get stream information. This
+ * is useful for file formats with no headers such as MPEG. This
+ * function also computes the real framerate in case of MPEG-2 repeat
+ * frame mode.
+ * The logical file position is not changed by this function;
+ * examined packets may be buffered for later processing.
+ *
+ * @param ic media file handle
+ * @param options If non-NULL, an ic.nb_streams long array of pointers to
+ * dictionaries, where i-th member contains options for
+ * codec corresponding to i-th stream.
+ * On return each dictionary will be filled with options that were not found.
+ * @return >=0 if OK, AVERROR_xxx on error
+ *
+ * @note this function isn't guaranteed to open all the codecs, so
+ * options being non-empty at return is a perfectly normal behavior.
+ *
+ * @todo Let the user decide somehow what information is needed so that
+ * we do not waste time getting stuff the user does not need.
+ */
+int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);
+
+/**
+ * Find the "best" stream in the file.
+ * The best stream is determined according to various heuristics as the most
+ * likely to be what the user expects.
+ * If the decoder parameter is non-NULL, av_find_best_stream will find the
+ * default decoder for the stream's codec; streams for which no decoder can
+ * be found are ignored.
+ *
+ * @param ic media file handle
+ * @param type stream type: video, audio, subtitles, etc.
+ * @param wanted_stream_nb user-requested stream number,
+ * or -1 for automatic selection
+ * @param related_stream try to find a stream related (eg. in the same
+ * program) to this one, or -1 if none
+ * @param decoder_ret if non-NULL, returns the decoder for the
+ * selected stream
+ * @param flags flags; none are currently defined
+ * @return the non-negative stream number in case of success,
+ * AVERROR_STREAM_NOT_FOUND if no stream with the requested type
+ * could be found,
+ * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder
+ * @note If av_find_best_stream returns successfully and decoder_ret is not
+ * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.
+ */
+int av_find_best_stream(AVFormatContext *ic,
+ enum AVMediaType type,
+ int wanted_stream_nb,
+ int related_stream,
+ AVCodec **decoder_ret,
+ int flags);
+
+#if FF_API_READ_PACKET
+/**
+ * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw
+ * unprocessed packets
+ *
+ * Read a transport packet from a media file.
+ *
+ * This function is obsolete and should never be used.
+ * Use av_read_frame() instead.
+ *
+ * @param s media file handle
+ * @param pkt is filled
+ * @return 0 if OK, AVERROR_xxx on error
+ */
+attribute_deprecated
+int av_read_packet(AVFormatContext *s, AVPacket *pkt);
+#endif
+
+/**
+ * Return the next frame of a stream.
+ * This function returns what is stored in the file, and does not validate
+ * that what is there are valid frames for the decoder. It will split what is
+ * stored in the file into frames and return one for each call. It will not
+ * omit invalid data between valid frames so as to give the decoder the maximum
+ * information possible for decoding.
+ *
+ * The returned packet is valid
+ * until the next av_read_frame() or until av_close_input_file() and
+ * must be freed with av_free_packet. For video, the packet contains
+ * exactly one frame. For audio, it contains an integer number of
+ * frames if each frame has a known fixed size (e.g. PCM or ADPCM
+ * data). If the audio frames have a variable size (e.g. MPEG audio),
+ * then it contains one frame.
+ *
+ * pkt->pts, pkt->dts and pkt->duration are always set to correct
+ * values in AVStream.time_base units (and guessed if the format cannot
+ * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
+ * has B-frames, so it is better to rely on pkt->dts if you do not
+ * decompress the payload.
+ *
+ * @return 0 if OK, < 0 on error or end of file
+ */
+int av_read_frame(AVFormatContext *s, AVPacket *pkt);
+
+/**
+ * Seek to the keyframe at timestamp.
+ * 'timestamp' in 'stream_index'.
+ * @param stream_index If stream_index is (-1), a default
+ * stream is selected, and timestamp is automatically converted
+ * from AV_TIME_BASE units to the stream specific time_base.
+ * @param timestamp Timestamp in AVStream.time_base units
+ * or, if no stream is specified, in AV_TIME_BASE units.
+ * @param flags flags which select direction and seeking mode
+ * @return >= 0 on success
+ */
+int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
+ int flags);
+
+/**
+ * Seek to timestamp ts.
+ * Seeking will be done so that the point from which all active streams
+ * can be presented successfully will be closest to ts and within min/max_ts.
+ * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
+ *
+ * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and
+ * are the file position (this may not be supported by all demuxers).
+ * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames
+ * in the stream with stream_index (this may not be supported by all demuxers).
+ * Otherwise all timestamps are in units of the stream selected by stream_index
+ * or if stream_index is -1, in AV_TIME_BASE units.
+ * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as
+ * keyframes (this may not be supported by all demuxers).
+ *
+ * @param stream_index index of the stream which is used as time base reference
+ * @param min_ts smallest acceptable timestamp
+ * @param ts target timestamp
+ * @param max_ts largest acceptable timestamp
+ * @param flags flags
+ * @return >=0 on success, error code otherwise
+ *
+ * @note This is part of the new seek API which is still under construction.
+ * Thus do not use this yet. It may change at any time, do not expect
+ * ABI compatibility yet!
+ */
+int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
+
+/**
+ * Start playing a network-based stream (e.g. RTSP stream) at the
+ * current position.
+ */
+int av_read_play(AVFormatContext *s);
+
+/**
+ * Pause a network-based stream (e.g. RTSP stream).
+ *
+ * Use av_read_play() to resume it.
+ */
+int av_read_pause(AVFormatContext *s);
+
+#if FF_API_CLOSE_INPUT_FILE
+/**
+ * @deprecated use avformat_close_input()
+ * Close a media file (but not its codecs).
+ *
+ * @param s media file handle
+ */
+attribute_deprecated
+void av_close_input_file(AVFormatContext *s);
+#endif
+
+/**
+ * Close an opened input AVFormatContext. Free it and all its contents
+ * and set *s to NULL.
+ */
+void avformat_close_input(AVFormatContext **s);
+/**
+ * @}
+ */
+
+#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
+#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
+#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes
+#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number
+
+/**
+ * @addtogroup lavf_encoding
+ * @{
+ */
+/**
+ * Allocate the stream private data and write the stream header to
+ * an output media file.
+ *
+ * @param s Media file handle, must be allocated with avformat_alloc_context().
+ * Its oformat field must be set to the desired output format;
+ * Its pb field must be set to an already openened AVIOContext.
+ * @param options An AVDictionary filled with AVFormatContext and muxer-private options.
+ * On return this parameter will be destroyed and replaced with a dict containing
+ * options that were not found. May be NULL.
+ *
+ * @return 0 on success, negative AVERROR on failure.
+ *
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next.
+ */
+int avformat_write_header(AVFormatContext *s, AVDictionary **options);
+
+/**
+ * Write a packet to an output media file.
+ *
+ * The packet shall contain one audio or video frame.
+ * The packet must be correctly interleaved according to the container
+ * specification, if not then av_interleaved_write_frame must be used.
+ *
+ * @param s media file handle
+ * @param pkt The packet, which contains the stream_index, buf/buf_size,
+ * dts/pts, ...
+ * This can be NULL (at any time, not just at the end), in
+ * order to immediately flush data buffered within the muxer,
+ * for muxers that buffer up data internally before writing it
+ * to the output.
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
+ */
+int av_write_frame(AVFormatContext *s, AVPacket *pkt);
+
+/**
+ * Write a packet to an output media file ensuring correct interleaving.
+ *
+ * The packet must contain one audio or video frame.
+ * If the packets are already correctly interleaved, the application should
+ * call av_write_frame() instead as it is slightly faster. It is also important
+ * to keep in mind that completely non-interleaved input will need huge amounts
+ * of memory to interleave with this, so it is preferable to interleave at the
+ * demuxer level.
+ *
+ * @param s media file handle
+ * @param pkt The packet containing the data to be written. Libavformat takes
+ * ownership of the data and will free it when it sees fit using the packet's
+ * This can be NULL (at any time, not just at the end), to flush the
+ * interleaving queues.
+ * @ref AVPacket.destruct "destruct" field. The caller must not access the data
+ * after this function returns, as it may already be freed.
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the
+ * index of the corresponding stream in @ref AVFormatContext.streams
+ * "s.streams".
+ * It is very strongly recommended that timing information (@ref AVPacket.pts
+ * "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to
+ * correct values.
+ *
+ * @return 0 on success, a negative AVERROR on error.
+ */
+int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
+
+#if FF_API_INTERLEAVE_PACKET
+/**
+ * @deprecated this function was never meant to be called by the user
+ * programs.
+ */
+attribute_deprecated
+int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
+ AVPacket *pkt, int flush);
+#endif
+
+/**
+ * Write the stream trailer to an output media file and free the
+ * file private data.
+ *
+ * May only be called after a successful call to avformat_write_header.
+ *
+ * @param s media file handle
+ * @return 0 if OK, AVERROR_xxx on error
+ */
+int av_write_trailer(AVFormatContext *s);
+
+/**
+ * Return the output format in the list of registered output formats
+ * which best matches the provided parameters, or return NULL if
+ * there is no match.
+ *
+ * @param short_name if non-NULL checks if short_name matches with the
+ * names of the registered formats
+ * @param filename if non-NULL checks if filename terminates with the
+ * extensions of the registered formats
+ * @param mime_type if non-NULL checks if mime_type matches with the
+ * MIME type of the registered formats
+ */
+AVOutputFormat *av_guess_format(const char *short_name,
+ const char *filename,
+ const char *mime_type);
+
+/**
+ * Guess the codec ID based upon muxer and filename.
+ */
+enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+ const char *filename, const char *mime_type,
+ enum AVMediaType type);
+
+/**
+ * @}
+ */
+
+
+/**
+ * @defgroup lavf_misc Utility functions
+ * @ingroup libavf
+ * @{
+ *
+ * Miscelaneous utility functions related to both muxing and demuxing
+ * (or neither).
+ */
+
+/**
+ * Send a nice hexadecimal dump of a buffer to the specified file stream.
+ *
+ * @param f The file stream pointer where the dump should be sent to.
+ * @param buf buffer
+ * @param size buffer size
+ *
+ * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2
+ */
+void av_hex_dump(FILE *f, const uint8_t *buf, int size);
+
+/**
+ * Send a nice hexadecimal dump of a buffer to the log.
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct.
+ * @param level The importance level of the message, lower values signifying
+ * higher importance.
+ * @param buf buffer
+ * @param size buffer size
+ *
+ * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2
+ */
+void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size);
+
+/**
+ * Send a nice dump of a packet to the specified file stream.
+ *
+ * @param f The file stream pointer where the dump should be sent to.
+ * @param pkt packet to dump
+ * @param dump_payload True if the payload must be displayed, too.
+ * @param st AVStream that the packet belongs to
+ */
+void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st);
+
+
+/**
+ * Send a nice dump of a packet to the log.
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct.
+ * @param level The importance level of the message, lower values signifying
+ * higher importance.
+ * @param pkt packet to dump
+ * @param dump_payload True if the payload must be displayed, too.
+ * @param st AVStream that the packet belongs to
+ */
+void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
+ AVStream *st);
+
+/**
+ * Get the AVCodecID for the given codec tag tag.
+ * If no codec id is found returns AV_CODEC_ID_NONE.
+ *
+ * @param tags list of supported codec_id-codec_tag pairs, as stored
+ * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
+ */
+enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
+
+/**
+ * Get the codec tag for the given codec id id.
+ * If no codec tag is found returns 0.
+ *
+ * @param tags list of supported codec_id-codec_tag pairs, as stored
+ * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
+ */
+unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
+
+int av_find_default_stream_index(AVFormatContext *s);
+
+/**
+ * Get the index for a specific timestamp.
+ * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
+ * to the timestamp which is <= the requested one, if backward
+ * is 0, then it will be >=
+ * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
+ * @return < 0 if no such timestamp could be found
+ */
+int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
+
+/**
+ * Add an index entry into a sorted list. Update the entry if the list
+ * already contains it.
+ *
+ * @param timestamp timestamp in the time base of the given stream
+ */
+int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
+ int size, int distance, int flags);
+
+
+/**
+ * Split a URL string into components.
+ *
+ * The pointers to buffers for storing individual components may be null,
+ * in order to ignore that component. Buffers for components not found are
+ * set to empty strings. If the port is not found, it is set to a negative
+ * value.
+ *
+ * @param proto the buffer for the protocol
+ * @param proto_size the size of the proto buffer
+ * @param authorization the buffer for the authorization
+ * @param authorization_size the size of the authorization buffer
+ * @param hostname the buffer for the host name
+ * @param hostname_size the size of the hostname buffer
+ * @param port_ptr a pointer to store the port number in
+ * @param path the buffer for the path
+ * @param path_size the size of the path buffer
+ * @param url the URL to split
+ */
+void av_url_split(char *proto, int proto_size,
+ char *authorization, int authorization_size,
+ char *hostname, int hostname_size,
+ int *port_ptr,
+ char *path, int path_size,
+ const char *url);
+
+
+void av_dump_format(AVFormatContext *ic,
+ int index,
+ const char *url,
+ int is_output);
+
+/**
+ * Return in 'buf' the path with '%d' replaced by a number.
+ *
+ * Also handles the '%0nd' format where 'n' is the total number
+ * of digits and '%%'.
+ *
+ * @param buf destination buffer
+ * @param buf_size destination buffer size
+ * @param path numbered sequence string
+ * @param number frame number
+ * @return 0 if OK, -1 on format error
+ */
+int av_get_frame_filename(char *buf, int buf_size,
+ const char *path, int number);
+
+/**
+ * Check whether filename actually is a numbered sequence generator.
+ *
+ * @param filename possible numbered sequence string
+ * @return 1 if a valid numbered sequence string, 0 otherwise
+ */
+int av_filename_number_test(const char *filename);
+
+/**
+ * Generate an SDP for an RTP session.
+ *
+ * @param ac array of AVFormatContexts describing the RTP streams. If the
+ * array is composed by only one context, such context can contain
+ * multiple AVStreams (one AVStream per RTP stream). Otherwise,
+ * all the contexts in the array (an AVCodecContext per RTP stream)
+ * must contain only one AVStream.
+ * @param n_files number of AVCodecContexts contained in ac
+ * @param buf buffer where the SDP will be stored (must be allocated by
+ * the caller)
+ * @param size the size of the buffer
+ * @return 0 if OK, AVERROR_xxx on error
+ */
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
+
+/**
+ * Return a positive value if the given filename has one of the given
+ * extensions, 0 otherwise.
+ *
+ * @param extensions a comma-separated list of filename extensions
+ */
+int av_match_ext(const char *filename, const char *extensions);
+
+/**
+ * Test if the given container can store a codec.
+ *
+ * @param std_compliance standards compliance level, one of FF_COMPLIANCE_*
+ *
+ * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot.
+ * A negative number if this information is not available.
+ */
+int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance);
+
+/**
+ * @defgroup riff_fourcc RIFF FourCCs
+ * @{
+ * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are
+ * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the
+ * following code:
+ * @code
+ * uint32_t tag = MKTAG('H', '2', '6', '4');
+ * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
+ * enum AVCodecID id = av_codec_get_id(table, tag);
+ * @endcode
+ */
+/**
+ * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_video_tags(void);
+/**
+ * @return the table mapping RIFF FourCCs for audio to AVCodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_audio_tags(void);
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#endif /* AVFORMAT_AVFORMAT_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavformat/avio.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavformat/avio.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,433 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef AVFORMAT_AVIO_H
+#define AVFORMAT_AVIO_H
+
+/**
+ * @file
+ * @ingroup lavf_io
+ * Buffered I/O operations
+ */
+
+#include
+
+#include "libavutil/common.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+
+#include "libavformat/version.h"
+
+
+#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
+
+/**
+ * Callback for checking whether to abort blocking functions.
+ * AVERROR_EXIT is returned in this case by the interrupted
+ * function. During blocking operations, callback is called with
+ * opaque as parameter. If the callback returns 1, the
+ * blocking operation will be aborted.
+ *
+ * No members can be added to this struct without a major bump, if
+ * new elements have been added after this struct in AVFormatContext
+ * or AVIOContext.
+ */
+typedef struct AVIOInterruptCB {
+ int (*callback)(void*);
+ void *opaque;
+} AVIOInterruptCB;
+
+/**
+ * Bytestream IO Context.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVIOContext) must not be used outside libav*.
+ *
+ * @note None of the function pointers in AVIOContext should be called
+ * directly, they should only be set by the client application
+ * when implementing custom I/O. Normally these are set to the
+ * function pointers specified in avio_alloc_context()
+ */
+typedef struct AVIOContext {
+ /**
+ * A class for private options.
+ *
+ * If this AVIOContext is created by avio_open2(), av_class is set and
+ * passes the options down to protocols.
+ *
+ * If this AVIOContext is manually allocated, then av_class may be set by
+ * the caller.
+ *
+ * warning -- this field can be NULL, be sure to not pass this AVIOContext
+ * to any av_opt_* functions in that case.
+ */
+ const AVClass *av_class;
+ unsigned char *buffer; /**< Start of the buffer. */
+ int buffer_size; /**< Maximum buffer size */
+ unsigned char *buf_ptr; /**< Current position in the buffer */
+ unsigned char *buf_end; /**< End of the data, may be less than
+ buffer+buffer_size if the read function returned
+ less data than requested, e.g. for streams where
+ no more data has been received yet. */
+ void *opaque; /**< A private pointer, passed to the read/write/seek/...
+ functions. */
+ int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
+ int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
+ int64_t (*seek)(void *opaque, int64_t offset, int whence);
+ int64_t pos; /**< position in the file of the current buffer */
+ int must_flush; /**< true if the next seek should flush */
+ int eof_reached; /**< true if eof reached */
+ int write_flag; /**< true if open for writing */
+ int max_packet_size;
+ unsigned long checksum;
+ unsigned char *checksum_ptr;
+ unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
+ int error; /**< contains the error code or 0 if no error happened */
+ /**
+ * Pause or resume playback for network streaming protocols - e.g. MMS.
+ */
+ int (*read_pause)(void *opaque, int pause);
+ /**
+ * Seek to a given timestamp in stream with the specified stream_index.
+ * Needed for some network streaming protocols which don't support seeking
+ * to byte position.
+ */
+ int64_t (*read_seek)(void *opaque, int stream_index,
+ int64_t timestamp, int flags);
+ /**
+ * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
+ */
+ int seekable;
+} AVIOContext;
+
+/* unbuffered I/O */
+
+/**
+ * Return AVIO_FLAG_* access flags corresponding to the access permissions
+ * of the resource in url, or a negative value corresponding to an
+ * AVERROR code in case of failure. The returned access flags are
+ * masked by the value in flags.
+ *
+ * @note This function is intrinsically unsafe, in the sense that the
+ * checked resource may change its existence or permission status from
+ * one call to another. Thus you should not trust the returned value,
+ * unless you are sure that no other processes are accessing the
+ * checked resource.
+ */
+int avio_check(const char *url, int flags);
+
+/**
+ * Allocate and initialize an AVIOContext for buffered I/O. It must be later
+ * freed with av_free().
+ *
+ * @param buffer Memory block for input/output operations via AVIOContext.
+ * The buffer must be allocated with av_malloc() and friends.
+ * @param buffer_size The buffer size is very important for performance.
+ * For protocols with fixed blocksize it should be set to this blocksize.
+ * For others a typical size is a cache page, e.g. 4kb.
+ * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
+ * @param opaque An opaque pointer to user-specific data.
+ * @param read_packet A function for refilling the buffer, may be NULL.
+ * @param write_packet A function for writing the buffer contents, may be NULL.
+ * @param seek A function for seeking to specified byte position, may be NULL.
+ *
+ * @return Allocated AVIOContext or NULL on failure.
+ */
+AVIOContext *avio_alloc_context(
+ unsigned char *buffer,
+ int buffer_size,
+ int write_flag,
+ void *opaque,
+ int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+ int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+ int64_t (*seek)(void *opaque, int64_t offset, int whence));
+
+void avio_w8(AVIOContext *s, int b);
+void avio_write(AVIOContext *s, const unsigned char *buf, int size);
+void avio_wl64(AVIOContext *s, uint64_t val);
+void avio_wb64(AVIOContext *s, uint64_t val);
+void avio_wl32(AVIOContext *s, unsigned int val);
+void avio_wb32(AVIOContext *s, unsigned int val);
+void avio_wl24(AVIOContext *s, unsigned int val);
+void avio_wb24(AVIOContext *s, unsigned int val);
+void avio_wl16(AVIOContext *s, unsigned int val);
+void avio_wb16(AVIOContext *s, unsigned int val);
+
+/**
+ * Write a NULL-terminated string.
+ * @return number of bytes written.
+ */
+int avio_put_str(AVIOContext *s, const char *str);
+
+/**
+ * Convert an UTF-8 string to UTF-16LE and write it.
+ * @return number of bytes written.
+ */
+int avio_put_str16le(AVIOContext *s, const char *str);
+
+/**
+ * Passing this as the "whence" parameter to a seek function causes it to
+ * return the filesize without seeking anywhere. Supporting this is optional.
+ * If it is not supported then the seek function will return <0.
+ */
+#define AVSEEK_SIZE 0x10000
+
+/**
+ * Oring this flag as into the "whence" parameter to a seek function causes it to
+ * seek by any means (like reopening and linear reading) or other normally unreasonble
+ * means that can be extreemly slow.
+ * This may be ignored by the seek code.
+ */
+#define AVSEEK_FORCE 0x20000
+
+/**
+ * fseek() equivalent for AVIOContext.
+ * @return new position or AVERROR.
+ */
+int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
+
+/**
+ * Skip given number of bytes forward
+ * @return new position or AVERROR.
+ */
+static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
+{
+ return avio_seek(s, offset, SEEK_CUR);
+}
+
+/**
+ * ftell() equivalent for AVIOContext.
+ * @return position or AVERROR.
+ */
+static av_always_inline int64_t avio_tell(AVIOContext *s)
+{
+ return avio_seek(s, 0, SEEK_CUR);
+}
+
+/**
+ * Get the filesize.
+ * @return filesize or AVERROR
+ */
+int64_t avio_size(AVIOContext *s);
+
+/** @warning currently size is limited */
+int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
+
+void avio_flush(AVIOContext *s);
+
+
+/**
+ * Read size bytes from AVIOContext into buf.
+ * @return number of bytes read or AVERROR
+ */
+int avio_read(AVIOContext *s, unsigned char *buf, int size);
+
+/**
+ * @name Functions for reading from AVIOContext
+ * @{
+ *
+ * @note return 0 if EOF, so you cannot use it if EOF handling is
+ * necessary
+ */
+int avio_r8 (AVIOContext *s);
+unsigned int avio_rl16(AVIOContext *s);
+unsigned int avio_rl24(AVIOContext *s);
+unsigned int avio_rl32(AVIOContext *s);
+uint64_t avio_rl64(AVIOContext *s);
+unsigned int avio_rb16(AVIOContext *s);
+unsigned int avio_rb24(AVIOContext *s);
+unsigned int avio_rb32(AVIOContext *s);
+uint64_t avio_rb64(AVIOContext *s);
+/**
+ * @}
+ */
+
+/**
+ * Read a string from pb into buf. The reading will terminate when either
+ * a NULL character was encountered, maxlen bytes have been read, or nothing
+ * more can be read from pb. The result is guaranteed to be NULL-terminated, it
+ * will be truncated if buf is too small.
+ * Note that the string is not interpreted or validated in any way, it
+ * might get truncated in the middle of a sequence for multi-byte encodings.
+ *
+ * @return number of bytes read (is always <= maxlen).
+ * If reading ends on EOF or error, the return value will be one more than
+ * bytes actually read.
+ */
+int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
+
+/**
+ * Read a UTF-16 string from pb and convert it to UTF-8.
+ * The reading will terminate when either a null or invalid character was
+ * encountered or maxlen bytes have been read.
+ * @return number of bytes read (is always <= maxlen)
+ */
+int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
+int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
+
+
+/**
+ * @name URL open modes
+ * The flags argument to avio_open must be one of the following
+ * constants, optionally ORed with other flags.
+ * @{
+ */
+#define AVIO_FLAG_READ 1 /**< read-only */
+#define AVIO_FLAG_WRITE 2 /**< write-only */
+#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
+/**
+ * @}
+ */
+
+/**
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
+ */
+#define AVIO_FLAG_NONBLOCK 8
+
+/**
+ * Create and initialize a AVIOContext for accessing the
+ * resource indicated by url.
+ * @note When the resource indicated by url has been opened in
+ * read+write mode, the AVIOContext can be used only for writing.
+ *
+ * @param s Used to return the pointer to the created AVIOContext.
+ * In case of failure the pointed to value is set to NULL.
+ * @param flags flags which control how the resource indicated by url
+ * is to be opened
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int avio_open(AVIOContext **s, const char *url, int flags);
+
+/**
+ * Create and initialize a AVIOContext for accessing the
+ * resource indicated by url.
+ * @note When the resource indicated by url has been opened in
+ * read+write mode, the AVIOContext can be used only for writing.
+ *
+ * @param s Used to return the pointer to the created AVIOContext.
+ * In case of failure the pointed to value is set to NULL.
+ * @param flags flags which control how the resource indicated by url
+ * is to be opened
+ * @param int_cb an interrupt callback to be used at the protocols level
+ * @param options A dictionary filled with protocol-private options. On return
+ * this parameter will be destroyed and replaced with a dict containing options
+ * that were not found. May be NULL.
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int avio_open2(AVIOContext **s, const char *url, int flags,
+ const AVIOInterruptCB *int_cb, AVDictionary **options);
+
+/**
+ * Close the resource accessed by the AVIOContext s and free it.
+ * This function can only be used if s was opened by avio_open().
+ *
+ * The internal buffer is automatically flushed before closing the
+ * resource.
+ *
+ * @return 0 on success, an AVERROR < 0 on error.
+ * @see avio_closep
+ */
+int avio_close(AVIOContext *s);
+
+/**
+ * Close the resource accessed by the AVIOContext *s, free it
+ * and set the pointer pointing to it to NULL.
+ * This function can only be used if s was opened by avio_open().
+ *
+ * The internal buffer is automatically flushed before closing the
+ * resource.
+ *
+ * @return 0 on success, an AVERROR < 0 on error.
+ * @see avio_close
+ */
+int avio_closep(AVIOContext **s);
+
+
+/**
+ * Open a write only memory stream.
+ *
+ * @param s new IO context
+ * @return zero if no error.
+ */
+int avio_open_dyn_buf(AVIOContext **s);
+
+/**
+ * Return the written size and a pointer to the buffer. The buffer
+ * must be freed with av_free().
+ * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
+ *
+ * @param s IO context
+ * @param pbuffer pointer to a byte buffer
+ * @return the length of the byte buffer
+ */
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
+
+/**
+ * Iterate through names of available protocols.
+ *
+ * @param opaque A private pointer representing current protocol.
+ * It must be a pointer to NULL on first iteration and will
+ * be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ * otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ */
+const char *avio_enum_protocols(void **opaque, int output);
+
+/**
+ * Pause and resume playing - only meaningful if using a network streaming
+ * protocol (e.g. MMS).
+ * @param pause 1 for pause, 0 for resume
+ */
+int avio_pause(AVIOContext *h, int pause);
+
+/**
+ * Seek to a given timestamp relative to some component stream.
+ * Only meaningful if using a network streaming protocol (e.g. MMS.).
+ * @param stream_index The stream index that the timestamp is relative to.
+ * If stream_index is (-1) the timestamp should be in AV_TIME_BASE
+ * units from the beginning of the presentation.
+ * If a stream_index >= 0 is used and the protocol does not support
+ * seeking based on component streams, the call will fail with ENOTSUP.
+ * @param timestamp timestamp in AVStream.time_base units
+ * or if there is no stream specified then in AV_TIME_BASE units.
+ * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
+ * and AVSEEK_FLAG_ANY. The protocol may silently ignore
+ * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
+ * fail with ENOTSUP if used and not supported.
+ * @return >= 0 on success
+ * @see AVInputFormat::read_seek
+ */
+int64_t avio_seek_time(AVIOContext *h, int stream_index,
+ int64_t timestamp, int flags);
+
+#endif /* AVFORMAT_AVIO_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavformat/version.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavformat/version.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,71 @@
+/*
+ * Version macros.
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_VERSION_H
+#define AVFORMAT_VERSION_H
+
+/**
+ * @file
+ * @ingroup libavf
+ * Libavformat version macros
+ */
+
+#include "libavutil/avutil.h"
+
+#define LIBAVFORMAT_VERSION_MAJOR 54
+#define LIBAVFORMAT_VERSION_MINOR 19
+#define LIBAVFORMAT_VERSION_MICRO 0
+
+#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
+ LIBAVFORMAT_VERSION_MINOR, \
+ LIBAVFORMAT_VERSION_MICRO)
+#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \
+ LIBAVFORMAT_VERSION_MINOR, \
+ LIBAVFORMAT_VERSION_MICRO)
+#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
+
+#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#ifndef FF_API_CLOSE_INPUT_FILE
+#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_APPLEHTTP_PROTO
+#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_READ_PACKET
+#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_INTERLEAVE_PACKET
+#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_AV_GETTIME
+#define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_R_FRAME_RATE
+#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+
+#endif /* AVFORMAT_VERSION_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/adler32.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/adler32.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,43 @@
+/*
+ * copyright (c) 2006 Mans Rullgard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_ADLER32_H
+#define AVUTIL_ADLER32_H
+
+#include
+#include "attributes.h"
+
+/**
+ * @ingroup lavu_crypto
+ * Calculate the Adler32 checksum of a buffer.
+ *
+ * Passing the return value to a subsequent av_adler32_update() call
+ * allows the checksum of multiple buffers to be calculated as though
+ * they were concatenated.
+ *
+ * @param adler initial checksum value
+ * @param buf pointer to input buffer
+ * @param len size of input buffer
+ * @return updated checksum
+ */
+unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
+ unsigned int len) av_pure;
+
+#endif /* AVUTIL_ADLER32_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/aes.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/aes.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,67 @@
+/*
+ * copyright (c) 2007 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_AES_H
+#define AVUTIL_AES_H
+
+#include
+
+#include "attributes.h"
+#include "version.h"
+
+/**
+ * @defgroup lavu_aes AES
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+#if FF_API_CONTEXT_SIZE
+extern attribute_deprecated const int av_aes_size;
+#endif
+
+struct AVAES;
+
+/**
+ * Allocate an AVAES context.
+ */
+struct AVAES *av_aes_alloc(void);
+
+/**
+ * Initialize an AVAES context.
+ * @param key_bits 128, 192 or 256
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ * @param count number of 16 byte blocks
+ * @param dst destination array, can be equal to src
+ * @param src source array, can be equal to dst
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AES_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/attributes.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/attributes.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,122 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Macro definitions for various function/variable attributes
+ */
+
+#ifndef AVUTIL_ATTRIBUTES_H
+#define AVUTIL_ATTRIBUTES_H
+
+#ifdef __GNUC__
+# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
+#else
+# define AV_GCC_VERSION_AT_LEAST(x,y) 0
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define av_always_inline __attribute__((always_inline)) inline
+#elif defined(_MSC_VER)
+# define av_always_inline __forceinline
+#else
+# define av_always_inline inline
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define av_noinline __attribute__((noinline))
+#else
+# define av_noinline
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define av_pure __attribute__((pure))
+#else
+# define av_pure
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(2,6)
+# define av_const __attribute__((const))
+#else
+# define av_const
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(4,3)
+# define av_cold __attribute__((cold))
+#else
+# define av_cold
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(4,1)
+# define av_flatten __attribute__((flatten))
+#else
+# define av_flatten
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define attribute_deprecated __attribute__((deprecated))
+#else
+# define attribute_deprecated
+#endif
+
+#if defined(__GNUC__)
+# define av_unused __attribute__((unused))
+#else
+# define av_unused
+#endif
+
+/**
+ * Mark a variable as used and prevent the compiler from optimizing it
+ * away. This is useful for variables accessed only from inline
+ * assembler without the compiler being aware.
+ */
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define av_used __attribute__((used))
+#else
+# define av_used
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,3)
+# define av_alias __attribute__((may_alias))
+#else
+# define av_alias
+#endif
+
+#if defined(__GNUC__) && !defined(__ICC)
+# define av_uninit(x) x=x
+#else
+# define av_uninit(x) x
+#endif
+
+#ifdef __GNUC__
+# define av_builtin_constant_p __builtin_constant_p
+# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
+#else
+# define av_builtin_constant_p(x) 0
+# define av_printf_format(fmtpos, attrpos)
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(2,5)
+# define av_noreturn __attribute__((noreturn))
+#else
+# define av_noreturn
+#endif
+
+#endif /* AVUTIL_ATTRIBUTES_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/audio_fifo.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/audio_fifo.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,146 @@
+/*
+ * Audio FIFO
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Audio FIFO Buffer
+ */
+
+#ifndef AVUTIL_AUDIO_FIFO_H
+#define AVUTIL_AUDIO_FIFO_H
+
+#include "avutil.h"
+#include "fifo.h"
+#include "samplefmt.h"
+
+/**
+ * @addtogroup lavu_audio
+ * @{
+ */
+
+/**
+ * Context for an Audio FIFO Buffer.
+ *
+ * - Operates at the sample level rather than the byte level.
+ * - Supports multiple channels with either planar or packed sample format.
+ * - Automatic reallocation when writing to a full buffer.
+ */
+typedef struct AVAudioFifo AVAudioFifo;
+
+/**
+ * Free an AVAudioFifo.
+ *
+ * @param af AVAudioFifo to free
+ */
+void av_audio_fifo_free(AVAudioFifo *af);
+
+/**
+ * Allocate an AVAudioFifo.
+ *
+ * @param sample_fmt sample format
+ * @param channels number of channels
+ * @param nb_samples initial allocation size, in samples
+ * @return newly allocated AVAudioFifo, or NULL on error
+ */
+AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels,
+ int nb_samples);
+
+/**
+ * Reallocate an AVAudioFifo.
+ *
+ * @param af AVAudioFifo to reallocate
+ * @param nb_samples new allocation size, in samples
+ * @return 0 if OK, or negative AVERROR code on failure
+ */
+int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
+
+/**
+ * Write data to an AVAudioFifo.
+ *
+ * The AVAudioFifo will be reallocated automatically if the available space
+ * is less than nb_samples.
+ *
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
+ *
+ * @param af AVAudioFifo to write to
+ * @param data audio data plane pointers
+ * @param nb_samples number of samples to write
+ * @return number of samples actually written, or negative AVERROR
+ * code on failure.
+ */
+int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
+
+/**
+ * Read data from an AVAudioFifo.
+ *
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
+ *
+ * @param af AVAudioFifo to read from
+ * @param data audio data plane pointers
+ * @param nb_samples number of samples to read
+ * @return number of samples actually read, or negative AVERROR code
+ * on failure.
+ */
+int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples);
+
+/**
+ * Drain data from an AVAudioFifo.
+ *
+ * Removes the data without reading it.
+ *
+ * @param af AVAudioFifo to drain
+ * @param nb_samples number of samples to drain
+ * @return 0 if OK, or negative AVERROR code on failure
+ */
+int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples);
+
+/**
+ * Reset the AVAudioFifo buffer.
+ *
+ * This empties all data in the buffer.
+ *
+ * @param af AVAudioFifo to reset
+ */
+void av_audio_fifo_reset(AVAudioFifo *af);
+
+/**
+ * Get the current number of samples in the AVAudioFifo available for reading.
+ *
+ * @param af the AVAudioFifo to query
+ * @return number of samples available for reading
+ */
+int av_audio_fifo_size(AVAudioFifo *af);
+
+/**
+ * Get the current number of samples in the AVAudioFifo available for writing.
+ *
+ * @param af the AVAudioFifo to query
+ * @return number of samples available for writing
+ */
+int av_audio_fifo_space(AVAudioFifo *af);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AUDIO_FIFO_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/audioconvert.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/audioconvert.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer
+ * Copyright (c) 2008 Peter Ross
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_AUDIOCONVERT_H
+#define AVUTIL_AUDIOCONVERT_H
+
+#include
+
+/**
+ * @file
+ * audio conversion routines
+ */
+
+/**
+ * @addtogroup lavu_audio
+ * @{
+ */
+
+/**
+ * @defgroup channel_masks Audio channel masks
+ * @{
+ */
+#define AV_CH_FRONT_LEFT 0x00000001
+#define AV_CH_FRONT_RIGHT 0x00000002
+#define AV_CH_FRONT_CENTER 0x00000004
+#define AV_CH_LOW_FREQUENCY 0x00000008
+#define AV_CH_BACK_LEFT 0x00000010
+#define AV_CH_BACK_RIGHT 0x00000020
+#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
+#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
+#define AV_CH_BACK_CENTER 0x00000100
+#define AV_CH_SIDE_LEFT 0x00000200
+#define AV_CH_SIDE_RIGHT 0x00000400
+#define AV_CH_TOP_CENTER 0x00000800
+#define AV_CH_TOP_FRONT_LEFT 0x00001000
+#define AV_CH_TOP_FRONT_CENTER 0x00002000
+#define AV_CH_TOP_FRONT_RIGHT 0x00004000
+#define AV_CH_TOP_BACK_LEFT 0x00008000
+#define AV_CH_TOP_BACK_CENTER 0x00010000
+#define AV_CH_TOP_BACK_RIGHT 0x00020000
+#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
+#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
+#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
+#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
+#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
+#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
+#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
+
+/** Channel mask value used for AVCodecContext.request_channel_layout
+ to indicate that the user requests the channel order of the decoder output
+ to be the native codec channel order. */
+#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
+
+/**
+ * @}
+ * @defgroup channel_mask_c Audio channel convenience macros
+ * @{
+ * */
+#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
+#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
+
+enum AVMatrixEncoding {
+ AV_MATRIX_ENCODING_NONE,
+ AV_MATRIX_ENCODING_DOLBY,
+ AV_MATRIX_ENCODING_DPLII,
+ AV_MATRIX_ENCODING_NB
+};
+
+/**
+ * @}
+ */
+
+/**
+ * Return a channel layout id that matches name, or 0 if no match is found.
+ *
+ * name can be one or several of the following notations,
+ * separated by '+' or '|':
+ * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
+ * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
+ * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
+ * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
+ * - a number of channels, in decimal, optionally followed by 'c', yielding
+ * the default channel layout for that number of channels (@see
+ * av_get_default_channel_layout);
+ * - a channel layout mask, in hexadecimal starting with "0x" (see the
+ * AV_CH_* macros).
+ *
+ * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
+ */
+uint64_t av_get_channel_layout(const char *name);
+
+/**
+ * Return a description of a channel layout.
+ * If nb_channels is <= 0, it is guessed from the channel_layout.
+ *
+ * @param buf put here the string containing the channel layout
+ * @param buf_size size in bytes of the buffer
+ */
+void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
+
+/**
+ * Return the number of channels in the channel layout.
+ */
+int av_get_channel_layout_nb_channels(uint64_t channel_layout);
+
+/**
+ * Return default channel layout for a given number of channels.
+ */
+uint64_t av_get_default_channel_layout(int nb_channels);
+
+/**
+ * Get the index of a channel in channel_layout.
+ *
+ * @param channel a channel layout describing exactly one channel which must be
+ * present in channel_layout.
+ *
+ * @return index of channel in channel_layout on success, a negative AVERROR
+ * on error.
+ */
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+ uint64_t channel);
+
+/**
+ * Get the channel with the given index in channel_layout.
+ */
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
+
+/**
+ * Get the name of a given channel.
+ *
+ * @return channel name on success, NULL on error.
+ */
+const char *av_get_channel_name(uint64_t channel);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AUDIOCONVERT_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/avassert.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/avassert.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,66 @@
+/*
+ * copyright (c) 2010 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * simple assert() macros that are a bit more flexible than ISO C assert().
+ * @author Michael Niedermayer
+ */
+
+#ifndef AVUTIL_AVASSERT_H
+#define AVUTIL_AVASSERT_H
+
+#include
+#include "avutil.h"
+#include "log.h"
+
+/**
+ * assert() equivalent, that is always enabled.
+ */
+#define av_assert0(cond) do { \
+ if (!(cond)) { \
+ av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \
+ AV_STRINGIFY(cond), __FILE__, __LINE__); \
+ abort(); \
+ } \
+} while (0)
+
+
+/**
+ * assert() equivalent, that does not lie in speed critical code.
+ * These asserts() thus can be enabled without fearing speedloss.
+ */
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
+#define av_assert1(cond) av_assert0(cond)
+#else
+#define av_assert1(cond) ((void)0)
+#endif
+
+
+/**
+ * assert() equivalent, that does lie in speed critical code.
+ */
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
+#define av_assert2(cond) av_assert0(cond)
+#else
+#define av_assert2(cond) ((void)0)
+#endif
+
+#endif /* AVUTIL_AVASSERT_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/avconfig.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/avconfig.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,6 @@
+/* Generated by ffconf */
+#ifndef AVUTIL_AVCONFIG_H
+#define AVUTIL_AVCONFIG_H
+#define AV_HAVE_BIGENDIAN 0
+#define AV_HAVE_FAST_UNALIGNED 1
+#endif /* AVUTIL_AVCONFIG_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/avstring.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/avstring.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2007 Mans Rullgard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_AVSTRING_H
+#define AVUTIL_AVSTRING_H
+
+#include
+#include "attributes.h"
+
+/**
+ * @addtogroup lavu_string
+ * @{
+ */
+
+/**
+ * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
+ * the address of the first character in str after the prefix.
+ *
+ * @param str input string
+ * @param pfx prefix to test
+ * @param ptr updated if the prefix is matched inside str
+ * @return non-zero if the prefix matches, zero otherwise
+ */
+int av_strstart(const char *str, const char *pfx, const char **ptr);
+
+/**
+ * Return non-zero if pfx is a prefix of str independent of case. If
+ * it is, *ptr is set to the address of the first character in str
+ * after the prefix.
+ *
+ * @param str input string
+ * @param pfx prefix to test
+ * @param ptr updated if the prefix is matched inside str
+ * @return non-zero if the prefix matches, zero otherwise
+ */
+int av_stristart(const char *str, const char *pfx, const char **ptr);
+
+/**
+ * Locate the first case-independent occurrence in the string haystack
+ * of the string needle. A zero-length string needle is considered to
+ * match at the start of haystack.
+ *
+ * This function is a case-insensitive version of the standard strstr().
+ *
+ * @param haystack string to search in
+ * @param needle string to search for
+ * @return pointer to the located match within haystack
+ * or a null pointer if no match
+ */
+char *av_stristr(const char *haystack, const char *needle);
+
+/**
+ * Copy the string src to dst, but no more than size - 1 bytes, and
+ * null-terminate dst.
+ *
+ * This function is the same as BSD strlcpy().
+ *
+ * @param dst destination buffer
+ * @param src source string
+ * @param size size of destination buffer
+ * @return the length of src
+ *
+ * @warning since the return value is the length of src, src absolutely
+ * _must_ be a properly 0-terminated string, otherwise this will read beyond
+ * the end of the buffer and possibly crash.
+ */
+size_t av_strlcpy(char *dst, const char *src, size_t size);
+
+/**
+ * Append the string src to the string dst, but to a total length of
+ * no more than size - 1 bytes, and null-terminate dst.
+ *
+ * This function is similar to BSD strlcat(), but differs when
+ * size <= strlen(dst).
+ *
+ * @param dst destination buffer
+ * @param src source string
+ * @param size size of destination buffer
+ * @return the total length of src and dst
+ *
+ * @warning since the return value use the length of src and dst, these
+ * absolutely _must_ be a properly 0-terminated strings, otherwise this
+ * will read beyond the end of the buffer and possibly crash.
+ */
+size_t av_strlcat(char *dst, const char *src, size_t size);
+
+/**
+ * Append output to a string, according to a format. Never write out of
+ * the destination buffer, and always put a terminating 0 within
+ * the buffer.
+ * @param dst destination buffer (string to which the output is
+ * appended)
+ * @param size total size of the destination buffer
+ * @param fmt printf-compatible format string, specifying how the
+ * following parameters are used
+ * @return the length of the string that would have been generated
+ * if enough space had been available
+ */
+size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
+
+/**
+ * Convert a number to a av_malloced string.
+ */
+char *av_d2str(double d);
+
+/**
+ * Unescape the given string until a non escaped terminating char,
+ * and return the token corresponding to the unescaped string.
+ *
+ * The normal \ and ' escaping is supported. Leading and trailing
+ * whitespaces are removed, unless they are escaped with '\' or are
+ * enclosed between ''.
+ *
+ * @param buf the buffer to parse, buf will be updated to point to the
+ * terminating char
+ * @param term a 0-terminated list of terminating chars
+ * @return the malloced unescaped string, which must be av_freed by
+ * the user, NULL in case of allocation failure
+ */
+char *av_get_token(const char **buf, const char *term);
+
+/**
+ * Locale-independent conversion of ASCII characters to uppercase.
+ */
+static inline int av_toupper(int c)
+{
+ if (c >= 'a' && c <= 'z')
+ c ^= 0x20;
+ return c;
+}
+
+/**
+ * Locale-independent conversion of ASCII characters to lowercase.
+ */
+static inline int av_tolower(int c)
+{
+ if (c >= 'A' && c <= 'Z')
+ c ^= 0x20;
+ return c;
+}
+
+/*
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strcasecmp(const char *a, const char *b);
+
+/**
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strncasecmp(const char *a, const char *b, size_t n);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AVSTRING_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/avutil.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/avutil.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,274 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_AVUTIL_H
+#define AVUTIL_AVUTIL_H
+
+/**
+ * @file
+ * external API header
+ */
+
+/**
+ * @mainpage
+ *
+ * @section libav_intro Introduction
+ *
+ * This document describes the usage of the different libraries
+ * provided by Libav.
+ *
+ * @li @ref libavc "libavcodec" encoding/decoding library
+ * @li @subpage libavfilter graph based frame editing library
+ * @li @ref libavf "libavformat" I/O and muxing/demuxing library
+ * @li @ref lavd "libavdevice" special devices muxing/demuxing library
+ * @li @ref lavu "libavutil" common utility library
+ * @li @subpage libswscale color conversion and scaling library
+ */
+
+/**
+ * @defgroup lavu Common utility functions
+ *
+ * @brief
+ * libavutil contains the code shared across all the other Libav
+ * libraries
+ *
+ * @note In order to use the functions provided by avutil you must include
+ * the specific header.
+ *
+ * @{
+ *
+ * @defgroup lavu_crypto Crypto and Hashing
+ *
+ * @{
+ * @}
+ *
+ * @defgroup lavu_math Maths
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_string String Manipulation
+ *
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_mem Memory Management
+ *
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_data Data Structures
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_audio Audio related
+ *
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_error Error Codes
+ *
+ * @{
+ *
+ * @}
+ *
+ * @defgroup lavu_misc Other
+ *
+ * @{
+ *
+ * @defgroup lavu_internal Internal
+ *
+ * Not exported functions, for internal usage only
+ *
+ * @{
+ *
+ * @}
+ */
+
+
+/**
+ * @defgroup preproc_misc Preprocessor String Macros
+ *
+ * String manipulation macros
+ *
+ * @{
+ */
+
+#define AV_STRINGIFY(s) AV_TOSTRING(s)
+#define AV_TOSTRING(s) #s
+
+#define AV_GLUE(a, b) a ## b
+#define AV_JOIN(a, b) AV_GLUE(a, b)
+
+#define AV_PRAGMA(s) _Pragma(#s)
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup version_utils Library Version Macros
+ *
+ * Useful to check and match library version in order to maintain
+ * backward compatibility.
+ *
+ * @{
+ */
+
+#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
+#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
+#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavu_ver
+ * @{
+ */
+
+/**
+ * Return the LIBAVUTIL_VERSION_INT constant.
+ */
+unsigned avutil_version(void);
+
+/**
+ * Return the libavutil build-time configuration.
+ */
+const char *avutil_configuration(void);
+
+/**
+ * Return the libavutil license.
+ */
+const char *avutil_license(void);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavu_media Media Type
+ * @brief Media Type
+ */
+
+enum AVMediaType {
+ AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
+ AVMEDIA_TYPE_VIDEO,
+ AVMEDIA_TYPE_AUDIO,
+ AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
+ AVMEDIA_TYPE_SUBTITLE,
+ AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
+ AVMEDIA_TYPE_NB
+};
+
+/**
+ * @defgroup lavu_const Constants
+ * @{
+ *
+ * @defgroup lavu_enc Encoding specific
+ *
+ * @note those definition should move to avcodec
+ * @{
+ */
+
+#define FF_LAMBDA_SHIFT 7
+#define FF_LAMBDA_SCALE (1<
+
+/**
+ * @defgroup lavu_base64 Base64
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+
+/**
+ * Decode a base64-encoded string.
+ *
+ * @param out buffer for decoded data
+ * @param in null-terminated input string
+ * @param out_size size in bytes of the out buffer, must be at
+ * least 3/4 of the length of in
+ * @return number of bytes written, or a negative value in case of
+ * invalid input
+ */
+int av_base64_decode(uint8_t *out, const char *in, int out_size);
+
+/**
+ * Encode data to base64 and null-terminate.
+ *
+ * @param out buffer for encoded data
+ * @param out_size size in bytes of the output buffer, must be at
+ * least AV_BASE64_SIZE(in_size)
+ * @param in_size size in bytes of the 'in' buffer
+ * @return 'out' or NULL in case of error
+ */
+char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
+
+/**
+ * Calculate the output size needed to base64-encode x bytes.
+ */
+#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
+
+ /**
+ * @}
+ */
+
+#endif /* AVUTIL_BASE64_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/blowfish.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/blowfish.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,76 @@
+/*
+ * Blowfish algorithm
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_BLOWFISH_H
+#define AVUTIL_BLOWFISH_H
+
+#include
+
+/**
+ * @defgroup lavu_blowfish Blowfish
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+#define AV_BF_ROUNDS 16
+
+typedef struct AVBlowfish {
+ uint32_t p[AV_BF_ROUNDS + 2];
+ uint32_t s[4][256];
+} AVBlowfish;
+
+/**
+ * Initialize an AVBlowfish context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param key a key
+ * @param key_len length of the key
+ */
+void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param xl left four bytes halves of input to be encrypted
+ * @param xr right four bytes halves of input to be encrypted
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
+ int decrypt);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param dst destination array, can be equal to src
+ * @param src source array, can be equal to dst
+ * @param count number of 8 byte blocks
+ * @param iv initialization vector for CBC mode, if NULL ECB will be used
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
+ int count, uint8_t *iv, int decrypt);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_BLOWFISH_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/bswap.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/bswap.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,109 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * byte swapping routines
+ */
+
+#ifndef AVUTIL_BSWAP_H
+#define AVUTIL_BSWAP_H
+
+#include
+#include "libavutil/avconfig.h"
+#include "attributes.h"
+
+#ifdef HAVE_AV_CONFIG_H
+
+#include "config.h"
+
+#if ARCH_ARM
+# include "arm/bswap.h"
+#elif ARCH_AVR32
+# include "avr32/bswap.h"
+#elif ARCH_BFIN
+# include "bfin/bswap.h"
+#elif ARCH_SH4
+# include "sh4/bswap.h"
+#elif ARCH_X86
+# include "x86/bswap.h"
+#endif
+
+#endif /* HAVE_AV_CONFIG_H */
+
+#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
+#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
+#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32))
+
+#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
+
+#ifndef av_bswap16
+static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
+{
+ x= (x>>8) | (x<<8);
+ return x;
+}
+#endif
+
+#ifndef av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
+{
+ return AV_BSWAP32C(x);
+}
+#endif
+
+#ifndef av_bswap64
+static inline uint64_t av_const av_bswap64(uint64_t x)
+{
+ return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32);
+}
+#endif
+
+// be2ne ... big-endian to native-endian
+// le2ne ... little-endian to native-endian
+
+#if AV_HAVE_BIGENDIAN
+#define av_be2ne16(x) (x)
+#define av_be2ne32(x) (x)
+#define av_be2ne64(x) (x)
+#define av_le2ne16(x) av_bswap16(x)
+#define av_le2ne32(x) av_bswap32(x)
+#define av_le2ne64(x) av_bswap64(x)
+#define AV_BE2NEC(s, x) (x)
+#define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
+#else
+#define av_be2ne16(x) av_bswap16(x)
+#define av_be2ne32(x) av_bswap32(x)
+#define av_be2ne64(x) av_bswap64(x)
+#define av_le2ne16(x) (x)
+#define av_le2ne32(x) (x)
+#define av_le2ne64(x) (x)
+#define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
+#define AV_LE2NEC(s, x) (x)
+#endif
+
+#define AV_BE2NE16C(x) AV_BE2NEC(16, x)
+#define AV_BE2NE32C(x) AV_BE2NEC(32, x)
+#define AV_BE2NE64C(x) AV_BE2NEC(64, x)
+#define AV_LE2NE16C(x) AV_LE2NEC(16, x)
+#define AV_LE2NE32C(x) AV_LE2NEC(32, x)
+#define AV_LE2NE64C(x) AV_LE2NEC(64, x)
+
+#endif /* AVUTIL_BSWAP_H */
diff -r 6237d2f002ba -r 2bc61f8841a1 misc/winutils/include/libavutil/common.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/winutils/include/libavutil/common.h Sun Oct 28 15:12:37 2012 +0100
@@ -0,0 +1,405 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * common internal and external API header
+ */
+
+#ifndef AVUTIL_COMMON_H
+#define AVUTIL_COMMON_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "attributes.h"
+#include "version.h"
+#include "libavutil/avconfig.h"
+
+#if AV_HAVE_BIGENDIAN
+# define AV_NE(be, le) (be)
+#else
+# define AV_NE(be, le) (le)
+#endif
+
+//rounded division & shift
+#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
+/* assume b>0 */
+#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
+#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
+#define FFSIGN(a) ((a) > 0 ? 1 : -1)
+
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
+#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
+#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
+#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
+
+#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
+
+/* misc math functions */
+
+#if FF_API_AV_REVERSE
+extern attribute_deprecated const uint8_t av_reverse[256];
+#endif
+
+#ifdef HAVE_AV_CONFIG_H
+# include "config.h"
+# include "intmath.h"
+#endif
+
+/* Pull in unguarded fallback defines at the end of this file. */
+#include "common.h"
+
+#ifndef av_log2
+av_const int av_log2(unsigned v);
+#endif
+
+#ifndef av_log2_16bit
+av_const int av_log2_16bit(unsigned v);
+#endif
+
+/**
+ * Clip a signed integer value into the amin-amax range.
+ * @param a value to clip
+ * @param amin minimum value of the clip range
+ * @param amax maximum value of the clip range
+ * @return clipped value
+ */
+static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
+{
+ if (a < amin) return amin;
+ else if (a > amax) return amax;
+ else return a;
+}
+
+/**
+ * Clip a signed integer value into the 0-255 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
+{
+ if (a&(~0xFF)) return (-a)>>31;
+ else return a;
+}
+
+/**
+ * Clip a signed integer value into the -128,127 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const int8_t av_clip_int8_c(int a)
+{
+ if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
+ else return a;
+}
+
+/**
+ * Clip a signed integer value into the 0-65535 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
+{
+ if (a&(~0xFFFF)) return (-a)>>31;
+ else return a;
+}
+
+/**
+ * Clip a signed integer value into the -32768,32767 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const int16_t av_clip_int16_c(int a)
+{
+ if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
+ else return a;
+}
+
+/**
+ * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
+{
+ if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
+ else return a;
+}
+
+/**
+ * Clip a signed integer to an unsigned power of two range.
+ * @param a value to clip
+ * @param p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
+{
+ if (a & ~((1<